1 /* $NetBSD: ufs_extern.h,v 1.79 2015/03/27 17:27:56 riastradh 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 39 struct buf; 40 struct componentname; 41 struct direct; 42 struct disklabel; 43 struct dquot; 44 struct fid; 45 struct flock; 46 struct indir; 47 struct inode; 48 struct mbuf; 49 struct mount; 50 struct nameidata; 51 struct lwp; 52 struct ufid; 53 struct ufs_args; 54 struct ufs_lookup_results; 55 struct ufsmount; 56 struct uio; 57 struct vattr; 58 struct vnode; 59 60 extern pool_cache_t ufs_direct_cache; /* memory pool for directs */ 61 62 __BEGIN_DECLS 63 #define ufs_abortop genfs_abortop 64 int ufs_access(void *); 65 int ufs_advlock(void *); 66 int ufs_bmap(void *); 67 int ufs_close(void *); 68 int ufs_create(void *); 69 int ufs_getattr(void *); 70 int ufs_inactive(void *); 71 #define ufs_fcntl genfs_fcntl 72 #define ufs_ioctl genfs_enoioctl 73 #define ufs_islocked genfs_islocked 74 int ufs_link(void *); 75 #define ufs_lock genfs_lock 76 int ufs_lookup(void *); 77 int ufs_mkdir(void *); 78 int ufs_mknod(void *); 79 #define ufs_mmap genfs_mmap 80 #define ufs_revoke genfs_revoke 81 int ufs_open(void *); 82 int ufs_pathconf(void *); 83 int ufs_print(void *); 84 int ufs_readdir(void *); 85 int ufs_readlink(void *); 86 int ufs_remove(void *); 87 int ufs_rename(void *); 88 int ufs_rmdir(void *); 89 #define ufs_seek genfs_seek 90 #define ufs_poll genfs_poll 91 int ufs_setattr(void *); 92 int ufs_strategy(void *); 93 int ufs_symlink(void *); 94 #define ufs_unlock genfs_unlock 95 int ufs_whiteout(void *); 96 int ufsspec_close(void *); 97 int ufsspec_read(void *); 98 int ufsspec_write(void *); 99 100 int ufsfifo_read(void *); 101 int ufsfifo_write(void *); 102 int ufsfifo_close(void *); 103 104 /* ufs_bmap.c */ 105 typedef bool (*ufs_issequential_callback_t)(const struct ufsmount *, 106 daddr_t, daddr_t); 107 int ufs_bmaparray(struct vnode *, daddr_t, daddr_t *, struct indir *, 108 int *, int *, ufs_issequential_callback_t); 109 int ufs_getlbns(struct vnode *, daddr_t, struct indir *, int *); 110 111 /* ufs_inode.c */ 112 int ufs_reclaim(struct vnode *); 113 int ufs_balloc_range(struct vnode *, off_t, off_t, kauth_cred_t, int); 114 int ufs_truncate(struct vnode *, uint64_t, kauth_cred_t); 115 116 /* ufs_lookup.c */ 117 void ufs_dirbad(struct inode *, doff_t, const char *); 118 int ufs_dirbadentry(struct vnode *, struct direct *, int); 119 void ufs_makedirentry(struct inode *, struct componentname *, 120 struct direct *); 121 int ufs_direnter(struct vnode *, const struct ufs_lookup_results *, 122 struct vnode *, struct direct *, 123 struct componentname *, struct buf *); 124 int ufs_dirremove(struct vnode *, const struct ufs_lookup_results *, 125 struct inode *, int, int); 126 int ufs_dirrewrite(struct inode *, off_t, 127 struct inode *, ino_t, int, int, int); 128 int ufs_dirempty(struct inode *, ino_t, kauth_cred_t); 129 int ufs_blkatoff(struct vnode *, off_t, char **, struct buf **, bool); 130 131 /* ufs_rename.c -- for lfs */ 132 bool ufs_gro_directory_empty_p(struct mount *, kauth_cred_t, 133 struct vnode *, struct vnode *); 134 int ufs_gro_rename_check_possible(struct mount *, 135 struct vnode *, struct vnode *, struct vnode *, struct vnode *); 136 int ufs_gro_rename_check_permitted(struct mount *, kauth_cred_t, 137 struct vnode *, struct vnode *, struct vnode *, struct vnode *); 138 int ufs_gro_remove_check_possible(struct mount *, 139 struct vnode *, struct vnode *); 140 int ufs_gro_remove_check_permitted(struct mount *, kauth_cred_t, 141 struct vnode *, struct vnode *); 142 int ufs_gro_rename(struct mount *, kauth_cred_t, 143 struct vnode *, struct componentname *, void *, struct vnode *, 144 struct vnode *, struct componentname *, void *, struct vnode *); 145 int ufs_gro_remove(struct mount *, kauth_cred_t, 146 struct vnode *, struct componentname *, void *, struct vnode *); 147 int ufs_gro_lookup(struct mount *, struct vnode *, 148 struct componentname *, void *, struct vnode **); 149 int ufs_gro_genealogy(struct mount *, kauth_cred_t, 150 struct vnode *, struct vnode *, struct vnode **); 151 int 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 */ 159 void ufsquota_init(struct inode *); 160 void ufsquota_free(struct inode *); 161 int chkdq(struct inode *, int64_t, kauth_cred_t, int); 162 int chkiq(struct inode *, int32_t, kauth_cred_t, int); 163 int quota_handle_cmd(struct mount *, struct lwp *, 164 struct quotactl_args *); 165 166 int qsync(struct mount *); 167 168 /* ufs_quota1.c */ 169 int quota1_umount(struct mount *, int); 170 171 /* ufs_quota2.c */ 172 int quota2_umount(struct mount *, int); 173 174 /* ufs_vfsops.c */ 175 void ufs_init(void); 176 void ufs_reinit(void); 177 void ufs_done(void); 178 int ufs_start(struct mount *, int); 179 int ufs_root(struct mount *, struct vnode **); 180 int ufs_vget(struct mount *, ino_t, struct vnode **); 181 int ufs_quotactl(struct mount *, struct quotactl_args *); 182 int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **); 183 184 /* ufs_vnops.c */ 185 void ufs_vinit(struct mount *, int (**)(void *), 186 int (**)(void *), struct vnode **); 187 int ufs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t); 188 void ufs_gop_markupdate(struct vnode *, int); 189 int 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 194 extern kmutex_t ufs_hashlock; 195 196 #endif /* !_UFS_UFS_EXTERN_H_ */ 197