Ian Kent | e9a7c2f | 2016-03-15 14:58:25 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 9 | #ifndef _LINUX_AUTO_FS4_H |
| 10 | #define _LINUX_AUTO_FS4_H |
| 11 | |
| 12 | /* Include common v3 definitions */ |
Jaswinder Singh Rajput | 5d461bf | 2009-01-30 20:31:19 +0530 | [diff] [blame] | 13 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Ian Kent | 5c0a32f | 2006-03-27 01:14:55 -0800 | [diff] [blame] | 21 | #define AUTOFS_PROTO_VERSION 5 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #define AUTOFS_MIN_PROTO_VERSION 3 |
Ian Kent | 5c0a32f | 2006-03-27 01:14:55 -0800 | [diff] [blame] | 23 | #define AUTOFS_MAX_PROTO_VERSION 5 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
Ian Kent | 1972580 | 2011-01-14 18:46:40 +0000 | [diff] [blame] | 25 | #define AUTOFS_PROTO_SUBVERSION 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | |
| 27 | /* Mask for expire behaviour */ |
| 28 | #define AUTOFS_EXP_IMMEDIATE 1 |
| 29 | #define AUTOFS_EXP_LEAVES 2 |
| 30 | |
Ian Kent | a92daf6 | 2009-01-06 14:42:08 -0800 | [diff] [blame] | 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; |
Ian Kent | a92daf6 | 2009-01-06 14:42:08 -0800 | [diff] [blame] | 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; |
Ian Kent | a92daf6 | 2009-01-06 14:42:08 -0800 | [diff] [blame] | 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; |
Ian Kent | a92daf6 | 2009-01-06 14:42:08 -0800 | [diff] [blame] | 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; |
Ian Kent | a92daf6 | 2009-01-06 14:42:08 -0800 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | static inline unsigned int autofs_type_any(unsigned int type) |
| 82 | { |
| 83 | return (type == AUTOFS_TYPE_ANY); |
| 84 | } |
Ian Kent | bb979d7 | 2008-10-15 22:02:52 -0700 | [diff] [blame] | 85 | |
Ian Kent | 5c0a32f | 2006-03-27 01:14:55 -0800 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | |
| 108 | /* v4 multi expire (via pipe) */ |
| 109 | struct autofs_packet_expire_multi { |
| 110 | struct autofs_packet_hdr hdr; |
Ian Kent | 0266725 | 2016-03-15 14:58:36 -0700 | [diff] [blame] | 111 | autofs_wqt_t wait_queue_token; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | int len; |
| 113 | char name[NAME_MAX+1]; |
| 114 | }; |
| 115 | |
Ian Kent | e851447 | 2007-02-20 13:58:09 -0800 | [diff] [blame] | 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 | |
Ian Kent | 5c0a32f | 2006-03-27 01:14:55 -0800 | [diff] [blame] | 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 | |
Ian Kent | e851447 | 2007-02-20 13:58:09 -0800 | [diff] [blame] | 142 | union autofs_v5_packet_union { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | struct autofs_packet_hdr hdr; |
Ian Kent | 5c0a32f | 2006-03-27 01:14:55 -0800 | [diff] [blame] | 144 | struct autofs_v5_packet v5_packet; |
Ian Kent | e851447 | 2007-02-20 13:58:09 -0800 | [diff] [blame] | 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; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | }; |
| 150 | |
Ian Kent | e9a7c2f | 2016-03-15 14:58:25 -0700 | [diff] [blame] | 151 | #define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93, 0x66, int) |
Ian Kent | 5c0a32f | 2006-03-27 01:14:55 -0800 | [diff] [blame] | 152 | #define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI |
| 153 | #define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI |
Ian Kent | e9a7c2f | 2016-03-15 14:58:25 -0700 | [diff] [blame] | 154 | #define AUTOFS_IOC_PROTOSUBVER _IOR(0x93, 0x67, int) |
| 155 | #define AUTOFS_IOC_ASKUMOUNT _IOR(0x93, 0x70, int) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | |
| 157 | #endif /* _LINUX_AUTO_FS4_H */ |