mntent.h 3.5 KB

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