xref: /openbsd/sys/ufs/ufs/ufsmount.h (revision 3484f39e)
1 /*	$OpenBSD: ufsmount.h,v 1.13 2016/02/27 18:50:38 natano 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  m_ext2fs *e2fs;		/* EXT2FS */
54 	} ufsmount_u;
55 #define	um_fs		ufsmount_u.fs
56 #define	um_e2fs		ufsmount_u.e2fs
57 #define	um_e2fsb	ufsmount_u.e2fs->s_es
58 
59 	struct	vnode *um_quotas[MAXQUOTAS];	/* pointer to quota files */
60 	struct	ucred *um_cred[MAXQUOTAS];	/* quota file access cred */
61 	u_long	um_nindir;			/* indirect ptrs per block */
62 	u_long	um_bptrtodb;			/* indir ptr to disk block */
63 	u_long	um_seqinc;			/* inc between seq blocks */
64 	time_t	um_btime[MAXQUOTAS];		/* block quota time limit */
65 	time_t	um_itime[MAXQUOTAS];		/* inode quota time limit */
66 	char	um_qflags[MAXQUOTAS];		/* quota specific flags */
67 	struct	netexport um_export;		/* export information */
68 	u_int64_t um_savedmaxfilesize;		/* XXX - limit maxfilesize */
69 	u_int	um_maxsymlinklen;		/* max size of short symlink */
70 };
71 
72 /*
73  * Filesystem types
74  */
75 #define	UM_UFS1	1
76 #define	UM_UFS2	2
77 #define	UM_EXT2FS	3
78 
79 /*
80  * Flags describing the state of quotas.
81  */
82 #define	QTF_OPENING	0x01			/* Q_QUOTAON in progress */
83 #define	QTF_CLOSING	0x02			/* Q_QUOTAOFF in progress */
84 
85 /* Convert mount ptr to ufsmount ptr. */
86 #define VFSTOUFS(mp)	((struct ufsmount *)((mp)->mnt_data))
87 
88 /*
89  * Macros to access file system parameters in the ufsmount structure.
90  * Used by ufs_bmap.
91  */
92 #define MNINDIR(ump)			((ump)->um_nindir)
93 #define	blkptrtodb(ump, b)		((b) << (ump)->um_bptrtodb)
94 #define	is_sequential(ump, a, b)	((b) == (a) + ump->um_seqinc)
95