]>
Commit | Line | Data |
---|---|---|
19361cb7 | 1 | /* Utilities for reading/writing fstab, mtab, etc. |
a784e502 | 2 | Copyright (C) 1995-1999, 2012 Free Software Foundation, Inc. |
54d79e99 UD |
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 | |
41bdb6e2 AJ |
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. | |
54d79e99 UD |
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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
54d79e99 | 14 | |
41bdb6e2 AJ |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, write to the Free | |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | 02111-1307 USA. */ | |
7a770247 RM |
19 | |
20 | #ifndef _MNTENT_H | |
21 | #define _MNTENT_H 1 | |
22 | ||
23 | #include <features.h> | |
24 | #define __need_FILE | |
25 | #include <stdio.h> | |
ba1ffaa1 | 26 | #include <paths.h> |
7a770247 RM |
27 | |
28 | ||
29 | /* File listing canonical interesting mount points. */ | |
c4029823 | 30 | #define MNTTAB _PATH_MNTTAB /* Deprecated alias. */ |
7a770247 RM |
31 | |
32 | /* File listing currently active mount points. */ | |
c4029823 UD |
33 | #define MOUNTED _PATH_MOUNTED /* Deprecated alias. */ |
34 | ||
35 | ||
36 | /* General filesystem types. */ | |
37 | #define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */ | |
38 | #define MNTTYPE_NFS "nfs" /* Network file system. */ | |
39 | #define MNTTYPE_SWAP "swap" /* Swap device. */ | |
40 | ||
41 | ||
42 | /* Generic mount options. */ | |
43 | #define MNTOPT_DEFAULTS "defaults" /* Use all default options. */ | |
44 | #define MNTOPT_RO "ro" /* Read only. */ | |
45 | #define MNTOPT_RW "rw" /* Read/write. */ | |
46 | #define MNTOPT_SUID "suid" /* Set uid allowed. */ | |
47 | #define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */ | |
48 | #define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */ | |
7a770247 RM |
49 | |
50 | ||
51 | __BEGIN_DECLS | |
52 | ||
53 | /* Structure describing a mount table entry. */ | |
54 | struct mntent | |
55 | { | |
bf7997b6 UD |
56 | char *mnt_fsname; /* Device or server for filesystem. */ |
57 | char *mnt_dir; /* Directory mounted on. */ | |
58 | char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */ | |
59 | char *mnt_opts; /* Comma-separated options for fs. */ | |
7a770247 RM |
60 | int mnt_freq; /* Dump frequency (in days). */ |
61 | int mnt_passno; /* Pass number for `fsck'. */ | |
62 | }; | |
63 | ||
64 | ||
65 | /* Prepare to begin reading and/or writing mount table entries from the | |
66 | beginning of FILE. MODE is as for `fopen'. */ | |
a784e502 | 67 | extern FILE *setmntent (const char *__file, const char *__mode) __THROW; |
7a770247 RM |
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). */ | |
ee8449f7 | 72 | extern struct mntent *getmntent (FILE *__stream) __THROW; |
7a770247 | 73 | |
19361cb7 | 74 | #ifdef __USE_MISC |
845dcb57 | 75 | /* Reentrant version of the above function. */ |
c1422e5b UD |
76 | extern struct mntent *getmntent_r (FILE *__restrict __stream, |
77 | struct mntent *__restrict __result, | |
78 | char *__restrict __buffer, | |
ee8449f7 | 79 | int __bufsize) __THROW; |
845dcb57 UD |
80 | #endif |
81 | ||
7a770247 RM |
82 | /* Write the mount table entry described by MNT to STREAM. |
83 | Return zero on success, nonzero on failure. */ | |
c1422e5b | 84 | extern int addmntent (FILE *__restrict __stream, |
a784e502 | 85 | const struct mntent *__restrict __mnt) __THROW; |
7a770247 RM |
86 | |
87 | /* Close a stream opened with `setmntent'. */ | |
ee8449f7 | 88 | extern int endmntent (FILE *__stream) __THROW; |
7a770247 RM |
89 | |
90 | /* Search MNT->mnt_opts for an option matching OPT. | |
91 | Returns the address of the substring, or null if none found. */ | |
a784e502 UD |
92 | extern char *hasmntopt (const struct mntent *__mnt, |
93 | const char *__opt) __THROW; | |
7a770247 RM |
94 | |
95 | ||
96 | __END_DECLS | |
97 | ||
98 | #endif /* mntent.h */ |