xref: /netbsd/sys/ufs/ufs/ufsmount.h (revision bf9ec67e)
1 /*	$NetBSD: ufsmount.h,v 1.8 2000/11/27 08:40:02 chs Exp $	*/
2 
3 /*
4  * Copyright (c) 1982, 1986, 1989, 1993
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. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by the University of
18  *	California, Berkeley and its contributors.
19  * 4. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *	@(#)ufsmount.h	8.6 (Berkeley) 3/30/95
36  */
37 
38 /*
39  * Arguments to mount UFS-based filesystems
40  */
41 struct ufs_args {
42 	char	*fspec;			/* block special device to mount */
43 	struct	export_args export;	/* network export information */
44 };
45 
46 /*
47  * Arguments to mount MFS
48  */
49 struct mfs_args {
50 	char	*fspec;			/* name to export for statfs */
51 	struct	export_args export;	/* if exported MFSes are supported */
52 	caddr_t	base;			/* base of file system in memory */
53 	u_long	size;			/* size of file system */
54 };
55 
56 #ifdef _KERNEL
57 struct buf;
58 struct inode;
59 struct nameidata;
60 struct timeval;
61 struct ucred;
62 struct uio;
63 struct vnode;
64 struct netexport;
65 
66 /* This structure describes the UFS specific mount structure data. */
67 struct ufsmount {
68 	struct	mount *um_mountp;		/* filesystem vfs structure */
69 	dev_t	um_dev;				/* device mounted */
70 	struct	vnode *um_devvp;		/* block device mounted vnode */
71 	u_int32_t um_flags;			/* UFS-specific flags - see below */
72 	union {					/* pointer to superblock */
73 		struct	fs *fs;			/* FFS */
74 		struct	lfs *lfs;		/* LFS */
75 		struct  m_ext2fs *e2fs; /* EXT2FS */
76 	} ufsmount_u;
77 #define	um_fs	ufsmount_u.fs
78 #define	um_lfs	ufsmount_u.lfs
79 #define um_e2fs	ufsmount_u.e2fs
80 #define um_e2fsb ufsmount_u.e2fs->s_es
81 
82 	struct	vnode *um_quotas[MAXQUOTAS];	/* pointer to quota files */
83 	struct	ucred *um_cred[MAXQUOTAS];	/* quota file access cred */
84 	u_long	um_nindir;			/* indirect ptrs per block */
85 	u_long	um_lognindir;			/* log2 of um_nindir */
86 	u_long	um_bptrtodb;			/* indir ptr to disk block */
87 	u_long	um_seqinc;			/* inc between seq blocks */
88 	time_t	um_btime[MAXQUOTAS];		/* block quota time limit */
89 	time_t	um_itime[MAXQUOTAS];		/* inode quota time limit */
90 	char	um_qflags[MAXQUOTAS];		/* quota specific flags */
91 	struct	netexport um_export;		/* export information */
92 	u_int64_t um_savedmaxfilesize;		/* XXX - limit maxfilesize */
93 };
94 
95 /* UFS-specific flags */
96 #define UFS_NEEDSWAP	0x01	/* filesystem metadata need byte-swapping */
97 
98 /*
99  * Flags describing the state of quotas.
100  */
101 #define	QTF_OPENING	0x01			/* Q_QUOTAON in progress */
102 #define	QTF_CLOSING	0x02			/* Q_QUOTAOFF in progress */
103 
104 /* Convert mount ptr to ufsmount ptr. */
105 #define VFSTOUFS(mp)	((struct ufsmount *)((mp)->mnt_data))
106 
107 /*
108  * Macros to access file system parameters in the ufsmount structure.
109  * Used by ufs_bmap.
110  */
111 #define MNINDIR(ump)			((ump)->um_nindir)
112 #define	blkptrtodb(ump, b)		((b) << (ump)->um_bptrtodb)
113 #define	is_sequential(ump, a, b)	((b) == (a) + ump->um_seqinc)
114 #endif /* _KERNEL */
115