update from main archive 960921
[glibc.git] / misc / mntent.h
blob8fa93f721ba81015c296f5163898f71bd5900dfb
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.
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.
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.
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. */
20 #ifndef _MNTENT_H
21 #define _MNTENT_H 1
23 #include <features.h>
24 #define __need_FILE
25 #include <stdio.h>
28 /* File listing canonical interesting mount points. */
29 #define _PATH_MNTTAB "/etc/fstab"
30 #define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
32 /* File listing currently active mount points. */
33 #define _PATH_MOUNTED "/var/run/mtab"
34 #define MOUNTED _PATH_MOUNTED /* Deprecated alias. */
37 __BEGIN_DECLS
39 /* Structure describing a mount table entry. */
40 struct mntent
42 char *mnt_fsname; /* Device or server for filesystem. */
43 char *mnt_dir; /* Directory mounted on. */
44 char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */
45 char *mnt_opts; /* Comma-separated options for fs. */
46 int mnt_freq; /* Dump frequency (in days). */
47 int mnt_passno; /* Pass number for `fsck'. */
51 /* Prepare to begin reading and/or writing mount table entries from the
52 beginning of FILE. MODE is as for `fopen'. */
53 extern FILE *__setmntent __P ((__const char *__file,
54 __const char *__mode));
55 extern FILE *setmntent __P ((__const char *__file,
56 __const char *__mode));
58 /* Read one mount table entry from STREAM. Returns a pointer to storage
59 reused on the next call, or null for EOF or error (use feof/ferror to
60 check). */
61 extern struct mntent *getmntent __P ((FILE *__stream));
63 #ifdef __USE_REENTRANT
64 /* Reentrant version of the above function. */
65 extern struct mntent *__getmntent_r __P ((FILE *__stream,
66 struct mntent *__result,
67 char *__buffer, int __bufsize));
68 extern struct mntent *getmntent_r __P ((FILE *__stream,
69 struct mntent *__result,
70 char *__buffer, int __bufsize));
71 #endif
73 /* Write the mount table entry described by MNT to STREAM.
74 Return zero on success, nonzero on failure. */
75 extern int __addmntent __P ((FILE *__stream,
76 __const struct mntent *__mnt));
77 extern int addmntent __P ((FILE *__stream,
78 __const struct mntent *__mnt));
80 /* Close a stream opened with `setmntent'. */
81 extern int __endmntent __P ((FILE *__stream));
82 extern int endmntent __P ((FILE *__stream));
84 /* Search MNT->mnt_opts for an option matching OPT.
85 Returns the address of the substring, or null if none found. */
86 extern char *__hasmntopt __P ((__const struct mntent *__mnt,
87 __const char *__opt));
88 extern char *hasmntopt __P ((__const struct mntent *__mnt,
89 __const char *__opt));
92 __END_DECLS
94 #endif /* mntent.h */