auto_dev-ioctl.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * Copyright 2008 Red Hat, Inc. All rights reserved.
  4. * Copyright 2008 Ian Kent <raven@themaw.net>
  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_DEV_IOCTL_H
  11. #define _LINUX_AUTO_DEV_IOCTL_H
  12. #include <linux/auto_fs.h>
  13. #include <linux/string.h>
  14. #define AUTOFS_DEVICE_NAME "autofs"
  15. #define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1
  16. #define AUTOFS_DEV_IOCTL_VERSION_MINOR 1
  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 it 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[];
  91. };
  92. static __inline__ void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
  93. {
  94. memset(in, 0, AUTOFS_DEV_IOCTL_SIZE);
  95. in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
  96. in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
  97. in->size = AUTOFS_DEV_IOCTL_SIZE;
  98. in->ioctlfd = -1;
  99. }
  100. enum {
  101. /* Get various version info */
  102. AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71,
  103. AUTOFS_DEV_IOCTL_PROTOVER_CMD,
  104. AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD,
  105. /* Open mount ioctl fd */
  106. AUTOFS_DEV_IOCTL_OPENMOUNT_CMD,
  107. /* Close mount ioctl fd */
  108. AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD,
  109. /* Mount/expire status returns */
  110. AUTOFS_DEV_IOCTL_READY_CMD,
  111. AUTOFS_DEV_IOCTL_FAIL_CMD,
  112. /* Activate/deactivate autofs mount */
  113. AUTOFS_DEV_IOCTL_SETPIPEFD_CMD,
  114. AUTOFS_DEV_IOCTL_CATATONIC_CMD,
  115. /* Expiry timeout */
  116. AUTOFS_DEV_IOCTL_TIMEOUT_CMD,
  117. /* Get mount last requesting uid and gid */
  118. AUTOFS_DEV_IOCTL_REQUESTER_CMD,
  119. /* Check for eligible expire candidates */
  120. AUTOFS_DEV_IOCTL_EXPIRE_CMD,
  121. /* Request busy status */
  122. AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD,
  123. /* Check if path is a mountpoint */
  124. AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD,
  125. };
  126. #define AUTOFS_DEV_IOCTL_VERSION \
  127. _IOWR(AUTOFS_IOCTL, \
  128. AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)
  129. #define AUTOFS_DEV_IOCTL_PROTOVER \
  130. _IOWR(AUTOFS_IOCTL, \
  131. AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl)
  132. #define AUTOFS_DEV_IOCTL_PROTOSUBVER \
  133. _IOWR(AUTOFS_IOCTL, \
  134. AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl)
  135. #define AUTOFS_DEV_IOCTL_OPENMOUNT \
  136. _IOWR(AUTOFS_IOCTL, \
  137. AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl)
  138. #define AUTOFS_DEV_IOCTL_CLOSEMOUNT \
  139. _IOWR(AUTOFS_IOCTL, \
  140. AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl)
  141. #define AUTOFS_DEV_IOCTL_READY \
  142. _IOWR(AUTOFS_IOCTL, \
  143. AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl)
  144. #define AUTOFS_DEV_IOCTL_FAIL \
  145. _IOWR(AUTOFS_IOCTL, \
  146. AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl)
  147. #define AUTOFS_DEV_IOCTL_SETPIPEFD \
  148. _IOWR(AUTOFS_IOCTL, \
  149. AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl)
  150. #define AUTOFS_DEV_IOCTL_CATATONIC \
  151. _IOWR(AUTOFS_IOCTL, \
  152. AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl)
  153. #define AUTOFS_DEV_IOCTL_TIMEOUT \
  154. _IOWR(AUTOFS_IOCTL, \
  155. AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl)
  156. #define AUTOFS_DEV_IOCTL_REQUESTER \
  157. _IOWR(AUTOFS_IOCTL, \
  158. AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl)
  159. #define AUTOFS_DEV_IOCTL_EXPIRE \
  160. _IOWR(AUTOFS_IOCTL, \
  161. AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl)
  162. #define AUTOFS_DEV_IOCTL_ASKUMOUNT \
  163. _IOWR(AUTOFS_IOCTL, \
  164. AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl)
  165. #define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \
  166. _IOWR(AUTOFS_IOCTL, \
  167. AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl)
  168. #endif /* _LINUX_AUTO_DEV_IOCTL_H */