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