1/* $NetBSD: ufs_extern.h,v 1.83 2016/10/28 20:38:12 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 * @(#)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_inode.c */
112int ufs_reclaim(struct vnode *);
113int ufs_balloc_range(struct vnode *, off_t, off_t, kauth_cred_t, int);
114int ufs_truncate_retry(struct vnode *, uint64_t, kauth_cred_t);
115
116/* ufs_lookup.c */
117void ufs_dirbad(struct inode *, doff_t, const char *);
118const char *ufs_dirbadentry(const struct vnode *, const struct direct *, int);
119void ufs_makedirentry(struct inode *, struct componentname *,
120 struct direct *);
121int ufs_direnter(struct vnode *, const struct ufs_lookup_results *,
122 struct vnode *, struct direct *,
123 struct componentname *, struct buf *);
124int ufs_dirremove(struct vnode *, const struct ufs_lookup_results *,
125 struct inode *, int, int);
126int ufs_dirrewrite(struct inode *, off_t,
127 struct inode *, ino_t, int, int, int);
128int ufs_dirempty(struct inode *, ino_t, kauth_cred_t);
129int ufs_blkatoff(struct vnode *, off_t, void *, struct buf **, bool);
130
131/* ufs_rename.c -- for lfs */
132bool ufs_gro_directory_empty_p(struct mount *, kauth_cred_t,
133 struct vnode *, struct vnode *);
134int ufs_gro_rename_check_possible(struct mount *,
135 struct vnode *, struct vnode *, struct vnode *, struct vnode *);
136int ufs_gro_rename_check_permitted(struct mount *, kauth_cred_t,
137 struct vnode *, struct vnode *, struct vnode *, struct vnode *);
138int ufs_gro_remove_check_possible(struct mount *,
139 struct vnode *, struct vnode *);
140int ufs_gro_remove_check_permitted(struct mount *, kauth_cred_t,
141 struct vnode *, struct vnode *);
142int ufs_gro_rename(struct mount *, kauth_cred_t,
143 struct vnode *, struct componentname *, void *, struct vnode *,
144 struct vnode *, struct componentname *, void *, struct vnode *);
145int ufs_gro_remove(struct mount *, kauth_cred_t,
146 struct vnode *, struct componentname *, void *, struct vnode *);
147int ufs_gro_lookup(struct mount *, struct vnode *,
148 struct componentname *, void *, struct vnode **);
149int ufs_gro_genealogy(struct mount *, kauth_cred_t,
150 struct vnode *, struct vnode *, struct vnode **);
151int ufs_gro_lock_directory(struct mount *, struct vnode *);
152
153
154/* ufs_quota.c */
155/*
156 * Flags to chkdq() and chkiq()
157 */
158#define FORCE 0x01 /* force usage changes independent of limits */
159void ufsquota_init(struct inode *);
160void ufsquota_free(struct inode *);
161int chkdq(struct inode *, int64_t, kauth_cred_t, int);
162int chkiq(struct inode *, int32_t, kauth_cred_t, int);
163int quota_handle_cmd(struct mount *, struct lwp *,
164 struct quotactl_args *);
165
166int qsync(struct mount *);
167
168/* ufs_quota1.c */
169int quota1_umount(struct mount *, int);
170
171/* ufs_quota2.c */
172int quota2_umount(struct mount *, int);
173
174/* ufs_vfsops.c */
175void ufs_init(void);
176void ufs_reinit(void);
177void ufs_done(void);
178int ufs_start(struct mount *, int);
179int ufs_root(struct mount *, struct vnode **);
180int ufs_vget(struct mount *, ino_t, struct vnode **);
181int ufs_quotactl(struct mount *, struct quotactl_args *);
182int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **);
183
184/* ufs_vnops.c */
185void ufs_vinit(struct mount *, int (**)(void *),
186 int (**)(void *), struct vnode **);
187int ufs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
188void ufs_gop_markupdate(struct vnode *, int);
189int ufs_bufio(enum uio_rw, struct vnode *, void *, size_t, off_t, int,
190 kauth_cred_t, size_t *, struct lwp *);
191
192__END_DECLS
193
194extern kmutex_t ufs_hashlock;
195
196#endif /* !_UFS_UFS_EXTERN_H_ */
197