mntent.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Utilities for reading/writing fstab, mtab, etc.
  2. Copyright (C) 1995-2016 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. /* Read one mount table entry from STREAM. Returns a pointer to storage
  51. reused on the next call, or null for EOF or error (use feof/ferror to
  52. check). */
  53. extern struct mntent *getmntent (FILE *__stream) __THROW;
  54. #ifdef __USE_MISC
  55. /* Reentrant version of the above function. */
  56. extern struct mntent *getmntent_r (FILE *__restrict __stream,
  57. struct mntent *__restrict __result,
  58. char *__restrict __buffer,
  59. int __bufsize) __THROW;
  60. #endif
  61. /* Write the mount table entry described by MNT to STREAM.
  62. Return zero on success, nonzero on failure. */
  63. extern int addmntent (FILE *__restrict __stream,
  64. const struct mntent *__restrict __mnt) __THROW;
  65. /* Close a stream opened with `setmntent'. */
  66. extern int endmntent (FILE *__stream) __THROW;
  67. /* Search MNT->mnt_opts for an option matching OPT.
  68. Returns the address of the substring, or null if none found. */
  69. extern char *hasmntopt (const struct mntent *__mnt,
  70. const char *__opt) __THROW;
  71. __END_DECLS
  72. #endif /* mntent.h */