mntent.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _MNTENT_H
  16. #define _MNTENT_H 1
  17. #include <features.h>
  18. #define __need_FILE
  19. #include <stdio.h>
  20. #include <paths.h>
  21. /* File listing canonical interesting mount points. */
  22. #define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
  23. /* File listing currently active mount points. */
  24. #define MOUNTED _PATH_MOUNTED /* Deprecated alias. */
  25. /* General filesystem types. */
  26. #define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */
  27. #define MNTTYPE_NFS "nfs" /* Network file system. */
  28. #define MNTTYPE_SWAP "swap" /* Swap device. */
  29. /* Generic mount options. */
  30. #define MNTOPT_DEFAULTS "defaults" /* Use all default options. */
  31. #define MNTOPT_RO "ro" /* Read only. */
  32. #define MNTOPT_RW "rw" /* Read/write. */
  33. #define MNTOPT_SUID "suid" /* Set uid allowed. */
  34. #define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */
  35. #define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */
  36. __BEGIN_DECLS
  37. /* Structure describing a mount table entry. */
  38. struct mntent
  39. {
  40. char *mnt_fsname; /* Device or server for filesystem. */
  41. char *mnt_dir; /* Directory mounted on. */
  42. char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */
  43. char *mnt_opts; /* Comma-separated options for fs. */
  44. int mnt_freq; /* Dump frequency (in days). */
  45. int mnt_passno; /* Pass number for `fsck'. */
  46. };
  47. /* Prepare to begin reading and/or writing mount table entries from the
  48. beginning of FILE. MODE is as for `fopen'. */
  49. extern FILE *setmntent (const char *__file, const char *__mode) __THROW;
  50. libc_hidden_proto(setmntent)
  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. libc_hidden_proto(getmntent_r)
  62. #endif
  63. /* Write the mount table entry described by MNT to STREAM.
  64. Return zero on success, nonzero on failure. */
  65. extern int addmntent (FILE *__restrict __stream,
  66. const struct mntent *__restrict __mnt) __THROW;
  67. /* Close a stream opened with `setmntent'. */
  68. extern int endmntent (FILE *__stream) __THROW;
  69. libc_hidden_proto(endmntent)
  70. /* Search MNT->mnt_opts for an option matching OPT.
  71. Returns the address of the substring, or null if none found. */
  72. extern char *hasmntopt (const struct mntent *__mnt,
  73. const char *__opt) __THROW;
  74. __END_DECLS
  75. #endif /* mntent.h */