aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/fs_ioctl.txt
blob: 37abbe13219fc9f8649ee190f0256d8f446eedb7 (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Copyright 2018 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

include <uapi/linux/fiemap.h>
include <uapi/linux/fs.h>
include <uapi/linux/fsmap.h>
include <uapi/linux/fsverity.h>
include <linux/falloc.h>

ioctl$FIBMAP(fd fd, cmd const[FIBMAP], arg ptr[in, int32])
ioctl$FIGETBSZ(fd fd, cmd const[FIGETBSZ], arg ptr[out, intptr])
ioctl$FITRIM(fd fd, cmd const[FITRIM], arg ptr[in, fstrim_range])
ioctl$FICLONE(fd fd, cmd const[FICLONE], arg fd)
ioctl$FICLONERANGE(fd fd, cmd const[FICLONERANGE], arg ptr[in, file_clone_range])
ioctl$FIDEDUPERANGE(fd fd, cmd const[FIDEDUPERANGE], arg ptr[in, file_dedupe_range])

ioctl$FS_IOC_GETFLAGS(fd fd, cmd const[FS_IOC_GETFLAGS], arg ptr[out, intptr])
ioctl$FS_IOC_SETFLAGS(fd fd, cmd const[FS_IOC_SETFLAGS], arg ptr[in, intptr])
ioctl$FS_IOC_GETVERSION(fd fd, cmd const[FS_IOC_GETVERSION], arg ptr[out, intptr])
ioctl$FS_IOC_SETVERSION(fd fd, cmd const[FS_IOC_SETVERSION], arg ptr[in, intptr])
ioctl$FS_IOC_FIEMAP(fd fd, cmd const[FS_IOC_FIEMAP], v ptr[in, fiemap])
ioctl$FS_IOC_RESVSP(fd fd, cmd const[FS_IOC_RESVSP], arg ptr[in, space_resv])
ioctl$FS_IOC_FSGETXATTR(fd fd, cmd const[FS_IOC_FSGETXATTR], arg ptr[in, fsxattr])
ioctl$FS_IOC_FSSETXATTR(fd fd, cmd const[FS_IOC_FSSETXATTR], arg ptr[in, fsxattr])
ioctl$FS_IOC_GETFSLABEL(fd fd, cmd const[FS_IOC_GETFSLABEL], arg ptr[out, array[const[0, int8], FSLABEL_MAX]])
ioctl$FS_IOC_SETFSLABEL(fd fd, cmd const[FS_IOC_SETFSLABEL], arg ptr[in, array[int8, FSLABEL_MAX]])
ioctl$FS_IOC_SET_ENCRYPTION_POLICY(fd fd, cmd const[FS_IOC_SET_ENCRYPTION_POLICY], arg ptr[in, fscrypt_policy])
ioctl$FS_IOC_GET_ENCRYPTION_POLICY(fd fd, cmd const[FS_IOC_GET_ENCRYPTION_POLICY], arg ptr[out, array[int8, 16]])
ioctl$FS_IOC_GET_ENCRYPTION_PWSALT(fd fd, cmd const[FS_IOC_GET_ENCRYPTION_PWSALT], arg ptr[out, fscrypt_policy])
ioctl$FS_IOC_GETFSMAP(fd fd, cmd const[FS_IOC_GETFSMAP], arg ptr[in, fsmap_head])
ioctl$FS_IOC_ENABLE_VERITY(fd fd, cmd const[FS_IOC_ENABLE_VERITY])
ioctl$FS_IOC_MEASURE_VERITY(fd fd, cmd const[FS_IOC_MEASURE_VERITY], arg ptr[inout, fsverity_digest])

fscrypt_policy {
	version			const[0, int8]
	mode			fscrypt_policy_mode
	flags			flags[fs_policy_flags, int8]
	master_key_descriptor	array[int8, FS_KEY_DESCRIPTOR_SIZE]
}

fscrypt_policy_mode [
	aes128		fscrypt_policy_mode_t[FS_ENCRYPTION_MODE_AES_128_CBC, FS_ENCRYPTION_MODE_AES_128_CTS]
	aes256		fscrypt_policy_mode_t[FS_ENCRYPTION_MODE_AES_256_XTS, FS_ENCRYPTION_MODE_AES_256_CTS]
	speck128	fscrypt_policy_mode_t[FS_ENCRYPTION_MODE_SPECK128_256_XTS, FS_ENCRYPTION_MODE_SPECK128_256_CTS]
]

type fscrypt_policy_mode_t[CONTENTS, FILENAMES] {
	contents_encryption_mode	const[CONTENTS, int8]
	filenames_encryption_mode	const[FILENAMES, int8]
}

fs_policy_flags = FS_POLICY_FLAGS_PAD_4, FS_POLICY_FLAGS_PAD_8, FS_POLICY_FLAGS_PAD_16

fsverity_digest_algorithm_flags = FS_VERITY_ALG_SHA256, FS_VERITY_ALG_SHA512, FS_VERITY_ALG_CRC32C

fsverity_digest {
	digest_algorithm	flags[fsverity_digest_algorithm_flags, int16]
	digest_size		len[digest, int16]
	digest			array[int8]
}

space_resv {
	l_type		const[0, int16]
	l_whence	flags[seek_whence, int16]
	l_start		int64
	l_len		int64
	l_sysid		const[0, int32]
	l_pid		const[0, int32]
	l_pad		array[const[0, int32], 4]
}

fstrim_range {
	start	int64
	len	int64
	minlen	int64
}

file_clone_range {
	src_fd		fd
	pad		const[0, int32]
	src_offset	int64
	src_length	int64
	dest_offset	int64
}

file_dedupe_range {
	src_offset	int64
	src_length	int64
	dest_count	len[info, int16]
	reserved1	const[0, int16]
	reserved2	const[0, int32]
	info		array[file_dedupe_range_info]
}

file_dedupe_range_info {
	dest_fd		fd
	pad		const[0, int32]
	dest_offset	int64
	bytes_deduped	const[0, int64]
	status		const[0, int32]
	reserved	const[0, int32]
}

fsxattr {
	fsx_xflags	int32
	fsx_extsize	int32
	fsx_nextents	int32
	fsx_projid	int32
	fsx_cowextsize	int32
	fsx_pad		const[0, int64]
}

fiemap {
	start	int64
	len	int64
	flags	flags[fiemap_flags, int32]
	mapped	int32
	count	len[extent, int32]
	extent	array[fiemap_extent]
}

fiemap_extent {
	logical	int64
	phys	int64
	len	int64
	pad1	const[0, int64]
	pad2	const[0, int64]
	flags	flags[fiemap_extent_flags, int32]
	pad3	const[0, int32]
	pad4	const[0, int32]
	pad5	const[0, int32]
}

fsmap_head {
	fmh_iflags	const[0, int32]
	fmh_oflags	const[0, int32]
	fmh_count	len[fmh_recs, int32]
	fmh_entries	const[0, int32]
	fmh_reserved	array[const[0, int64], 6]
	fmh_keys	array[fsmap, 2]
	fmh_recs	array[array[const[0, int8], FSMAP_SIZE]]
}

fsmap {
	fmr_device	int32
	fmr_flags	int32
	fmr_physical	int64
	fmr_owner	int64
	fmr_offset	int64
	fmr_length	int64
	fmr_reserved	array[const[0, int64], 3]
}

define FSMAP_SIZE	sizeof(struct fsmap)