1/* $NetBSD: ext2fs_extern.h,v 1.55 2016/08/20 19:47:44 jdolecek 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
65struct buf;
66struct fid;
67struct m_ext2fs;
68struct inode;
69struct mount;
70struct nameidata;
71struct lwp;
72struct proc;
73struct statvfs;
74struct timeval;
75struct ufsmount;
76struct uio;
77struct vnode;
78struct mbuf;
79struct componentname;
80struct ufs_lookup_results;
81struct ext2fs_searchslot;
82struct ext2fs_direct;
83
84extern struct pool ext2fs_inode_pool; /* memory pool for inodes */
85extern struct pool ext2fs_dinode_pool; /* memory pool for dinodes */
86
87#define EXT2FS_ITIMES(ip, acc, mod, cre) \
88 while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
89 ext2fs_itimes(ip, acc, mod, cre)
90
91__BEGIN_DECLS
92
93/* ext2fs_alloc.c */
94int ext2fs_alloc(struct inode *, daddr_t, daddr_t , kauth_cred_t,
95 daddr_t *);
96int ext2fs_realloccg(struct inode *, daddr_t, daddr_t, int, int ,
97 kauth_cred_t, struct buf **);
98int ext2fs_valloc(struct vnode *, int, kauth_cred_t, struct vnode **);
99/* XXX ondisk32 */
100daddr_t ext2fs_blkpref(struct inode *, daddr_t, int, int32_t *);
101void ext2fs_blkfree(struct inode *, daddr_t);
102int ext2fs_vfree(struct vnode *, ino_t, int);
103int ext2fs_cg_verify_and_initialize(struct vnode *, struct m_ext2fs *, int);
104
105/* ext2fs_balloc.c */
106int ext2fs_balloc(struct inode *, daddr_t, int, kauth_cred_t,
107 struct buf **, int);
108int ext2fs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
109
110/* ext2fs_bmap.c */
111int ext2fs_bmap(void *);
112
113/* ext2fs_inode.c */
114uint64_t ext2fs_size(struct inode *);
115int ext2fs_setsize(struct inode *, uint64_t);
116uint64_t ext2fs_nblock(struct inode *);
117int ext2fs_setnblock(struct inode *, uint64_t);
118int ext2fs_update(struct vnode *, const struct timespec *,
119 const struct timespec *, int);
120int ext2fs_truncate(struct vnode *, off_t, int, kauth_cred_t);
121int ext2fs_inactive(void *);
122
123/* ext2fs_lookup.c */
124int ext2fs_readdir(void *);
125int ext2fs_lookup(void *);
126int ext2fs_search_dirblock(struct inode *, void *, int *,
127 const char *, int , int *, doff_t *, doff_t *, doff_t *,
128 struct ext2fs_searchslot *);
129int ext2fs_direnter(struct inode *, struct vnode *,
130 const struct ufs_lookup_results *,
131 struct componentname *);
132int ext2fs_dirremove(struct vnode *, const struct ufs_lookup_results *,
133 struct componentname *);
134int ext2fs_dirrewrite(struct inode *, const struct ufs_lookup_results *,
135 struct inode *, struct componentname *);
136int ext2fs_dirempty(struct inode *, ino_t, kauth_cred_t);
137int ext2fs_add_entry(struct vnode *, struct ext2fs_direct *,
138 const struct ufs_lookup_results *, size_t);
139
140/* ext2fs_subr.c */
141int ext2fs_blkatoff(struct vnode *, off_t, char **, struct buf **);
142void ext2fs_fragacct(struct m_ext2fs *, int, int32_t[], int);
143void ext2fs_itimes(struct inode *, const struct timespec *,
144 const struct timespec *, const struct timespec *);
145
146/* ext2fs_vfsops.c */
147VFS_PROTOS(ext2fs);
148int ext2fs_reload(struct mount *, kauth_cred_t, struct lwp *);
149int ext2fs_mountfs(struct vnode *, struct mount *);
150int ext2fs_flushfiles(struct mount *, int);
151int ext2fs_sbupdate(struct ufsmount *, int);
152int ext2fs_cgupdate(struct ufsmount *, int);
153void ext2fs_set_inode_guid(struct inode *);
154
155/* ext2fs_readwrite.c */
156int ext2fs_read(void *);
157int ext2fs_write(void *);
158int ext2fs_bufrd(struct vnode *, struct uio *, int, kauth_cred_t);
159int ext2fs_bufwr(struct vnode *, struct uio *, int, kauth_cred_t);
160
161/* ext2fs_vnops.c */
162int ext2fs_create(void *);
163int ext2fs_mknod(void *);
164int ext2fs_open(void *);
165int ext2fs_access(void *);
166int ext2fs_getattr(void *);
167int ext2fs_setattr(void *);
168int ext2fs_remove(void *);
169int ext2fs_link(void *);
170int ext2fs_rename(void *);
171int ext2fs_mkdir(void *);
172int ext2fs_rmdir(void *);
173int ext2fs_symlink(void *);
174int ext2fs_readlink(void *);
175int ext2fs_advlock(void *);
176int ext2fs_fsync(void *);
177int ext2fs_vinit(struct mount *, int (**specops)(void *),
178 int (**fifoops)(void *), struct vnode **);
179int ext2fs_makeinode(int, struct vnode *, struct vnode **,
180 struct componentname *cnp, int);
181int ext2fs_reclaim(void *);
182
183/* ext2fs_hash.c */
184int ext2fs_htree_hash(const char *, int, uint32_t *, int, uint32_t *,
185 uint32_t *);
186
187/* ext2fs_htree.c */
188int ext2fs_htree_has_idx(struct inode *);
189int ext2fs_htree_lookup(struct inode *, const char *, int, struct buf **,
190 int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *);
191int ext2fs_htree_create_index(struct vnode *, struct componentname *,
192 struct ext2fs_direct *);
193int ext2fs_htree_add_entry(struct vnode *, struct ext2fs_direct *,
194 struct componentname *, size_t);
195
196__END_DECLS
197
198#define IS_EXT2_VNODE(vp) (vp->v_tag == VT_EXT2FS)
199
200extern int (**ext2fs_vnodeop_p)(void *);
201extern int (**ext2fs_specop_p)(void *);
202extern int (**ext2fs_fifoop_p)(void *);
203
204#endif /* !_UFS_EXT2FS_EXT2FS_EXTERN_H_ */
205