Commit | Line | Data |
---|---|---|
e2be04c7 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
6cbd5570 CM |
2 | /* |
3 | * Copyright (C) 2007 Oracle. All rights reserved. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or | |
6 | * modify it under the terms of the GNU General Public | |
7 | * License v2 as published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public | |
15 | * License along with this program; if not, write to the | |
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
17 | * Boston, MA 021110-1307, USA. | |
18 | */ | |
19 | ||
55e301fd FB |
20 | #ifndef _UAPI_LINUX_BTRFS_H |
21 | #define _UAPI_LINUX_BTRFS_H | |
22 | #include <linux/types.h> | |
c5739bba CM |
23 | #include <linux/ioctl.h> |
24 | ||
25 | #define BTRFS_IOCTL_MAGIC 0x94 | |
26 | #define BTRFS_VOL_NAME_MAX 255 | |
d4ae133b | 27 | #define BTRFS_LABEL_SIZE 256 |
8a4b83cc | 28 | |
c071fcfd | 29 | /* this should be 4k */ |
72fd032e | 30 | #define BTRFS_PATH_NAME_MAX 4087 |
c5739bba | 31 | struct btrfs_ioctl_vol_args { |
3de4586c | 32 | __s64 fd; |
8a4b83cc | 33 | char name[BTRFS_PATH_NAME_MAX + 1]; |
c5739bba CM |
34 | }; |
35 | ||
ad8bc4d0 AJ |
36 | #define BTRFS_DEVICE_PATH_NAME_MAX 1024 |
37 | #define BTRFS_SUBVOL_NAME_MAX 4039 | |
38 | ||
39 | #define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0) | |
40 | #define BTRFS_SUBVOL_RDONLY (1ULL << 1) | |
41 | #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) | |
3f6bcfbd | 42 | |
735654ea DS |
43 | #define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3) |
44 | ||
45 | #define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED \ | |
6b526ed7 AJ |
46 | (BTRFS_SUBVOL_CREATE_ASYNC | \ |
47 | BTRFS_SUBVOL_RDONLY | \ | |
48 | BTRFS_SUBVOL_QGROUP_INHERIT | \ | |
735654ea | 49 | BTRFS_DEVICE_SPEC_BY_ID) |
6b526ed7 | 50 | |
475f6387 JS |
51 | #define BTRFS_FSID_SIZE 16 |
52 | #define BTRFS_UUID_SIZE 16 | |
b2373f25 | 53 | #define BTRFS_UUID_UNPARSED_SIZE 37 |
fdfb1e4f | 54 | |
83288b60 JM |
55 | /* |
56 | * flags definition for qgroup limits | |
57 | * | |
58 | * Used by: | |
59 | * struct btrfs_qgroup_limit.flags | |
60 | * struct btrfs_qgroup_limit_item.flags | |
61 | */ | |
62 | #define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0) | |
63 | #define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1) | |
64 | #define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2) | |
65 | #define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3) | |
66 | #define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4) | |
67 | #define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5) | |
bed92eae AJ |
68 | |
69 | struct btrfs_qgroup_limit { | |
70 | __u64 flags; | |
71 | __u64 max_rfer; | |
72 | __u64 max_excl; | |
73 | __u64 rsv_rfer; | |
74 | __u64 rsv_excl; | |
75 | }; | |
76 | ||
83288b60 JM |
77 | /* |
78 | * flags definition for qgroup inheritance | |
79 | * | |
80 | * Used by: | |
81 | * struct btrfs_qgroup_inherit.flags | |
82 | */ | |
83 | #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) | |
84 | ||
bed92eae AJ |
85 | struct btrfs_qgroup_inherit { |
86 | __u64 flags; | |
87 | __u64 num_qgroups; | |
88 | __u64 num_ref_copies; | |
89 | __u64 num_excl_copies; | |
90 | struct btrfs_qgroup_limit lim; | |
91 | __u64 qgroups[0]; | |
92 | }; | |
93 | ||
94 | struct btrfs_ioctl_qgroup_limit_args { | |
95 | __u64 qgroupid; | |
96 | struct btrfs_qgroup_limit lim; | |
97 | }; | |
98 | ||
884f6eca JM |
99 | /* |
100 | * flags for subvolumes | |
101 | * | |
102 | * Used by: | |
103 | * struct btrfs_ioctl_vol_args_v2.flags | |
104 | * | |
105 | * BTRFS_SUBVOL_RDONLY is also provided/consumed by the following ioctls: | |
106 | * - BTRFS_IOC_SUBVOL_GETFLAGS | |
107 | * - BTRFS_IOC_SUBVOL_SETFLAGS | |
108 | */ | |
884f6eca | 109 | |
fdfb1e4f | 110 | struct btrfs_ioctl_vol_args_v2 { |
72fd032e SW |
111 | __s64 fd; |
112 | __u64 transid; | |
fdfb1e4f | 113 | __u64 flags; |
6f72c7e2 AJ |
114 | union { |
115 | struct { | |
116 | __u64 size; | |
117 | struct btrfs_qgroup_inherit __user *qgroup_inherit; | |
118 | }; | |
119 | __u64 unused[4]; | |
120 | }; | |
6b526ed7 AJ |
121 | union { |
122 | char name[BTRFS_SUBVOL_NAME_MAX + 1]; | |
1691cf16 | 123 | __u64 devid; |
6b526ed7 | 124 | }; |
72fd032e SW |
125 | }; |
126 | ||
a2de733c AJ |
127 | /* |
128 | * structure to report errors and progress to userspace, either as a | |
129 | * result of a finished scrub, a canceled scrub or a progress inquiry | |
130 | */ | |
131 | struct btrfs_scrub_progress { | |
132 | __u64 data_extents_scrubbed; /* # of data extents scrubbed */ | |
133 | __u64 tree_extents_scrubbed; /* # of tree extents scrubbed */ | |
134 | __u64 data_bytes_scrubbed; /* # of data bytes scrubbed */ | |
135 | __u64 tree_bytes_scrubbed; /* # of tree bytes scrubbed */ | |
136 | __u64 read_errors; /* # of read errors encountered (EIO) */ | |
137 | __u64 csum_errors; /* # of failed csum checks */ | |
138 | __u64 verify_errors; /* # of occurences, where the metadata | |
139 | * of a tree block did not match the | |
140 | * expected values, like generation or | |
141 | * logical */ | |
142 | __u64 no_csum; /* # of 4k data block for which no csum | |
143 | * is present, probably the result of | |
144 | * data written with nodatasum */ | |
145 | __u64 csum_discards; /* # of csum for which no data was found | |
146 | * in the extent tree. */ | |
147 | __u64 super_errors; /* # of bad super blocks encountered */ | |
148 | __u64 malloc_errors; /* # of internal kmalloc errors. These | |
149 | * will likely cause an incomplete | |
150 | * scrub */ | |
151 | __u64 uncorrectable_errors; /* # of errors where either no intact | |
152 | * copy was found or the writeback | |
153 | * failed */ | |
154 | __u64 corrected_errors; /* # of errors corrected */ | |
155 | __u64 last_physical; /* last physical address scrubbed. In | |
156 | * case a scrub was aborted, this can | |
157 | * be used to restart the scrub */ | |
158 | __u64 unverified_errors; /* # of occurences where a read for a | |
159 | * full (64k) bio failed, but the re- | |
160 | * check succeeded for each 4k piece. | |
161 | * Intermittent error. */ | |
162 | }; | |
163 | ||
8628764e | 164 | #define BTRFS_SCRUB_READONLY 1 |
475f6387 JS |
165 | struct btrfs_ioctl_scrub_args { |
166 | __u64 devid; /* in */ | |
167 | __u64 start; /* in */ | |
168 | __u64 end; /* in */ | |
169 | __u64 flags; /* in */ | |
170 | struct btrfs_scrub_progress progress; /* out */ | |
171 | /* pad to 1k */ | |
172 | __u64 unused[(1024-32-sizeof(struct btrfs_scrub_progress))/8]; | |
173 | }; | |
174 | ||
e93c89c1 SB |
175 | #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0 |
176 | #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID 1 | |
177 | struct btrfs_ioctl_dev_replace_start_params { | |
178 | __u64 srcdevid; /* in, if 0, use srcdev_name instead */ | |
e93c89c1 SB |
179 | __u64 cont_reading_from_srcdev_mode; /* in, see #define |
180 | * above */ | |
3f6bcfbd SB |
181 | __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */ |
182 | __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */ | |
e93c89c1 SB |
183 | }; |
184 | ||
185 | #define BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED 0 | |
186 | #define BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED 1 | |
187 | #define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED 2 | |
188 | #define BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED 3 | |
189 | #define BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED 4 | |
190 | struct btrfs_ioctl_dev_replace_status_params { | |
191 | __u64 replace_state; /* out, see #define above */ | |
192 | __u64 progress_1000; /* out, 0 <= x <= 1000 */ | |
193 | __u64 time_started; /* out, seconds since 1-Jan-1970 */ | |
194 | __u64 time_stopped; /* out, seconds since 1-Jan-1970 */ | |
195 | __u64 num_write_errors; /* out */ | |
196 | __u64 num_uncorrectable_read_errors; /* out */ | |
197 | }; | |
198 | ||
199 | #define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0 | |
200 | #define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1 | |
201 | #define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2 | |
202 | #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0 | |
203 | #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1 | |
204 | #define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2 | |
2fc9f6ba | 205 | #define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3 |
e93c89c1 SB |
206 | struct btrfs_ioctl_dev_replace_args { |
207 | __u64 cmd; /* in */ | |
208 | __u64 result; /* out */ | |
209 | ||
210 | union { | |
211 | struct btrfs_ioctl_dev_replace_start_params start; | |
212 | struct btrfs_ioctl_dev_replace_status_params status; | |
213 | }; /* in/out */ | |
214 | ||
215 | __u64 spare[64]; | |
216 | }; | |
217 | ||
475f6387 JS |
218 | struct btrfs_ioctl_dev_info_args { |
219 | __u64 devid; /* in/out */ | |
220 | __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */ | |
221 | __u64 bytes_used; /* out */ | |
222 | __u64 total_bytes; /* out */ | |
223 | __u64 unused[379]; /* pad to 4k */ | |
224 | __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */ | |
225 | }; | |
226 | ||
227 | struct btrfs_ioctl_fs_info_args { | |
228 | __u64 max_id; /* out */ | |
229 | __u64 num_devices; /* out */ | |
230 | __u8 fsid[BTRFS_FSID_SIZE]; /* out */ | |
80a773fb DS |
231 | __u32 nodesize; /* out */ |
232 | __u32 sectorsize; /* out */ | |
233 | __u32 clone_alignment; /* out */ | |
234 | __u32 reserved32; | |
235 | __u64 reserved[122]; /* pad to 1k */ | |
475f6387 JS |
236 | }; |
237 | ||
18db9ac6 JM |
238 | /* |
239 | * feature flags | |
240 | * | |
241 | * Used by: | |
242 | * struct btrfs_ioctl_feature_flags | |
243 | */ | |
6675df31 OS |
244 | #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0) |
245 | /* | |
246 | * Older kernels (< 4.9) on big-endian systems produced broken free space tree | |
247 | * bitmaps, and btrfs-progs also used to corrupt the free space tree (versions | |
248 | * < 4.7.3). If this bit is clear, then the free space tree cannot be trusted. | |
249 | * btrfs-progs can also intentionally clear this bit to ask the kernel to | |
250 | * rebuild the free space tree, however this might not work on older kernels | |
251 | * that do not know about this bit. If not sure, clear the cache manually on | |
252 | * first mount when booting older kernel versions. | |
253 | */ | |
254 | #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1) | |
18db9ac6 JM |
255 | |
256 | #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0) | |
257 | #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1) | |
258 | #define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2) | |
259 | #define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3) | |
5c1aab1d | 260 | #define BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD (1ULL << 4) |
18db9ac6 JM |
261 | |
262 | /* | |
263 | * older kernels tried to do bigger metadata blocks, but the | |
264 | * code was pretty buggy. Lets not let them try anymore. | |
265 | */ | |
266 | #define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5) | |
267 | ||
268 | #define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6) | |
269 | #define BTRFS_FEATURE_INCOMPAT_RAID56 (1ULL << 7) | |
270 | #define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA (1ULL << 8) | |
271 | #define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9) | |
7239ff4b | 272 | #define BTRFS_FEATURE_INCOMPAT_METADATA_UUID (1ULL << 10) |
cfbb825c | 273 | #define BTRFS_FEATURE_INCOMPAT_RAID1C34 (1ULL << 11) |
18db9ac6 | 274 | |
2eaa055f JM |
275 | struct btrfs_ioctl_feature_flags { |
276 | __u64 compat_flags; | |
277 | __u64 compat_ro_flags; | |
278 | __u64 incompat_flags; | |
279 | }; | |
280 | ||
837d5b6e ID |
281 | /* balance control ioctl modes */ |
282 | #define BTRFS_BALANCE_CTL_PAUSE 1 | |
a7e99c69 | 283 | #define BTRFS_BALANCE_CTL_CANCEL 2 |
837d5b6e | 284 | |
c9e9f97b ID |
285 | /* |
286 | * this is packed, because it should be exactly the same as its disk | |
287 | * byte order counterpart (struct btrfs_disk_balance_args) | |
288 | */ | |
289 | struct btrfs_balance_args { | |
290 | __u64 profiles; | |
bc309467 | 291 | union { |
261cc2cc | 292 | __u64 usage; |
bc309467 | 293 | struct { |
261cc2cc HK |
294 | __u32 usage_min; |
295 | __u32 usage_max; | |
bc309467 DS |
296 | }; |
297 | }; | |
c9e9f97b ID |
298 | __u64 devid; |
299 | __u64 pstart; | |
300 | __u64 pend; | |
301 | __u64 vstart; | |
302 | __u64 vend; | |
303 | ||
304 | __u64 target; | |
305 | ||
306 | __u64 flags; | |
307 | ||
12907fc7 DS |
308 | /* |
309 | * BTRFS_BALANCE_ARGS_LIMIT with value 'limit' | |
310 | * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum | |
311 | * and maximum | |
312 | */ | |
313 | union { | |
314 | __u64 limit; /* limit number of processed chunks */ | |
315 | struct { | |
316 | __u32 limit_min; | |
317 | __u32 limit_max; | |
318 | }; | |
319 | }; | |
dee32d0a GAP |
320 | |
321 | /* | |
322 | * Process chunks that cross stripes_min..stripes_max devices, | |
323 | * BTRFS_BALANCE_ARGS_STRIPES_RANGE | |
324 | */ | |
261cc2cc HK |
325 | __u32 stripes_min; |
326 | __u32 stripes_max; | |
dee32d0a GAP |
327 | |
328 | __u64 unused[6]; | |
c9e9f97b ID |
329 | } __attribute__ ((__packed__)); |
330 | ||
331 | /* report balance progress to userspace */ | |
332 | struct btrfs_balance_progress { | |
333 | __u64 expected; /* estimated # of chunks that will be | |
334 | * relocated to fulfill the request */ | |
335 | __u64 considered; /* # of chunks we have considered so far */ | |
336 | __u64 completed; /* # of chunks relocated so far */ | |
337 | }; | |
338 | ||
04cd01df JM |
339 | /* |
340 | * flags definition for balance | |
341 | * | |
342 | * Restriper's general type filter | |
343 | * | |
344 | * Used by: | |
345 | * btrfs_ioctl_balance_args.flags | |
346 | * btrfs_balance_control.flags (internal) | |
347 | */ | |
348 | #define BTRFS_BALANCE_DATA (1ULL << 0) | |
349 | #define BTRFS_BALANCE_SYSTEM (1ULL << 1) | |
350 | #define BTRFS_BALANCE_METADATA (1ULL << 2) | |
351 | ||
352 | #define BTRFS_BALANCE_TYPE_MASK (BTRFS_BALANCE_DATA | \ | |
353 | BTRFS_BALANCE_SYSTEM | \ | |
354 | BTRFS_BALANCE_METADATA) | |
355 | ||
356 | #define BTRFS_BALANCE_FORCE (1ULL << 3) | |
357 | #define BTRFS_BALANCE_RESUME (1ULL << 4) | |
358 | ||
359 | /* | |
360 | * flags definitions for per-type balance args | |
361 | * | |
362 | * Balance filters | |
363 | * | |
364 | * Used by: | |
365 | * struct btrfs_balance_args | |
366 | */ | |
367 | #define BTRFS_BALANCE_ARGS_PROFILES (1ULL << 0) | |
368 | #define BTRFS_BALANCE_ARGS_USAGE (1ULL << 1) | |
369 | #define BTRFS_BALANCE_ARGS_DEVID (1ULL << 2) | |
370 | #define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3) | |
371 | #define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4) | |
372 | #define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5) | |
373 | #define BTRFS_BALANCE_ARGS_LIMIT_RANGE (1ULL << 6) | |
374 | #define BTRFS_BALANCE_ARGS_STRIPES_RANGE (1ULL << 7) | |
375 | #define BTRFS_BALANCE_ARGS_USAGE_RANGE (1ULL << 10) | |
376 | ||
377 | #define BTRFS_BALANCE_ARGS_MASK \ | |
378 | (BTRFS_BALANCE_ARGS_PROFILES | \ | |
379 | BTRFS_BALANCE_ARGS_USAGE | \ | |
380 | BTRFS_BALANCE_ARGS_DEVID | \ | |
381 | BTRFS_BALANCE_ARGS_DRANGE | \ | |
382 | BTRFS_BALANCE_ARGS_VRANGE | \ | |
383 | BTRFS_BALANCE_ARGS_LIMIT | \ | |
384 | BTRFS_BALANCE_ARGS_LIMIT_RANGE | \ | |
385 | BTRFS_BALANCE_ARGS_STRIPES_RANGE | \ | |
386 | BTRFS_BALANCE_ARGS_USAGE_RANGE) | |
387 | ||
388 | /* | |
389 | * Profile changing flags. When SOFT is set we won't relocate chunk if | |
390 | * it already has the target profile (even though it may be | |
391 | * half-filled). | |
392 | */ | |
393 | #define BTRFS_BALANCE_ARGS_CONVERT (1ULL << 8) | |
394 | #define BTRFS_BALANCE_ARGS_SOFT (1ULL << 9) | |
395 | ||
396 | ||
397 | /* | |
398 | * flags definition for balance state | |
399 | * | |
400 | * Used by: | |
401 | * struct btrfs_ioctl_balance_args.state | |
402 | */ | |
837d5b6e ID |
403 | #define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0) |
404 | #define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1) | |
a7e99c69 | 405 | #define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2) |
837d5b6e | 406 | |
c9e9f97b ID |
407 | struct btrfs_ioctl_balance_args { |
408 | __u64 flags; /* in/out */ | |
409 | __u64 state; /* out */ | |
410 | ||
411 | struct btrfs_balance_args data; /* in/out */ | |
412 | struct btrfs_balance_args meta; /* in/out */ | |
413 | struct btrfs_balance_args sys; /* in/out */ | |
414 | ||
415 | struct btrfs_balance_progress stat; /* out */ | |
416 | ||
417 | __u64 unused[72]; /* pad to 1k */ | |
418 | }; | |
419 | ||
ac8e9819 CM |
420 | #define BTRFS_INO_LOOKUP_PATH_MAX 4080 |
421 | struct btrfs_ioctl_ino_lookup_args { | |
422 | __u64 treeid; | |
423 | __u64 objectid; | |
424 | char name[BTRFS_INO_LOOKUP_PATH_MAX]; | |
425 | }; | |
426 | ||
23d0b79d TM |
427 | #define BTRFS_INO_LOOKUP_USER_PATH_MAX (4080 - BTRFS_VOL_NAME_MAX - 1) |
428 | struct btrfs_ioctl_ino_lookup_user_args { | |
429 | /* in, inode number containing the subvolume of 'subvolid' */ | |
430 | __u64 dirid; | |
431 | /* in */ | |
432 | __u64 treeid; | |
433 | /* out, name of the subvolume of 'treeid' */ | |
434 | char name[BTRFS_VOL_NAME_MAX + 1]; | |
435 | /* | |
436 | * out, constructed path from the directory with which the ioctl is | |
437 | * called to dirid | |
438 | */ | |
439 | char path[BTRFS_INO_LOOKUP_USER_PATH_MAX]; | |
440 | }; | |
441 | ||
1a63143d | 442 | /* Search criteria for the btrfs SEARCH ioctl family. */ |
ac8e9819 | 443 | struct btrfs_ioctl_search_key { |
1a63143d HK |
444 | /* |
445 | * The tree we're searching in. 1 is the tree of tree roots, 2 is the | |
446 | * extent tree, etc... | |
447 | * | |
448 | * A special tree_id value of 0 will cause a search in the subvolume | |
449 | * tree that the inode which is passed to the ioctl is part of. | |
450 | */ | |
451 | __u64 tree_id; /* in */ | |
ac8e9819 | 452 | |
1a63143d HK |
453 | /* |
454 | * When doing a tree search, we're actually taking a slice from a | |
455 | * linear search space of 136-bit keys. | |
456 | * | |
457 | * A full 136-bit tree key is composed as: | |
458 | * (objectid << 72) + (type << 64) + offset | |
459 | * | |
460 | * The individual min and max values for objectid, type and offset | |
461 | * define the min_key and max_key values for the search range. All | |
462 | * metadata items with a key in the interval [min_key, max_key] will be | |
463 | * returned. | |
464 | * | |
465 | * Additionally, we can filter the items returned on transaction id of | |
466 | * the metadata block they're stored in by specifying a transid range. | |
467 | * Be aware that this transaction id only denotes when the metadata | |
468 | * page that currently contains the item got written the last time as | |
469 | * result of a COW operation. The number does not have any meaning | |
470 | * related to the transaction in which an individual item that is being | |
471 | * returned was created or changed. | |
472 | */ | |
473 | __u64 min_objectid; /* in */ | |
474 | __u64 max_objectid; /* in */ | |
475 | __u64 min_offset; /* in */ | |
476 | __u64 max_offset; /* in */ | |
477 | __u64 min_transid; /* in */ | |
478 | __u64 max_transid; /* in */ | |
479 | __u32 min_type; /* in */ | |
480 | __u32 max_type; /* in */ | |
ac8e9819 CM |
481 | |
482 | /* | |
1a63143d HK |
483 | * input: The maximum amount of results desired. |
484 | * output: The actual amount of items returned, restricted by any of: | |
485 | * - reaching the upper bound of the search range | |
486 | * - reaching the input nr_items amount of items | |
487 | * - completely filling the supplied memory buffer | |
ac8e9819 | 488 | */ |
1a63143d | 489 | __u32 nr_items; /* in/out */ |
ac8e9819 CM |
490 | |
491 | /* align to 64 bits */ | |
492 | __u32 unused; | |
493 | ||
494 | /* some extra for later */ | |
495 | __u64 unused1; | |
496 | __u64 unused2; | |
497 | __u64 unused3; | |
498 | __u64 unused4; | |
499 | }; | |
500 | ||
501 | struct btrfs_ioctl_search_header { | |
502 | __u64 transid; | |
503 | __u64 objectid; | |
504 | __u64 offset; | |
505 | __u32 type; | |
506 | __u32 len; | |
507 | }; | |
508 | ||
509 | #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key)) | |
510 | /* | |
511 | * the buf is an array of search headers where | |
512 | * each header is followed by the actual item | |
513 | * the type field is expanded to 32 bits for alignment | |
514 | */ | |
515 | struct btrfs_ioctl_search_args { | |
516 | struct btrfs_ioctl_search_key key; | |
517 | char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; | |
518 | }; | |
519 | ||
cc68a8a5 GH |
520 | struct btrfs_ioctl_search_args_v2 { |
521 | struct btrfs_ioctl_search_key key; /* in/out - search parameters */ | |
522 | __u64 buf_size; /* in - size of buffer | |
523 | * out - on EOVERFLOW: needed size | |
524 | * to store item */ | |
525 | __u64 buf[0]; /* out - found items */ | |
526 | }; | |
527 | ||
c071fcfd CM |
528 | struct btrfs_ioctl_clone_range_args { |
529 | __s64 src_fd; | |
530 | __u64 src_offset, src_length; | |
531 | __u64 dest_offset; | |
532 | }; | |
533 | ||
33ca9133 JM |
534 | /* |
535 | * flags definition for the defrag range ioctl | |
536 | * | |
537 | * Used by: | |
538 | * struct btrfs_ioctl_defrag_range_args.flags | |
539 | */ | |
1e701a32 CM |
540 | #define BTRFS_DEFRAG_RANGE_COMPRESS 1 |
541 | #define BTRFS_DEFRAG_RANGE_START_IO 2 | |
33ca9133 JM |
542 | struct btrfs_ioctl_defrag_range_args { |
543 | /* start of the defrag operation */ | |
544 | __u64 start; | |
545 | ||
546 | /* number of bytes to defrag, use (u64)-1 to say all */ | |
547 | __u64 len; | |
548 | ||
549 | /* | |
550 | * flags for the operation, which can include turning | |
551 | * on compression for this one defrag | |
552 | */ | |
553 | __u64 flags; | |
554 | ||
555 | /* | |
556 | * any extent bigger than this will be considered | |
557 | * already defragged. Use 0 to take the kernel default | |
558 | * Use 1 to say every single extent must be rewritten | |
559 | */ | |
560 | __u32 extent_thresh; | |
561 | ||
562 | /* | |
563 | * which compression method to use if turning on compression | |
564 | * for this defrag operation. If unspecified, zlib will | |
565 | * be used | |
566 | */ | |
567 | __u32 compress_type; | |
568 | ||
569 | /* spare for later */ | |
570 | __u32 unused[4]; | |
571 | }; | |
572 | ||
1e701a32 | 573 | |
416161db MF |
574 | #define BTRFS_SAME_DATA_DIFFERS 1 |
575 | /* For extent-same ioctl */ | |
576 | struct btrfs_ioctl_same_extent_info { | |
577 | __s64 fd; /* in - destination file */ | |
578 | __u64 logical_offset; /* in - start of extent in destination */ | |
579 | __u64 bytes_deduped; /* out - total # of bytes we were able | |
580 | * to dedupe from this file */ | |
581 | /* status of this dedupe operation: | |
582 | * 0 if dedup succeeds | |
583 | * < 0 for error | |
584 | * == BTRFS_SAME_DATA_DIFFERS if data differs | |
585 | */ | |
586 | __s32 status; /* out - see above description */ | |
587 | __u32 reserved; | |
588 | }; | |
589 | ||
590 | struct btrfs_ioctl_same_args { | |
591 | __u64 logical_offset; /* in - start of extent in source */ | |
592 | __u64 length; /* in - length of extent */ | |
593 | __u16 dest_count; /* in - total elements in info array */ | |
594 | __u16 reserved1; | |
595 | __u32 reserved2; | |
596 | struct btrfs_ioctl_same_extent_info info[0]; | |
597 | }; | |
598 | ||
1406e432 | 599 | struct btrfs_ioctl_space_info { |
ce769a29 SW |
600 | __u64 flags; |
601 | __u64 total_bytes; | |
602 | __u64 used_bytes; | |
1406e432 JB |
603 | }; |
604 | ||
605 | struct btrfs_ioctl_space_args { | |
ce769a29 SW |
606 | __u64 space_slots; |
607 | __u64 total_spaces; | |
1406e432 JB |
608 | struct btrfs_ioctl_space_info spaces[0]; |
609 | }; | |
1e701a32 | 610 | |
a542ad1b JS |
611 | struct btrfs_data_container { |
612 | __u32 bytes_left; /* out -- bytes not needed to deliver output */ | |
613 | __u32 bytes_missing; /* out -- additional bytes needed for result */ | |
614 | __u32 elem_cnt; /* out */ | |
615 | __u32 elem_missed; /* out */ | |
740c3d22 | 616 | __u64 val[0]; /* out */ |
a542ad1b JS |
617 | }; |
618 | ||
d7728c96 JS |
619 | struct btrfs_ioctl_ino_path_args { |
620 | __u64 inum; /* in */ | |
d04b1deb | 621 | __u64 size; /* in */ |
d7728c96 | 622 | __u64 reserved[4]; |
740c3d22 CM |
623 | /* struct btrfs_data_container *fspath; out */ |
624 | __u64 fspath; /* out */ | |
d7728c96 JS |
625 | }; |
626 | ||
627 | struct btrfs_ioctl_logical_ino_args { | |
628 | __u64 logical; /* in */ | |
d04b1deb | 629 | __u64 size; /* in */ |
d24a67b2 ZB |
630 | __u64 reserved[3]; /* must be 0 for now */ |
631 | __u64 flags; /* in, v2 only */ | |
740c3d22 CM |
632 | /* struct btrfs_data_container *inodes; out */ |
633 | __u64 inodes; | |
d7728c96 | 634 | }; |
d24a67b2 ZB |
635 | /* Return every ref to the extent, not just those containing logical block. |
636 | * Requires logical == extent bytenr. */ | |
637 | #define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0) | |
d7728c96 | 638 | |
442a4f63 SB |
639 | enum btrfs_dev_stat_values { |
640 | /* disk I/O failure stats */ | |
641 | BTRFS_DEV_STAT_WRITE_ERRS, /* EIO or EREMOTEIO from lower layers */ | |
642 | BTRFS_DEV_STAT_READ_ERRS, /* EIO or EREMOTEIO from lower layers */ | |
643 | BTRFS_DEV_STAT_FLUSH_ERRS, /* EIO or EREMOTEIO from lower layers */ | |
644 | ||
645 | /* stats for indirect indications for I/O failures */ | |
646 | BTRFS_DEV_STAT_CORRUPTION_ERRS, /* checksum error, bytenr error or | |
647 | * contents is illegal: this is an | |
648 | * indication that the block was damaged | |
649 | * during read or write, or written to | |
650 | * wrong location or read from wrong | |
651 | * location */ | |
652 | BTRFS_DEV_STAT_GENERATION_ERRS, /* an indication that blocks have not | |
653 | * been written */ | |
654 | ||
655 | BTRFS_DEV_STAT_VALUES_MAX | |
656 | }; | |
657 | ||
b27f7c0c DS |
658 | /* Reset statistics after reading; needs SYS_ADMIN capability */ |
659 | #define BTRFS_DEV_STATS_RESET (1ULL << 0) | |
660 | ||
c11d2c23 SB |
661 | struct btrfs_ioctl_get_dev_stats { |
662 | __u64 devid; /* in */ | |
663 | __u64 nr_items; /* in/out */ | |
b27f7c0c | 664 | __u64 flags; /* in/out */ |
c11d2c23 SB |
665 | |
666 | /* out values: */ | |
667 | __u64 values[BTRFS_DEV_STAT_VALUES_MAX]; | |
668 | ||
73a3ca20 HK |
669 | /* |
670 | * This pads the struct to 1032 bytes. It was originally meant to pad to | |
671 | * 1024 bytes, but when adding the flags field, the padding calculation | |
672 | * was not adjusted. | |
673 | */ | |
674 | __u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX]; | |
c11d2c23 SB |
675 | }; |
676 | ||
5d13a37b AJ |
677 | #define BTRFS_QUOTA_CTL_ENABLE 1 |
678 | #define BTRFS_QUOTA_CTL_DISABLE 2 | |
2f232036 | 679 | #define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3 |
5d13a37b AJ |
680 | struct btrfs_ioctl_quota_ctl_args { |
681 | __u64 cmd; | |
682 | __u64 status; | |
683 | }; | |
684 | ||
2f232036 JS |
685 | struct btrfs_ioctl_quota_rescan_args { |
686 | __u64 flags; | |
687 | __u64 progress; | |
688 | __u64 reserved[6]; | |
689 | }; | |
690 | ||
5d13a37b AJ |
691 | struct btrfs_ioctl_qgroup_assign_args { |
692 | __u64 assign; | |
693 | __u64 src; | |
694 | __u64 dst; | |
695 | }; | |
696 | ||
697 | struct btrfs_ioctl_qgroup_create_args { | |
698 | __u64 create; | |
699 | __u64 qgroupid; | |
700 | }; | |
8ea05e3a AB |
701 | struct btrfs_ioctl_timespec { |
702 | __u64 sec; | |
703 | __u32 nsec; | |
704 | }; | |
705 | ||
706 | struct btrfs_ioctl_received_subvol_args { | |
707 | char uuid[BTRFS_UUID_SIZE]; /* in */ | |
708 | __u64 stransid; /* in */ | |
709 | __u64 rtransid; /* out */ | |
710 | struct btrfs_ioctl_timespec stime; /* in */ | |
711 | struct btrfs_ioctl_timespec rtime; /* out */ | |
712 | __u64 flags; /* in */ | |
713 | __u64 reserved[16]; /* in */ | |
714 | }; | |
715 | ||
cb95e7bf MF |
716 | /* |
717 | * Caller doesn't want file data in the send stream, even if the | |
718 | * search of clone sources doesn't find an extent. UPDATE_EXTENT | |
719 | * commands will be sent instead of WRITE commands. | |
720 | */ | |
c2c71324 SB |
721 | #define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1 |
722 | ||
723 | /* | |
724 | * Do not add the leading stream header. Used when multiple snapshots | |
725 | * are sent back to back. | |
726 | */ | |
727 | #define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2 | |
728 | ||
729 | /* | |
730 | * Omit the command at the end of the stream that indicated the end | |
731 | * of the stream. This option is used when multiple snapshots are | |
732 | * sent back to back. | |
733 | */ | |
734 | #define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4 | |
735 | ||
736 | #define BTRFS_SEND_FLAG_MASK \ | |
737 | (BTRFS_SEND_FLAG_NO_FILE_DATA | \ | |
738 | BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \ | |
739 | BTRFS_SEND_FLAG_OMIT_END_CMD) | |
cb95e7bf | 740 | |
31db9f7c AB |
741 | struct btrfs_ioctl_send_args { |
742 | __s64 send_fd; /* in */ | |
743 | __u64 clone_sources_count; /* in */ | |
744 | __u64 __user *clone_sources; /* in */ | |
745 | __u64 parent_root; /* in */ | |
746 | __u64 flags; /* in */ | |
747 | __u64 reserved[4]; /* in */ | |
748 | }; | |
5d13a37b | 749 | |
b64ec075 TM |
750 | /* |
751 | * Information about a fs tree root. | |
752 | * | |
753 | * All items are filled by the ioctl | |
754 | */ | |
755 | struct btrfs_ioctl_get_subvol_info_args { | |
756 | /* Id of this subvolume */ | |
757 | __u64 treeid; | |
758 | ||
759 | /* Name of this subvolume, used to get the real name at mount point */ | |
760 | char name[BTRFS_VOL_NAME_MAX + 1]; | |
761 | ||
762 | /* | |
763 | * Id of the subvolume which contains this subvolume. | |
764 | * Zero for top-level subvolume or a deleted subvolume. | |
765 | */ | |
766 | __u64 parent_id; | |
767 | ||
768 | /* | |
769 | * Inode number of the directory which contains this subvolume. | |
770 | * Zero for top-level subvolume or a deleted subvolume | |
771 | */ | |
772 | __u64 dirid; | |
773 | ||
774 | /* Latest transaction id of this subvolume */ | |
775 | __u64 generation; | |
776 | ||
777 | /* Flags of this subvolume */ | |
778 | __u64 flags; | |
779 | ||
780 | /* UUID of this subvolume */ | |
781 | __u8 uuid[BTRFS_UUID_SIZE]; | |
782 | ||
783 | /* | |
784 | * UUID of the subvolume of which this subvolume is a snapshot. | |
785 | * All zero for a non-snapshot subvolume. | |
786 | */ | |
787 | __u8 parent_uuid[BTRFS_UUID_SIZE]; | |
788 | ||
789 | /* | |
790 | * UUID of the subvolume from which this subvolume was received. | |
791 | * All zero for non-received subvolume. | |
792 | */ | |
793 | __u8 received_uuid[BTRFS_UUID_SIZE]; | |
794 | ||
795 | /* Transaction id indicating when change/create/send/receive happened */ | |
796 | __u64 ctransid; | |
797 | __u64 otransid; | |
798 | __u64 stransid; | |
799 | __u64 rtransid; | |
800 | /* Time corresponding to c/o/s/rtransid */ | |
801 | struct btrfs_ioctl_timespec ctime; | |
802 | struct btrfs_ioctl_timespec otime; | |
803 | struct btrfs_ioctl_timespec stime; | |
804 | struct btrfs_ioctl_timespec rtime; | |
805 | ||
806 | /* Must be zero */ | |
807 | __u64 reserved[8]; | |
808 | }; | |
809 | ||
42e4b520 TM |
810 | #define BTRFS_MAX_ROOTREF_BUFFER_NUM 255 |
811 | struct btrfs_ioctl_get_subvol_rootref_args { | |
812 | /* in/out, minimum id of rootref's treeid to be searched */ | |
813 | __u64 min_treeid; | |
814 | ||
815 | /* out */ | |
816 | struct { | |
817 | __u64 treeid; | |
818 | __u64 dirid; | |
819 | } rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM]; | |
820 | ||
821 | /* out, number of found items */ | |
822 | __u8 num_items; | |
823 | __u8 align[7]; | |
824 | }; | |
825 | ||
183860f6 AJ |
826 | /* Error codes as returned by the kernel */ |
827 | enum btrfs_err_code { | |
eb710b15 | 828 | BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1, |
183860f6 AJ |
829 | BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET, |
830 | BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET, | |
831 | BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET, | |
832 | BTRFS_ERROR_DEV_TGT_REPLACE, | |
833 | BTRFS_ERROR_DEV_MISSING_NOT_FOUND, | |
834 | BTRFS_ERROR_DEV_ONLY_WRITABLE, | |
47e6f742 DS |
835 | BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS, |
836 | BTRFS_ERROR_DEV_RAID1C3_MIN_NOT_MET, | |
8d6fac00 | 837 | BTRFS_ERROR_DEV_RAID1C4_MIN_NOT_MET, |
183860f6 | 838 | }; |
183860f6 | 839 | |
c5739bba CM |
840 | #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ |
841 | struct btrfs_ioctl_vol_args) | |
6702ed49 | 842 | #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ |
8352d8a4 | 843 | struct btrfs_ioctl_vol_args) |
edbd8d4e CM |
844 | #define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \ |
845 | struct btrfs_ioctl_vol_args) | |
8a4b83cc CM |
846 | #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \ |
847 | struct btrfs_ioctl_vol_args) | |
228a73ab AJ |
848 | #define BTRFS_IOC_FORGET_DEV _IOW(BTRFS_IOCTL_MAGIC, 5, \ |
849 | struct btrfs_ioctl_vol_args) | |
6bf13c0c SW |
850 | /* trans start and trans end are dangerous, and only for |
851 | * use by applications that know how to avoid the | |
852 | * resulting deadlocks | |
853 | */ | |
854 | #define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6) | |
855 | #define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7) | |
856 | #define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8) | |
857 | ||
f2eb0a24 | 858 | #define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int) |
788f20eb CM |
859 | #define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \ |
860 | struct btrfs_ioctl_vol_args) | |
861 | #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \ | |
862 | struct btrfs_ioctl_vol_args) | |
863 | #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \ | |
864 | struct btrfs_ioctl_vol_args) | |
c5c9cd4d SW |
865 | |
866 | #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \ | |
867 | struct btrfs_ioctl_clone_range_args) | |
868 | ||
3de4586c CM |
869 | #define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \ |
870 | struct btrfs_ioctl_vol_args) | |
76dda93c YZ |
871 | #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ |
872 | struct btrfs_ioctl_vol_args) | |
1e701a32 CM |
873 | #define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \ |
874 | struct btrfs_ioctl_defrag_range_args) | |
ac8e9819 CM |
875 | #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ |
876 | struct btrfs_ioctl_search_args) | |
cc68a8a5 GH |
877 | #define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \ |
878 | struct btrfs_ioctl_search_args_v2) | |
ac8e9819 CM |
879 | #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ |
880 | struct btrfs_ioctl_ino_lookup_args) | |
68b823ef | 881 | #define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64) |
1406e432 JB |
882 | #define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \ |
883 | struct btrfs_ioctl_space_args) | |
46204592 SW |
884 | #define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64) |
885 | #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64) | |
fdfb1e4f LZ |
886 | #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \ |
887 | struct btrfs_ioctl_vol_args_v2) | |
6f72c7e2 AJ |
888 | #define BTRFS_IOC_SUBVOL_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 24, \ |
889 | struct btrfs_ioctl_vol_args_v2) | |
d3a94048 | 890 | #define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64) |
0caa102d | 891 | #define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64) |
475f6387 JS |
892 | #define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \ |
893 | struct btrfs_ioctl_scrub_args) | |
894 | #define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28) | |
895 | #define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, \ | |
896 | struct btrfs_ioctl_scrub_args) | |
897 | #define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \ | |
898 | struct btrfs_ioctl_dev_info_args) | |
899 | #define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \ | |
900 | struct btrfs_ioctl_fs_info_args) | |
c9e9f97b ID |
901 | #define BTRFS_IOC_BALANCE_V2 _IOWR(BTRFS_IOCTL_MAGIC, 32, \ |
902 | struct btrfs_ioctl_balance_args) | |
837d5b6e | 903 | #define BTRFS_IOC_BALANCE_CTL _IOW(BTRFS_IOCTL_MAGIC, 33, int) |
19a39dce ID |
904 | #define BTRFS_IOC_BALANCE_PROGRESS _IOR(BTRFS_IOCTL_MAGIC, 34, \ |
905 | struct btrfs_ioctl_balance_args) | |
d7728c96 JS |
906 | #define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, \ |
907 | struct btrfs_ioctl_ino_path_args) | |
908 | #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \ | |
7af7c616 | 909 | struct btrfs_ioctl_logical_ino_args) |
8ea05e3a AB |
910 | #define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \ |
911 | struct btrfs_ioctl_received_subvol_args) | |
31db9f7c | 912 | #define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args) |
02db0844 JB |
913 | #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \ |
914 | struct btrfs_ioctl_vol_args) | |
5d13a37b AJ |
915 | #define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \ |
916 | struct btrfs_ioctl_quota_ctl_args) | |
917 | #define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \ | |
918 | struct btrfs_ioctl_qgroup_assign_args) | |
919 | #define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \ | |
920 | struct btrfs_ioctl_qgroup_create_args) | |
921 | #define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \ | |
922 | struct btrfs_ioctl_qgroup_limit_args) | |
2f232036 JS |
923 | #define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \ |
924 | struct btrfs_ioctl_quota_rescan_args) | |
925 | #define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \ | |
926 | struct btrfs_ioctl_quota_rescan_args) | |
57254b6e | 927 | #define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) |
40cf931f ES |
928 | #define BTRFS_IOC_GET_FSLABEL FS_IOC_GETFSLABEL |
929 | #define BTRFS_IOC_SET_FSLABEL FS_IOC_SETFSLABEL | |
c11d2c23 SB |
930 | #define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \ |
931 | struct btrfs_ioctl_get_dev_stats) | |
e93c89c1 SB |
932 | #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \ |
933 | struct btrfs_ioctl_dev_replace_args) | |
416161db MF |
934 | #define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \ |
935 | struct btrfs_ioctl_same_args) | |
2eaa055f JM |
936 | #define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ |
937 | struct btrfs_ioctl_feature_flags) | |
938 | #define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \ | |
939 | struct btrfs_ioctl_feature_flags[2]) | |
940 | #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ | |
941 | struct btrfs_ioctl_feature_flags[3]) | |
6b526ed7 AJ |
942 | #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \ |
943 | struct btrfs_ioctl_vol_args_v2) | |
d24a67b2 ZB |
944 | #define BTRFS_IOC_LOGICAL_INO_V2 _IOWR(BTRFS_IOCTL_MAGIC, 59, \ |
945 | struct btrfs_ioctl_logical_ino_args) | |
b64ec075 TM |
946 | #define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, \ |
947 | struct btrfs_ioctl_get_subvol_info_args) | |
42e4b520 TM |
948 | #define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, \ |
949 | struct btrfs_ioctl_get_subvol_rootref_args) | |
23d0b79d TM |
950 | #define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, \ |
951 | struct btrfs_ioctl_ino_lookup_user_args) | |
416161db | 952 | |
55e301fd | 953 | #endif /* _UAPI_LINUX_BTRFS_H */ |