]> git.ipfire.org Git - thirdparty/glibc.git/blob - misc/mntent.h
update from main archive
[thirdparty/glibc.git] / misc / mntent.h
1 /* <mntent.h> -- Utilities for reading/writing fstab, mtab, etc.
2 Copyright (C) 1995, 1996 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 Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 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 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
19
20 #ifndef _MNTENT_H
21 #define _MNTENT_H 1
22
23 #include <features.h>
24 #define __need_FILE
25 #include <stdio.h>
26
27
28 /* File listing canonical interesting mount points. */
29 #define _PATH_MNTTAB "/etc/fstab"
30 #define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
31
32 /* File listing currently active mount points. */
33 #define _PATH_MOUNTED "/var/run/mtab"
34 #define MOUNTED _PATH_MOUNTED /* Deprecated alias. */
35
36
37 /* General filesystem types. */
38 #define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */
39 #define MNTTYPE_NFS "nfs" /* Network file system. */
40 #define MNTTYPE_SWAP "swap" /* Swap device. */
41
42
43 /* Generic mount options. */
44 #define MNTOPT_DEFAULTS "defaults" /* Use all default options. */
45 #define MNTOPT_RO "ro" /* Read only. */
46 #define MNTOPT_RW "rw" /* Read/write. */
47 #define MNTOPT_SUID "suid" /* Set uid allowed. */
48 #define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */
49 #define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */
50
51
52 __BEGIN_DECLS
53
54 /* Structure describing a mount table entry. */
55 struct mntent
56 {
57 char *mnt_fsname; /* Device or server for filesystem. */
58 char *mnt_dir; /* Directory mounted on. */
59 char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */
60 char *mnt_opts; /* Comma-separated options for fs. */
61 int mnt_freq; /* Dump frequency (in days). */
62 int mnt_passno; /* Pass number for `fsck'. */
63 };
64
65
66 /* Prepare to begin reading and/or writing mount table entries from the
67 beginning of FILE. MODE is as for `fopen'. */
68 extern FILE *__setmntent __P ((__const char *__file, __const char *__mode));
69 extern FILE *setmntent __P ((__const char *__file, __const char *__mode));
70
71 /* Read one mount table entry from STREAM. Returns a pointer to storage
72 reused on the next call, or null for EOF or error (use feof/ferror to
73 check). */
74 extern struct mntent *getmntent __P ((FILE *__stream));
75
76 #ifdef __USE_REENTRANT
77 /* Reentrant version of the above function. */
78 extern struct mntent *__getmntent_r __P ((FILE *__stream,
79 struct mntent *__result,
80 char *__buffer, int __bufsize));
81 extern struct mntent *getmntent_r __P ((FILE *__stream,
82 struct mntent *__result,
83 char *__buffer, int __bufsize));
84 #endif
85
86 /* Write the mount table entry described by MNT to STREAM.
87 Return zero on success, nonzero on failure. */
88 extern int __addmntent __P ((FILE *__stream, __const struct mntent *__mnt));
89 extern int addmntent __P ((FILE *__stream, __const struct mntent *__mnt));
90
91 /* Close a stream opened with `setmntent'. */
92 extern int __endmntent __P ((FILE *__stream));
93 extern int endmntent __P ((FILE *__stream));
94
95 /* Search MNT->mnt_opts for an option matching OPT.
96 Returns the address of the substring, or null if none found. */
97 extern char *__hasmntopt __P ((__const struct mntent *__mnt,
98 __const char *__opt));
99 extern char *hasmntopt __P ((__const struct mntent *__mnt,
100 __const char *__opt));
101
102
103 __END_DECLS
104
105 #endif /* mntent.h */