1 /*	$OpenBSD: ufsmount.h,v 1.11 2005/07/03 20:14:03 drahn Exp $	*/
2 /*	$NetBSD: ufsmount.h,v 1.4 1994/12/21 20:00:23 mycroft 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.4 (Berkeley) 10/27/94
33  */
34 
35 struct buf;
36 struct inode;
37 struct nameidata;
38 struct timeval;
39 struct ucred;
40 struct uio;
41 struct vnode;
42 struct netexport;
43 
44 /* This structure describes the UFS specific mount structure data. */
45 struct ufsmount {
46 	struct	mount *um_mountp;		/* filesystem vfs structure */
47 	dev_t	um_dev;				/* device mounted */
48 	struct	vnode *um_devvp;		/* block device mounted vnode */
49 	u_long	um_fstype;			/* type of file system */
50 
51 	union {					/* pointer to superblock */
52 		struct	fs *fs;			/* FFS */
53 		struct	lfs *lfs;		/* LFS */
54 		struct  m_ext2fs *e2fs;		/* EXT2FS */
55 	} ufsmount_u;
56 #define	um_fs	ufsmount_u.fs
57 #define	um_lfs	ufsmount_u.lfs
58 #define um_e2fs    ufsmount_u.e2fs
59 #define um_e2fsb ufsmount_u.e2fs->s_es
60 
61 	struct	vnode *um_quotas[MAXQUOTAS];	/* pointer to quota files */
62 	struct	ucred *um_cred[MAXQUOTAS];	/* quota file access cred */
63 	u_long	um_nindir;			/* indirect ptrs per block */
64 	u_long	um_bptrtodb;			/* indir ptr to disk block */
65 	u_long	um_seqinc;			/* inc between seq blocks */
66 	time_t	um_btime[MAXQUOTAS];		/* block quota time limit */
67 	time_t	um_itime[MAXQUOTAS];		/* inode quota time limit */
68 	char	um_qflags[MAXQUOTAS];		/* quota specific flags */
69 	struct	netexport um_export;		/* export information */
70 	u_int64_t um_savedmaxfilesize;		/* XXX - limit maxfilesize */
71 };
72 
73 /*
74  * Filesystem types
75  */
76 #define	UM_UFS1	1
77 #define	UM_UFS2	2
78 #define	UM_EXT2FS	3
79 #define	UM_LFS	4
80 
81 /*
82  * Flags describing the state of quotas.
83  */
84 #define	QTF_OPENING	0x01			/* Q_QUOTAON in progress */
85 #define	QTF_CLOSING	0x02			/* Q_QUOTAOFF in progress */
86 
87 /* Convert mount ptr to ufsmount ptr. */
88 #define VFSTOUFS(mp)	((struct ufsmount *)((mp)->mnt_data))
89 
90 /*
91  * Macros to access file system parameters in the ufsmount structure.
92  * Used by ufs_bmap.
93  */
94 #define MNINDIR(ump)			((ump)->um_nindir)
95 #define	blkptrtodb(ump, b)		((b) << (ump)->um_bptrtodb)
96 #define	is_sequential(ump, a, b)	((b) == (a) + ump->um_seqinc)
97