xref: /freebsd/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/mnttab.h (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1 // SPDX-License-Identifier: CDDL-1.0
2 /*
3  * CDDL HEADER START
4  *
5  * The contents of this file are subject to the terms of the
6  * Common Development and Distribution License, Version 1.0 only
7  * (the "License").  You may not use this file except in compliance
8  * with the License.
9  *
10  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11  * or https://opensource.org/licenses/CDDL-1.0.
12  * See the License for the specific language governing permissions
13  * and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL HEADER in each
16  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17  * If applicable, add the following below this CDDL HEADER, with the
18  * fields enclosed by brackets "[]" replaced with your own identifying
19  * information: Portions Copyright [yyyy] [name of copyright owner]
20  *
21  * CDDL HEADER END
22  */
23 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
24 /*  All Rights Reserved  */
25 /*
26  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 /* Copyright 2006 Ricardo Correia */
30 
31 #ifndef _SYS_MNTTAB_H
32 #define	_SYS_MNTTAB_H
33 
34 #include <stdio.h>
35 #include <sys/types.h>
36 
37 #ifdef MNTTAB
38 #undef MNTTAB
39 #endif /* MNTTAB */
40 
41 #include <paths.h>
42 #include <sys/mount.h>
43 #define	MNTTAB		_PATH_DEVZERO
44 #define	MS_NOMNTTAB		0x0
45 #define	MS_RDONLY		0x1
46 #define	umount2(p, f)	unmount(p, f)
47 #define	MNT_LINE_MAX	4108
48 
49 #define	MNT_TOOLONG	1	/* entry exceeds MNT_LINE_MAX */
50 #define	MNT_TOOMANY	2	/* too many fields in line */
51 #define	MNT_TOOFEW	3	/* too few fields in line */
52 
53 struct mnttab {
54 	char *mnt_special;
55 	char *mnt_mountp;
56 	char *mnt_fstype;
57 	char *mnt_mntopts;
58 };
59 
60 /*
61  * NOTE: fields in extmnttab should match struct mnttab till new fields
62  * are encountered, this allows hasmntopt to work properly when its arg is
63  * a pointer to an extmnttab struct cast to a mnttab struct pointer.
64  */
65 
66 struct extmnttab {
67 	char *mnt_special;
68 	char *mnt_mountp;
69 	char *mnt_fstype;
70 	char *mnt_mntopts;
71 	uint_t mnt_major;
72 	uint_t mnt_minor;
73 };
74 
75 struct stat64;
76 struct statfs;
77 
78 extern int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref);
79 extern int _sol_getmntent(FILE *fp, struct mnttab *mp);
80 extern int getextmntent(const char *path, struct extmnttab *entry,
81     struct stat64 *statbuf);
82 extern void statfs2mnttab(struct statfs *sfs, struct mnttab *mp);
83 extern char *hasmntopt(struct mnttab *mnt, const char *opt);
84 extern int getmntent(FILE *fp, struct mnttab *mp);
85 
86 #endif
87