xref: /titanic_52/usr/src/uts/common/sys/mnttab.h (revision e5803b76927480e8f9b67b22201c484ccf4c2bcf)
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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
22 /*	  All Rights Reserved  	*/
23 
24 
25 /*
26  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 
30 #ifndef _SYS_MNTTAB_H
31 #define	_SYS_MNTTAB_H
32 
33 #include <sys/types.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	MNTTAB	"/etc/mnttab"
40 #define	MNT_LINE_MAX	1024
41 
42 #define	MNT_TOOLONG	1	/* entry exceeds MNT_LINE_MAX */
43 #define	MNT_TOOMANY	2	/* too many fields in line */
44 #define	MNT_TOOFEW	3	/* too few fields in line */
45 
46 #define	mntnull(mp)\
47 	((mp)->mnt_special = (mp)->mnt_mountp = \
48 	    (mp)->mnt_fstype = (mp)->mnt_mntopts = \
49 	    (mp)->mnt_time = NULL)
50 
51 #define	putmntent(fd, mp)	(-1)
52 
53 /*
54  * The fields in struct extmnttab should match those in struct mnttab until new
55  * fields are encountered. This allows hasmntopt(), getmntent_common() and
56  * mntioctl() to cast one type to the other safely.
57  *
58  * The fields in struct mnttab, struct extmnttab and struct mntentbuf must all
59  * match those in the corresponding 32-bit versions defined in mntvnops.c.
60  */
61 struct mnttab {
62 	char	*mnt_special;
63 	char	*mnt_mountp;
64 	char	*mnt_fstype;
65 	char	*mnt_mntopts;
66 	char	*mnt_time;
67 };
68 
69 struct extmnttab {
70 	char	*mnt_special;
71 	char	*mnt_mountp;
72 	char	*mnt_fstype;
73 	char	*mnt_mntopts;
74 	char	*mnt_time;
75 	uint_t	mnt_major;
76 	uint_t	mnt_minor;
77 };
78 
79 struct mntentbuf {
80 	struct	extmnttab *mbuf_emp;
81 	size_t 	mbuf_bufsize;
82 	char	*mbuf_buf;
83 };
84 
85 #if !defined(_KERNEL)
86 #ifdef __STDC__
87 extern void	resetmnttab(FILE *);
88 extern int	getmntent(FILE *, struct mnttab *);
89 extern int	getextmntent(FILE *, struct extmnttab *, size_t);
90 extern int	getmntany(FILE *, struct mnttab *, struct mnttab *);
91 extern char	*hasmntopt(struct mnttab *, char *);
92 extern char	*mntopt(char **);
93 #else
94 extern void	resetmnttab();
95 extern int	getmntent();
96 extern int	getextmntent();
97 extern int	getmntany();
98 extern char	*hasmntopt();
99 extern char	*mntopt();
100 #endif
101 #endif
102 
103 #ifdef	__cplusplus
104 }
105 #endif
106 
107 #endif	/* _SYS_MNTTAB_H */
108