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 https://opensource.org/licenses/CDDL-1.0.
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 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
27 */
28 /* Copyright 2006 Ricardo Correia */
29
30 #ifndef _SYS_MNTTAB_H
31 #define _SYS_MNTTAB_H
32
33 #include <stdio.h>
34 #include <mntent.h>
35 #include <sys/stat.h>
36 #include <sys/types.h>
37
38 #ifdef MNTTAB
39 #undef MNTTAB
40 #endif /* MNTTAB */
41
42 #define MNTTAB "/proc/self/mounts"
43 #define MNT_LINE_MAX 4108
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 struct mnttab {
50 char *mnt_special;
51 char *mnt_mountp;
52 char *mnt_fstype;
53 char *mnt_mntopts;
54 };
55
56 /*
57 * NOTE: fields in extmnttab should match struct mnttab till new fields
58 * are encountered, this allows hasmntopt to work properly when its arg is
59 * a pointer to an extmnttab struct cast to a mnttab struct pointer.
60 */
61
62 struct extmnttab {
63 char *mnt_special;
64 char *mnt_mountp;
65 char *mnt_fstype;
66 char *mnt_mntopts;
67 uint_t mnt_major;
68 uint_t mnt_minor;
69 };
70
71 struct statfs;
72
73 extern int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref);
74 extern int _sol_getmntent(FILE *fp, struct mnttab *mp);
75 extern int getextmntent(const char *path, struct extmnttab *mp,
76 struct stat64 *statbuf);
77 static inline char *_sol_hasmntopt(struct mnttab *mnt, const char *opt)
78 {
79 struct mntent mnt_new;
80
81 mnt_new.mnt_opts = mnt->mnt_mntopts;
82
83 return (hasmntopt(&mnt_new, opt));
84 }
85
86 #define hasmntopt _sol_hasmntopt
87 #define getmntent _sol_getmntent
88
89 #endif
Cache object: 3f846d173e81e4a3e20a51fa50b2678b
|