1 /* Utilities for reading/writing fstab, mtab, etc.
2    Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <http://www.gnu.org/licenses/>.  */
18 
19 #ifndef	_MNTENT_H
20 #define	_MNTENT_H	1
21 
22 #include <features.h>
23 #define __need_FILE
24 #include <stdio.h>
25 #include <paths.h>
26 
27 
28 /* File listing canonical interesting mount points.  */
29 #define	MNTTAB		_PATH_MNTTAB	/* Deprecated alias.  */
30 
31 /* File listing currently active mount points.  */
32 #define	MOUNTED		_PATH_MOUNTED	/* Deprecated alias.  */
33 
34 
35 /* General filesystem types.  */
36 #define MNTTYPE_IGNORE	"ignore"	/* Ignore this entry.  */
37 #define MNTTYPE_NFS	"nfs"		/* Network file system.  */
38 #define MNTTYPE_SWAP	"swap"		/* Swap device.  */
39 
40 
41 /* Generic mount options.  */
42 #define MNTOPT_DEFAULTS	"defaults"	/* Use all default options.  */
43 #define MNTOPT_RO	"ro"		/* Read only.  */
44 #define MNTOPT_RW	"rw"		/* Read/write.  */
45 #define MNTOPT_SUID	"suid"		/* Set uid allowed.  */
46 #define MNTOPT_NOSUID	"nosuid"	/* No set uid allowed.  */
47 #define MNTOPT_NOAUTO	"noauto"	/* Do not auto mount.  */
48 
49 
50 __BEGIN_DECLS
51 
52 /* Structure describing a mount table entry.  */
53 struct mntent
54   {
55     char *mnt_fsname;		/* Device or server for filesystem.  */
56     char *mnt_dir;		/* Directory mounted on.  */
57     char *mnt_type;		/* Type of filesystem: ufs, nfs, etc.  */
58     char *mnt_opts;		/* Comma-separated options for fs.  */
59     int mnt_freq;		/* Dump frequency (in days).  */
60     int mnt_passno;		/* Pass number for `fsck'.  */
61   };
62 
63 
64 /* Prepare to begin reading and/or writing mount table entries from the
65    beginning of FILE.  MODE is as for `fopen'.  */
66 extern FILE *setmntent (const char *__file, const char *__mode) __THROW;
67 libc_hidden_proto(setmntent)
68 
69 /* Read one mount table entry from STREAM.  Returns a pointer to storage
70    reused on the next call, or null for EOF or error (use feof/ferror to
71    check).  */
72 extern struct mntent *getmntent (FILE *__stream) __THROW;
73 
74 #ifdef __USE_MISC
75 /* Reentrant version of the above function.  */
76 extern struct mntent *getmntent_r (FILE *__restrict __stream,
77 				   struct mntent *__restrict __result,
78 				   char *__restrict __buffer,
79 				   int __bufsize) __THROW;
80 libc_hidden_proto(getmntent_r)
81 #endif
82 
83 /* Write the mount table entry described by MNT to STREAM.
84    Return zero on success, nonzero on failure.  */
85 extern int addmntent (FILE *__restrict __stream,
86 		      const struct mntent *__restrict __mnt) __THROW;
87 
88 /* Close a stream opened with `setmntent'.  */
89 extern int endmntent (FILE *__stream) __THROW;
90 libc_hidden_proto(endmntent)
91 
92 /* Search MNT->mnt_opts for an option matching OPT.
93    Returns the address of the substring, or null if none found.  */
94 extern char *hasmntopt (const struct mntent *__mnt,
95 			const char *__opt) __THROW;
96 
97 
98 __END_DECLS
99 
100 #endif	/* mntent.h */
101