1 | /* Utilities for reading/writing fstab, mtab, etc. |
2 | Copyright (C) 1995-2014 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 | |
68 | /* Read one mount table entry from STREAM. Returns a pointer to storage |
69 | reused on the next call, or null for EOF or error (use feof/ferror to |
70 | check). */ |
71 | extern struct mntent *getmntent (FILE *__stream) __THROW; |
72 | |
73 | #ifdef __USE_MISC |
74 | /* Reentrant version of the above function. */ |
75 | extern struct mntent *getmntent_r (FILE *__restrict __stream, |
76 | struct mntent *__restrict __result, |
77 | char *__restrict __buffer, |
78 | int __bufsize) __THROW; |
79 | #endif |
80 | |
81 | /* Write the mount table entry described by MNT to STREAM. |
82 | Return zero on success, nonzero on failure. */ |
83 | extern int addmntent (FILE *__restrict __stream, |
84 | const struct mntent *__restrict __mnt) __THROW; |
85 | |
86 | /* Close a stream opened with `setmntent'. */ |
87 | extern int endmntent (FILE *__stream) __THROW; |
88 | |
89 | /* Search MNT->mnt_opts for an option matching OPT. |
90 | Returns the address of the substring, or null if none found. */ |
91 | extern char *hasmntopt (const struct mntent *__mnt, |
92 | const char *__opt) __THROW; |
93 | |
94 | |
95 | __END_DECLS |
96 | |
97 | #endif /* mntent.h */ |
98 | |