xref: /openbsd/sys/ufs/ffs/ffs_extern.h (revision f2dfb0a4)
1 /*	$OpenBSD: ffs_extern.h,v 1.7 1998/02/08 22:41:49 tholo Exp $	*/
2 /*	$NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $	*/
3 
4 /*-
5  * Copyright (c) 1991, 1993, 1994
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *	This product includes software developed by the University of
19  *	California, Berkeley and its contributors.
20  * 4. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  *	@(#)ffs_extern.h	8.3 (Berkeley) 4/16/94
37  */
38 
39 #define FFS_CLUSTERREAD		1	/* cluster reading enabled */
40 #define FFS_CLUSTERWRITE	2	/* cluster writing enabled */
41 #define FFS_REALLOCBLKS		3	/* block reallocation enabled */
42 #define FFS_ASYNCFREE		4	/* asynchronous block freeing enabled */
43 #define	FFS_MAXID		5	/* number of valid ffs ids */
44 
45 #define FFS_NAMES { \
46 	{ 0, 0 }, \
47 	{ "doclusterread", CTLTYPE_INT }, \
48 	{ "doclusterwrite", CTLTYPE_INT }, \
49 	{ "doreallocblks", CTLTYPE_INT }, \
50 	{ "doasyncfree", CTLTYPE_INT }, \
51 }
52 
53 
54 struct buf;
55 struct fid;
56 struct fs;
57 struct inode;
58 struct mount;
59 struct nameidata;
60 struct proc;
61 struct statfs;
62 struct timeval;
63 struct ucred;
64 struct ufsmount;
65 struct vfsconf;
66 struct uio;
67 struct vnode;
68 struct mbuf;
69 struct cg;
70 struct vop_vfree_args;
71 
72 __BEGIN_DECLS
73 
74 /* ffs_alloc.c */
75 int ffs_alloc __P((struct inode *, daddr_t, daddr_t , int, struct ucred *,
76 		   daddr_t *));
77 int ffs_realloccg __P((struct inode *, daddr_t, daddr_t, int, int ,
78 		       struct ucred *, struct buf **));
79 int ffs_reallocblks __P((void *));
80 int ffs_valloc __P((void *));
81 daddr_t ffs_blkpref __P((struct inode *, daddr_t, int, daddr_t *));
82 void ffs_blkfree __P((struct inode *, daddr_t, long));
83 int ffs_vfree __P((void *));
84 void ffs_clusteracct __P((struct fs *, struct cg *, daddr_t, int));
85 
86 /* ffs_balloc.c */
87 int ffs_balloc __P((void *));
88 
89 /* ffs_inode.c */
90 int ffs_init __P((struct vfsconf *));
91 int ffs_update __P((void *));
92 int ffs_truncate __P((void *));
93 
94 /* ffs_subr.c */
95 int ffs_blkatoff __P((void *));
96 void ffs_fragacct __P((struct fs *, int, int32_t[], int));
97 #ifdef DIAGNOSTIC
98 void	ffs_checkoverlap __P((struct buf *, struct inode *));
99 #endif
100 int   ffs_freefile __P((struct vop_vfree_args *));
101 int   ffs_isfreeblock __P((struct fs *, unsigned char *, daddr_t));
102 int ffs_isblock __P((struct fs *, unsigned char *, daddr_t));
103 void ffs_clrblock __P((struct fs *, u_char *, daddr_t));
104 void ffs_setblock __P((struct fs *, unsigned char *, daddr_t));
105 
106 /* ffs_vfsops.c */
107 int ffs_mountroot __P((void));
108 int ffs_mount __P((struct mount *, const char *, caddr_t, struct nameidata *,
109 		   struct proc *));
110 int ffs_reload __P((struct mount *, struct ucred *, struct proc *));
111 int ffs_mountfs __P((struct vnode *, struct mount *, struct proc *));
112 int ffs_oldfscompat __P((struct fs *));
113 int ffs_unmount __P((struct mount *, int, struct proc *));
114 int ffs_flushfiles __P((struct mount *, int, struct proc *));
115 int ffs_statfs __P((struct mount *, struct statfs *, struct proc *));
116 int ffs_sync __P((struct mount *, int, struct ucred *, struct proc *));
117 int ffs_vget __P((struct mount *, ino_t, struct vnode **));
118 int ffs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
119 		    struct vnode **, int *, struct ucred **));
120 int ffs_vptofh __P((struct vnode *, struct fid *));
121 int ffs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
122 		    struct proc *));
123 int ffs_sbupdate __P((struct ufsmount *, int));
124 int ffs_cgupdate __P((struct ufsmount *, int));
125 
126 /* ffs_vnops.c */
127 int ffs_read __P((void *));
128 int ffs_write __P((void *));
129 int ffs_fsync __P((void *));
130 int ffs_reclaim __P((void *));
131 
132 
133 /*
134  * Soft dependency function prototypes.
135  */
136 
137 struct vop_vfree_args;
138 struct vop_fsync_args;
139 
140 void  softdep_initialize __P((void));
141 int   softdep_process_worklist __P((struct mount *));
142 int   softdep_mount __P((struct vnode *, struct mount *, struct fs *,
143           struct ucred *));
144 int   softdep_flushfiles __P((struct mount *, int, struct proc *));
145 void  softdep_update_inodeblock __P((struct inode *, struct buf *, int));
146 void  softdep_load_inodeblock __P((struct inode *));
147 int   softdep_fsync __P((struct vnode *));
148 void  softdep_freefile __P((struct vop_vfree_args *));
149 void  softdep_setup_freeblocks __P((struct inode *, off_t));
150 void  softdep_deallocate_dependencies __P((struct buf *));
151 void  softdep_setup_inomapdep __P((struct buf *, struct inode *, ino_t));
152 void  softdep_setup_blkmapdep __P((struct buf *, struct fs *, daddr_t));
153 void  softdep_setup_allocdirect __P((struct inode *, ufs_lbn_t, daddr_t,
154           daddr_t, long, long, struct buf *));
155 void  softdep_setup_allocindir_meta __P((struct buf *, struct inode *,
156           struct buf *, int, daddr_t));
157 void  softdep_setup_allocindir_page __P((struct inode *, ufs_lbn_t,
158           struct buf *, int, daddr_t, daddr_t, struct buf *));
159 void  softdep_disk_io_initiation __P((struct buf *));
160 void  softdep_disk_write_complete __P((struct buf *));
161 int   softdep_sync_metadata __P((struct vop_fsync_args *));
162 
163 __END_DECLS
164 
165 extern int (**ffs_vnodeop_p) __P((void *));
166 extern int (**ffs_specop_p) __P((void *));
167 #ifdef FIFO
168 extern int (**ffs_fifoop_p) __P((void *));
169 #define FFS_FIFOOPS ffs_fifoop_p
170 #else
171 #define FFS_FIFOOPS NULL
172 #endif
173