xref: /titanic_50/usr/src/uts/common/sys/fs/mntdata.h (revision 753a6d457b330b1b29b2d3eefcd0831116ce950d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_MNTFS_MNTDATA_H
27 #define	_SYS_MNTFS_MNTDATA_H
28 
29 #include <sys/vnode.h>
30 #include <sys/poll.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct mntsnap {
37 	char	*mnts_text;	/* base address of text in user addr space */
38 	size_t	mnts_textsize;	/* size of mapped text */
39 	char	*mnts_metadata;	/* base address of metadata in user space */
40 	size_t	mnts_metasize;	/* size of mapped metadata */
41 	uint_t	mnts_count;	/* number of mounts in snapshot */
42 	timespec_t mnts_time;	/* time when snapshot was taken */
43 } mntsnap_t;
44 
45 typedef struct mntnode {
46 	uint_t mnt_flags;	/* flags */
47 	vnode_t *mnt_mountvp;	/* vnode mounted on */
48 	vnode_t *mnt_vnode;	/* vnode for this mntnode */
49 	mntsnap_t mnt_read;	/* Data for read() */
50 	mntsnap_t mnt_ioctl;	/* Data for ioctl() */
51 	uint_t mnt_offset;	/* offset within ioctl() snapshot */
52 	krwlock_t mnt_contents;	/* protects mnt_read, mnt_ioctl, mnt_offset */
53 } mntnode_t;
54 
55 struct zone;
56 
57 typedef struct mntdata {
58 	struct zone *mnt_zone;		/* zone for mount point */
59 	uint_t mnt_nopen;		/* count of vnodes open */
60 	size_t mnt_size;		/* latest snapshot size for mount */
61 	struct mntnode mnt_node;	/* embedded mntnode */
62 } mntdata_t;
63 
64 /*
65  * Conversion macros.
66  */
67 #define	VTOM(vp)	((struct mntnode *)(vp)->v_data)
68 #define	MTOV(pnp)	((pnp)->mnt_vnode)
69 #define	MTOD(pnp)	((struct mntdata *)MTOV(pnp)->v_vfsp->vfs_data)
70 
71 #if defined(_KERNEL)
72 
73 /*
74  * Values for mnt_flags.
75  */
76 #define	MNT_SHOWHIDDEN	0x1	/* Hack to show all mounts, even MS_NOMNTTAB */
77 
78 extern	struct vnodeops	*mntvnodeops;
79 extern	void mntfs_getmntopts(struct vfs *, char **, size_t *);
80 
81 #endif	/* _KERNEL */
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* _SYS_MNTFS_MNTDATA_H */
88