auto_dev-ioctl.h 5.1 KB

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