1/*	$NetBSD: ufs_extern.h,v 1.70 2012/01/29 07:14:38 dholland 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 *	@(#)ufs_extern.h	8.10 (Berkeley) 5/14/95
32 */
33
34#ifndef _UFS_UFS_EXTERN_H_
35#define _UFS_UFS_EXTERN_H_
36
37#include <sys/mutex.h>
38
39struct buf;
40struct componentname;
41struct direct;
42struct disklabel;
43struct dquot;
44struct fid;
45struct flock;
46struct indir;
47struct inode;
48struct mbuf;
49struct mount;
50struct nameidata;
51struct lwp;
52struct ufid;
53struct ufs_args;
54struct ufs_lookup_results;
55struct ufsmount;
56struct uio;
57struct vattr;
58struct vnode;
59
60extern pool_cache_t ufs_direct_cache;	/* memory pool for directs */
61
62__BEGIN_DECLS
63#define	ufs_abortop	genfs_abortop
64int	ufs_access(void *);
65int	ufs_advlock(void *);
66int	ufs_bmap(void *);
67int	ufs_close(void *);
68int	ufs_create(void *);
69int	ufs_getattr(void *);
70int	ufs_inactive(void *);
71#define	ufs_fcntl	genfs_fcntl
72#define	ufs_ioctl	genfs_enoioctl
73#define	ufs_islocked	genfs_islocked
74int	ufs_link(void *);
75#define	ufs_lock	genfs_lock
76int	ufs_lookup(void *);
77int	ufs_mkdir(void *);
78int	ufs_mknod(void *);
79#define	ufs_mmap	genfs_mmap
80#define	ufs_revoke	genfs_revoke
81int	ufs_open(void *);
82int	ufs_pathconf(void *);
83int	ufs_print(void *);
84int	ufs_readdir(void *);
85int	ufs_readlink(void *);
86int	ufs_remove(void *);
87int	ufs_rename(void *);
88int	ufs_rmdir(void *);
89#define	ufs_seek	genfs_seek
90#define	ufs_poll	genfs_poll
91int	ufs_setattr(void *);
92int	ufs_strategy(void *);
93int	ufs_symlink(void *);
94#define	ufs_unlock	genfs_unlock
95int	ufs_whiteout(void *);
96int	ufsspec_close(void *);
97int	ufsspec_read(void *);
98int	ufsspec_write(void *);
99
100int	ufsfifo_read(void *);
101int	ufsfifo_write(void *);
102int	ufsfifo_close(void *);
103
104/* ufs_bmap.c */
105typedef	bool (*ufs_issequential_callback_t)(const struct ufsmount *,
106						 daddr_t, daddr_t);
107int	ufs_bmaparray(struct vnode *, daddr_t, daddr_t *, struct indir *,
108		      int *, int *, ufs_issequential_callback_t);
109int	ufs_getlbns(struct vnode *, daddr_t, struct indir *, int *);
110
111/* ufs_ihash.c */
112void	ufs_ihashinit(void);
113void	ufs_ihashreinit(void);
114void	ufs_ihashdone(void);
115struct vnode *ufs_ihashlookup(dev_t, ino_t);
116struct vnode *ufs_ihashget(dev_t, ino_t, int);
117void	ufs_ihashins(struct inode *);
118void	ufs_ihashrem(struct inode *);
119
120/* ufs_inode.c */
121int	ufs_reclaim(struct vnode *);
122int	ufs_balloc_range(struct vnode *, off_t, off_t, kauth_cred_t, int);
123
124/* ufs_lookup.c */
125void	ufs_dirbad(struct inode *, doff_t, const char *);
126int	ufs_dirbadentry(struct vnode *, struct direct *, int);
127void	ufs_makedirentry(struct inode *, struct componentname *,
128			 struct direct *);
129int	ufs_direnter(struct vnode *, const struct ufs_lookup_results *,
130		     struct vnode *, struct direct *,
131		     struct componentname *, struct buf *);
132int	ufs_dirremove(struct vnode *, const struct ufs_lookup_results *,
133		      struct inode *, int, int);
134int	ufs_dirrewrite(struct inode *, off_t,
135		       struct inode *, ino_t, int, int, int);
136int	ufs_dirempty(struct inode *, ino_t, kauth_cred_t);
137int	ufs_checkpath(struct inode *, struct inode *, kauth_cred_t);
138int	ufs_parentcheck(struct vnode *, struct vnode *, kauth_cred_t,
139			int *, struct vnode **);
140int	ufs_blkatoff(struct vnode *, off_t, char **, struct buf **, bool);
141
142/* ufs_quota.c */
143/*
144 * Flags to chkdq() and chkiq()
145 */
146#define	FORCE	0x01	/* force usage changes independent of limits */
147void	ufsquota_init(struct inode *);
148void	ufsquota_free(struct inode *);
149int	chkdq(struct inode *, int64_t, kauth_cred_t, int);
150int	chkiq(struct inode *, int32_t, kauth_cred_t, int);
151int	quota_handle_cmd(struct mount *, struct lwp *,
152			 struct quotactl_args *);
153
154int	qsync(struct mount *);
155
156/* ufs_quota1.c */
157int	quota1_umount(struct mount *, int);
158
159/* ufs_quota2.c */
160int	quota2_umount(struct mount *, int);
161
162/* ufs_vfsops.c */
163void	ufs_init(void);
164void	ufs_reinit(void);
165void	ufs_done(void);
166int	ufs_start(struct mount *, int);
167int	ufs_root(struct mount *, struct vnode **);
168int	ufs_quotactl(struct mount *, struct quotactl_args *);
169int	ufs_fhtovp(struct mount *, struct ufid *, struct vnode **);
170
171/* ufs_vnops.c */
172void	ufs_vinit(struct mount *, int (**)(void *),
173		  int (**)(void *), struct vnode **);
174int	ufs_makeinode(int, struct vnode *, const struct ufs_lookup_results *,
175		      struct vnode **, struct componentname *);
176int	ufs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
177void	ufs_gop_markupdate(struct vnode *, int);
178
179/*
180 * Snapshot function prototypes.
181 */
182
183void	ffs_snapgone(struct inode *);
184
185__END_DECLS
186
187extern kmutex_t ufs_ihash_lock;
188extern kmutex_t ufs_hashlock;
189
190#endif /* !_UFS_UFS_EXTERN_H_ */
191