Back to index

glibc  2.9
mntent.h
Go to the documentation of this file.
00001 /* Utilities for reading/writing fstab, mtab, etc.
00002    Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef       _MNTENT_H
00021 #define       _MNTENT_H     1
00022 
00023 #include <features.h>
00024 #define __need_FILE
00025 #include <stdio.h>
00026 #include <paths.h>
00027 
00028 
00029 /* File listing canonical interesting mount points.  */
00030 #define       MNTTAB        _PATH_MNTTAB  /* Deprecated alias.  */
00031 
00032 /* File listing currently active mount points.  */
00033 #define       MOUNTED              _PATH_MOUNTED /* Deprecated alias.  */
00034 
00035 
00036 /* General filesystem types.  */
00037 #define MNTTYPE_IGNORE      "ignore"      /* Ignore this entry.  */
00038 #define MNTTYPE_NFS  "nfs"         /* Network file system.  */
00039 #define MNTTYPE_SWAP "swap"        /* Swap device.  */
00040 
00041 
00042 /* Generic mount options.  */
00043 #define MNTOPT_DEFAULTS     "defaults"    /* Use all default options.  */
00044 #define MNTOPT_RO    "ro"          /* Read only.  */
00045 #define MNTOPT_RW    "rw"          /* Read/write.  */
00046 #define MNTOPT_SUID  "suid"        /* Set uid allowed.  */
00047 #define MNTOPT_NOSUID       "nosuid"      /* No set uid allowed.  */
00048 #define MNTOPT_NOAUTO       "noauto"      /* Do not auto mount.  */
00049 
00050 
00051 __BEGIN_DECLS
00052 
00053 /* Structure describing a mount table entry.  */
00054 struct mntent
00055   {
00056     char *mnt_fsname;              /* Device or server for filesystem.  */
00057     char *mnt_dir;          /* Directory mounted on.  */
00058     char *mnt_type;         /* Type of filesystem: ufs, nfs, etc.  */
00059     char *mnt_opts;         /* Comma-separated options for fs.  */
00060     int mnt_freq;           /* Dump frequency (in days).  */
00061     int mnt_passno;         /* Pass number for `fsck'.  */
00062   };
00063 
00064 
00065 /* Prepare to begin reading and/or writing mount table entries from the
00066    beginning of FILE.  MODE is as for `fopen'.  */
00067 extern FILE *setmntent (__const char *__file, __const char *__mode) __THROW;
00068 
00069 /* Read one mount table entry from STREAM.  Returns a pointer to storage
00070    reused on the next call, or null for EOF or error (use feof/ferror to
00071    check).  */
00072 extern struct mntent *getmntent (FILE *__stream) __THROW;
00073 
00074 #ifdef __USE_MISC
00075 /* Reentrant version of the above function.  */
00076 extern struct mntent *getmntent_r (FILE *__restrict __stream,
00077                                struct mntent *__restrict __result,
00078                                char *__restrict __buffer,
00079                                int __bufsize) __THROW;
00080 #endif
00081 
00082 /* Write the mount table entry described by MNT to STREAM.
00083    Return zero on success, nonzero on failure.  */
00084 extern int addmntent (FILE *__restrict __stream,
00085                     __const struct mntent *__restrict __mnt) __THROW;
00086 
00087 /* Close a stream opened with `setmntent'.  */
00088 extern int endmntent (FILE *__stream) __THROW;
00089 
00090 /* Search MNT->mnt_opts for an option matching OPT.
00091    Returns the address of the substring, or null if none found.  */
00092 extern char *hasmntopt (__const struct mntent *__mnt,
00093                      __const char *__opt) __THROW;
00094 
00095 
00096 __END_DECLS
00097 
00098 #endif /* mntent.h */