Home | History | Annotate | Line # | Download | only in ufs
      1 /*	$NetBSD: ufs_extern.h,v 1.88 2021/10/20 03:08:19 thorpej 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 int	ufs_accessx(void *);
     64 int	ufs_advlock(void *);
     65 int	ufs_bmap(void *);
     66 int	ufs_close(void *);
     67 int	ufs_create(void *);
     68 int	ufs_getattr(void *);
     69 int	ufs_inactive(void *);
     70 int	ufs_link(void *);
     71 int	ufs_lookup(void *);
     72 int	ufs_mkdir(void *);
     73 int	ufs_mknod(void *);
     74 int	ufs_open(void *);
     75 int	ufs_pathconf(void *);
     76 int	ufs_print(void *);
     77 int	ufs_readdir(void *);
     78 int	ufs_readlink(void *);
     79 int	ufs_remove(void *);
     80 int	ufs_rename(void *);
     81 int	ufs_rmdir(void *);
     82 int	ufs_setattr(void *);
     83 int	ufs_strategy(void *);
     84 int	ufs_symlink(void *);
     85 int	ufs_whiteout(void *);
     86 
     87 int	ufsspec_close(void *);
     88 int	ufsspec_read(void *);
     89 int	ufsspec_write(void *);
     90 
     91 int	ufsfifo_read(void *);
     92 int	ufsfifo_write(void *);
     93 int	ufsfifo_close(void *);
     94 
     95 /* ufs_bmap.c */
     96 typedef	bool (*ufs_issequential_callback_t)(const struct ufsmount *,
     97 						 daddr_t, daddr_t);
     98 int	ufs_bmaparray(struct vnode *, daddr_t, daddr_t *, struct indir *,
     99 		      int *, int *, ufs_issequential_callback_t);
    100 int	ufs_getlbns(struct vnode *, daddr_t, struct indir *, int *);
    101 
    102 /* ufs_inode.c */
    103 int	ufs_reclaim(struct vnode *);
    104 int	ufs_balloc_range(struct vnode *, off_t, off_t, kauth_cred_t, int);
    105 int	ufs_truncate_all(struct vnode *);
    106 int	ufs_truncate_retry(struct vnode *, int, uint64_t, kauth_cred_t);
    107 
    108 /* ufs_lookup.c */
    109 void	ufs_dirbad(struct inode *, doff_t, const char *);
    110 const char *ufs_dirbadentry(const struct vnode *, const struct direct *, int);
    111 void	ufs_makedirentry(struct inode *, struct componentname *,
    112 			 struct direct *);
    113 int	ufs_direnter(struct vnode *, const struct ufs_lookup_results *,
    114 		     struct vnode *, struct direct *,
    115 		     struct componentname *, struct buf *);
    116 int	ufs_dirremove(struct vnode *, const struct ufs_lookup_results *,
    117 		      struct inode *, int, int);
    118 int	ufs_dirrewrite(struct inode *, off_t,
    119 		       struct inode *, ino_t, int, int, int);
    120 int	ufs_dirempty(struct inode *, ino_t, kauth_cred_t);
    121 int	ufs_blkatoff(struct vnode *, off_t, void *, struct buf **, bool);
    122 
    123 /* ufs_rename.c -- for lfs */
    124 bool	ufs_gro_directory_empty_p(struct mount *, kauth_cred_t,
    125 	    struct vnode *, struct vnode *);
    126 int	ufs_gro_rename_check_possible(struct mount *,
    127 	    struct vnode *, struct vnode *, struct vnode *, struct vnode *);
    128 int	ufs_gro_rename_check_permitted(struct mount *, kauth_cred_t,
    129 	    struct vnode *, struct vnode *, struct vnode *, struct vnode *);
    130 int	ufs_gro_remove_check_possible(struct mount *,
    131 	    struct vnode *, struct vnode *);
    132 int	ufs_gro_remove_check_permitted(struct mount *, kauth_cred_t,
    133 	    struct vnode *, struct vnode *);
    134 int	ufs_gro_rename(struct mount *, kauth_cred_t,
    135 	    struct vnode *, struct componentname *, void *, struct vnode *,
    136 	    struct vnode *, struct componentname *, void *, struct vnode *,
    137 	    nlink_t *);
    138 int	ufs_gro_remove(struct mount *, kauth_cred_t,
    139 	    struct vnode *, struct componentname *, void *, struct vnode *,
    140 	    nlink_t *);
    141 int	ufs_gro_lookup(struct mount *, struct vnode *,
    142 	    struct componentname *, void *, struct vnode **);
    143 int	ufs_gro_genealogy(struct mount *, kauth_cred_t,
    144 	    struct vnode *, struct vnode *, struct vnode **);
    145 int	ufs_gro_lock_directory(struct mount *, struct vnode *);
    146 
    147 
    148 /* ufs_quota.c */
    149 /*
    150  * Flags to chkdq() and chkiq()
    151  */
    152 #define	FORCE	0x01	/* force usage changes independent of limits */
    153 void	ufsquota_init(struct inode *);
    154 void	ufsquota_free(struct inode *);
    155 int	chkdq(struct inode *, int64_t, kauth_cred_t, int);
    156 int	chkiq(struct inode *, int32_t, kauth_cred_t, int);
    157 int	quota_handle_cmd(struct mount *, struct lwp *,
    158 			 struct quotactl_args *);
    159 
    160 int	qsync(struct mount *);
    161 
    162 /* ufs_quota1.c */
    163 int	quota1_umount(struct mount *, int);
    164 
    165 /* ufs_quota2.c */
    166 int	quota2_umount(struct mount *, int);
    167 
    168 /* ufs_vfsops.c */
    169 void	ufs_init(void);
    170 void	ufs_reinit(void);
    171 void	ufs_done(void);
    172 int	ufs_start(struct mount *, int);
    173 int	ufs_root(struct mount *, int, struct vnode **);
    174 int	ufs_vget(struct mount *, ino_t, int, struct vnode **);
    175 int	ufs_quotactl(struct mount *, struct quotactl_args *);
    176 int	ufs_fhtovp(struct mount *, struct ufid *, int, struct vnode **);
    177 
    178 /* ufs_vnops.c */
    179 void	ufs_vinit(struct mount *, int (**)(void *),
    180 		  int (**)(void *), struct vnode **);
    181 int	ufs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
    182 void	ufs_gop_markupdate(struct vnode *, int);
    183 int	ufs_bufio(enum uio_rw, struct vnode *, void *, size_t, off_t, int,
    184 	    kauth_cred_t, size_t *, struct lwp *);
    185 
    186 __END_DECLS
    187 
    188 extern kmutex_t ufs_hashlock;
    189 
    190 #endif /* !_UFS_UFS_EXTERN_H_ */
    191