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