xref: /titanic_52/usr/src/uts/common/sys/mnttab.h (revision ba3594ba9b5dd4c846c472a8d657edcb7c8109ac)
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
5835ee219SRobert Harris  * Common Development and Distribution License (the "License").
6835ee219SRobert 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*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
27*ba3594baSGarrett D'Amore  *
28835ee219SRobert Harris  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
297c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifndef _SYS_MNTTAB_H
337c478bd9Sstevel@tonic-gate #define	_SYS_MNTTAB_H
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
387c478bd9Sstevel@tonic-gate extern "C" {
397c478bd9Sstevel@tonic-gate #endif
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #define	MNTTAB	"/etc/mnttab"
427c478bd9Sstevel@tonic-gate #define	MNT_LINE_MAX	1024
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #define	MNT_TOOLONG	1	/* entry exceeds MNT_LINE_MAX */
457c478bd9Sstevel@tonic-gate #define	MNT_TOOMANY	2	/* too many fields in line */
467c478bd9Sstevel@tonic-gate #define	MNT_TOOFEW	3	/* too few fields in line */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate #define	mntnull(mp)\
497c478bd9Sstevel@tonic-gate 	((mp)->mnt_special = (mp)->mnt_mountp = \
507c478bd9Sstevel@tonic-gate 	    (mp)->mnt_fstype = (mp)->mnt_mntopts = \
517c478bd9Sstevel@tonic-gate 	    (mp)->mnt_time = NULL)
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #define	putmntent(fd, mp)	(-1)
547c478bd9Sstevel@tonic-gate 
55835ee219SRobert Harris /*
56835ee219SRobert Harris  * The fields in struct extmnttab should match those in struct mnttab until new
57835ee219SRobert Harris  * fields are encountered. This allows hasmntopt(), getmntent_common() and
58835ee219SRobert Harris  * mntioctl() to cast one type to the other safely.
59835ee219SRobert Harris  *
60835ee219SRobert Harris  * The fields in struct mnttab, struct extmnttab and struct mntentbuf must all
61835ee219SRobert Harris  * match those in the corresponding 32-bit versions defined in mntvnops.c.
62835ee219SRobert Harris  */
637c478bd9Sstevel@tonic-gate struct mnttab {
647c478bd9Sstevel@tonic-gate 	char	*mnt_special;
657c478bd9Sstevel@tonic-gate 	char	*mnt_mountp;
667c478bd9Sstevel@tonic-gate 	char	*mnt_fstype;
677c478bd9Sstevel@tonic-gate 	char	*mnt_mntopts;
687c478bd9Sstevel@tonic-gate 	char	*mnt_time;
697c478bd9Sstevel@tonic-gate };
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate struct extmnttab {
727c478bd9Sstevel@tonic-gate 	char	*mnt_special;
737c478bd9Sstevel@tonic-gate 	char	*mnt_mountp;
747c478bd9Sstevel@tonic-gate 	char	*mnt_fstype;
757c478bd9Sstevel@tonic-gate 	char	*mnt_mntopts;
767c478bd9Sstevel@tonic-gate 	char	*mnt_time;
777c478bd9Sstevel@tonic-gate 	uint_t	mnt_major;
787c478bd9Sstevel@tonic-gate 	uint_t	mnt_minor;
797c478bd9Sstevel@tonic-gate };
807c478bd9Sstevel@tonic-gate 
81835ee219SRobert Harris struct mntentbuf {
82835ee219SRobert Harris 	struct	extmnttab *mbuf_emp;
83835ee219SRobert Harris 	size_t 	mbuf_bufsize;
84835ee219SRobert Harris 	char	*mbuf_buf;
85835ee219SRobert Harris };
86835ee219SRobert Harris 
877c478bd9Sstevel@tonic-gate #if !defined(_KERNEL)
887c478bd9Sstevel@tonic-gate extern void	resetmnttab(FILE *);
897c478bd9Sstevel@tonic-gate extern int	getmntent(FILE *, struct mnttab *);
907c478bd9Sstevel@tonic-gate extern int	getextmntent(FILE *, struct extmnttab *, size_t);
917c478bd9Sstevel@tonic-gate extern int	getmntany(FILE *, struct mnttab *, struct mnttab *);
927c478bd9Sstevel@tonic-gate extern char	*hasmntopt(struct mnttab *, char *);
937c478bd9Sstevel@tonic-gate extern char	*mntopt(char **);
947c478bd9Sstevel@tonic-gate #endif
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
977c478bd9Sstevel@tonic-gate }
987c478bd9Sstevel@tonic-gate #endif
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate #endif	/* _SYS_MNTTAB_H */
101