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