cpp-d1064d
[cross.git] / i686-linux-gnu-4.7 / usr / include / mntent.h
1 /* Utilities for reading/writing fstab, mtab, etc.
2    Copyright (C) 1995-2018 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 #include <paths.h>
24 #include <bits/types/FILE.h>
25
26 /* File listing canonical interesting mount points.  */
27 #define MNTTAB          _PATH_MNTTAB    /* Deprecated alias.  */
28
29 /* File listing currently active mount points.  */
30 #define MOUNTED         _PATH_MOUNTED   /* Deprecated alias.  */
31
32
33 /* General filesystem types.  */
34 #define MNTTYPE_IGNORE  "ignore"        /* Ignore this entry.  */
35 #define MNTTYPE_NFS     "nfs"           /* Network file system.  */
36 #define MNTTYPE_SWAP    "swap"          /* Swap device.  */
37
38
39 /* Generic mount options.  */
40 #define MNTOPT_DEFAULTS "defaults"      /* Use all default options.  */
41 #define MNTOPT_RO       "ro"            /* Read only.  */
42 #define MNTOPT_RW       "rw"            /* Read/write.  */
43 #define MNTOPT_SUID     "suid"          /* Set uid allowed.  */
44 #define MNTOPT_NOSUID   "nosuid"        /* No set uid allowed.  */
45 #define MNTOPT_NOAUTO   "noauto"        /* Do not auto mount.  */
46
47
48 __BEGIN_DECLS
49
50 /* Structure describing a mount table entry.  */
51 struct mntent
52   {
53     char *mnt_fsname;           /* Device or server for filesystem.  */
54     char *mnt_dir;              /* Directory mounted on.  */
55     char *mnt_type;             /* Type of filesystem: ufs, nfs, etc.  */
56     char *mnt_opts;             /* Comma-separated options for fs.  */
57     int mnt_freq;               /* Dump frequency (in days).  */
58     int mnt_passno;             /* Pass number for `fsck'.  */
59   };
60
61
62 /* Prepare to begin reading and/or writing mount table entries from the
63    beginning of FILE.  MODE is as for `fopen'.  */
64 extern FILE *setmntent (const char *__file, const char *__mode) __THROW;
65
66 /* Read one mount table entry from STREAM.  Returns a pointer to storage
67    reused on the next call, or null for EOF or error (use feof/ferror to
68    check).  */
69 extern struct mntent *getmntent (FILE *__stream) __THROW;
70
71 #ifdef __USE_MISC
72 /* Reentrant version of the above function.  */
73 extern struct mntent *getmntent_r (FILE *__restrict __stream,
74                                    struct mntent *__restrict __result,
75                                    char *__restrict __buffer,
76                                    int __bufsize) __THROW;
77 #endif
78
79 /* Write the mount table entry described by MNT to STREAM.
80    Return zero on success, nonzero on failure.  */
81 extern int addmntent (FILE *__restrict __stream,
82                       const struct mntent *__restrict __mnt) __THROW;
83
84 /* Close a stream opened with `setmntent'.  */
85 extern int endmntent (FILE *__stream) __THROW;
86
87 /* Search MNT->mnt_opts for an option matching OPT.
88    Returns the address of the substring, or null if none found.  */
89 extern char *hasmntopt (const struct mntent *__mnt,
90                         const char *__opt) __THROW;
91
92
93 __END_DECLS
94
95 #endif  /* mntent.h */