xref: /linux-6.15/include/linux/auto_dev-ioctl.h (revision 930cc144)
1 /*
2  * Copyright 2008 Red Hat, Inc. All rights reserved.
3  * Copyright 2008 Ian Kent <[email protected]>
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_DEV_IOCTL_H
11 #define _LINUX_AUTO_DEV_IOCTL_H
12 
13 #include <linux/types.h>
14 
15 #define AUTOFS_DEVICE_NAME		"autofs"
16 
17 #define AUTOFS_DEV_IOCTL_VERSION_MAJOR	1
18 #define AUTOFS_DEV_IOCTL_VERSION_MINOR	0
19 
20 #define AUTOFS_DEVID_LEN		16
21 
22 #define AUTOFS_DEV_IOCTL_SIZE		sizeof(struct autofs_dev_ioctl)
23 
24 /*
25  * An ioctl interface for autofs mount point control.
26  */
27 
28 /*
29  * All the ioctls use this structure.
30  * When sending a path size must account for the total length
31  * of the chunk of memory otherwise is is the size of the
32  * structure.
33  */
34 
35 struct autofs_dev_ioctl {
36 	__u32 ver_major;
37 	__u32 ver_minor;
38 	__u32 size;		/* total size of data passed in
39 				 * including this struct */
40 	__s32 ioctlfd;		/* automount command fd */
41 
42 	__u32 arg1;		/* Command parameters */
43 	__u32 arg2;
44 
45 	char path[0];
46 };
47 
48 static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
49 {
50 	in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
51 	in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
52 	in->size = sizeof(struct autofs_dev_ioctl);
53 	in->ioctlfd = -1;
54 	in->arg1 = 0;
55 	in->arg2 = 0;
56 	return;
57 }
58 
59 /*
60  * If you change this make sure you make the corresponding change
61  * to autofs-dev-ioctl.c:lookup_ioctl()
62  */
63 enum {
64 	/* Get various version info */
65 	AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71,
66 	AUTOFS_DEV_IOCTL_PROTOVER_CMD,
67 	AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD,
68 
69 	/* Open mount ioctl fd */
70 	AUTOFS_DEV_IOCTL_OPENMOUNT_CMD,
71 
72 	/* Close mount ioctl fd */
73 	AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD,
74 
75 	/* Mount/expire status returns */
76 	AUTOFS_DEV_IOCTL_READY_CMD,
77 	AUTOFS_DEV_IOCTL_FAIL_CMD,
78 
79 	/* Activate/deactivate autofs mount */
80 	AUTOFS_DEV_IOCTL_SETPIPEFD_CMD,
81 	AUTOFS_DEV_IOCTL_CATATONIC_CMD,
82 
83 	/* Expiry timeout */
84 	AUTOFS_DEV_IOCTL_TIMEOUT_CMD,
85 
86 	/* Get mount last requesting uid and gid */
87 	AUTOFS_DEV_IOCTL_REQUESTER_CMD,
88 
89 	/* Check for eligible expire candidates */
90 	AUTOFS_DEV_IOCTL_EXPIRE_CMD,
91 
92 	/* Request busy status */
93 	AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD,
94 
95 	/* Check if path is a mountpoint */
96 	AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD,
97 };
98 
99 #define AUTOFS_IOCTL 0x93
100 
101 #define AUTOFS_DEV_IOCTL_VERSION \
102 	_IOWR(AUTOFS_IOCTL, \
103 	      AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)
104 
105 #define AUTOFS_DEV_IOCTL_PROTOVER \
106 	_IOWR(AUTOFS_IOCTL, \
107 	      AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl)
108 
109 #define AUTOFS_DEV_IOCTL_PROTOSUBVER \
110 	_IOWR(AUTOFS_IOCTL, \
111 	      AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl)
112 
113 #define AUTOFS_DEV_IOCTL_OPENMOUNT \
114 	_IOWR(AUTOFS_IOCTL, \
115 	      AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl)
116 
117 #define AUTOFS_DEV_IOCTL_CLOSEMOUNT \
118 	_IOWR(AUTOFS_IOCTL, \
119 	      AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl)
120 
121 #define AUTOFS_DEV_IOCTL_READY \
122 	_IOWR(AUTOFS_IOCTL, \
123 	      AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl)
124 
125 #define AUTOFS_DEV_IOCTL_FAIL \
126 	_IOWR(AUTOFS_IOCTL, \
127 	      AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl)
128 
129 #define AUTOFS_DEV_IOCTL_SETPIPEFD \
130 	_IOWR(AUTOFS_IOCTL, \
131 	      AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl)
132 
133 #define AUTOFS_DEV_IOCTL_CATATONIC \
134 	_IOWR(AUTOFS_IOCTL, \
135 	      AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl)
136 
137 #define AUTOFS_DEV_IOCTL_TIMEOUT \
138 	_IOWR(AUTOFS_IOCTL, \
139 	      AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl)
140 
141 #define AUTOFS_DEV_IOCTL_REQUESTER \
142 	_IOWR(AUTOFS_IOCTL, \
143 	      AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl)
144 
145 #define AUTOFS_DEV_IOCTL_EXPIRE \
146 	_IOWR(AUTOFS_IOCTL, \
147 	      AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl)
148 
149 #define AUTOFS_DEV_IOCTL_ASKUMOUNT \
150 	_IOWR(AUTOFS_IOCTL, \
151 	      AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl)
152 
153 #define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \
154 	_IOWR(AUTOFS_IOCTL, \
155 	      AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl)
156 
157 #endif	/* _LINUX_AUTO_DEV_IOCTL_H */
158