auto_dev-ioctl.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*
  2. * Copyright 2008 Red Hat, Inc. All rights reserved.
  3. * Copyright 2008 Ian Kent <raven@themaw.net>
  4. *
  5. * This file is part of the Linux kernel and is made available under
  6. * the terms of the GNU General Public License, version 2, or at your
  7. * option, any later version, incorporated herein by reference.
  8. */
  9. #ifndef _LINUX_AUTO_DEV_IOCTL_H
  10. #define _LINUX_AUTO_DEV_IOCTL_H
  11. #include <linux/string.h>
  12. #include <linux/types.h>
  13. #define AUTOFS_DEVICE_NAME "autofs"
  14. #define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1
  15. #define AUTOFS_DEV_IOCTL_VERSION_MINOR 0
  16. #define AUTOFS_DEVID_LEN 16
  17. #define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl)
  18. /*
  19. * An ioctl interface for autofs mount point control.
  20. */
  21. struct args_protover {
  22. __u32 version;
  23. };
  24. struct args_protosubver {
  25. __u32 sub_version;
  26. };
  27. struct args_openmount {
  28. __u32 devid;
  29. };
  30. struct args_ready {
  31. __u32 token;
  32. };
  33. struct args_fail {
  34. __u32 token;
  35. __s32 status;
  36. };
  37. struct args_setpipefd {
  38. __s32 pipefd;
  39. };
  40. struct args_timeout {
  41. __u64 timeout;
  42. };
  43. struct args_requester {
  44. __u32 uid;
  45. __u32 gid;
  46. };
  47. struct args_expire {
  48. __u32 how;
  49. };
  50. struct args_askumount {
  51. __u32 may_umount;
  52. };
  53. struct args_ismountpoint {
  54. union {
  55. struct args_in {
  56. __u32 type;
  57. } in;
  58. struct args_out {
  59. __u32 devid;
  60. __u32 magic;
  61. } out;
  62. };
  63. };
  64. /*
  65. * All the ioctls use this structure.
  66. * When sending a path size must account for the total length
  67. * of the chunk of memory otherwise is is the size of the
  68. * structure.
  69. */
  70. struct autofs_dev_ioctl {
  71. __u32 ver_major;
  72. __u32 ver_minor;
  73. __u32 size; /* total size of data passed in
  74. * including this struct */
  75. __s32 ioctlfd; /* automount command fd */
  76. /* Command parameters */
  77. union {
  78. struct args_protover protover;
  79. struct args_protosubver protosubver;
  80. struct args_openmount openmount;
  81. struct args_ready ready;
  82. struct args_fail fail;
  83. struct args_setpipefd setpipefd;
  84. struct args_timeout timeout;
  85. struct args_requester requester;
  86. struct args_expire expire;
  87. struct args_askumount askumount;
  88. struct args_ismountpoint ismountpoint;
  89. };
  90. char path[0];
  91. };
  92. static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
  93. {
  94. memset(in, 0, sizeof(struct autofs_dev_ioctl));
  95. in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
  96. in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
  97. in->size = sizeof(struct autofs_dev_ioctl);
  98. in->ioctlfd = -1;
  99. return;
  100. }
  101. /*
  102. * If you change this make sure you make the corresponding change
  103. * to autofs-dev-ioctl.c:lookup_ioctl()
  104. */
  105. enum {
  106. /* Get various version info */
  107. AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71,
  108. AUTOFS_DEV_IOCTL_PROTOVER_CMD,
  109. AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD,
  110. /* Open mount ioctl fd */
  111. AUTOFS_DEV_IOCTL_OPENMOUNT_CMD,
  112. /* Close mount ioctl fd */
  113. AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD,
  114. /* Mount/expire status returns */
  115. AUTOFS_DEV_IOCTL_READY_CMD,
  116. AUTOFS_DEV_IOCTL_FAIL_CMD,
  117. /* Activate/deactivate autofs mount */
  118. AUTOFS_DEV_IOCTL_SETPIPEFD_CMD,
  119. AUTOFS_DEV_IOCTL_CATATONIC_CMD,
  120. /* Expiry timeout */
  121. AUTOFS_DEV_IOCTL_TIMEOUT_CMD,
  122. /* Get mount last requesting uid and gid */
  123. AUTOFS_DEV_IOCTL_REQUESTER_CMD,
  124. /* Check for eligible expire candidates */
  125. AUTOFS_DEV_IOCTL_EXPIRE_CMD,
  126. /* Request busy status */
  127. AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD,
  128. /* Check if path is a mountpoint */
  129. AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD,
  130. };
  131. #define AUTOFS_IOCTL 0x93
  132. #define AUTOFS_DEV_IOCTL_VERSION \
  133. _IOWR(AUTOFS_IOCTL, \
  134. AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)
  135. #define AUTOFS_DEV_IOCTL_PROTOVER \
  136. _IOWR(AUTOFS_IOCTL, \
  137. AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl)
  138. #define AUTOFS_DEV_IOCTL_PROTOSUBVER \
  139. _IOWR(AUTOFS_IOCTL, \
  140. AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl)
  141. #define AUTOFS_DEV_IOCTL_OPENMOUNT \
  142. _IOWR(AUTOFS_IOCTL, \
  143. AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl)
  144. #define AUTOFS_DEV_IOCTL_CLOSEMOUNT \
  145. _IOWR(AUTOFS_IOCTL, \
  146. AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl)
  147. #define AUTOFS_DEV_IOCTL_READY \
  148. _IOWR(AUTOFS_IOCTL, \
  149. AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl)
  150. #define AUTOFS_DEV_IOCTL_FAIL \
  151. _IOWR(AUTOFS_IOCTL, \
  152. AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl)
  153. #define AUTOFS_DEV_IOCTL_SETPIPEFD \
  154. _IOWR(AUTOFS_IOCTL, \
  155. AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl)
  156. #define AUTOFS_DEV_IOCTL_CATATONIC \
  157. _IOWR(AUTOFS_IOCTL, \
  158. AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl)
  159. #define AUTOFS_DEV_IOCTL_TIMEOUT \
  160. _IOWR(AUTOFS_IOCTL, \
  161. AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl)
  162. #define AUTOFS_DEV_IOCTL_REQUESTER \
  163. _IOWR(AUTOFS_IOCTL, \
  164. AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl)
  165. #define AUTOFS_DEV_IOCTL_EXPIRE \
  166. _IOWR(AUTOFS_IOCTL, \
  167. AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl)
  168. #define AUTOFS_DEV_IOCTL_ASKUMOUNT \
  169. _IOWR(AUTOFS_IOCTL, \
  170. AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl)
  171. #define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \
  172. _IOWR(AUTOFS_IOCTL, \
  173. AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl)
  174. #endif /* _LINUX_AUTO_DEV_IOCTL_H */