xref: /titanic_50/usr/src/uts/common/sys/mnttab.h (revision 835ee2195df075073d2670eb95a6eab413d6c789)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*835ee219SRobert Harris  * Common Development and Distribution License (the "License").
6*835ee219SRobert Harris  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
227c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
26*835ee219SRobert Harris  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_MNTTAB_H
317c478bd9Sstevel@tonic-gate #define	_SYS_MNTTAB_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #define	MNTTAB	"/etc/mnttab"
407c478bd9Sstevel@tonic-gate #define	MNT_LINE_MAX	1024
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #define	MNT_TOOLONG	1	/* entry exceeds MNT_LINE_MAX */
437c478bd9Sstevel@tonic-gate #define	MNT_TOOMANY	2	/* too many fields in line */
447c478bd9Sstevel@tonic-gate #define	MNT_TOOFEW	3	/* too few fields in line */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #define	mntnull(mp)\
477c478bd9Sstevel@tonic-gate 	((mp)->mnt_special = (mp)->mnt_mountp = \
487c478bd9Sstevel@tonic-gate 	    (mp)->mnt_fstype = (mp)->mnt_mntopts = \
497c478bd9Sstevel@tonic-gate 	    (mp)->mnt_time = NULL)
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #define	putmntent(fd, mp)	(-1)
527c478bd9Sstevel@tonic-gate 
53*835ee219SRobert Harris /*
54*835ee219SRobert Harris  * The fields in struct extmnttab should match those in struct mnttab until new
55*835ee219SRobert Harris  * fields are encountered. This allows hasmntopt(), getmntent_common() and
56*835ee219SRobert Harris  * mntioctl() to cast one type to the other safely.
57*835ee219SRobert Harris  *
58*835ee219SRobert Harris  * The fields in struct mnttab, struct extmnttab and struct mntentbuf must all
59*835ee219SRobert Harris  * match those in the corresponding 32-bit versions defined in mntvnops.c.
60*835ee219SRobert Harris  */
617c478bd9Sstevel@tonic-gate struct mnttab {
627c478bd9Sstevel@tonic-gate 	char	*mnt_special;
637c478bd9Sstevel@tonic-gate 	char	*mnt_mountp;
647c478bd9Sstevel@tonic-gate 	char	*mnt_fstype;
657c478bd9Sstevel@tonic-gate 	char	*mnt_mntopts;
667c478bd9Sstevel@tonic-gate 	char	*mnt_time;
677c478bd9Sstevel@tonic-gate };
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate struct extmnttab {
707c478bd9Sstevel@tonic-gate 	char	*mnt_special;
717c478bd9Sstevel@tonic-gate 	char	*mnt_mountp;
727c478bd9Sstevel@tonic-gate 	char	*mnt_fstype;
737c478bd9Sstevel@tonic-gate 	char	*mnt_mntopts;
747c478bd9Sstevel@tonic-gate 	char	*mnt_time;
757c478bd9Sstevel@tonic-gate 	uint_t	mnt_major;
767c478bd9Sstevel@tonic-gate 	uint_t	mnt_minor;
777c478bd9Sstevel@tonic-gate };
787c478bd9Sstevel@tonic-gate 
79*835ee219SRobert Harris struct mntentbuf {
80*835ee219SRobert Harris 	struct	extmnttab *mbuf_emp;
81*835ee219SRobert Harris 	size_t 	mbuf_bufsize;
82*835ee219SRobert Harris 	char	*mbuf_buf;
83*835ee219SRobert Harris };
84*835ee219SRobert Harris 
857c478bd9Sstevel@tonic-gate #if !defined(_KERNEL)
867c478bd9Sstevel@tonic-gate #ifdef __STDC__
877c478bd9Sstevel@tonic-gate extern void	resetmnttab(FILE *);
887c478bd9Sstevel@tonic-gate extern int	getmntent(FILE *, struct mnttab *);
897c478bd9Sstevel@tonic-gate extern int	getextmntent(FILE *, struct extmnttab *, size_t);
907c478bd9Sstevel@tonic-gate extern int	getmntany(FILE *, struct mnttab *, struct mnttab *);
917c478bd9Sstevel@tonic-gate extern char	*hasmntopt(struct mnttab *, char *);
927c478bd9Sstevel@tonic-gate extern char	*mntopt(char **);
937c478bd9Sstevel@tonic-gate #else
947c478bd9Sstevel@tonic-gate extern void	resetmnttab();
957c478bd9Sstevel@tonic-gate extern int	getmntent();
967c478bd9Sstevel@tonic-gate extern int	getextmntent();
977c478bd9Sstevel@tonic-gate extern int	getmntany();
987c478bd9Sstevel@tonic-gate extern char	*hasmntopt();
997c478bd9Sstevel@tonic-gate extern char	*mntopt();
1007c478bd9Sstevel@tonic-gate #endif
1017c478bd9Sstevel@tonic-gate #endif
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #endif	/* _SYS_MNTTAB_H */
108