Sync usage with man page.
[netbsd-mini2440.git] / sys / ufs / lfs / lfs_extern.h
blobde4b64a758b1cec6355058aecd95addec5050310
1 /* $NetBSD: lfs_extern.h,v 1.95 2008/04/28 20:24:11 martin Exp $ */
3 /*-
4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Konrad E. Schroder <perseant@hhhh.org>.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
31 /*-
32 * Copyright (c) 1991, 1993, 1994
33 * The Regents of the University of California. All rights reserved.
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
37 * are met:
38 * 1. Redistributions of source code must retain the above copyright
39 * notice, this list of conditions and the following disclaimer.
40 * 2. Redistributions in binary form must reproduce the above copyright
41 * notice, this list of conditions and the following disclaimer in the
42 * documentation and/or other materials provided with the distribution.
43 * 3. Neither the name of the University nor the names of its contributors
44 * may be used to endorse or promote products derived from this software
45 * without specific prior written permission.
47 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE.
59 * @(#)lfs_extern.h 8.6 (Berkeley) 5/8/95
62 #ifndef _UFS_LFS_LFS_EXTERN_H_
63 #define _UFS_LFS_LFS_EXTERN_H_
65 #ifdef _KERNEL
66 #include <sys/mallocvar.h>
68 MALLOC_DECLARE(M_SEGMENT);
69 #endif
71 /* Copied from ext2fs for ITIMES. XXX This is a bogus use of v_tag. */
72 #define IS_LFS_VNODE(vp) (vp->v_tag == VT_LFS)
75 * Sysctl values for LFS.
77 #define LFS_WRITEINDIR 1 /* flush indirect blocks on non-checkpoint writes */
78 #define LFS_CLEAN_VNHEAD 2 /* put prev unrefed cleaned vnodes on head of free list */
79 #define LFS_DOSTATS 3
80 #define LFS_MAXPAGES 4
81 #define LFS_FS_PAGETRIP 5
82 #define LFS_STATS 6
83 #define LFS_DO_RFW 7
84 #define LFS_DEBUGLOG 8
85 #define LFS_IGNORE_LAZY_SYNC 9
86 #define LFS_MAXID 10
88 struct fid;
89 struct mount;
90 struct nameidata;
91 struct proc;
92 struct statvfs;
93 struct timeval;
94 struct inode;
95 struct uio;
96 struct mbuf;
97 struct ufs1_dinode;
98 struct buf;
99 struct vnode;
100 struct dlfs;
101 struct lfs;
102 struct segment;
103 struct block_info;
105 #if defined(_KERNEL)
107 extern int lfs_allclean_wakeup;
108 extern struct pool lfs_inode_pool; /* memory pool for inodes */
109 extern struct pool lfs_dinode_pool; /* memory pool for dinodes */
110 extern struct pool lfs_inoext_pool; /* memory pool for inode extension */
111 extern struct pool lfs_lbnentry_pool; /* memory pool for balloc accounting */
113 extern int locked_queue_count;
114 extern long locked_queue_bytes;
115 extern int lfs_subsys_pages;
116 extern int lfs_dirvcount;
117 extern kmutex_t lfs_lock;
118 extern int lfs_debug_log_subsys[];
119 extern kcondvar_t lfs_writing_cv;
120 extern kcondvar_t locked_queue_cv;
122 __BEGIN_DECLS
123 /* lfs_alloc.c */
124 void lfs_vcreate(struct mount *, ino_t, struct vnode *);
125 int lfs_valloc(struct vnode *, int, kauth_cred_t, struct vnode **);
126 int lfs_vfree(struct vnode *, ino_t, int);
127 void lfs_order_freelist(struct lfs *);
128 int lfs_extend_ifile(struct lfs *, kauth_cred_t);
129 int lfs_ialloc(struct lfs *, struct vnode *, ino_t, int, struct vnode **);
130 void lfs_orphan(struct lfs *, ino_t);
132 /* lfs_balloc.c */
133 int lfs_balloc(struct vnode *, off_t, int, kauth_cred_t, int, struct buf **);
134 void lfs_register_block(struct vnode *, daddr_t);
135 void lfs_deregister_block(struct vnode *, daddr_t);
136 void lfs_deregister_all(struct vnode *);
138 /* lfs_bio.c */
139 int lfs_availwait(struct lfs *, int);
140 int lfs_bwrite_ext(struct buf *, int);
141 int lfs_fits(struct lfs *, int);
142 void lfs_flush_fs(struct lfs *, int);
143 void lfs_flush(struct lfs *, int, int);
144 int lfs_check(struct vnode *, daddr_t, int);
145 void lfs_freebuf(struct lfs *, struct buf *);
146 struct buf *lfs_newbuf(struct lfs *, struct vnode *, daddr_t, size_t, int);
147 void lfs_countlocked(int *, long *, const char *);
148 int lfs_reserve(struct lfs *, struct vnode *, struct vnode *, int);
150 /* lfs_debug.c */
151 #ifdef DEBUG
152 int lfs_bwrite_log(struct buf *, const char *, int);
153 void lfs_dumplog(void);
154 void lfs_dump_super(struct lfs *);
155 void lfs_dump_dinode(struct ufs1_dinode *);
156 void lfs_check_bpp(struct lfs *, struct segment *, char *, int);
157 void lfs_check_segsum(struct lfs *, struct segment *, char *, int);
158 void lfs_debug_log(int, const char *, ...);
159 #endif /* DEBUG */
161 /* lfs_inode.c */
162 int lfs_update(struct vnode *, const struct timespec *, const struct timespec *,
163 int);
164 int lfs_truncate(struct vnode *, off_t, int, kauth_cred_t);
165 struct ufs1_dinode *lfs_ifind(struct lfs *, ino_t, struct buf *);
166 void lfs_finalize_ino_seguse(struct lfs *, struct inode *);
167 void lfs_finalize_fs_seguse(struct lfs *);
169 /* lfs_rfw.c */
170 int lfs_rf_valloc(struct lfs *, ino_t, int, struct lwp *, struct vnode **);
171 void lfs_roll_forward(struct lfs *, struct mount *, struct lwp *);
173 /* lfs_segment.c */
174 void lfs_imtime(struct lfs *);
175 int lfs_vflush(struct vnode *);
176 int lfs_segwrite(struct mount *, int);
177 int lfs_writefile(struct lfs *, struct segment *, struct vnode *);
178 int lfs_writeinode(struct lfs *, struct segment *, struct inode *);
179 int lfs_gatherblock(struct segment *, struct buf *, kmutex_t *);
180 int lfs_gather(struct lfs *, struct segment *, struct vnode *, int (*match )(struct lfs *, struct buf *));
181 void lfs_update_single(struct lfs *, struct segment *, struct vnode *,
182 daddr_t, int32_t, int);
183 void lfs_updatemeta(struct segment *);
184 int lfs_rewind(struct lfs *, int);
185 void lfs_unset_inval_all(struct lfs *);
186 int lfs_initseg(struct lfs *);
187 int lfs_writeseg(struct lfs *, struct segment *);
188 void lfs_writesuper(struct lfs *, daddr_t);
189 int lfs_match_data(struct lfs *, struct buf *);
190 int lfs_match_indir(struct lfs *, struct buf *);
191 int lfs_match_dindir(struct lfs *, struct buf *);
192 int lfs_match_tindir(struct lfs *, struct buf *);
193 void lfs_callback(struct buf *);
194 int lfs_vref(struct vnode *);
195 void lfs_vunref(struct vnode *);
196 void lfs_vunref_head(struct vnode *);
197 void lfs_acquire_finfo(struct lfs *fs, ino_t, int);
198 void lfs_release_finfo(struct lfs *fs);
200 /* lfs_subr.c */
201 void lfs_setup_resblks(struct lfs *);
202 void lfs_pad_check(unsigned char *, int, char *, int);
203 void lfs_free_resblks(struct lfs *);
204 void *lfs_malloc(struct lfs *, size_t, int);
205 void lfs_free(struct lfs *, void *, int);
206 int lfs_seglock(struct lfs *, unsigned long);
207 void lfs_segunlock(struct lfs *);
208 void lfs_segunlock_relock(struct lfs *);
209 int lfs_writer_enter(struct lfs *, const char *);
210 void lfs_writer_leave(struct lfs *);
211 void lfs_wakeup_cleaner(struct lfs *);
213 /* lfs_syscalls.c */
214 int lfs_fastvget(struct mount *, ino_t, daddr_t, struct vnode **, struct ufs1_dinode *);
215 struct buf *lfs_fakebuf(struct lfs *, struct vnode *, int, size_t, void *);
216 int lfs_do_segclean(struct lfs *, unsigned long);
217 int lfs_segwait(fsid_t *, struct timeval *);
218 int lfs_bmapv(struct proc *, fsid_t *, struct block_info *, int);
219 int lfs_markv(struct proc *, fsid_t *, struct block_info *, int);
221 /* lfs_vfsops.c */
222 void lfs_init(void);
223 void lfs_reinit(void);
224 void lfs_done(void);
225 int lfs_mountroot(void);
226 int lfs_mount(struct mount *, const char *, void *, size_t *);
227 int lfs_unmount(struct mount *, int);
228 int lfs_statvfs(struct mount *, struct statvfs *);
229 int lfs_sync(struct mount *, int, kauth_cred_t);
230 int lfs_vget(struct mount *, ino_t, struct vnode **);
231 int lfs_fhtovp(struct mount *, struct fid *, struct vnode **);
232 int lfs_vptofh(struct vnode *, struct fid *, size_t *);
233 void lfs_vinit(struct mount *, struct vnode **);
234 int lfs_resize_fs(struct lfs *, int);
236 /* lfs_vnops.c */
237 void lfs_mark_vnode(struct vnode *);
238 void lfs_unmark_vnode(struct vnode *);
239 int lfs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
240 void lfs_gop_size(struct vnode *, off_t, off_t *, int);
241 int lfs_putpages_ext(void *, int);
242 int lfs_gatherpages(struct vnode *);
243 void lfs_flush_dirops(struct lfs *);
244 void lfs_flush_pchain(struct lfs *);
246 int lfs_bwrite (void *);
247 int lfs_fsync (void *);
248 int lfs_symlink (void *);
249 int lfs_mknod (void *);
250 int lfs_create (void *);
251 int lfs_mkdir (void *);
252 int lfs_read (void *);
253 int lfs_remove (void *);
254 int lfs_rmdir (void *);
255 int lfs_link (void *);
256 int lfs_mmap (void *);
257 int lfs_rename (void *);
258 int lfs_getattr (void *);
259 int lfs_setattr (void *);
260 int lfs_close (void *);
261 int lfsspec_close(void *);
262 int lfsfifo_close(void *);
263 int lfs_fcntl (void *);
264 int lfs_inactive (void *);
265 int lfs_reclaim (void *);
266 int lfs_strategy (void *);
267 int lfs_write (void *);
268 int lfs_getpages (void *);
269 int lfs_putpages (void *);
271 extern int lfs_mount_type;
272 extern int (**lfs_vnodeop_p)(void *);
273 extern int (**lfs_specop_p)(void *);
274 extern int (**lfs_fifoop_p)(void *);
275 extern const struct genfs_ops lfs_genfsops;
277 #endif /* defined(_KERNEL) */
279 /* lfs_cksum.c */
280 u_int32_t cksum(void *, size_t);
281 u_int32_t lfs_cksum_part(void *, size_t, u_int32_t);
282 #define lfs_cksum_fold(sum) (sum)
283 u_int32_t lfs_sb_cksum(struct dlfs *);
285 __END_DECLS
287 #endif /* !_UFS_LFS_LFS_EXTERN_H_ */