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