Home | History | Annotate | Line # | Download | only in lfs
ulfsmount.h revision 1.10
      1 /*	$NetBSD: ulfsmount.h,v 1.10 2013/07/28 00:29:18 dholland Exp $	*/
      2 /*  from NetBSD: ufsmount.h,v 1.39 2012/10/19 17:09:08 drochner Exp  */
      3 
      4 /*
      5  * Copyright (c) 1982, 1986, 1989, 1993
      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  *	@(#)ufsmount.h	8.6 (Berkeley) 3/30/95
     33  */
     34 
     35 #ifndef _UFS_LFS_ULFSMOUNT_H_
     36 #define _UFS_LFS_ULFSMOUNT_H_
     37 
     38 #include <sys/mount.h> /* struct export_args30 */
     39 
     40 #ifdef _KERNEL
     41 
     42 #if defined(_KERNEL_OPT)
     43 #include "opt_lfs.h"
     44 #endif
     45 
     46 #include <sys/mutex.h>
     47 
     48 #include <ufs/lfs/ulfs_extattr.h>
     49 #include <ufs/lfs/ulfs_quotacommon.h>
     50 
     51 struct buf;
     52 struct inode;
     53 struct nameidata;
     54 struct timeval;
     55 struct uio;
     56 struct vnode;
     57 
     58 /* This structure describes the ULFS specific mount structure data. */
     59 struct ulfsmount {
     60 	/* Abstract vfs-level filesystem structure. */
     61 	struct mount *um_mountp;
     62 
     63 	/* The block device we're mounted on. */
     64 	dev_t um_dev;
     65 	struct vnode *um_devvp;
     66 
     67 	/* type of fs; currently always ULFS1, theoretically also ULFS2 */
     68 	u_long um_fstype;
     69 
     70 	/* pointer to the filesystem-specific filesystem structure */
     71 	struct lfs *um_lfs;
     72 
     73 	/* ULFS-level information */
     74 	u_int32_t um_flags;			/* ULFS flags (below) */
     75 	u_long	um_nindir;			/* indirect ptrs per block */
     76 	u_long	um_lognindir;			/* log2 of um_nindir */
     77 	u_long	um_bptrtodb;			/* indir ptr to disk block */
     78 	u_long	um_seqinc;			/* inc between seq blocks */
     79 	int um_maxsymlinklen;
     80 	int um_dirblksiz;
     81 	u_int64_t um_maxfilesize;
     82 
     83 	/* Extended attribute information. */
     84 	struct ulfs_extattr_per_mount um_extattr;
     85 
     86 	/* Quota-related material. */
     87 	struct vnode *um_quotas[ULFS_MAXQUOTAS]; /* quota files */
     88 	kauth_cred_t um_cred[ULFS_MAXQUOTAS];	/* quota file access cred */
     89 	union {
     90 	    struct um_q1 {
     91 		time_t	q1_btime[ULFS_MAXQUOTAS]; /* block quota time limit */
     92 		time_t	q1_itime[ULFS_MAXQUOTAS]; /* inode quota time limit */
     93 		char	q1_qflags[ULFS_MAXQUOTAS]; /* quota flags */
     94 	    } um_q1;
     95 	    struct um_q2 {
     96 		uint64_t q2_bsize;		/* block size of quota file */
     97 		uint64_t q2_bmask;		/* mask for above */
     98 	    } um_q2;
     99 	} um_q;
    100 #define umq1_btime  um_q.um_q1.q1_btime
    101 #define umq1_itime  um_q.um_q1.q1_itime
    102 #define umq1_qflags um_q.um_q1.q1_qflags
    103 #define umq2_bsize  um_q.um_q2.q2_bsize
    104 #define umq2_bmask  um_q.um_q2.q2_bmask
    105 };
    106 
    107 #define	ULFS_ITIMES(vp, acc, mod, cre) \
    108 	((void)0)
    109 #define	ULFS_UPDATE(vp, acc, mod, flags) \
    110 	lfs_update((vp), (acc), (mod), (flags))
    111 #define	ULFS_TRUNCATE(vp, off, flags, cr) \
    112 	lfs_truncate((vp), (off), (flags), (cr))
    113 #define	ULFS_VALLOC(vp, mode, cr, vpp) \
    114 	lfs_valloc((vp), (mode), (cr), (vpp))
    115 #define	ULFS_VFREE(vp, ino, mode) \
    116 	lfs_vfree((vp), (ino), (mode))
    117 #define	ULFS_BALLOC(vp, off, size, cr, flags, bpp) \
    118 	lfs_balloc((vp), (off), (size), (cr), (flags), (bpp))
    119 #define	ULFS_UNMARK_VNODE(vp) \
    120 	lfs_unmark_vnode((vp))
    121 
    122 /* ULFS-specific flags for um_flags */
    123 #define ULFS_NEEDSWAP	0x01	/* filesystem metadata need byte-swapping */
    124 /*	unused		0x02	   */
    125 #define ULFS_QUOTA	0x04	/* filesystem has QUOTA (v1) */
    126 #define ULFS_QUOTA2	0x08	/* filesystem has QUOTA2 */
    127 
    128 /*
    129  * Filesystem types
    130  */
    131 #define ULFS1  1
    132 #define ULFS2  2
    133 
    134 
    135 /*
    136  * Flags describing the state of quotas.
    137  */
    138 #define	QTF_OPENING	0x01			/* Q_QUOTAON in progress */
    139 #define	QTF_CLOSING	0x02			/* Q_QUOTAOFF in progress */
    140 
    141 /* Convert mount ptr to ulfsmount ptr. */
    142 #define VFSTOULFS(mp)	((struct ulfsmount *)((mp)->mnt_data))
    143 
    144 /*
    145  * Macros to access file system parameters in the ulfsmount structure.
    146  * Used by ulfs_bmap.
    147  */
    148 #define MNINDIR(ump)			((ump)->um_nindir)
    149 #define	blkptrtodb(ump, b)		((b) << (ump)->um_bptrtodb)
    150 
    151 /*
    152  * Predicate for byte-swapping support.
    153  */
    154 #define	FSFMT(vp)	(((vp)->v_mount->mnt_iflag & IMNT_DTYPE) == 0)
    155 
    156 #endif /* _KERNEL */
    157 
    158 #endif /* !_UFS_LFS_ULFSMOUNT_H_ */
    159