logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

auto_fs.h (6428B)


  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * Copyright 1997 Transmeta Corporation - All Rights Reserved
  4. * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
  5. * Copyright 2005-2006,2013,2017-2018 Ian Kent <raven@themaw.net>
  6. *
  7. * This file is part of the Linux kernel and is made available under
  8. * the terms of the GNU General Public License, version 2, or at your
  9. * option, any later version, incorporated herein by reference.
  10. *
  11. * ----------------------------------------------------------------------- */
  12. #ifndef _LINUX_AUTO_FS_H
  13. #define _LINUX_AUTO_FS_H
  14. #include <linux/types.h>
  15. #include <linux/limits.h>
  16. #include <sys/ioctl.h>
  17. #define AUTOFS_PROTO_VERSION 5
  18. #define AUTOFS_MIN_PROTO_VERSION 3
  19. #define AUTOFS_MAX_PROTO_VERSION 5
  20. #define AUTOFS_PROTO_SUBVERSION 6
  21. /*
  22. * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed
  23. * back to the kernel via ioctl from userspace. On architectures where 32- and
  24. * 64-bit userspace binaries can be executed it's important that the size of
  25. * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we
  26. * do not break the binary ABI interface by changing the structure size.
  27. */
  28. #if defined(__ia64__) || defined(__alpha__) /* pure 64bit architectures */
  29. typedef unsigned long autofs_wqt_t;
  30. #else
  31. typedef unsigned int autofs_wqt_t;
  32. #endif
  33. /* Packet types */
  34. #define autofs_ptype_missing 0 /* Missing entry (mount request) */
  35. #define autofs_ptype_expire 1 /* Expire entry (umount request) */
  36. struct autofs_packet_hdr {
  37. int proto_version; /* Protocol version */
  38. int type; /* Type of packet */
  39. };
  40. struct autofs_packet_missing {
  41. struct autofs_packet_hdr hdr;
  42. autofs_wqt_t wait_queue_token;
  43. int len;
  44. char name[NAME_MAX+1];
  45. };
  46. /* v3 expire (via ioctl) */
  47. struct autofs_packet_expire {
  48. struct autofs_packet_hdr hdr;
  49. int len;
  50. char name[NAME_MAX+1];
  51. };
  52. #define AUTOFS_IOCTL 0x93
  53. enum {
  54. AUTOFS_IOC_READY_CMD = 0x60,
  55. AUTOFS_IOC_FAIL_CMD,
  56. AUTOFS_IOC_CATATONIC_CMD,
  57. AUTOFS_IOC_PROTOVER_CMD,
  58. AUTOFS_IOC_SETTIMEOUT_CMD,
  59. AUTOFS_IOC_EXPIRE_CMD,
  60. };
  61. #define AUTOFS_IOC_READY _IO(AUTOFS_IOCTL, AUTOFS_IOC_READY_CMD)
  62. #define AUTOFS_IOC_FAIL _IO(AUTOFS_IOCTL, AUTOFS_IOC_FAIL_CMD)
  63. #define AUTOFS_IOC_CATATONIC _IO(AUTOFS_IOCTL, AUTOFS_IOC_CATATONIC_CMD)
  64. #define AUTOFS_IOC_PROTOVER _IOR(AUTOFS_IOCTL, \
  65. AUTOFS_IOC_PROTOVER_CMD, int)
  66. #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(AUTOFS_IOCTL, \
  67. AUTOFS_IOC_SETTIMEOUT_CMD, \
  68. compat_ulong_t)
  69. #define AUTOFS_IOC_SETTIMEOUT _IOWR(AUTOFS_IOCTL, \
  70. AUTOFS_IOC_SETTIMEOUT_CMD, \
  71. unsigned long)
  72. #define AUTOFS_IOC_EXPIRE _IOR(AUTOFS_IOCTL, \
  73. AUTOFS_IOC_EXPIRE_CMD, \
  74. struct autofs_packet_expire)
  75. /* autofs version 4 and later definitions */
  76. /* Mask for expire behaviour */
  77. #define AUTOFS_EXP_NORMAL 0x00
  78. #define AUTOFS_EXP_IMMEDIATE 0x01
  79. #define AUTOFS_EXP_LEAVES 0x02
  80. #define AUTOFS_EXP_FORCED 0x04
  81. #define AUTOFS_TYPE_ANY 0U
  82. #define AUTOFS_TYPE_INDIRECT 1U
  83. #define AUTOFS_TYPE_DIRECT 2U
  84. #define AUTOFS_TYPE_OFFSET 4U
  85. static __inline__ void set_autofs_type_indirect(unsigned int *type)
  86. {
  87. *type = AUTOFS_TYPE_INDIRECT;
  88. }
  89. static __inline__ unsigned int autofs_type_indirect(unsigned int type)
  90. {
  91. return (type == AUTOFS_TYPE_INDIRECT);
  92. }
  93. static __inline__ void set_autofs_type_direct(unsigned int *type)
  94. {
  95. *type = AUTOFS_TYPE_DIRECT;
  96. }
  97. static __inline__ unsigned int autofs_type_direct(unsigned int type)
  98. {
  99. return (type == AUTOFS_TYPE_DIRECT);
  100. }
  101. static __inline__ void set_autofs_type_offset(unsigned int *type)
  102. {
  103. *type = AUTOFS_TYPE_OFFSET;
  104. }
  105. static __inline__ unsigned int autofs_type_offset(unsigned int type)
  106. {
  107. return (type == AUTOFS_TYPE_OFFSET);
  108. }
  109. static __inline__ unsigned int autofs_type_trigger(unsigned int type)
  110. {
  111. return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET);
  112. }
  113. /*
  114. * This isn't really a type as we use it to say "no type set" to
  115. * indicate we want to search for "any" mount in the
  116. * autofs_dev_ioctl_ismountpoint() device ioctl function.
  117. */
  118. static __inline__ void set_autofs_type_any(unsigned int *type)
  119. {
  120. *type = AUTOFS_TYPE_ANY;
  121. }
  122. static __inline__ unsigned int autofs_type_any(unsigned int type)
  123. {
  124. return (type == AUTOFS_TYPE_ANY);
  125. }
  126. /* Daemon notification packet types */
  127. enum autofs_notify {
  128. NFY_NONE,
  129. NFY_MOUNT,
  130. NFY_EXPIRE
  131. };
  132. /* Kernel protocol version 4 packet types */
  133. /* Expire entry (umount request) */
  134. #define autofs_ptype_expire_multi 2
  135. /* Kernel protocol version 5 packet types */
  136. /* Indirect mount missing and expire requests. */
  137. #define autofs_ptype_missing_indirect 3
  138. #define autofs_ptype_expire_indirect 4
  139. /* Direct mount missing and expire requests */
  140. #define autofs_ptype_missing_direct 5
  141. #define autofs_ptype_expire_direct 6
  142. /* v4 multi expire (via pipe) */
  143. struct autofs_packet_expire_multi {
  144. struct autofs_packet_hdr hdr;
  145. autofs_wqt_t wait_queue_token;
  146. int len;
  147. char name[NAME_MAX+1];
  148. };
  149. union autofs_packet_union {
  150. struct autofs_packet_hdr hdr;
  151. struct autofs_packet_missing missing;
  152. struct autofs_packet_expire expire;
  153. struct autofs_packet_expire_multi expire_multi;
  154. };
  155. /* autofs v5 common packet struct */
  156. struct autofs_v5_packet {
  157. struct autofs_packet_hdr hdr;
  158. autofs_wqt_t wait_queue_token;
  159. __u32 dev;
  160. __u64 ino;
  161. __u32 uid;
  162. __u32 gid;
  163. __u32 pid;
  164. __u32 tgid;
  165. __u32 len;
  166. char name[NAME_MAX+1];
  167. };
  168. typedef struct autofs_v5_packet autofs_packet_missing_indirect_t;
  169. typedef struct autofs_v5_packet autofs_packet_expire_indirect_t;
  170. typedef struct autofs_v5_packet autofs_packet_missing_direct_t;
  171. typedef struct autofs_v5_packet autofs_packet_expire_direct_t;
  172. union autofs_v5_packet_union {
  173. struct autofs_packet_hdr hdr;
  174. struct autofs_v5_packet v5_packet;
  175. autofs_packet_missing_indirect_t missing_indirect;
  176. autofs_packet_expire_indirect_t expire_indirect;
  177. autofs_packet_missing_direct_t missing_direct;
  178. autofs_packet_expire_direct_t expire_direct;
  179. };
  180. enum {
  181. AUTOFS_IOC_EXPIRE_MULTI_CMD = 0x66, /* AUTOFS_IOC_EXPIRE_CMD + 1 */
  182. AUTOFS_IOC_PROTOSUBVER_CMD,
  183. AUTOFS_IOC_ASKUMOUNT_CMD = 0x70, /* AUTOFS_DEV_IOCTL_VERSION_CMD - 1 */
  184. };
  185. #define AUTOFS_IOC_EXPIRE_MULTI _IOW(AUTOFS_IOCTL, \
  186. AUTOFS_IOC_EXPIRE_MULTI_CMD, int)
  187. #define AUTOFS_IOC_PROTOSUBVER _IOR(AUTOFS_IOCTL, \
  188. AUTOFS_IOC_PROTOSUBVER_CMD, int)
  189. #define AUTOFS_IOC_ASKUMOUNT _IOR(AUTOFS_IOCTL, \
  190. AUTOFS_IOC_ASKUMOUNT_CMD, int)
  191. #endif /* _LINUX_AUTO_FS_H */