1 /* 2 * Copyright 1999-2000 Jeremy Fitzhardinge <[email protected]> 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 9 #ifndef _LINUX_AUTO_FS4_H 10 #define _LINUX_AUTO_FS4_H 11 12 /* Include common v3 definitions */ 13 #include <linux/types.h> 14 #include <linux/auto_fs.h> 15 16 /* autofs v4 definitions */ 17 #undef AUTOFS_PROTO_VERSION 18 #undef AUTOFS_MIN_PROTO_VERSION 19 #undef AUTOFS_MAX_PROTO_VERSION 20 21 #define AUTOFS_PROTO_VERSION 5 22 #define AUTOFS_MIN_PROTO_VERSION 3 23 #define AUTOFS_MAX_PROTO_VERSION 5 24 25 #define AUTOFS_PROTO_SUBVERSION 2 26 27 /* Mask for expire behaviour */ 28 #define AUTOFS_EXP_IMMEDIATE 1 29 #define AUTOFS_EXP_LEAVES 2 30 31 #define AUTOFS_TYPE_ANY 0U 32 #define AUTOFS_TYPE_INDIRECT 1U 33 #define AUTOFS_TYPE_DIRECT 2U 34 #define AUTOFS_TYPE_OFFSET 4U 35 36 static inline void set_autofs_type_indirect(unsigned int *type) 37 { 38 *type = AUTOFS_TYPE_INDIRECT; 39 } 40 41 static inline unsigned int autofs_type_indirect(unsigned int type) 42 { 43 return (type == AUTOFS_TYPE_INDIRECT); 44 } 45 46 static inline void set_autofs_type_direct(unsigned int *type) 47 { 48 *type = AUTOFS_TYPE_DIRECT; 49 } 50 51 static inline unsigned int autofs_type_direct(unsigned int type) 52 { 53 return (type == AUTOFS_TYPE_DIRECT); 54 } 55 56 static inline void set_autofs_type_offset(unsigned int *type) 57 { 58 *type = AUTOFS_TYPE_OFFSET; 59 } 60 61 static inline unsigned int autofs_type_offset(unsigned int type) 62 { 63 return (type == AUTOFS_TYPE_OFFSET); 64 } 65 66 static inline unsigned int autofs_type_trigger(unsigned int type) 67 { 68 return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET); 69 } 70 71 /* 72 * This isn't really a type as we use it to say "no type set" to 73 * indicate we want to search for "any" mount in the 74 * autofs_dev_ioctl_ismountpoint() device ioctl function. 75 */ 76 static inline void set_autofs_type_any(unsigned int *type) 77 { 78 *type = AUTOFS_TYPE_ANY; 79 } 80 81 static inline unsigned int autofs_type_any(unsigned int type) 82 { 83 return (type == AUTOFS_TYPE_ANY); 84 } 85 86 /* Daemon notification packet types */ 87 enum autofs_notify { 88 NFY_NONE, 89 NFY_MOUNT, 90 NFY_EXPIRE 91 }; 92 93 /* Kernel protocol version 4 packet types */ 94 95 /* Expire entry (umount request) */ 96 #define autofs_ptype_expire_multi 2 97 98 /* Kernel protocol version 5 packet types */ 99 100 /* Indirect mount missing and expire requests. */ 101 #define autofs_ptype_missing_indirect 3 102 #define autofs_ptype_expire_indirect 4 103 104 /* Direct mount missing and expire requests */ 105 #define autofs_ptype_missing_direct 5 106 #define autofs_ptype_expire_direct 6 107 108 /* v4 multi expire (via pipe) */ 109 struct autofs_packet_expire_multi { 110 struct autofs_packet_hdr hdr; 111 autofs_wqt_t wait_queue_token; 112 int len; 113 char name[NAME_MAX+1]; 114 }; 115 116 union autofs_packet_union { 117 struct autofs_packet_hdr hdr; 118 struct autofs_packet_missing missing; 119 struct autofs_packet_expire expire; 120 struct autofs_packet_expire_multi expire_multi; 121 }; 122 123 /* autofs v5 common packet struct */ 124 struct autofs_v5_packet { 125 struct autofs_packet_hdr hdr; 126 autofs_wqt_t wait_queue_token; 127 __u32 dev; 128 __u64 ino; 129 __u32 uid; 130 __u32 gid; 131 __u32 pid; 132 __u32 tgid; 133 __u32 len; 134 char name[NAME_MAX+1]; 135 }; 136 137 typedef struct autofs_v5_packet autofs_packet_missing_indirect_t; 138 typedef struct autofs_v5_packet autofs_packet_expire_indirect_t; 139 typedef struct autofs_v5_packet autofs_packet_missing_direct_t; 140 typedef struct autofs_v5_packet autofs_packet_expire_direct_t; 141 142 union autofs_v5_packet_union { 143 struct autofs_packet_hdr hdr; 144 struct autofs_v5_packet v5_packet; 145 autofs_packet_missing_indirect_t missing_indirect; 146 autofs_packet_expire_indirect_t expire_indirect; 147 autofs_packet_missing_direct_t missing_direct; 148 autofs_packet_expire_direct_t expire_direct; 149 }; 150 151 enum { 152 AUTOFS_IOC_EXPIRE_MULTI_CMD = 0x66, /* AUTOFS_IOC_EXPIRE_CMD + 1 */ 153 AUTOFS_IOC_PROTOSUBVER_CMD, 154 AUTOFS_IOC_ASKUMOUNT_CMD = 0x70, /* AUTOFS_DEV_IOCTL_VERSION_CMD - 1 */ 155 }; 156 157 #define AUTOFS_IOC_EXPIRE_MULTI _IOW(AUTOFS_IOCTL, AUTOFS_IOC_EXPIRE_MULTI_CMD, int) 158 #define AUTOFS_IOC_PROTOSUBVER _IOR(AUTOFS_IOCTL, AUTOFS_IOC_PROTOSUBVER_CMD, int) 159 #define AUTOFS_IOC_ASKUMOUNT _IOR(AUTOFS_IOCTL, AUTOFS_IOC_ASKUMOUNT_CMD, int) 160 161 #endif /* _LINUX_AUTO_FS4_H */ 162