xref: /onnv-gate/usr/src/uts/common/sys/mnttab.h (revision 10910:951a65b3846b)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*10910SRobert.Harris@Sun.COM  * Common Development and Distribution License (the "License").
6*10910SRobert.Harris@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
220Sstevel@tonic-gate /*	  All Rights Reserved  	*/
230Sstevel@tonic-gate 
240Sstevel@tonic-gate 
250Sstevel@tonic-gate /*
26*10910SRobert.Harris@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
270Sstevel@tonic-gate  * Use is subject to license terms.
280Sstevel@tonic-gate  */
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifndef _SYS_MNTTAB_H
310Sstevel@tonic-gate #define	_SYS_MNTTAB_H
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <sys/types.h>
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #ifdef	__cplusplus
360Sstevel@tonic-gate extern "C" {
370Sstevel@tonic-gate #endif
380Sstevel@tonic-gate 
390Sstevel@tonic-gate #define	MNTTAB	"/etc/mnttab"
400Sstevel@tonic-gate #define	MNT_LINE_MAX	1024
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #define	MNT_TOOLONG	1	/* entry exceeds MNT_LINE_MAX */
430Sstevel@tonic-gate #define	MNT_TOOMANY	2	/* too many fields in line */
440Sstevel@tonic-gate #define	MNT_TOOFEW	3	/* too few fields in line */
450Sstevel@tonic-gate 
460Sstevel@tonic-gate #define	mntnull(mp)\
470Sstevel@tonic-gate 	((mp)->mnt_special = (mp)->mnt_mountp = \
480Sstevel@tonic-gate 	    (mp)->mnt_fstype = (mp)->mnt_mntopts = \
490Sstevel@tonic-gate 	    (mp)->mnt_time = NULL)
500Sstevel@tonic-gate 
510Sstevel@tonic-gate #define	putmntent(fd, mp)	(-1)
520Sstevel@tonic-gate 
53*10910SRobert.Harris@Sun.COM /*
54*10910SRobert.Harris@Sun.COM  * The fields in struct extmnttab should match those in struct mnttab until new
55*10910SRobert.Harris@Sun.COM  * fields are encountered. This allows hasmntopt(), getmntent_common() and
56*10910SRobert.Harris@Sun.COM  * mntioctl() to cast one type to the other safely.
57*10910SRobert.Harris@Sun.COM  *
58*10910SRobert.Harris@Sun.COM  * The fields in struct mnttab, struct extmnttab and struct mntentbuf must all
59*10910SRobert.Harris@Sun.COM  * match those in the corresponding 32-bit versions defined in mntvnops.c.
60*10910SRobert.Harris@Sun.COM  */
610Sstevel@tonic-gate struct mnttab {
620Sstevel@tonic-gate 	char	*mnt_special;
630Sstevel@tonic-gate 	char	*mnt_mountp;
640Sstevel@tonic-gate 	char	*mnt_fstype;
650Sstevel@tonic-gate 	char	*mnt_mntopts;
660Sstevel@tonic-gate 	char	*mnt_time;
670Sstevel@tonic-gate };
680Sstevel@tonic-gate 
690Sstevel@tonic-gate struct extmnttab {
700Sstevel@tonic-gate 	char	*mnt_special;
710Sstevel@tonic-gate 	char	*mnt_mountp;
720Sstevel@tonic-gate 	char	*mnt_fstype;
730Sstevel@tonic-gate 	char	*mnt_mntopts;
740Sstevel@tonic-gate 	char	*mnt_time;
750Sstevel@tonic-gate 	uint_t	mnt_major;
760Sstevel@tonic-gate 	uint_t	mnt_minor;
770Sstevel@tonic-gate };
780Sstevel@tonic-gate 
79*10910SRobert.Harris@Sun.COM struct mntentbuf {
80*10910SRobert.Harris@Sun.COM 	struct	extmnttab *mbuf_emp;
81*10910SRobert.Harris@Sun.COM 	size_t 	mbuf_bufsize;
82*10910SRobert.Harris@Sun.COM 	char	*mbuf_buf;
83*10910SRobert.Harris@Sun.COM };
84*10910SRobert.Harris@Sun.COM 
850Sstevel@tonic-gate #if !defined(_KERNEL)
860Sstevel@tonic-gate #ifdef __STDC__
870Sstevel@tonic-gate extern void	resetmnttab(FILE *);
880Sstevel@tonic-gate extern int	getmntent(FILE *, struct mnttab *);
890Sstevel@tonic-gate extern int	getextmntent(FILE *, struct extmnttab *, size_t);
900Sstevel@tonic-gate extern int	getmntany(FILE *, struct mnttab *, struct mnttab *);
910Sstevel@tonic-gate extern char	*hasmntopt(struct mnttab *, char *);
920Sstevel@tonic-gate extern char	*mntopt(char **);
930Sstevel@tonic-gate #else
940Sstevel@tonic-gate extern void	resetmnttab();
950Sstevel@tonic-gate extern int	getmntent();
960Sstevel@tonic-gate extern int	getextmntent();
970Sstevel@tonic-gate extern int	getmntany();
980Sstevel@tonic-gate extern char	*hasmntopt();
990Sstevel@tonic-gate extern char	*mntopt();
1000Sstevel@tonic-gate #endif
1010Sstevel@tonic-gate #endif
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate #ifdef	__cplusplus
1040Sstevel@tonic-gate }
1050Sstevel@tonic-gate #endif
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate #endif	/* _SYS_MNTTAB_H */
108