auto_dev-ioctl.h 5.0 KB

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