1 /*	$OpenBSD: ext2fs_extern.h,v 1.22 2005/07/28 23:11:25 pedro Exp $	*/
2 /*	$NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $	*/
3 
4 /*-
5  * Copyright (c) 1997 Manuel Bouyer.
6  * Copyright (c) 1991, 1993, 1994
7  *	The Regents of the University of California.  All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *	@(#)ffs_extern.h	8.3 (Berkeley) 4/16/94
34  * Modified for ext2fs by Manuel Bouyer.
35  */
36 
37 struct buf;
38 struct fid;
39 struct m_ext2fs;
40 struct inode;
41 struct mount;
42 struct nameidata;
43 struct proc;
44 struct statfs;
45 struct timeval;
46 struct ucred;
47 struct ufsmount;
48 struct uio;
49 struct vnode;
50 struct vfsconf;
51 struct mbuf;
52 struct componentname;
53 
54 /* extern struct pool ext2fs_inode_pool; */	/* memory pool for inodes */
55 
56 __BEGIN_DECLS
57 
58 /* ext2fs_alloc.c */
59 int ext2fs_alloc(struct inode *, ufs1_daddr_t, ufs1_daddr_t , struct ucred *,
60 		   ufs1_daddr_t *);
61 int ext2fs_realloccg(struct inode *, ufs1_daddr_t, ufs1_daddr_t, int, int,
62 			  struct ucred *, struct buf **);
63 int ext2fs_reallocblks(void *);
64 int ext2fs_inode_alloc(struct inode *pip, mode_t mode, struct ucred *,
65     struct vnode **);
66 daddr_t ext2fs_blkpref(struct inode *, ufs1_daddr_t, int, ufs1_daddr_t *);
67 void ext2fs_blkfree(struct inode *, ufs1_daddr_t);
68 int ext2fs_inode_free(struct inode *pip, ino_t ino, mode_t mode);
69 
70 /* ext2fs_balloc.c */
71 int ext2fs_buf_alloc(struct inode *, daddr_t, int, struct ucred *,
72 			struct buf **, int);
73 
74 /* ext2fs_bmap.c */
75 int ext2fs_bmap(void *);
76 
77 /* ext2fs_inode.c */
78 int ext2fs_init(struct vfsconf *);
79 u_int64_t ext2fs_size(struct inode *);
80 int ext2fs_setsize(struct inode *, u_int64_t);
81 int ext2fs_update(struct inode *ip, struct timespec *atime,
82     struct timespec *mtime, int waitfor);
83 int ext2fs_truncate(struct inode *, off_t, int, struct ucred *);
84 int ext2fs_inactive(void *);
85 
86 /* ext2fs_lookup.c */
87 int ext2fs_readdir(void *);
88 int ext2fs_lookup(void *);
89 int ext2fs_direnter(struct inode *, struct vnode *,
90 									struct componentname *);
91 int ext2fs_dirremove(struct vnode *, struct componentname *);
92 int ext2fs_dirrewrite(struct inode *, struct inode *,
93 								struct componentname *);
94 int ext2fs_dirempty(struct inode *, ino_t, struct ucred *);
95 int ext2fs_checkpath(struct inode *, struct inode *, struct ucred *);
96 
97 /* ext2fs_subr.c */
98 int ext2fs_bufatoff(struct inode *, off_t, char **, struct buf **);
99 void ext2fs_fragacct(struct m_ext2fs *, int, int32_t[], int);
100 #ifdef DIAGNOSTIC
101 void	ext2fs_checkoverlap(struct buf *, struct inode *);
102 #endif
103 
104 /* ext2fs_vfsops.c */
105 int ext2fs_mountroot(void);
106 int ext2fs_mount(struct mount *, const char *, void *,
107 		   struct nameidata *, struct proc *);
108 int ext2fs_reload(struct mount *, struct ucred *, struct proc *);
109 int ext2fs_mountfs(struct vnode *, struct mount *, struct proc *);
110 int ext2fs_unmount(struct mount *, int, struct proc *);
111 int ext2fs_flushfiles(struct mount *, int, struct proc *);
112 int ext2fs_statfs(struct mount *, struct statfs *, struct proc *);
113 int ext2fs_sync(struct mount *, int, struct ucred *, struct proc *);
114 int ext2fs_vget(struct mount *, ino_t, struct vnode **);
115 int ext2fs_fhtovp(struct mount *, struct fid *, struct vnode **);
116 int ext2fs_vptofh(struct vnode *, struct fid *);
117 int ext2fs_sbupdate(struct ufsmount *, int);
118 int ext2fs_cgupdate(struct ufsmount *, int);
119 int ext2fs_sysctl(int *, u_int, void *, size_t *, void *, size_t,
120 		       struct proc *);
121 
122 /* ext2fs_readwrite.c */
123 int ext2fs_read(void *);
124 int ext2fs_write(void *);
125 
126 /* ext2fs_vnops.c */
127 int ext2fs_create(void *);
128 int ext2fs_mknod(void *);
129 int ext2fs_open(void *);
130 int ext2fs_access(void *);
131 int ext2fs_getattr(void *);
132 int ext2fs_setattr(void *);
133 int ext2fs_remove(void *);
134 int ext2fs_link(void *);
135 int ext2fs_rename(void *);
136 int ext2fs_mkdir(void *);
137 int ext2fs_rmdir(void *);
138 int ext2fs_symlink(void *);
139 int ext2fs_readlink(void *);
140 int ext2fs_advlock(void *);
141 int ext2fs_makeinode(int, struct vnode *, struct vnode **,
142                      struct componentname *cnp);
143 int ext2fs_fsync(void *);
144 int ext2fs_reclaim(void *);
145 int ext2fsfifo_reclaim(void *);
146 
147 __END_DECLS
148 
149 #define IS_EXT2_VNODE(vp)   (vp->v_tag == VT_EXT2FS)
150 
151 extern int (**ext2fs_vnodeop_p)(void *);
152 extern int (**ext2fs_specop_p)(void *);
153 #ifdef FIFO
154 extern int (**ext2fs_fifoop_p)(void *);
155 #define EXT2FS_FIFOOPS ext2fs_fifoop_p
156 #else
157 #define EXT2FS_FIFOOPS NULL
158 #endif
159