xref: /netbsd-src/sys/ufs/ext2fs/ext2fs_extern.h (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 /*	$NetBSD: ext2fs_extern.h,v 1.42 2009/10/21 17:37:21 pooka Exp $	*/
2 
3 /*-
4  * Copyright (c) 1991, 1993, 1994
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *	@(#)ffs_extern.h	8.3 (Berkeley) 4/16/94
32  * Modified for ext2fs by Manuel Bouyer.
33  */
34 
35 /*-
36  * Copyright (c) 1997 Manuel Bouyer.
37  *
38  * Redistribution and use in source and binary forms, with or without
39  * modification, are permitted provided that the following conditions
40  * are met:
41  * 1. Redistributions of source code must retain the above copyright
42  *    notice, this list of conditions and the following disclaimer.
43  * 2. Redistributions in binary form must reproduce the above copyright
44  *    notice, this list of conditions and the following disclaimer in the
45  *    documentation and/or other materials provided with the distribution.
46  *
47  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
48  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
49  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
50  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
51  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
52  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
53  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
55  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
56  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57  *
58  *	@(#)ffs_extern.h	8.3 (Berkeley) 4/16/94
59  * Modified for ext2fs by Manuel Bouyer.
60  */
61 
62 #ifndef _UFS_EXT2FS_EXT2FS_EXTERN_H_
63 #define _UFS_EXT2FS_EXT2FS_EXTERN_H_
64 
65 struct buf;
66 struct fid;
67 struct m_ext2fs;
68 struct inode;
69 struct mount;
70 struct nameidata;
71 struct lwp;
72 struct proc;
73 struct statvfs;
74 struct timeval;
75 struct ufsmount;
76 struct uio;
77 struct vnode;
78 struct mbuf;
79 struct componentname;
80 
81 extern struct pool ext2fs_inode_pool;		/* memory pool for inodes */
82 extern struct pool ext2fs_dinode_pool;		/* memory pool for dinodes */
83 
84 #define	EXT2FS_ITIMES(ip, acc, mod, cre) \
85 	while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
86 		ext2fs_itimes(ip, acc, mod, cre)
87 
88 __BEGIN_DECLS
89 
90 /* ext2fs_alloc.c */
91 int ext2fs_alloc(struct inode *, daddr_t, daddr_t , kauth_cred_t,
92 		   daddr_t *);
93 int ext2fs_realloccg(struct inode *, daddr_t, daddr_t, int, int ,
94 			  kauth_cred_t, struct buf **);
95 int ext2fs_valloc(struct vnode *, int, kauth_cred_t, struct vnode **);
96 /* XXX ondisk32 */
97 daddr_t ext2fs_blkpref(struct inode *, daddr_t, int, int32_t *);
98 void ext2fs_blkfree(struct inode *, daddr_t);
99 int ext2fs_vfree(struct vnode *, ino_t, int);
100 
101 /* ext2fs_balloc.c */
102 int ext2fs_balloc(struct inode *, daddr_t, int, kauth_cred_t,
103 			struct buf **, int);
104 int ext2fs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
105 
106 /* ext2fs_bmap.c */
107 int ext2fs_bmap(void *);
108 
109 /* ext2fs_inode.c */
110 u_int64_t ext2fs_size(struct inode *);
111 int ext2fs_setsize(struct inode *, u_int64_t);
112 int ext2fs_update(struct vnode *, const struct timespec *,
113     const struct timespec *, int);
114 int ext2fs_truncate(struct vnode *, off_t, int, kauth_cred_t);
115 int ext2fs_inactive(void *);
116 
117 /* ext2fs_lookup.c */
118 int ext2fs_readdir(void *);
119 int ext2fs_lookup(void *);
120 int ext2fs_direnter(struct inode *, struct vnode *,
121 			 struct componentname *);
122 int ext2fs_dirremove(struct vnode *, struct componentname *);
123 int ext2fs_dirrewrite(struct inode *, struct inode *,
124 			   struct componentname *);
125 int ext2fs_dirempty(struct inode *, ino_t, kauth_cred_t);
126 int ext2fs_checkpath(struct inode *, struct inode *, kauth_cred_t);
127 
128 /* ext2fs_subr.c */
129 int ext2fs_blkatoff(struct vnode *, off_t, char **, struct buf **);
130 void ext2fs_fragacct(struct m_ext2fs *, int, int32_t[], int);
131 void ext2fs_itimes(struct inode *, const struct timespec *,
132     const struct timespec *, const struct timespec *);
133 
134 /* ext2fs_vfsops.c */
135 VFS_PROTOS(ext2fs);
136 int ext2fs_reload(struct mount *, kauth_cred_t, struct lwp *);
137 int ext2fs_mountfs(struct vnode *, struct mount *);
138 int ext2fs_flushfiles(struct mount *, int);
139 int ext2fs_sbupdate(struct ufsmount *, int);
140 int ext2fs_cgupdate(struct ufsmount *, int);
141 void ext2fs_set_inode_guid(struct inode *);
142 
143 /* ext2fs_readwrite.c */
144 int ext2fs_read(void *);
145 int ext2fs_write(void *);
146 
147 /* ext2fs_vnops.c */
148 int ext2fs_create(void *);
149 int ext2fs_mknod(void *);
150 int ext2fs_open(void *);
151 int ext2fs_access(void *);
152 int ext2fs_getattr(void *);
153 int ext2fs_setattr(void *);
154 int ext2fs_remove(void *);
155 int ext2fs_link(void *);
156 int ext2fs_rename(void *);
157 int ext2fs_mkdir(void *);
158 int ext2fs_rmdir(void *);
159 int ext2fs_symlink(void *);
160 int ext2fs_readlink(void *);
161 int ext2fs_advlock(void *);
162 int ext2fs_fsync(void *);
163 int ext2fs_vinit(struct mount *, int (**specops)(void *),
164 		      int (**fifoops)(void *), struct vnode **);
165 int ext2fs_makeinode(int, struct vnode *, struct vnode **,
166 			  struct componentname *cnp);
167 int ext2fs_reclaim(void *);
168 
169 __END_DECLS
170 
171 #define IS_EXT2_VNODE(vp)   (vp->v_tag == VT_EXT2FS)
172 
173 extern int (**ext2fs_vnodeop_p)(void *);
174 extern int (**ext2fs_specop_p)(void *);
175 extern int (**ext2fs_fifoop_p)(void *);
176 
177 #endif /* !_UFS_EXT2FS_EXT2FS_EXTERN_H_ */
178