]> git.ipfire.org Git - thirdparty/glibc.git/blame - misc/mntent.h
update from main archive
[thirdparty/glibc.git] / misc / mntent.h
CommitLineData
7a770247 1/* <mntent.h> -- Utilities for reading/writing fstab, mtab, etc.
845dcb57 2Copyright (C) 1995, 1996 Free Software Foundation, Inc.
7a770247
RM
3This file is part of the GNU C Library.
4
5The GNU C Library is free software; you can redistribute it and/or
6modify it under the terms of the GNU Library General Public License as
7published by the Free Software Foundation; either version 2 of the
8License, or (at your option) any later version.
9
10The GNU C Library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13Library General Public License for more details.
14
15You should have received a copy of the GNU Library General Public
16License along with the GNU C Library; see the file COPYING.LIB. If
17not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18Cambridge, 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"
c4029823 30#define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
7a770247
RM
31
32/* File listing currently active mount points. */
33#define _PATH_MOUNTED "/var/run/mtab"
c4029823
UD
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. */
7a770247
RM
50
51
52__BEGIN_DECLS
53
54/* Structure describing a mount table entry. */
55struct 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'. */
c4029823
UD
68extern FILE *__setmntent __P ((__const char *__file, __const char *__mode));
69extern FILE *setmntent __P ((__const char *__file, __const char *__mode));
7a770247
RM
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). */
74extern struct mntent *getmntent __P ((FILE *__stream));
75
845dcb57
UD
76#ifdef __USE_REENTRANT
77/* Reentrant version of the above function. */
78extern struct mntent *__getmntent_r __P ((FILE *__stream,
79 struct mntent *__result,
80 char *__buffer, int __bufsize));
81extern struct mntent *getmntent_r __P ((FILE *__stream,
82 struct mntent *__result,
83 char *__buffer, int __bufsize));
84#endif
85
7a770247
RM
86/* Write the mount table entry described by MNT to STREAM.
87 Return zero on success, nonzero on failure. */
c4029823
UD
88extern int __addmntent __P ((FILE *__stream, __const struct mntent *__mnt));
89extern int addmntent __P ((FILE *__stream, __const struct mntent *__mnt));
7a770247
RM
90
91/* Close a stream opened with `setmntent'. */
845dcb57 92extern int __endmntent __P ((FILE *__stream));
7a770247
RM
93extern 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. */
845dcb57
UD
97extern char *__hasmntopt __P ((__const struct mntent *__mnt,
98 __const char *__opt));
7a770247
RM
99extern char *hasmntopt __P ((__const struct mntent *__mnt,
100 __const char *__opt));
101
102
103__END_DECLS
104
105#endif /* mntent.h */