Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / include / uapi / linux / auto_fs4.h
CommitLineData
e9a7c2f1 1/*
1da177e4
LT
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 */
5d461bfe 13#include <linux/types.h>
1da177e4
LT
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
5c0a32fc 21#define AUTOFS_PROTO_VERSION 5
1da177e4 22#define AUTOFS_MIN_PROTO_VERSION 3
5c0a32fc 23#define AUTOFS_MAX_PROTO_VERSION 5
1da177e4 24
1972580b 25#define AUTOFS_PROTO_SUBVERSION 2
1da177e4
LT
26
27/* Mask for expire behaviour */
28#define AUTOFS_EXP_IMMEDIATE 1
29#define AUTOFS_EXP_LEAVES 2
30
a92daf6b
IK
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
36static inline void set_autofs_type_indirect(unsigned int *type)
37{
38 *type = AUTOFS_TYPE_INDIRECT;
a92daf6b
IK
39}
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;
a92daf6b
IK
49}
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;
a92daf6b
IK
59}
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;
a92daf6b
IK
79}
80
81static inline unsigned int autofs_type_any(unsigned int type)
82{
83 return (type == AUTOFS_TYPE_ANY);
84}
bb979d7f 85
5c0a32fc
IK
86/* 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
1da177e4
LT
107
108/* v4 multi expire (via pipe) */
109struct autofs_packet_expire_multi {
110 struct autofs_packet_hdr hdr;
0266725a 111 autofs_wqt_t wait_queue_token;
1da177e4
LT
112 int len;
113 char name[NAME_MAX+1];
114};
115
e8514478
IK
116union 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
5c0a32fc
IK
123/* 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
e8514478 142union autofs_v5_packet_union {
1da177e4 143 struct autofs_packet_hdr hdr;
5c0a32fc 144 struct autofs_v5_packet v5_packet;
e8514478
IK
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;
1da177e4
LT
149};
150
e9a7c2f1 151#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93, 0x66, int)
5c0a32fc
IK
152#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI
153#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI
e9a7c2f1
IK
154#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93, 0x67, int)
155#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93, 0x70, int)
1da177e4
LT
156
157#endif /* _LINUX_AUTO_FS4_H */