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