mntent.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Utilities for reading/writing fstab, mtab, etc.
  2. Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #ifndef _MNTENT_H
  17. #define _MNTENT_H 1
  18. #include <features.h>
  19. #define __need_FILE
  20. #include <stdio.h>
  21. #include <paths.h>
  22. /* File listing canonical interesting mount points. */
  23. #define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
  24. /* File listing currently active mount points. */
  25. #define MOUNTED _PATH_MOUNTED /* Deprecated alias. */
  26. /* General filesystem types. */
  27. #define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */
  28. #define MNTTYPE_NFS "nfs" /* Network file system. */
  29. #define MNTTYPE_SWAP "swap" /* Swap device. */
  30. /* Generic mount options. */
  31. #define MNTOPT_DEFAULTS "defaults" /* Use all default options. */
  32. #define MNTOPT_RO "ro" /* Read only. */
  33. #define MNTOPT_RW "rw" /* Read/write. */
  34. #define MNTOPT_SUID "suid" /* Set uid allowed. */
  35. #define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */
  36. #define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */
  37. __BEGIN_DECLS
  38. /* Structure describing a mount table entry. */
  39. struct mntent
  40. {
  41. char *mnt_fsname; /* Device or server for filesystem. */
  42. char *mnt_dir; /* Directory mounted on. */
  43. char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */
  44. char *mnt_opts; /* Comma-separated options for fs. */
  45. int mnt_freq; /* Dump frequency (in days). */
  46. int mnt_passno; /* Pass number for `fsck'. */
  47. };
  48. /* Prepare to begin reading and/or writing mount table entries from the
  49. beginning of FILE. MODE is as for `fopen'. */
  50. extern FILE *setmntent (__const char *__file, __const char *__mode) __THROW;
  51. /* Read one mount table entry from STREAM. Returns a pointer to storage
  52. reused on the next call, or null for EOF or error (use feof/ferror to
  53. check). */
  54. extern struct mntent *getmntent (FILE *__stream) __THROW;
  55. #ifdef __USE_MISC
  56. /* Reentrant version of the above function. */
  57. extern struct mntent *getmntent_r (FILE *__restrict __stream,
  58. struct mntent *__restrict __result,
  59. char *__restrict __buffer,
  60. int __bufsize) __THROW;
  61. #endif
  62. /* Write the mount table entry described by MNT to STREAM.
  63. Return zero on success, nonzero on failure. */
  64. extern int addmntent (FILE *__restrict __stream,
  65. __const struct mntent *__restrict __mnt) __THROW;
  66. /* Close a stream opened with `setmntent'. */
  67. extern int endmntent (FILE *__stream) __THROW;
  68. /* Search MNT->mnt_opts for an option matching OPT.
  69. Returns the address of the substring, or null if none found. */
  70. extern char *hasmntopt (__const struct mntent *__mnt,
  71. __const char *__opt) __THROW;
  72. __END_DECLS
  73. #endif /* mntent.h */