lfs_extern.h revision 1.29 1 1.29 matt /* $NetBSD: lfs_extern.h,v 1.29 2002/05/12 23:06:29 matt Exp $ */
2 1.2 cgd
3 1.1 mycroft /*-
4 1.21 perseant * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
5 1.13 perseant * All rights reserved.
6 1.13 perseant *
7 1.13 perseant * This code is derived from software contributed to The NetBSD Foundation
8 1.13 perseant * by Konrad E. Schroder <perseant (at) hhhh.org>.
9 1.13 perseant *
10 1.13 perseant * Redistribution and use in source and binary forms, with or without
11 1.13 perseant * modification, are permitted provided that the following conditions
12 1.13 perseant * are met:
13 1.13 perseant * 1. Redistributions of source code must retain the above copyright
14 1.13 perseant * notice, this list of conditions and the following disclaimer.
15 1.13 perseant * 2. Redistributions in binary form must reproduce the above copyright
16 1.13 perseant * notice, this list of conditions and the following disclaimer in the
17 1.13 perseant * documentation and/or other materials provided with the distribution.
18 1.13 perseant * 3. All advertising materials mentioning features or use of this software
19 1.13 perseant * must display the following acknowledgement:
20 1.13 perseant * This product includes software developed by the NetBSD
21 1.13 perseant * Foundation, Inc. and its contributors.
22 1.13 perseant * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.13 perseant * contributors may be used to endorse or promote products derived
24 1.13 perseant * from this software without specific prior written permission.
25 1.13 perseant *
26 1.13 perseant * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.13 perseant * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.13 perseant * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.13 perseant * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.13 perseant * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.13 perseant * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.13 perseant * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.13 perseant * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.13 perseant * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.13 perseant * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.13 perseant * POSSIBILITY OF SUCH DAMAGE.
37 1.13 perseant */
38 1.13 perseant /*-
39 1.1 mycroft * Copyright (c) 1991, 1993, 1994
40 1.1 mycroft * The Regents of the University of California. All rights reserved.
41 1.1 mycroft *
42 1.1 mycroft * Redistribution and use in source and binary forms, with or without
43 1.1 mycroft * modification, are permitted provided that the following conditions
44 1.1 mycroft * are met:
45 1.1 mycroft * 1. Redistributions of source code must retain the above copyright
46 1.1 mycroft * notice, this list of conditions and the following disclaimer.
47 1.1 mycroft * 2. Redistributions in binary form must reproduce the above copyright
48 1.1 mycroft * notice, this list of conditions and the following disclaimer in the
49 1.1 mycroft * documentation and/or other materials provided with the distribution.
50 1.1 mycroft * 3. All advertising materials mentioning features or use of this software
51 1.1 mycroft * must display the following acknowledgement:
52 1.1 mycroft * This product includes software developed by the University of
53 1.1 mycroft * California, Berkeley and its contributors.
54 1.1 mycroft * 4. Neither the name of the University nor the names of its contributors
55 1.1 mycroft * may be used to endorse or promote products derived from this software
56 1.1 mycroft * without specific prior written permission.
57 1.1 mycroft *
58 1.1 mycroft * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
59 1.1 mycroft * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 1.1 mycroft * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 1.1 mycroft * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 1.1 mycroft * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 1.1 mycroft * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 1.1 mycroft * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 1.1 mycroft * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 1.1 mycroft * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 1.1 mycroft * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 1.1 mycroft * SUCH DAMAGE.
69 1.1 mycroft *
70 1.7 fvdl * @(#)lfs_extern.h 8.6 (Berkeley) 5/8/95
71 1.1 mycroft */
72 1.8 sommerfe
73 1.20 perseant /* Copied from ext2fs for ITIMES. XXX This is a bogus use of v_tag. */
74 1.20 perseant #define IS_LFS_VNODE(vp) (vp->v_tag == VT_LFS)
75 1.20 perseant
76 1.13 perseant /*
77 1.13 perseant * Sysctl values for LFS.
78 1.13 perseant */
79 1.13 perseant #define LFS_WRITEINDIR 1 /* flush indirect blocks on non-checkpoint writes */
80 1.13 perseant #define LFS_CLEAN_VNHEAD 2 /* put prev unrefed cleaned vnodes on head of free list */
81 1.13 perseant #define LFS_DOSTATS 3
82 1.13 perseant #define LFS_STATS 4
83 1.13 perseant #define LFS_MAXID 5
84 1.13 perseant
85 1.13 perseant #define LFS_NAMES { \
86 1.13 perseant { 0, 0 }, \
87 1.13 perseant { "flushindir", CTLTYPE_INT }, \
88 1.13 perseant { "clean_vnhead", CTLTYPE_INT }, \
89 1.13 perseant { "dostats", CTLTYPE_INT }, \
90 1.13 perseant { "stats", CTLTYPE_STRUCT }, \
91 1.13 perseant }
92 1.13 perseant
93 1.1 mycroft struct fid;
94 1.1 mycroft struct mount;
95 1.1 mycroft struct nameidata;
96 1.1 mycroft struct proc;
97 1.1 mycroft struct statfs;
98 1.1 mycroft struct timeval;
99 1.1 mycroft struct inode;
100 1.1 mycroft struct uio;
101 1.1 mycroft struct mbuf;
102 1.4 christos struct dinode;
103 1.4 christos struct buf;
104 1.4 christos struct vnode;
105 1.18 perseant struct dlfs;
106 1.4 christos struct lfs;
107 1.4 christos struct segment;
108 1.5 christos struct ucred;
109 1.10 thorpej
110 1.29 matt extern int lfs_allclean_wakeup;
111 1.10 thorpej extern struct pool lfs_inode_pool; /* memory pool for inodes */
112 1.1 mycroft
113 1.1 mycroft __BEGIN_DECLS
114 1.4 christos /* lfs_alloc.c */
115 1.25 perseant int lfs_rf_valloc(struct lfs *, ino_t, int, struct proc *, struct vnode **);
116 1.25 perseant void lfs_vcreate(struct mount *, ino_t, struct vnode *);
117 1.4 christos /* lfs_bio.c */
118 1.25 perseant int lfs_availwait(struct lfs *, int);
119 1.25 perseant int lfs_bwrite_ext(struct buf *, int);
120 1.25 perseant int lfs_fits(struct lfs *, int);
121 1.25 perseant void lfs_flush_fs(struct lfs *, int);
122 1.25 perseant void lfs_flush(struct lfs *, int);
123 1.25 perseant int lfs_check(struct vnode *, ufs_daddr_t, int);
124 1.24 perseant #ifdef MALLOCLOG
125 1.25 perseant void lfs_freebuf_malloclog(struct buf *, char *, int);
126 1.25 perseant struct buf *lfs_newbuf_malloclog(struct lfs *, struct vnode *,
127 1.25 perseant ufs_daddr_t, size_t, char *, int);
128 1.24 perseant #define lfs_freebuf(BP) lfs_freebuf_malloclog((BP), __FILE__, __LINE__)
129 1.25 perseant #define lfs_newbuf(F, V, A, S) lfs_newbuf_malloclog((F),(V),(A),(S),__FILE__,__LINE__)
130 1.24 perseant #else
131 1.25 perseant void lfs_freebuf(struct buf *);
132 1.25 perseant struct buf *lfs_newbuf(struct lfs *, struct vnode *, ufs_daddr_t, size_t);
133 1.24 perseant #endif
134 1.25 perseant void lfs_countlocked(int *, long *);
135 1.25 perseant int lfs_reserve(struct lfs *, struct vnode *, int);
136 1.4 christos
137 1.4 christos /* lfs_cksum.c */
138 1.25 perseant u_int32_t cksum(void *, size_t);
139 1.25 perseant u_int32_t lfs_sb_cksum(struct dlfs *);
140 1.4 christos
141 1.4 christos /* lfs_debug.c */
142 1.1 mycroft #ifdef DEBUG
143 1.25 perseant void lfs_dump_super(struct lfs *);
144 1.25 perseant void lfs_dump_dinode(struct dinode *);
145 1.25 perseant void lfs_check_bpp(struct lfs *, struct segment *, char *, int);
146 1.25 perseant void lfs_check_segsum(struct lfs *, struct segment *, char *, int);
147 1.13 perseant #endif /* DEBUG */
148 1.4 christos
149 1.4 christos /* lfs_inode.c */
150 1.25 perseant struct dinode *lfs_ifind(struct lfs *, ino_t, struct buf *);
151 1.4 christos
152 1.4 christos /* lfs_segment.c */
153 1.25 perseant void lfs_imtime(struct lfs *);
154 1.25 perseant int lfs_vflush(struct vnode *);
155 1.25 perseant int lfs_writevnodes(struct lfs *, struct mount *, struct segment *, int);
156 1.25 perseant int lfs_segwrite(struct mount *, int);
157 1.25 perseant void lfs_writefile(struct lfs *, struct segment *, struct vnode *);
158 1.25 perseant int lfs_writeinode(struct lfs *, struct segment *, struct inode *);
159 1.25 perseant int lfs_gatherblock(struct segment *, struct buf *, int *);
160 1.25 perseant int lfs_gather(struct lfs *, struct segment *, struct vnode *, int (*match )(struct lfs *, struct buf *));
161 1.25 perseant void lfs_updatemeta(struct segment *);
162 1.25 perseant int lfs_initseg(struct lfs *);
163 1.25 perseant void lfs_newseg(struct lfs *);
164 1.25 perseant int lfs_writeseg(struct lfs *, struct segment *);
165 1.25 perseant void lfs_writesuper(struct lfs *, daddr_t);
166 1.25 perseant int lfs_match_data(struct lfs *, struct buf *);
167 1.25 perseant int lfs_match_indir(struct lfs *, struct buf *);
168 1.25 perseant int lfs_match_dindir(struct lfs *, struct buf *);
169 1.25 perseant int lfs_match_tindir(struct lfs *, struct buf *);
170 1.25 perseant void lfs_callback(struct buf *);
171 1.25 perseant void lfs_supercallback(struct buf *);
172 1.25 perseant void lfs_shellsort(struct buf **, ufs_daddr_t *, int);
173 1.25 perseant int lfs_vref(struct vnode *);
174 1.25 perseant void lfs_vunref(struct vnode *);
175 1.25 perseant void lfs_vunref_head(struct vnode *);
176 1.4 christos
177 1.4 christos /* lfs_subr.c */
178 1.25 perseant void lfs_seglock(struct lfs *, unsigned long);
179 1.25 perseant void lfs_segunlock(struct lfs *);
180 1.4 christos
181 1.4 christos /* lfs_syscalls.c */
182 1.25 perseant int lfs_fastvget(struct mount *, ino_t, ufs_daddr_t, struct vnode **, struct dinode *, int *);
183 1.25 perseant struct buf *lfs_fakebuf(struct vnode *, int, size_t, caddr_t);
184 1.4 christos
185 1.4 christos /* lfs_vfsops.c */
186 1.25 perseant void lfs_init(void);
187 1.26 chs void lfs_reinit(void);
188 1.25 perseant void lfs_done(void);
189 1.25 perseant int lfs_mountroot(void);
190 1.25 perseant int lfs_mount(struct mount *, const char *, void *, struct nameidata *, struct proc *);
191 1.25 perseant int lfs_mountfs(struct vnode *, struct mount *, struct proc *);
192 1.25 perseant int lfs_unmount(struct mount *, int, struct proc *);
193 1.25 perseant int lfs_statfs(struct mount *, struct statfs *, struct proc *);
194 1.25 perseant int lfs_sync(struct mount *, int, struct ucred *, struct proc *);
195 1.25 perseant int lfs_vget(struct mount *, ino_t, struct vnode **);
196 1.25 perseant int lfs_fhtovp(struct mount *, struct fid *, struct vnode **);
197 1.25 perseant int lfs_vptofh(struct vnode *, struct fid *);
198 1.25 perseant int lfs_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
199 1.4 christos
200 1.18 perseant /* lfs_vnops.c */
201 1.25 perseant void lfs_unmark_vnode(struct vnode *);
202 1.25 perseant void lfs_itimes(struct inode *, struct timespec *, struct timespec *,
203 1.25 perseant struct timespec *);
204 1.25 perseant
205 1.25 perseant int lfs_balloc (void *);
206 1.25 perseant int lfs_valloc (void *);
207 1.25 perseant int lfs_vfree (void *);
208 1.25 perseant int lfs_bwrite (void *);
209 1.25 perseant int lfs_update (void *);
210 1.25 perseant int lfs_truncate(void *);
211 1.25 perseant int lfs_blkatoff(void *);
212 1.25 perseant int lfs_fsync (void *);
213 1.25 perseant int lfs_symlink (void *);
214 1.25 perseant int lfs_mknod (void *);
215 1.25 perseant int lfs_create (void *);
216 1.25 perseant int lfs_mkdir (void *);
217 1.25 perseant int lfs_read (void *);
218 1.25 perseant int lfs_remove (void *);
219 1.25 perseant int lfs_rmdir (void *);
220 1.25 perseant int lfs_link (void *);
221 1.25 perseant int lfs_rename (void *);
222 1.25 perseant int lfs_getattr (void *);
223 1.28 perseant int lfs_setattr (void *);
224 1.25 perseant int lfs_close (void *);
225 1.25 perseant int lfs_inactive(void *);
226 1.25 perseant int lfs_reclaim (void *);
227 1.25 perseant int lfs_write (void *);
228 1.25 perseant int lfs_whiteout(void *);
229 1.27 chs int lfs_getpages(void *);
230 1.27 chs int lfs_putpages(void *);
231 1.4 christos
232 1.1 mycroft __END_DECLS
233 1.7 fvdl extern int lfs_mount_type;
234 1.25 perseant extern int (**lfs_vnodeop_p)(void *);
235 1.25 perseant extern int (**lfs_specop_p)(void *);
236 1.25 perseant extern int (**lfs_fifoop_p)(void *);
237 1.27 chs extern struct genfs_ops lfs_genfsops;
238