auto_fs4.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
  3. *
  4. * This file is part of the Linux kernel and is made available under
  5. * the terms of the GNU General Public License, version 2, or at your
  6. * option, any later version, incorporated herein by reference.
  7. */
  8. #ifndef _LINUX_AUTO_FS4_H
  9. #define _LINUX_AUTO_FS4_H
  10. /* Include common v3 definitions */
  11. #include <linux/types.h>
  12. #include <linux/auto_fs.h>
  13. /* autofs v4 definitions */
  14. #undef AUTOFS_PROTO_VERSION
  15. #undef AUTOFS_MIN_PROTO_VERSION
  16. #undef AUTOFS_MAX_PROTO_VERSION
  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 2
  21. /* Mask for expire behaviour */
  22. #define AUTOFS_EXP_IMMEDIATE 1
  23. #define AUTOFS_EXP_LEAVES 2
  24. #define AUTOFS_TYPE_ANY 0U
  25. #define AUTOFS_TYPE_INDIRECT 1U
  26. #define AUTOFS_TYPE_DIRECT 2U
  27. #define AUTOFS_TYPE_OFFSET 4U
  28. static inline void set_autofs_type_indirect(unsigned int *type)
  29. {
  30. *type = AUTOFS_TYPE_INDIRECT;
  31. }
  32. static inline unsigned int autofs_type_indirect(unsigned int type)
  33. {
  34. return (type == AUTOFS_TYPE_INDIRECT);
  35. }
  36. static inline void set_autofs_type_direct(unsigned int *type)
  37. {
  38. *type = AUTOFS_TYPE_DIRECT;
  39. }
  40. static inline unsigned int autofs_type_direct(unsigned int type)
  41. {
  42. return (type == AUTOFS_TYPE_DIRECT);
  43. }
  44. static inline void set_autofs_type_offset(unsigned int *type)
  45. {
  46. *type = AUTOFS_TYPE_OFFSET;
  47. }
  48. static inline unsigned int autofs_type_offset(unsigned int type)
  49. {
  50. return (type == AUTOFS_TYPE_OFFSET);
  51. }
  52. static inline unsigned int autofs_type_trigger(unsigned int type)
  53. {
  54. return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET);
  55. }
  56. /*
  57. * This isn't really a type as we use it to say "no type set" to
  58. * indicate we want to search for "any" mount in the
  59. * autofs_dev_ioctl_ismountpoint() device ioctl function.
  60. */
  61. static inline void set_autofs_type_any(unsigned int *type)
  62. {
  63. *type = AUTOFS_TYPE_ANY;
  64. }
  65. static inline unsigned int autofs_type_any(unsigned int type)
  66. {
  67. return (type == AUTOFS_TYPE_ANY);
  68. }
  69. /* Daemon notification packet types */
  70. enum autofs_notify {
  71. NFY_NONE,
  72. NFY_MOUNT,
  73. NFY_EXPIRE
  74. };
  75. /* Kernel protocol version 4 packet types */
  76. /* Expire entry (umount request) */
  77. #define autofs_ptype_expire_multi 2
  78. /* Kernel protocol version 5 packet types */
  79. /* Indirect mount missing and expire requests. */
  80. #define autofs_ptype_missing_indirect 3
  81. #define autofs_ptype_expire_indirect 4
  82. /* Direct mount missing and expire requests */
  83. #define autofs_ptype_missing_direct 5
  84. #define autofs_ptype_expire_direct 6
  85. /* v4 multi expire (via pipe) */
  86. struct autofs_packet_expire_multi {
  87. struct autofs_packet_hdr hdr;
  88. autofs_wqt_t wait_queue_token;
  89. int len;
  90. char name[NAME_MAX+1];
  91. };
  92. union autofs_packet_union {
  93. struct autofs_packet_hdr hdr;
  94. struct autofs_packet_missing missing;
  95. struct autofs_packet_expire expire;
  96. struct autofs_packet_expire_multi expire_multi;
  97. };
  98. /* autofs v5 common packet struct */
  99. struct autofs_v5_packet {
  100. struct autofs_packet_hdr hdr;
  101. autofs_wqt_t wait_queue_token;
  102. __u32 dev;
  103. __u64 ino;
  104. __u32 uid;
  105. __u32 gid;
  106. __u32 pid;
  107. __u32 tgid;
  108. __u32 len;
  109. char name[NAME_MAX+1];
  110. };
  111. typedef struct autofs_v5_packet autofs_packet_missing_indirect_t;
  112. typedef struct autofs_v5_packet autofs_packet_expire_indirect_t;
  113. typedef struct autofs_v5_packet autofs_packet_missing_direct_t;
  114. typedef struct autofs_v5_packet autofs_packet_expire_direct_t;
  115. union autofs_v5_packet_union {
  116. struct autofs_packet_hdr hdr;
  117. struct autofs_v5_packet v5_packet;
  118. autofs_packet_missing_indirect_t missing_indirect;
  119. autofs_packet_expire_indirect_t expire_indirect;
  120. autofs_packet_missing_direct_t missing_direct;
  121. autofs_packet_expire_direct_t expire_direct;
  122. };
  123. #define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93, 0x66, int)
  124. #define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI
  125. #define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI
  126. #define AUTOFS_IOC_PROTOSUBVER _IOR(0x93, 0x67, int)
  127. #define AUTOFS_IOC_ASKUMOUNT _IOR(0x93, 0x70, int)
  128. #endif /* _LINUX_AUTO_FS4_H */