aboutsummaryrefslogtreecommitdiffstats
path: root/kernel4/linux/auto_fs.h
blob: 881964356db9c204a29f79fb857aad0f3788064a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* -*- linux-c -*- ------------------------------------------------------- *
 *   
 * linux/include/linux/auto_fs.h
 *
 *   Copyright 1997 Transmeta Corporation - All Rights Reserved
 *
 * This file is part of the Linux kernel and is made available under
 * the terms of the GNU General Public License, version 2, or at your
 * option, any later version, incorporated herein by reference.
 *
 * ----------------------------------------------------------------------- */


#ifndef _LINUX_AUTO_FS_H
#define _LINUX_AUTO_FS_H

#include <linux/version.h>
#include <linux/fs.h>
#include <linux/limits.h>
#include <linux/ioctl.h>
#include <asm/types.h>

#define AUTOFS_PROTO_MAJOR_VERSION 4
#define AUTOFS_PROTO_MINOR_VERSION 0
#define AUTOFS_PROTO_FEATURES      0x00000000

#define AUTOFS_NAME_MAX            255

/*
 * Previous protocol version differences:
 *
 * 1.0 - never distributed
 * 2.0 - hdr.body_len field used for protocol version; only
 *       autofs_ptype_missing supported; IOC_READY, IOC_FAIL, IOC_CATATONIC
 *       only.
 * 3.0 - hdr.body_len field used for protocol version; added support for
 *       IOC_PROTOVER, IOC_SETTIMEOUT, IOC_EXPIRE.
 *
 */

enum autofs_packet_type {
	AUTOFS_PTYPE_MISSING,	/* Missing entry (mount request) */
	AUTOFS_PTYPE_EXPIRE,	/* Expire entry (umount request) */
};

struct autofs_packet_hdr {
	int body_len;		      /* Length of packet body in bytes */
	enum autofs_packet_type type; /* Type of packet */
};

struct autofs_process_info {
	int pid;		/* pid of requesting process */
	int uid;		/* fsuid of requesting process */
	int gid;		/* fsgid of requesting process */
	int umask;		/* umask of requesting process */
};

struct autofs_packet_missing_body {
        unsigned long wait_queue_token;
	struct autofs_process_info pinfo;
	unsigned long parent;	/* parent "magic cookie" */
	int len;
	char name[AUTOFS_NAME_MAX+1];
};

struct autofs_packet_missing {
	struct autofs_packet_hdr hdr;
	struct autofs_packet_missing_body body;
};

/* Packet format for protocol versions 2-3 */
struct autofs_v3_packet_missing {
	struct autofs_packet_hdr hdr; /* body_len field not valid */
	int len;
	char name[AUTOFS_NAME_MAX+1];
};

struct autofs_packet_expire_body {
	int len;
	char name[AUTOFS_NAME_MAX+1];
};

struct autofs_packet_expire {
	struct autofs_packet_hdr hdr;
	struct autofs_packet_expire_body body;
};

struct autofs_proto_info {
	unsigned short major_ver;
	unsigned short minor_ver;
	unsigned long   features;
};

enum autofs_dir_mode {
	AUTOFS_DIR_LOCKED,
	AUTOFS_DIR_UNLOCKED,
	AUTOFS_DIR_MAGIC,
	AUTOFS_DIR_MODECOUNT
};

struct autofs_set_dir_mode {
	unsigned long inode;	/* inode number */
	unsigned long cookie;	/* magic cookie for AUTOFS_DIR_MAGIC */
	enum autofs_dir_mode mode;
};

#define AUTOFS_IOC_READY      _IO(0x93,0x60)
#define AUTOFS_IOC_FAIL       _IO(0x93,0x61)
#define AUTOFS_IOC_CATATONIC  _IO(0x93,0x62)
#define AUTOFS_IOC_PROTOVER   _IOR(0x93,0x63,int)
#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
#define AUTOFS_IOC_EXPIRE     _IOR(0x93,0x65,struct autofs_packet_expire)
#define AUTOFS_IOC_PROTOINFO  _IOR(0x93,0x66,struct autofs_proto_info)
#define AUTOFS_IOC_ENABLE     _IO(0x93,0x67)
#define AUTOFS_IOC_SETDIRMODE _IOW(0x93,0x68,struct autofs_set_dir_mode)

#ifdef __KERNEL__

/* Init function */
int init_autofs_fs(void);

#endif /* __KERNEL__ */

#endif /* _LINUX_AUTO_FS_H */