xref: /illumos-gate/usr/src/uts/common/sys/mnttab.h (revision d4b0f847)
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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #ifndef _SYS_MNTTAB_H
32 #define	_SYS_MNTTAB_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <sys/types.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 #define	MNTTAB	"/etc/mnttab"
43 #define	MNT_LINE_MAX	1024
44 
45 #define	MNT_TOOLONG	1	/* entry exceeds MNT_LINE_MAX */
46 #define	MNT_TOOMANY	2	/* too many fields in line */
47 #define	MNT_TOOFEW	3	/* too few fields in line */
48 
49 #define	mntnull(mp)\
50 	((mp)->mnt_special = (mp)->mnt_mountp = \
51 	    (mp)->mnt_fstype = (mp)->mnt_mntopts = \
52 	    (mp)->mnt_time = NULL)
53 
54 #define	putmntent(fd, mp)	(-1)
55 
56 struct mnttab {
57 	char	*mnt_special;
58 	char	*mnt_mountp;
59 	char	*mnt_fstype;
60 	char	*mnt_mntopts;
61 	char	*mnt_time;
62 };
63 
64 /*
65  * NOTE: fields in extmnttab should match struct mnttab till new fields
66  * are encountered, this allows hasmntopt to work properly when its arg is
67  * a pointer to an extmnttab struct cast to a mnttab struct pointer.
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 #if !defined(_KERNEL)
80 #ifdef __STDC__
81 extern void	resetmnttab(FILE *);
82 extern int	getmntent(FILE *, struct mnttab *);
83 extern int	getextmntent(FILE *, struct extmnttab *, size_t);
84 extern int	getmntany(FILE *, struct mnttab *, struct mnttab *);
85 extern char	*hasmntopt(struct mnttab *, char *);
86 extern char	*mntopt(char **);
87 #else
88 extern void	resetmnttab();
89 extern int	getmntent();
90 extern int	getextmntent();
91 extern int	getmntany();
92 extern char	*hasmntopt();
93 extern char	*mntopt();
94 #endif
95 #endif
96 
97 #ifdef	__cplusplus
98 }
99 #endif
100 
101 #endif	/* _SYS_MNTTAB_H */
102