ulfsmount.h revision 1.12.4.2 1 1.12.4.2 yamt /* $NetBSD: ulfsmount.h,v 1.12.4.2 2014/05/22 11:41:19 yamt Exp $ */
2 1.12.4.2 yamt /* from NetBSD: ufsmount.h,v 1.39 2012/10/19 17:09:08 drochner Exp */
3 1.12.4.2 yamt
4 1.12.4.2 yamt /*
5 1.12.4.2 yamt * Copyright (c) 1982, 1986, 1989, 1993
6 1.12.4.2 yamt * The Regents of the University of California. All rights reserved.
7 1.12.4.2 yamt *
8 1.12.4.2 yamt * Redistribution and use in source and binary forms, with or without
9 1.12.4.2 yamt * modification, are permitted provided that the following conditions
10 1.12.4.2 yamt * are met:
11 1.12.4.2 yamt * 1. Redistributions of source code must retain the above copyright
12 1.12.4.2 yamt * notice, this list of conditions and the following disclaimer.
13 1.12.4.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
14 1.12.4.2 yamt * notice, this list of conditions and the following disclaimer in the
15 1.12.4.2 yamt * documentation and/or other materials provided with the distribution.
16 1.12.4.2 yamt * 3. Neither the name of the University nor the names of its contributors
17 1.12.4.2 yamt * may be used to endorse or promote products derived from this software
18 1.12.4.2 yamt * without specific prior written permission.
19 1.12.4.2 yamt *
20 1.12.4.2 yamt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 1.12.4.2 yamt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 1.12.4.2 yamt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 1.12.4.2 yamt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 1.12.4.2 yamt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 1.12.4.2 yamt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 1.12.4.2 yamt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 1.12.4.2 yamt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 1.12.4.2 yamt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 1.12.4.2 yamt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 1.12.4.2 yamt * SUCH DAMAGE.
31 1.12.4.2 yamt *
32 1.12.4.2 yamt * @(#)ufsmount.h 8.6 (Berkeley) 3/30/95
33 1.12.4.2 yamt */
34 1.12.4.2 yamt
35 1.12.4.2 yamt #ifndef _UFS_LFS_ULFSMOUNT_H_
36 1.12.4.2 yamt #define _UFS_LFS_ULFSMOUNT_H_
37 1.12.4.2 yamt
38 1.12.4.2 yamt #include <sys/mount.h> /* struct export_args30 */
39 1.12.4.2 yamt
40 1.12.4.2 yamt #ifdef _KERNEL
41 1.12.4.2 yamt
42 1.12.4.2 yamt #if defined(_KERNEL_OPT)
43 1.12.4.2 yamt #include "opt_lfs.h"
44 1.12.4.2 yamt #endif
45 1.12.4.2 yamt
46 1.12.4.2 yamt #include <sys/mutex.h>
47 1.12.4.2 yamt
48 1.12.4.2 yamt #include <ufs/lfs/ulfs_extattr.h>
49 1.12.4.2 yamt #include <ufs/lfs/ulfs_quotacommon.h>
50 1.12.4.2 yamt
51 1.12.4.2 yamt struct buf;
52 1.12.4.2 yamt struct inode;
53 1.12.4.2 yamt struct nameidata;
54 1.12.4.2 yamt struct timeval;
55 1.12.4.2 yamt struct uio;
56 1.12.4.2 yamt struct vnode;
57 1.12.4.2 yamt
58 1.12.4.2 yamt /* This structure describes the ULFS specific mount structure data. */
59 1.12.4.2 yamt struct ulfsmount {
60 1.12.4.2 yamt /* Abstract vfs-level filesystem structure. */
61 1.12.4.2 yamt struct mount *um_mountp;
62 1.12.4.2 yamt
63 1.12.4.2 yamt /* The block device we're mounted on. */
64 1.12.4.2 yamt dev_t um_dev;
65 1.12.4.2 yamt struct vnode *um_devvp;
66 1.12.4.2 yamt
67 1.12.4.2 yamt /* type of fs; currently always ULFS1, theoretically also ULFS2 */
68 1.12.4.2 yamt u_long um_fstype;
69 1.12.4.2 yamt
70 1.12.4.2 yamt /* pointer to the filesystem-specific filesystem structure */
71 1.12.4.2 yamt struct lfs *um_lfs;
72 1.12.4.2 yamt
73 1.12.4.2 yamt /* Extended attribute information. */
74 1.12.4.2 yamt struct ulfs_extattr_per_mount um_extattr;
75 1.12.4.2 yamt
76 1.12.4.2 yamt /* Quota-related material. */
77 1.12.4.2 yamt struct vnode *um_quotas[ULFS_MAXQUOTAS]; /* quota files */
78 1.12.4.2 yamt kauth_cred_t um_cred[ULFS_MAXQUOTAS]; /* quota file access cred */
79 1.12.4.2 yamt union {
80 1.12.4.2 yamt struct um_q1 {
81 1.12.4.2 yamt time_t q1_btime[ULFS_MAXQUOTAS]; /* block quota time limit */
82 1.12.4.2 yamt time_t q1_itime[ULFS_MAXQUOTAS]; /* inode quota time limit */
83 1.12.4.2 yamt char q1_qflags[ULFS_MAXQUOTAS]; /* quota flags */
84 1.12.4.2 yamt } um_q1;
85 1.12.4.2 yamt struct um_q2 {
86 1.12.4.2 yamt uint64_t q2_bsize; /* block size of quota file */
87 1.12.4.2 yamt uint64_t q2_bmask; /* mask for above */
88 1.12.4.2 yamt } um_q2;
89 1.12.4.2 yamt } um_q;
90 1.12.4.2 yamt #define umq1_btime um_q.um_q1.q1_btime
91 1.12.4.2 yamt #define umq1_itime um_q.um_q1.q1_itime
92 1.12.4.2 yamt #define umq1_qflags um_q.um_q1.q1_qflags
93 1.12.4.2 yamt #define umq2_bsize um_q.um_q2.q2_bsize
94 1.12.4.2 yamt #define umq2_bmask um_q.um_q2.q2_bmask
95 1.12.4.2 yamt };
96 1.12.4.2 yamt
97 1.12.4.2 yamt /* ULFS-specific flags for um_flags */
98 1.12.4.2 yamt #define ULFS_NEEDSWAP 0x01 /* filesystem metadata need byte-swapping */
99 1.12.4.2 yamt /* unused 0x02 */
100 1.12.4.2 yamt #define ULFS_QUOTA 0x04 /* filesystem has QUOTA (v1) */
101 1.12.4.2 yamt #define ULFS_QUOTA2 0x08 /* filesystem has QUOTA2 */
102 1.12.4.2 yamt
103 1.12.4.2 yamt /*
104 1.12.4.2 yamt * Filesystem types
105 1.12.4.2 yamt */
106 1.12.4.2 yamt #define ULFS1 1
107 1.12.4.2 yamt #define ULFS2 2
108 1.12.4.2 yamt
109 1.12.4.2 yamt
110 1.12.4.2 yamt /*
111 1.12.4.2 yamt * Flags describing the state of quotas.
112 1.12.4.2 yamt */
113 1.12.4.2 yamt #define QTF_OPENING 0x01 /* Q_QUOTAON in progress */
114 1.12.4.2 yamt #define QTF_CLOSING 0x02 /* Q_QUOTAOFF in progress */
115 1.12.4.2 yamt
116 1.12.4.2 yamt /* Convert mount ptr to ulfsmount ptr. */
117 1.12.4.2 yamt #define VFSTOULFS(mp) ((struct ulfsmount *)((mp)->mnt_data))
118 1.12.4.2 yamt
119 1.12.4.2 yamt /*
120 1.12.4.2 yamt * Macros to access file system parameters (no longer) in the
121 1.12.4.2 yamt * ulfsmount structure.
122 1.12.4.2 yamt * Used by ulfs_bmap.
123 1.12.4.2 yamt */
124 1.12.4.2 yamt #define MNINDIR(lfs) ((lfs)->um_nindir)
125 1.12.4.2 yamt #define blkptrtodb(lfs, b) ((b) << (lfs)->um_bptrtodb)
126 1.12.4.2 yamt
127 1.12.4.2 yamt /*
128 1.12.4.2 yamt * Predicate for byte-swapping support.
129 1.12.4.2 yamt */
130 1.12.4.2 yamt #define FSFMT(vp) (((vp)->v_mount->mnt_iflag & IMNT_DTYPE) == 0)
131 1.12.4.2 yamt
132 1.12.4.2 yamt #endif /* _KERNEL */
133 1.12.4.2 yamt
134 1.12.4.2 yamt #endif /* !_UFS_LFS_ULFSMOUNT_H_ */
135