brintos

brintos / linux-shallow public Read only

0
0
Text · 4.9 KiB · 08be539 Raw
217 lines · c
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */2/*3 * Copyright 2008 Red Hat, Inc. All rights reserved.4 * Copyright 2008 Ian Kent <raven@themaw.net>5 *6 * This file is part of the Linux kernel and is made available under7 * the terms of the GNU General Public License, version 2, or at your8 * option, any later version, incorporated herein by reference.9 */10 11#ifndef _UAPI_LINUX_AUTO_DEV_IOCTL_H12#define _UAPI_LINUX_AUTO_DEV_IOCTL_H13 14#include <linux/auto_fs.h>15#include <linux/string.h>16 17#define AUTOFS_DEVICE_NAME		"autofs"18 19#define AUTOFS_DEV_IOCTL_VERSION_MAJOR	120#define AUTOFS_DEV_IOCTL_VERSION_MINOR	121 22#define AUTOFS_DEV_IOCTL_SIZE		sizeof(struct autofs_dev_ioctl)23 24/*25 * An ioctl interface for autofs mount point control.26 */27 28struct args_protover {29	__u32	version;30};31 32struct args_protosubver {33	__u32	sub_version;34};35 36struct args_openmount {37	__u32	devid;38};39 40struct args_ready {41	__u32	token;42};43 44struct args_fail {45	__u32	token;46	__s32	status;47};48 49struct args_setpipefd {50	__s32	pipefd;51};52 53struct args_timeout {54	__u64	timeout;55};56 57struct args_requester {58	__u32	uid;59	__u32	gid;60};61 62struct args_expire {63	__u32	how;64};65 66struct args_askumount {67	__u32	may_umount;68};69 70struct args_ismountpoint {71	union {72		struct args_in {73			__u32	type;74		} in;75		struct args_out {76			__u32	devid;77			__u32	magic;78		} out;79	};80};81 82/*83 * All the ioctls use this structure.84 * When sending a path size must account for the total length85 * of the chunk of memory otherwise it is the size of the86 * structure.87 */88 89struct autofs_dev_ioctl {90	__u32 ver_major;91	__u32 ver_minor;92	__u32 size;		/* total size of data passed in93				 * including this struct */94	__s32 ioctlfd;		/* automount command fd */95 96	/* Command parameters */97 98	union {99		struct args_protover		protover;100		struct args_protosubver		protosubver;101		struct args_openmount		openmount;102		struct args_ready		ready;103		struct args_fail		fail;104		struct args_setpipefd		setpipefd;105		struct args_timeout		timeout;106		struct args_requester		requester;107		struct args_expire		expire;108		struct args_askumount		askumount;109		struct args_ismountpoint	ismountpoint;110	};111 112	char path[];113};114 115static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)116{117	memset(in, 0, AUTOFS_DEV_IOCTL_SIZE);118	in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;119	in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;120	in->size = AUTOFS_DEV_IOCTL_SIZE;121	in->ioctlfd = -1;122}123 124enum {125	/* Get various version info */126	AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71,127	AUTOFS_DEV_IOCTL_PROTOVER_CMD,128	AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD,129 130	/* Open mount ioctl fd */131	AUTOFS_DEV_IOCTL_OPENMOUNT_CMD,132 133	/* Close mount ioctl fd */134	AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD,135 136	/* Mount/expire status returns */137	AUTOFS_DEV_IOCTL_READY_CMD,138	AUTOFS_DEV_IOCTL_FAIL_CMD,139 140	/* Activate/deactivate autofs mount */141	AUTOFS_DEV_IOCTL_SETPIPEFD_CMD,142	AUTOFS_DEV_IOCTL_CATATONIC_CMD,143 144	/* Expiry timeout */145	AUTOFS_DEV_IOCTL_TIMEOUT_CMD,146 147	/* Get mount last requesting uid and gid */148	AUTOFS_DEV_IOCTL_REQUESTER_CMD,149 150	/* Check for eligible expire candidates */151	AUTOFS_DEV_IOCTL_EXPIRE_CMD,152 153	/* Request busy status */154	AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD,155 156	/* Check if path is a mountpoint */157	AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD,158};159 160#define AUTOFS_DEV_IOCTL_VERSION \161	_IOWR(AUTOFS_IOCTL, \162	      AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)163 164#define AUTOFS_DEV_IOCTL_PROTOVER \165	_IOWR(AUTOFS_IOCTL, \166	      AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl)167 168#define AUTOFS_DEV_IOCTL_PROTOSUBVER \169	_IOWR(AUTOFS_IOCTL, \170	      AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl)171 172#define AUTOFS_DEV_IOCTL_OPENMOUNT \173	_IOWR(AUTOFS_IOCTL, \174	      AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl)175 176#define AUTOFS_DEV_IOCTL_CLOSEMOUNT \177	_IOWR(AUTOFS_IOCTL, \178	      AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl)179 180#define AUTOFS_DEV_IOCTL_READY \181	_IOWR(AUTOFS_IOCTL, \182	      AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl)183 184#define AUTOFS_DEV_IOCTL_FAIL \185	_IOWR(AUTOFS_IOCTL, \186	      AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl)187 188#define AUTOFS_DEV_IOCTL_SETPIPEFD \189	_IOWR(AUTOFS_IOCTL, \190	      AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl)191 192#define AUTOFS_DEV_IOCTL_CATATONIC \193	_IOWR(AUTOFS_IOCTL, \194	      AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl)195 196#define AUTOFS_DEV_IOCTL_TIMEOUT \197	_IOWR(AUTOFS_IOCTL, \198	      AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl)199 200#define AUTOFS_DEV_IOCTL_REQUESTER \201	_IOWR(AUTOFS_IOCTL, \202	      AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl)203 204#define AUTOFS_DEV_IOCTL_EXPIRE \205	_IOWR(AUTOFS_IOCTL, \206	      AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl)207 208#define AUTOFS_DEV_IOCTL_ASKUMOUNT \209	_IOWR(AUTOFS_IOCTL, \210	      AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl)211 212#define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \213	_IOWR(AUTOFS_IOCTL, \214	      AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl)215 216#endif	/* _UAPI_LINUX_AUTO_DEV_IOCTL_H */217