Home | History | Annotate | Line # | Download | only in lfs
ulfs_extern.h revision 1.2
      1 /*	$NetBSD: ulfs_extern.h,v 1.2 2013/06/06 00:48:04 dholland Exp $	*/
      2 /*  from NetBSD: ufs_extern.h,v 1.72 2012/05/09 00:21:18 riastradh Exp  */
      3 
      4 /*-
      5  * Copyright (c) 1991, 1993, 1994
      6  *	The Regents of the University of California.  All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. Neither the name of the University nor the names of its contributors
     17  *    may be used to endorse or promote products derived from this software
     18  *    without specific prior written permission.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     30  * SUCH DAMAGE.
     31  *
     32  *	@(#)ufs_extern.h	8.10 (Berkeley) 5/14/95
     33  */
     34 
     35 #ifndef _UFS_LFS_ULFS_EXTERN_H_
     36 #define _UFS_LFS_ULFS_EXTERN_H_
     37 
     38 #include <sys/mutex.h>
     39 
     40 struct buf;
     41 struct componentname;
     42 struct direct;
     43 struct disklabel;
     44 struct dquot;
     45 struct fid;
     46 struct flock;
     47 struct indir;
     48 struct inode;
     49 struct mbuf;
     50 struct mount;
     51 struct nameidata;
     52 struct lwp;
     53 struct ufid;
     54 struct ulfs_args;
     55 struct ulfs_lookup_results;
     56 struct ulfsmount;
     57 struct uio;
     58 struct vattr;
     59 struct vnode;
     60 
     61 extern pool_cache_t ulfs_direct_cache;	/* memory pool for directs */
     62 
     63 __BEGIN_DECLS
     64 #define	ulfs_abortop	genfs_abortop
     65 int	ulfs_access(void *);
     66 int	ulfs_advlock(void *);
     67 int	ulfs_bmap(void *);
     68 int	ulfs_close(void *);
     69 int	ulfs_create(void *);
     70 int	ulfs_getattr(void *);
     71 int	ulfs_inactive(void *);
     72 #define	ulfs_fcntl	genfs_fcntl
     73 #define	ulfs_ioctl	genfs_enoioctl
     74 #define	ulfs_islocked	genfs_islocked
     75 int	ulfs_link(void *);
     76 #define	ulfs_lock	genfs_lock
     77 int	ulfs_lookup(void *);
     78 int	ulfs_mkdir(void *);
     79 int	ulfs_mknod(void *);
     80 #define	ulfs_mmap	genfs_mmap
     81 #define	ulfs_revoke	genfs_revoke
     82 int	ulfs_open(void *);
     83 int	ulfs_pathconf(void *);
     84 int	ulfs_print(void *);
     85 int	ulfs_readdir(void *);
     86 int	ulfs_readlink(void *);
     87 int	ulfs_remove(void *);
     88 int	ulfs_rename(void *);
     89 int	ulfs_rmdir(void *);
     90 #define	ulfs_seek	genfs_seek
     91 #define	ulfs_poll	genfs_poll
     92 int	ulfs_setattr(void *);
     93 int	ulfs_strategy(void *);
     94 int	ulfs_symlink(void *);
     95 #define	ulfs_unlock	genfs_unlock
     96 int	ulfs_whiteout(void *);
     97 int	ulfsspec_close(void *);
     98 int	ulfsspec_read(void *);
     99 int	ulfsspec_write(void *);
    100 
    101 int	ulfsfifo_read(void *);
    102 int	ulfsfifo_write(void *);
    103 int	ulfsfifo_close(void *);
    104 
    105 /* ulfs_bmap.c */
    106 typedef	bool (*ulfs_issequential_callback_t)(const struct ulfsmount *,
    107 						 daddr_t, daddr_t);
    108 int	ulfs_bmaparray(struct vnode *, daddr_t, daddr_t *, struct indir *,
    109 		      int *, int *, ulfs_issequential_callback_t);
    110 int	ulfs_getlbns(struct vnode *, daddr_t, struct indir *, int *);
    111 
    112 /* ulfs_ihash.c */
    113 void	ulfs_ihashinit(void);
    114 void	ulfs_ihashreinit(void);
    115 void	ulfs_ihashdone(void);
    116 struct vnode *ulfs_ihashlookup(dev_t, ino_t);
    117 struct vnode *ulfs_ihashget(dev_t, ino_t, int);
    118 void	ulfs_ihashins(struct inode *);
    119 void	ulfs_ihashrem(struct inode *);
    120 
    121 /* ulfs_inode.c */
    122 int	ulfs_reclaim(struct vnode *);
    123 int	ulfs_balloc_range(struct vnode *, off_t, off_t, kauth_cred_t, int);
    124 
    125 /* ulfs_lookup.c */
    126 void	ulfs_dirbad(struct inode *, doff_t, const char *);
    127 int	ulfs_dirbadentry(struct vnode *, struct direct *, int);
    128 void	ulfs_makedirentry(struct inode *, struct componentname *,
    129 			 struct direct *);
    130 int	ulfs_direnter(struct vnode *, const struct ulfs_lookup_results *,
    131 		     struct vnode *, struct direct *,
    132 		     struct componentname *, struct buf *);
    133 int	ulfs_dirremove(struct vnode *, const struct ulfs_lookup_results *,
    134 		      struct inode *, int, int);
    135 int	ulfs_dirrewrite(struct inode *, off_t,
    136 		       struct inode *, ino_t, int, int, int);
    137 int	ulfs_dirempty(struct inode *, ino_t, kauth_cred_t);
    138 int	ulfs_checkpath(struct inode *, struct inode *, kauth_cred_t);
    139 int	ulfs_parentcheck(struct vnode *, struct vnode *, kauth_cred_t,
    140 			int *, struct vnode **);
    141 int	ulfs_blkatoff(struct vnode *, off_t, char **, struct buf **, bool);
    142 
    143 /* ulfs_rename.c -- for lfs */
    144 bool	ulfs_gro_directory_empty_p(struct mount *, kauth_cred_t,
    145 	    struct vnode *, struct vnode *);
    146 int	ulfs_gro_rename_check_possible(struct mount *,
    147 	    struct vnode *, struct vnode *, struct vnode *, struct vnode *);
    148 int	ulfs_gro_rename_check_permitted(struct mount *, kauth_cred_t,
    149 	    struct vnode *, struct vnode *, struct vnode *, struct vnode *);
    150 int	ulfs_gro_remove_check_possible(struct mount *,
    151 	    struct vnode *, struct vnode *);
    152 int	ulfs_gro_remove_check_permitted(struct mount *, kauth_cred_t,
    153 	    struct vnode *, struct vnode *);
    154 int	ulfs_gro_rename(struct mount *, kauth_cred_t,
    155 	    struct vnode *, struct componentname *, void *, struct vnode *,
    156 	    struct vnode *, struct componentname *, void *, struct vnode *);
    157 int	ulfs_gro_remove(struct mount *, kauth_cred_t,
    158 	    struct vnode *, struct componentname *, void *, struct vnode *);
    159 int	ulfs_gro_lookup(struct mount *, struct vnode *,
    160 	    struct componentname *, void *, struct vnode **);
    161 int	ulfs_gro_genealogy(struct mount *, kauth_cred_t,
    162 	    struct vnode *, struct vnode *, struct vnode **);
    163 int	ulfs_gro_lock_directory(struct mount *, struct vnode *);
    164 
    165 
    166 /* ulfs_quota.c */
    167 /*
    168  * Flags to chkdq() and chkiq()
    169  */
    170 #define	FORCE	0x01	/* force usage changes independent of limits */
    171 void	ulfsquota_init(struct inode *);
    172 void	ulfsquota_free(struct inode *);
    173 int	chkdq(struct inode *, int64_t, kauth_cred_t, int);
    174 int	chkiq(struct inode *, int32_t, kauth_cred_t, int);
    175 int	quota_handle_cmd(struct mount *, struct lwp *,
    176 			 struct quotactl_args *);
    177 
    178 int	qsync(struct mount *);
    179 
    180 /* ulfs_quota1.c */
    181 int	quota1_umount(struct mount *, int);
    182 
    183 /* ulfs_quota2.c */
    184 int	quota2_umount(struct mount *, int);
    185 
    186 /* ulfs_vfsops.c */
    187 void	ulfs_init(void);
    188 void	ulfs_reinit(void);
    189 void	ulfs_done(void);
    190 int	ulfs_start(struct mount *, int);
    191 int	ulfs_root(struct mount *, struct vnode **);
    192 int	ulfs_quotactl(struct mount *, struct quotactl_args *);
    193 int	ulfs_fhtovp(struct mount *, struct ufid *, struct vnode **);
    194 
    195 /* ulfs_vnops.c */
    196 void	ulfs_vinit(struct mount *, int (**)(void *),
    197 		  int (**)(void *), struct vnode **);
    198 int	ulfs_makeinode(int, struct vnode *, const struct ulfs_lookup_results *,
    199 		      struct vnode **, struct componentname *);
    200 int	ulfs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
    201 void	ulfs_gop_markupdate(struct vnode *, int);
    202 
    203 /*
    204  * Snapshot function prototypes.
    205  */
    206 
    207 void	lfs_snapgone(struct inode *);
    208 
    209 __END_DECLS
    210 
    211 extern kmutex_t ulfs_ihash_lock;
    212 extern kmutex_t ulfs_hashlock;
    213 
    214 #endif /* !_UFS_LFS_ULFS_EXTERN_H_ */
    215