auto_fs4.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /* -*- c -*-
  2. * linux/include/linux/auto_fs4.h
  3. *
  4. * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
  5. *
  6. * This file is part of the Linux kernel and is made available under
  7. * the terms of the GNU General Public License, version 2, or at your
  8. * option, any later version, incorporated herein by reference.
  9. */
  10. #ifndef _LINUX_AUTO_FS4_H
  11. #define _LINUX_AUTO_FS4_H
  12. /* Include common v3 definitions */
  13. #include <linux/types.h>
  14. #include <linux/auto_fs.h>
  15. /* autofs v4 definitions */
  16. #undef AUTOFS_PROTO_VERSION
  17. #undef AUTOFS_MIN_PROTO_VERSION
  18. #undef AUTOFS_MAX_PROTO_VERSION
  19. #define AUTOFS_PROTO_VERSION 5
  20. #define AUTOFS_MIN_PROTO_VERSION 3
  21. #define AUTOFS_MAX_PROTO_VERSION 5
  22. #define AUTOFS_PROTO_SUBVERSION 2
  23. /* Mask for expire behaviour */
  24. #define AUTOFS_EXP_IMMEDIATE 1
  25. #define AUTOFS_EXP_LEAVES 2
  26. #define AUTOFS_TYPE_ANY 0U
  27. #define AUTOFS_TYPE_INDIRECT 1U
  28. #define AUTOFS_TYPE_DIRECT 2U
  29. #define AUTOFS_TYPE_OFFSET 4U
  30. static inline void set_autofs_type_indirect(unsigned int *type)
  31. {
  32. *type = AUTOFS_TYPE_INDIRECT;
  33. return;
  34. }
  35. static inline unsigned int autofs_type_indirect(unsigned int type)
  36. {
  37. return (type == AUTOFS_TYPE_INDIRECT);
  38. }
  39. static inline void set_autofs_type_direct(unsigned int *type)
  40. {
  41. *type = AUTOFS_TYPE_DIRECT;
  42. return;
  43. }
  44. static inline unsigned int autofs_type_direct(unsigned int type)
  45. {
  46. return (type == AUTOFS_TYPE_DIRECT);
  47. }
  48. static inline void set_autofs_type_offset(unsigned int *type)
  49. {
  50. *type = AUTOFS_TYPE_OFFSET;
  51. return;
  52. }
  53. static inline unsigned int autofs_type_offset(unsigned int type)
  54. {
  55. return (type == AUTOFS_TYPE_OFFSET);
  56. }
  57. static inline unsigned int autofs_type_trigger(unsigned int type)
  58. {
  59. return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET);
  60. }
  61. /*
  62. * This isn't really a type as we use it to say "no type set" to
  63. * indicate we want to search for "any" mount in the
  64. * autofs_dev_ioctl_ismountpoint() device ioctl function.
  65. */
  66. static inline void set_autofs_type_any(unsigned int *type)
  67. {
  68. *type = AUTOFS_TYPE_ANY;
  69. return;
  70. }
  71. static inline unsigned int autofs_type_any(unsigned int type)
  72. {
  73. return (type == AUTOFS_TYPE_ANY);
  74. }
  75. /* Daemon notification packet types */
  76. enum autofs_notify {
  77. NFY_NONE,
  78. NFY_MOUNT,
  79. NFY_EXPIRE
  80. };
  81. /* Kernel protocol version 4 packet types */
  82. /* Expire entry (umount request) */
  83. #define autofs_ptype_expire_multi 2
  84. /* Kernel protocol version 5 packet types */
  85. /* Indirect mount missing and expire requests. */
  86. #define autofs_ptype_missing_indirect 3
  87. #define autofs_ptype_expire_indirect 4
  88. /* Direct mount missing and expire requests */
  89. #define autofs_ptype_missing_direct 5
  90. #define autofs_ptype_expire_direct 6
  91. /* v4 multi expire (via pipe) */
  92. struct autofs_packet_expire_multi {
  93. struct autofs_packet_hdr hdr;
  94. autofs_wqt_t wait_queue_token;
  95. int len;
  96. char name[NAME_MAX+1];
  97. };
  98. union autofs_packet_union {
  99. struct autofs_packet_hdr hdr;
  100. struct autofs_packet_missing missing;
  101. struct autofs_packet_expire expire;
  102. struct autofs_packet_expire_multi expire_multi;
  103. };
  104. /* autofs v5 common packet struct */
  105. struct autofs_v5_packet {
  106. struct autofs_packet_hdr hdr;
  107. autofs_wqt_t wait_queue_token;
  108. __u32 dev;
  109. __u64 ino;
  110. __u32 uid;
  111. __u32 gid;
  112. __u32 pid;
  113. __u32 tgid;
  114. __u32 len;
  115. char name[NAME_MAX+1];
  116. };
  117. typedef struct autofs_v5_packet autofs_packet_missing_indirect_t;
  118. typedef struct autofs_v5_packet autofs_packet_expire_indirect_t;
  119. typedef struct autofs_v5_packet autofs_packet_missing_direct_t;
  120. typedef struct autofs_v5_packet autofs_packet_expire_direct_t;
  121. union autofs_v5_packet_union {
  122. struct autofs_packet_hdr hdr;
  123. struct autofs_v5_packet v5_packet;
  124. autofs_packet_missing_indirect_t missing_indirect;
  125. autofs_packet_expire_indirect_t expire_indirect;
  126. autofs_packet_missing_direct_t missing_direct;
  127. autofs_packet_expire_direct_t expire_direct;
  128. };
  129. #define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int)
  130. #define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI
  131. #define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI
  132. #define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int)
  133. #define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int)
  134. #endif /* _LINUX_AUTO_FS4_H */