1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef _UAPI_LINUX_BTRFS_H
21 #define _UAPI_LINUX_BTRFS_H
22 #include <linux/types.h>
23 #include <linux/ioctl.h>
24
25 #define BTRFS_IOCTL_MAGIC 0x94
26 #define BTRFS_VOL_NAME_MAX 255
27 #define BTRFS_LABEL_SIZE 256
28
29
30 #define BTRFS_PATH_NAME_MAX 4087
31 struct btrfs_ioctl_vol_args {
32 __s64 fd;
33 char name[BTRFS_PATH_NAME_MAX + 1];
34 };
35
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)
42
43 #define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3)
44
45 #define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED \
46 (BTRFS_SUBVOL_CREATE_ASYNC | \
47 BTRFS_SUBVOL_RDONLY | \
48 BTRFS_SUBVOL_QGROUP_INHERIT | \
49 BTRFS_DEVICE_SPEC_BY_ID)
50
51 #define BTRFS_FSID_SIZE 16
52 #define BTRFS_UUID_SIZE 16
53 #define BTRFS_UUID_UNPARSED_SIZE 37
54
55
56
57
58
59
60
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)
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
77
78
79
80
81
82
83 #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
84
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
99
100
101
102
103
104
105
106
107
108
109
110 struct btrfs_ioctl_vol_args_v2 {
111 __s64 fd;
112 __u64 transid;
113 __u64 flags;
114 union {
115 struct {
116 __u64 size;
117 struct btrfs_qgroup_inherit __user *qgroup_inherit;
118 };
119 __u64 unused[4];
120 };
121 union {
122 char name[BTRFS_SUBVOL_NAME_MAX + 1];
123 __u64 devid;
124 };
125 };
126
127
128
129
130
131 struct btrfs_scrub_progress {
132 __u64 data_extents_scrubbed;
133 __u64 tree_extents_scrubbed;
134 __u64 data_bytes_scrubbed;
135 __u64 tree_bytes_scrubbed;
136 __u64 read_errors;
137 __u64 csum_errors;
138 __u64 verify_errors;
139
140
141
142 __u64 no_csum;
143
144
145 __u64 csum_discards;
146
147 __u64 super_errors;
148 __u64 malloc_errors;
149
150
151 __u64 uncorrectable_errors;
152
153
154 __u64 corrected_errors;
155 __u64 last_physical;
156
157
158 __u64 unverified_errors;
159
160
161
162 };
163
164 #define BTRFS_SCRUB_READONLY 1
165 struct btrfs_ioctl_scrub_args {
166 __u64 devid;
167 __u64 start;
168 __u64 end;
169 __u64 flags;
170 struct btrfs_scrub_progress progress;
171
172 __u64 unused[(1024-32-sizeof(struct btrfs_scrub_progress))/8];
173 };
174
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;
179 __u64 cont_reading_from_srcdev_mode;
180
181 __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1];
182 __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1];
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;
192 __u64 progress_1000;
193 __u64 time_started;
194 __u64 time_stopped;
195 __u64 num_write_errors;
196 __u64 num_uncorrectable_read_errors;
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
205 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3
206 struct btrfs_ioctl_dev_replace_args {
207 __u64 cmd;
208 __u64 result;
209
210 union {
211 struct btrfs_ioctl_dev_replace_start_params start;
212 struct btrfs_ioctl_dev_replace_status_params status;
213 };
214
215 __u64 spare[64];
216 };
217
218 struct btrfs_ioctl_dev_info_args {
219 __u64 devid;
220 __u8 uuid[BTRFS_UUID_SIZE];
221 __u64 bytes_used;
222 __u64 total_bytes;
223 __u64 unused[379];
224 __u8 path[BTRFS_DEVICE_PATH_NAME_MAX];
225 };
226
227 struct btrfs_ioctl_fs_info_args {
228 __u64 max_id;
229 __u64 num_devices;
230 __u8 fsid[BTRFS_FSID_SIZE];
231 __u32 nodesize;
232 __u32 sectorsize;
233 __u32 clone_alignment;
234 __u32 reserved32;
235 __u64 reserved[122];
236 };
237
238
239
240
241
242
243
244 #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0)
245
246
247
248
249
250
251
252
253
254 #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1)
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)
260 #define BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD (1ULL << 4)
261
262
263
264
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)
272 #define BTRFS_FEATURE_INCOMPAT_METADATA_UUID (1ULL << 10)
273
274 struct btrfs_ioctl_feature_flags {
275 __u64 compat_flags;
276 __u64 compat_ro_flags;
277 __u64 incompat_flags;
278 };
279
280
281 #define BTRFS_BALANCE_CTL_PAUSE 1
282 #define BTRFS_BALANCE_CTL_CANCEL 2
283
284
285
286
287
288 struct btrfs_balance_args {
289 __u64 profiles;
290 union {
291 __u64 usage;
292 struct {
293 __u32 usage_min;
294 __u32 usage_max;
295 };
296 };
297 __u64 devid;
298 __u64 pstart;
299 __u64 pend;
300 __u64 vstart;
301 __u64 vend;
302
303 __u64 target;
304
305 __u64 flags;
306
307
308
309
310
311
312 union {
313 __u64 limit;
314 struct {
315 __u32 limit_min;
316 __u32 limit_max;
317 };
318 };
319
320
321
322
323
324 __u32 stripes_min;
325 __u32 stripes_max;
326
327 __u64 unused[6];
328 } __attribute__ ((__packed__));
329
330
331 struct btrfs_balance_progress {
332 __u64 expected;
333
334 __u64 considered;
335 __u64 completed;
336 };
337
338
339
340
341
342
343
344
345
346
347 #define BTRFS_BALANCE_DATA (1ULL << 0)
348 #define BTRFS_BALANCE_SYSTEM (1ULL << 1)
349 #define BTRFS_BALANCE_METADATA (1ULL << 2)
350
351 #define BTRFS_BALANCE_TYPE_MASK (BTRFS_BALANCE_DATA | \
352 BTRFS_BALANCE_SYSTEM | \
353 BTRFS_BALANCE_METADATA)
354
355 #define BTRFS_BALANCE_FORCE (1ULL << 3)
356 #define BTRFS_BALANCE_RESUME (1ULL << 4)
357
358
359
360
361
362
363
364
365
366 #define BTRFS_BALANCE_ARGS_PROFILES (1ULL << 0)
367 #define BTRFS_BALANCE_ARGS_USAGE (1ULL << 1)
368 #define BTRFS_BALANCE_ARGS_DEVID (1ULL << 2)
369 #define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3)
370 #define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4)
371 #define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5)
372 #define BTRFS_BALANCE_ARGS_LIMIT_RANGE (1ULL << 6)
373 #define BTRFS_BALANCE_ARGS_STRIPES_RANGE (1ULL << 7)
374 #define BTRFS_BALANCE_ARGS_USAGE_RANGE (1ULL << 10)
375
376 #define BTRFS_BALANCE_ARGS_MASK \
377 (BTRFS_BALANCE_ARGS_PROFILES | \
378 BTRFS_BALANCE_ARGS_USAGE | \
379 BTRFS_BALANCE_ARGS_DEVID | \
380 BTRFS_BALANCE_ARGS_DRANGE | \
381 BTRFS_BALANCE_ARGS_VRANGE | \
382 BTRFS_BALANCE_ARGS_LIMIT | \
383 BTRFS_BALANCE_ARGS_LIMIT_RANGE | \
384 BTRFS_BALANCE_ARGS_STRIPES_RANGE | \
385 BTRFS_BALANCE_ARGS_USAGE_RANGE)
386
387
388
389
390
391
392 #define BTRFS_BALANCE_ARGS_CONVERT (1ULL << 8)
393 #define BTRFS_BALANCE_ARGS_SOFT (1ULL << 9)
394
395
396
397
398
399
400
401
402 #define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0)
403 #define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1)
404 #define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2)
405
406 struct btrfs_ioctl_balance_args {
407 __u64 flags;
408 __u64 state;
409
410 struct btrfs_balance_args data;
411 struct btrfs_balance_args meta;
412 struct btrfs_balance_args sys;
413
414 struct btrfs_balance_progress stat;
415
416 __u64 unused[72];
417 };
418
419 #define BTRFS_INO_LOOKUP_PATH_MAX 4080
420 struct btrfs_ioctl_ino_lookup_args {
421 __u64 treeid;
422 __u64 objectid;
423 char name[BTRFS_INO_LOOKUP_PATH_MAX];
424 };
425
426 #define BTRFS_INO_LOOKUP_USER_PATH_MAX (4080 - BTRFS_VOL_NAME_MAX - 1)
427 struct btrfs_ioctl_ino_lookup_user_args {
428
429 __u64 dirid;
430
431 __u64 treeid;
432
433 char name[BTRFS_VOL_NAME_MAX + 1];
434
435
436
437
438 char path[BTRFS_INO_LOOKUP_USER_PATH_MAX];
439 };
440
441
442 struct btrfs_ioctl_search_key {
443
444
445
446
447
448
449
450 __u64 tree_id;
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472 __u64 min_objectid;
473 __u64 max_objectid;
474 __u64 min_offset;
475 __u64 max_offset;
476 __u64 min_transid;
477 __u64 max_transid;
478 __u32 min_type;
479 __u32 max_type;
480
481
482
483
484
485
486
487
488 __u32 nr_items;
489
490
491 __u32 unused;
492
493
494 __u64 unused1;
495 __u64 unused2;
496 __u64 unused3;
497 __u64 unused4;
498 };
499
500 struct btrfs_ioctl_search_header {
501 __u64 transid;
502 __u64 objectid;
503 __u64 offset;
504 __u32 type;
505 __u32 len;
506 };
507
508 #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key))
509
510
511
512
513
514 struct btrfs_ioctl_search_args {
515 struct btrfs_ioctl_search_key key;
516 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
517 };
518
519 struct btrfs_ioctl_search_args_v2 {
520 struct btrfs_ioctl_search_key key;
521 __u64 buf_size;
522
523
524 __u64 buf[0];
525 };
526
527 struct btrfs_ioctl_clone_range_args {
528 __s64 src_fd;
529 __u64 src_offset, src_length;
530 __u64 dest_offset;
531 };
532
533
534
535
536
537
538
539 #define BTRFS_DEFRAG_RANGE_COMPRESS 1
540 #define BTRFS_DEFRAG_RANGE_START_IO 2
541 struct btrfs_ioctl_defrag_range_args {
542
543 __u64 start;
544
545
546 __u64 len;
547
548
549
550
551
552 __u64 flags;
553
554
555
556
557
558
559 __u32 extent_thresh;
560
561
562
563
564
565
566 __u32 compress_type;
567
568
569 __u32 unused[4];
570 };
571
572
573 #define BTRFS_SAME_DATA_DIFFERS 1
574
575 struct btrfs_ioctl_same_extent_info {
576 __s64 fd;
577 __u64 logical_offset;
578 __u64 bytes_deduped;
579
580
581
582
583
584
585 __s32 status;
586 __u32 reserved;
587 };
588
589 struct btrfs_ioctl_same_args {
590 __u64 logical_offset;
591 __u64 length;
592 __u16 dest_count;
593 __u16 reserved1;
594 __u32 reserved2;
595 struct btrfs_ioctl_same_extent_info info[0];
596 };
597
598 struct btrfs_ioctl_space_info {
599 __u64 flags;
600 __u64 total_bytes;
601 __u64 used_bytes;
602 };
603
604 struct btrfs_ioctl_space_args {
605 __u64 space_slots;
606 __u64 total_spaces;
607 struct btrfs_ioctl_space_info spaces[0];
608 };
609
610 struct btrfs_data_container {
611 __u32 bytes_left;
612 __u32 bytes_missing;
613 __u32 elem_cnt;
614 __u32 elem_missed;
615 __u64 val[0];
616 };
617
618 struct btrfs_ioctl_ino_path_args {
619 __u64 inum;
620 __u64 size;
621 __u64 reserved[4];
622
623 __u64 fspath;
624 };
625
626 struct btrfs_ioctl_logical_ino_args {
627 __u64 logical;
628 __u64 size;
629 __u64 reserved[3];
630 __u64 flags;
631
632 __u64 inodes;
633 };
634
635
636 #define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0)
637
638 enum btrfs_dev_stat_values {
639
640 BTRFS_DEV_STAT_WRITE_ERRS,
641 BTRFS_DEV_STAT_READ_ERRS,
642 BTRFS_DEV_STAT_FLUSH_ERRS,
643
644
645 BTRFS_DEV_STAT_CORRUPTION_ERRS,
646
647
648
649
650
651 BTRFS_DEV_STAT_GENERATION_ERRS,
652
653
654 BTRFS_DEV_STAT_VALUES_MAX
655 };
656
657
658 #define BTRFS_DEV_STATS_RESET (1ULL << 0)
659
660 struct btrfs_ioctl_get_dev_stats {
661 __u64 devid;
662 __u64 nr_items;
663 __u64 flags;
664
665
666 __u64 values[BTRFS_DEV_STAT_VALUES_MAX];
667
668
669
670
671
672
673 __u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
674 };
675
676 #define BTRFS_QUOTA_CTL_ENABLE 1
677 #define BTRFS_QUOTA_CTL_DISABLE 2
678 #define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
679 struct btrfs_ioctl_quota_ctl_args {
680 __u64 cmd;
681 __u64 status;
682 };
683
684 struct btrfs_ioctl_quota_rescan_args {
685 __u64 flags;
686 __u64 progress;
687 __u64 reserved[6];
688 };
689
690 struct btrfs_ioctl_qgroup_assign_args {
691 __u64 assign;
692 __u64 src;
693 __u64 dst;
694 };
695
696 struct btrfs_ioctl_qgroup_create_args {
697 __u64 create;
698 __u64 qgroupid;
699 };
700 struct btrfs_ioctl_timespec {
701 __u64 sec;
702 __u32 nsec;
703 };
704
705 struct btrfs_ioctl_received_subvol_args {
706 char uuid[BTRFS_UUID_SIZE];
707 __u64 stransid;
708 __u64 rtransid;
709 struct btrfs_ioctl_timespec stime;
710 struct btrfs_ioctl_timespec rtime;
711 __u64 flags;
712 __u64 reserved[16];
713 };
714
715
716
717
718
719
720 #define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1
721
722
723
724
725
726 #define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2
727
728
729
730
731
732
733 #define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4
734
735 #define BTRFS_SEND_FLAG_MASK \
736 (BTRFS_SEND_FLAG_NO_FILE_DATA | \
737 BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \
738 BTRFS_SEND_FLAG_OMIT_END_CMD)
739
740 struct btrfs_ioctl_send_args {
741 __s64 send_fd;
742 __u64 clone_sources_count;
743 __u64 __user *clone_sources;
744 __u64 parent_root;
745 __u64 flags;
746 __u64 reserved[4];
747 };
748
749
750
751
752
753
754 struct btrfs_ioctl_get_subvol_info_args {
755
756 __u64 treeid;
757
758
759 char name[BTRFS_VOL_NAME_MAX + 1];
760
761
762
763
764
765 __u64 parent_id;
766
767
768
769
770
771 __u64 dirid;
772
773
774 __u64 generation;
775
776
777 __u64 flags;
778
779
780 __u8 uuid[BTRFS_UUID_SIZE];
781
782
783
784
785
786 __u8 parent_uuid[BTRFS_UUID_SIZE];
787
788
789
790
791
792 __u8 received_uuid[BTRFS_UUID_SIZE];
793
794
795 __u64 ctransid;
796 __u64 otransid;
797 __u64 stransid;
798 __u64 rtransid;
799
800 struct btrfs_ioctl_timespec ctime;
801 struct btrfs_ioctl_timespec otime;
802 struct btrfs_ioctl_timespec stime;
803 struct btrfs_ioctl_timespec rtime;
804
805
806 __u64 reserved[8];
807 };
808
809 #define BTRFS_MAX_ROOTREF_BUFFER_NUM 255
810 struct btrfs_ioctl_get_subvol_rootref_args {
811
812 __u64 min_treeid;
813
814
815 struct {
816 __u64 treeid;
817 __u64 dirid;
818 } rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM];
819
820
821 __u8 num_items;
822 __u8 align[7];
823 };
824
825
826 enum btrfs_err_code {
827 BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1,
828 BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
829 BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET,
830 BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET,
831 BTRFS_ERROR_DEV_TGT_REPLACE,
832 BTRFS_ERROR_DEV_MISSING_NOT_FOUND,
833 BTRFS_ERROR_DEV_ONLY_WRITABLE,
834 BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
835 };
836
837 #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
838 struct btrfs_ioctl_vol_args)
839 #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
840 struct btrfs_ioctl_vol_args)
841 #define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \
842 struct btrfs_ioctl_vol_args)
843 #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \
844 struct btrfs_ioctl_vol_args)
845 #define BTRFS_IOC_FORGET_DEV _IOW(BTRFS_IOCTL_MAGIC, 5, \
846 struct btrfs_ioctl_vol_args)
847
848
849
850
851 #define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6)
852 #define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7)
853 #define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8)
854
855 #define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int)
856 #define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \
857 struct btrfs_ioctl_vol_args)
858 #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \
859 struct btrfs_ioctl_vol_args)
860 #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \
861 struct btrfs_ioctl_vol_args)
862
863 #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \
864 struct btrfs_ioctl_clone_range_args)
865
866 #define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \
867 struct btrfs_ioctl_vol_args)
868 #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \
869 struct btrfs_ioctl_vol_args)
870 #define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \
871 struct btrfs_ioctl_defrag_range_args)
872 #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \
873 struct btrfs_ioctl_search_args)
874 #define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
875 struct btrfs_ioctl_search_args_v2)
876 #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \
877 struct btrfs_ioctl_ino_lookup_args)
878 #define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
879 #define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \
880 struct btrfs_ioctl_space_args)
881 #define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64)
882 #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64)
883 #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \
884 struct btrfs_ioctl_vol_args_v2)
885 #define BTRFS_IOC_SUBVOL_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 24, \
886 struct btrfs_ioctl_vol_args_v2)
887 #define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64)
888 #define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64)
889 #define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \
890 struct btrfs_ioctl_scrub_args)
891 #define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28)
892 #define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, \
893 struct btrfs_ioctl_scrub_args)
894 #define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \
895 struct btrfs_ioctl_dev_info_args)
896 #define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \
897 struct btrfs_ioctl_fs_info_args)
898 #define BTRFS_IOC_BALANCE_V2 _IOWR(BTRFS_IOCTL_MAGIC, 32, \
899 struct btrfs_ioctl_balance_args)
900 #define BTRFS_IOC_BALANCE_CTL _IOW(BTRFS_IOCTL_MAGIC, 33, int)
901 #define BTRFS_IOC_BALANCE_PROGRESS _IOR(BTRFS_IOCTL_MAGIC, 34, \
902 struct btrfs_ioctl_balance_args)
903 #define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, \
904 struct btrfs_ioctl_ino_path_args)
905 #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \
906 struct btrfs_ioctl_logical_ino_args)
907 #define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
908 struct btrfs_ioctl_received_subvol_args)
909 #define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args)
910 #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \
911 struct btrfs_ioctl_vol_args)
912 #define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \
913 struct btrfs_ioctl_quota_ctl_args)
914 #define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \
915 struct btrfs_ioctl_qgroup_assign_args)
916 #define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \
917 struct btrfs_ioctl_qgroup_create_args)
918 #define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \
919 struct btrfs_ioctl_qgroup_limit_args)
920 #define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \
921 struct btrfs_ioctl_quota_rescan_args)
922 #define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
923 struct btrfs_ioctl_quota_rescan_args)
924 #define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
925 #define BTRFS_IOC_GET_FSLABEL FS_IOC_GETFSLABEL
926 #define BTRFS_IOC_SET_FSLABEL FS_IOC_SETFSLABEL
927 #define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \
928 struct btrfs_ioctl_get_dev_stats)
929 #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \
930 struct btrfs_ioctl_dev_replace_args)
931 #define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \
932 struct btrfs_ioctl_same_args)
933 #define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
934 struct btrfs_ioctl_feature_flags)
935 #define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \
936 struct btrfs_ioctl_feature_flags[2])
937 #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
938 struct btrfs_ioctl_feature_flags[3])
939 #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \
940 struct btrfs_ioctl_vol_args_v2)
941 #define BTRFS_IOC_LOGICAL_INO_V2 _IOWR(BTRFS_IOCTL_MAGIC, 59, \
942 struct btrfs_ioctl_logical_ino_args)
943 #define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, \
944 struct btrfs_ioctl_get_subvol_info_args)
945 #define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, \
946 struct btrfs_ioctl_get_subvol_rootref_args)
947 #define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, \
948 struct btrfs_ioctl_ino_lookup_user_args)
949
950 #endif