blob: 8f8f1bdcca8c07c8b237daf71525768d4685fc0f [file] [log] [blame]
Ian Kente9a7c2f2016-03-15 14:58:25 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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 Rajput5d461bf2009-01-30 20:31:19 +053013#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#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 Kent5c0a32f2006-03-27 01:14:55 -080021#define AUTOFS_PROTO_VERSION 5
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#define AUTOFS_MIN_PROTO_VERSION 3
Ian Kent5c0a32f2006-03-27 01:14:55 -080023#define AUTOFS_MAX_PROTO_VERSION 5
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Ian Kent19725802011-01-14 18:46:40 +000025#define AUTOFS_PROTO_SUBVERSION 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27/* Mask for expire behaviour */
28#define AUTOFS_EXP_IMMEDIATE 1
29#define AUTOFS_EXP_LEAVES 2
30
Ian Kenta92daf62009-01-06 14:42:08 -080031#define AUTOFS_TYPE_ANY 0U
32#define AUTOFS_TYPE_INDIRECT 1U
33#define AUTOFS_TYPE_DIRECT 2U
34#define AUTOFS_TYPE_OFFSET 4U
35
36static inline void set_autofs_type_indirect(unsigned int *type)
37{
38 *type = AUTOFS_TYPE_INDIRECT;
Ian Kenta92daf62009-01-06 14:42:08 -080039}
40
41static inline unsigned int autofs_type_indirect(unsigned int type)
42{
43 return (type == AUTOFS_TYPE_INDIRECT);
44}
45
46static inline void set_autofs_type_direct(unsigned int *type)
47{
48 *type = AUTOFS_TYPE_DIRECT;
Ian Kenta92daf62009-01-06 14:42:08 -080049}
50
51static inline unsigned int autofs_type_direct(unsigned int type)
52{
53 return (type == AUTOFS_TYPE_DIRECT);
54}
55
56static inline void set_autofs_type_offset(unsigned int *type)
57{
58 *type = AUTOFS_TYPE_OFFSET;
Ian Kenta92daf62009-01-06 14:42:08 -080059}
60
61static inline unsigned int autofs_type_offset(unsigned int type)
62{
63 return (type == AUTOFS_TYPE_OFFSET);
64}
65
66static 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 */
76static inline void set_autofs_type_any(unsigned int *type)
77{
78 *type = AUTOFS_TYPE_ANY;
Ian Kenta92daf62009-01-06 14:42:08 -080079}
80
81static inline unsigned int autofs_type_any(unsigned int type)
82{
83 return (type == AUTOFS_TYPE_ANY);
84}
Ian Kentbb979d72008-10-15 22:02:52 -070085
Ian Kent5c0a32f2006-03-27 01:14:55 -080086/* Daemon notification packet types */
87enum 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 Torvalds1da177e2005-04-16 15:20:36 -0700107
108/* v4 multi expire (via pipe) */
109struct autofs_packet_expire_multi {
110 struct autofs_packet_hdr hdr;
Ian Kent02667252016-03-15 14:58:36 -0700111 autofs_wqt_t wait_queue_token;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 int len;
113 char name[NAME_MAX+1];
114};
115
Ian Kente8514472007-02-20 13:58:09 -0800116union 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 Kent5c0a32f2006-03-27 01:14:55 -0800123/* autofs v5 common packet struct */
124struct 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
137typedef struct autofs_v5_packet autofs_packet_missing_indirect_t;
138typedef struct autofs_v5_packet autofs_packet_expire_indirect_t;
139typedef struct autofs_v5_packet autofs_packet_missing_direct_t;
140typedef struct autofs_v5_packet autofs_packet_expire_direct_t;
141
Ian Kente8514472007-02-20 13:58:09 -0800142union autofs_v5_packet_union {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 struct autofs_packet_hdr hdr;
Ian Kent5c0a32f2006-03-27 01:14:55 -0800144 struct autofs_v5_packet v5_packet;
Ian Kente8514472007-02-20 13:58:09 -0800145 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 Torvalds1da177e2005-04-16 15:20:36 -0700149};
150
Ian Kente9a7c2f2016-03-15 14:58:25 -0700151#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93, 0x66, int)
Ian Kent5c0a32f2006-03-27 01:14:55 -0800152#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI
153#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI
Ian Kente9a7c2f2016-03-15 14:58:25 -0700154#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93, 0x67, int)
155#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93, 0x70, int)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156
157#endif /* _LINUX_AUTO_FS4_H */