blob: a3ebc4fdd1eb52479749bcaa44b18db215b882a5 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_LINUX_BTRFS_H
8#define _UAPI_LINUX_BTRFS_H
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08009#ifdef __cplusplus
10extern "C" {
11#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070012#include <linux/types.h>
13#include <linux/ioctl.h>
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080014#include <linux/fs.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070015#define BTRFS_IOCTL_MAGIC 0x94
16#define BTRFS_VOL_NAME_MAX 255
Christopher Ferris106b3a82016-08-24 12:15:38 -070017#define BTRFS_LABEL_SIZE 256
Ben Cheng655a7c02013-10-16 16:09:24 -070018#define BTRFS_PATH_NAME_MAX 4087
Christopher Ferris106b3a82016-08-24 12:15:38 -070019struct btrfs_ioctl_vol_args {
Tao Baod7db5942015-01-28 10:07:51 -080020 __s64 fd;
21 char name[BTRFS_PATH_NAME_MAX + 1];
Ben Cheng655a7c02013-10-16 16:09:24 -070022};
Christopher Ferris106b3a82016-08-24 12:15:38 -070023#define BTRFS_DEVICE_PATH_NAME_MAX 1024
Christopher Ferris76a1d452018-06-27 14:12:29 -070024#define BTRFS_SUBVOL_NAME_MAX 4039
25#define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0)
26#define BTRFS_SUBVOL_RDONLY (1ULL << 1)
27#define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -070028#define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3)
Christopher Ferrisaf09c702020-06-01 20:29:29 -070029#define BTRFS_SUBVOL_SPEC_BY_ID (1ULL << 4)
30#define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED (BTRFS_SUBVOL_RDONLY | BTRFS_SUBVOL_QGROUP_INHERIT | BTRFS_DEVICE_SPEC_BY_ID | BTRFS_SUBVOL_SPEC_BY_ID)
Ben Cheng655a7c02013-10-16 16:09:24 -070031#define BTRFS_FSID_SIZE 16
Ben Cheng655a7c02013-10-16 16:09:24 -070032#define BTRFS_UUID_SIZE 16
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070033#define BTRFS_UUID_UNPARSED_SIZE 37
Christopher Ferris106b3a82016-08-24 12:15:38 -070034#define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0)
35#define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -070036#define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2)
37#define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3)
38#define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4)
39#define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5)
Christopher Ferris106b3a82016-08-24 12:15:38 -070040struct btrfs_qgroup_limit {
Tao Baod7db5942015-01-28 10:07:51 -080041 __u64 flags;
42 __u64 max_rfer;
43 __u64 max_excl;
Christopher Ferris106b3a82016-08-24 12:15:38 -070044 __u64 rsv_rfer;
Tao Baod7db5942015-01-28 10:07:51 -080045 __u64 rsv_excl;
Ben Cheng655a7c02013-10-16 16:09:24 -070046};
Christopher Ferris106b3a82016-08-24 12:15:38 -070047#define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
Christopher Ferris7f4c8372024-06-03 14:22:19 -070048#define BTRFS_QGROUP_INHERIT_FLAGS_SUPP (BTRFS_QGROUP_INHERIT_SET_LIMITS)
Ben Cheng655a7c02013-10-16 16:09:24 -070049struct btrfs_qgroup_inherit {
Tao Baod7db5942015-01-28 10:07:51 -080050 __u64 flags;
Tao Baod7db5942015-01-28 10:07:51 -080051 __u64 num_qgroups;
52 __u64 num_ref_copies;
53 __u64 num_excl_copies;
54 struct btrfs_qgroup_limit lim;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070055 __u64 qgroups[];
Ben Cheng655a7c02013-10-16 16:09:24 -070056};
57struct btrfs_ioctl_qgroup_limit_args {
Tao Baod7db5942015-01-28 10:07:51 -080058 __u64 qgroupid;
Tao Baod7db5942015-01-28 10:07:51 -080059 struct btrfs_qgroup_limit lim;
Ben Cheng655a7c02013-10-16 16:09:24 -070060};
Christopher Ferrisaf09c702020-06-01 20:29:29 -070061#define BTRFS_DEVICE_REMOVE_ARGS_MASK (BTRFS_DEVICE_SPEC_BY_ID)
62#define BTRFS_SUBVOL_CREATE_ARGS_MASK (BTRFS_SUBVOL_RDONLY | BTRFS_SUBVOL_QGROUP_INHERIT)
63#define BTRFS_SUBVOL_DELETE_ARGS_MASK (BTRFS_SUBVOL_SPEC_BY_ID)
Christopher Ferris106b3a82016-08-24 12:15:38 -070064struct btrfs_ioctl_vol_args_v2 {
Tao Baod7db5942015-01-28 10:07:51 -080065 __s64 fd;
66 __u64 transid;
67 __u64 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -070068 union {
Tao Baod7db5942015-01-28 10:07:51 -080069 struct {
70 __u64 size;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -070071 struct btrfs_qgroup_inherit * qgroup_inherit;
Christopher Ferris106b3a82016-08-24 12:15:38 -070072 };
Tao Baod7db5942015-01-28 10:07:51 -080073 __u64 unused[4];
74 };
Christopher Ferris106b3a82016-08-24 12:15:38 -070075 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -070076 char name[BTRFS_SUBVOL_NAME_MAX + 1];
77 __u64 devid;
Christopher Ferrisaf09c702020-06-01 20:29:29 -070078 __u64 subvolid;
Christopher Ferris106b3a82016-08-24 12:15:38 -070079 };
Ben Cheng655a7c02013-10-16 16:09:24 -070080};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070081struct btrfs_scrub_progress {
Tao Baod7db5942015-01-28 10:07:51 -080082 __u64 data_extents_scrubbed;
83 __u64 tree_extents_scrubbed;
84 __u64 data_bytes_scrubbed;
Tao Baod7db5942015-01-28 10:07:51 -080085 __u64 tree_bytes_scrubbed;
86 __u64 read_errors;
87 __u64 csum_errors;
88 __u64 verify_errors;
Tao Baod7db5942015-01-28 10:07:51 -080089 __u64 no_csum;
90 __u64 csum_discards;
91 __u64 super_errors;
92 __u64 malloc_errors;
Tao Baod7db5942015-01-28 10:07:51 -080093 __u64 uncorrectable_errors;
94 __u64 corrected_errors;
95 __u64 last_physical;
96 __u64 unverified_errors;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070097};
Ben Cheng655a7c02013-10-16 16:09:24 -070098#define BTRFS_SCRUB_READONLY 1
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070099#define BTRFS_SCRUB_SUPPORTED_FLAGS (BTRFS_SCRUB_READONLY)
Ben Cheng655a7c02013-10-16 16:09:24 -0700100struct btrfs_ioctl_scrub_args {
Tao Baod7db5942015-01-28 10:07:51 -0800101 __u64 devid;
Tao Baod7db5942015-01-28 10:07:51 -0800102 __u64 start;
103 __u64 end;
104 __u64 flags;
105 struct btrfs_scrub_progress progress;
Tao Baod7db5942015-01-28 10:07:51 -0800106 __u64 unused[(1024 - 32 - sizeof(struct btrfs_scrub_progress)) / 8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700107};
108#define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
109#define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700110struct btrfs_ioctl_dev_replace_start_params {
Tao Baod7db5942015-01-28 10:07:51 -0800111 __u64 srcdevid;
112 __u64 cont_reading_from_srcdev_mode;
113 __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1];
Tao Baod7db5942015-01-28 10:07:51 -0800114 __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1];
Ben Cheng655a7c02013-10-16 16:09:24 -0700115};
116#define BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED 0
117#define BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700118#define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700119#define BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED 3
120#define BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED 4
121struct btrfs_ioctl_dev_replace_status_params {
Tao Baod7db5942015-01-28 10:07:51 -0800122 __u64 replace_state;
123 __u64 progress_1000;
124 __u64 time_started;
125 __u64 time_stopped;
Tao Baod7db5942015-01-28 10:07:51 -0800126 __u64 num_write_errors;
127 __u64 num_uncorrectable_read_errors;
Ben Cheng655a7c02013-10-16 16:09:24 -0700128};
129#define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700130#define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700131#define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2
132#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0
133#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700134#define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800135#define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700136struct btrfs_ioctl_dev_replace_args {
Tao Baod7db5942015-01-28 10:07:51 -0800137 __u64 cmd;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800138 __u64 result;
Tao Baod7db5942015-01-28 10:07:51 -0800139 union {
140 struct btrfs_ioctl_dev_replace_start_params start;
141 struct btrfs_ioctl_dev_replace_status_params status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800142 };
Tao Baod7db5942015-01-28 10:07:51 -0800143 __u64 spare[64];
Ben Cheng655a7c02013-10-16 16:09:24 -0700144};
145struct btrfs_ioctl_dev_info_args {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800146 __u64 devid;
Tao Baod7db5942015-01-28 10:07:51 -0800147 __u8 uuid[BTRFS_UUID_SIZE];
148 __u64 bytes_used;
149 __u64 total_bytes;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000150 __u8 fsid[BTRFS_UUID_SIZE];
151 __u64 unused[377];
Tao Baod7db5942015-01-28 10:07:51 -0800152 __u8 path[BTRFS_DEVICE_PATH_NAME_MAX];
Ben Cheng655a7c02013-10-16 16:09:24 -0700153};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700154#define BTRFS_FS_INFO_FLAG_CSUM_INFO (1 << 0)
155#define BTRFS_FS_INFO_FLAG_GENERATION (1 << 1)
156#define BTRFS_FS_INFO_FLAG_METADATA_UUID (1 << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700157struct btrfs_ioctl_fs_info_args {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800158 __u64 max_id;
Tao Baod7db5942015-01-28 10:07:51 -0800159 __u64 num_devices;
160 __u8 fsid[BTRFS_FSID_SIZE];
161 __u32 nodesize;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800162 __u32 sectorsize;
Tao Baod7db5942015-01-28 10:07:51 -0800163 __u32 clone_alignment;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700164 __u16 csum_type;
165 __u16 csum_size;
166 __u64 flags;
167 __u64 generation;
168 __u8 metadata_uuid[BTRFS_FSID_SIZE];
169 __u8 reserved[944];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800170};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700171#define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800172#define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700173#define BTRFS_FEATURE_COMPAT_RO_VERITY (1ULL << 2)
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000174#define BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE (1ULL << 3)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700175#define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800176#define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700177#define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2)
178#define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3)
Christopher Ferris1308ad32017-11-14 17:32:13 -0800179#define BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD (1ULL << 4)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800180#define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700181#define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6)
182#define BTRFS_FEATURE_INCOMPAT_RAID56 (1ULL << 7)
183#define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA (1ULL << 8)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800184#define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9)
Christopher Ferrisd842e432019-03-07 10:21:59 -0800185#define BTRFS_FEATURE_INCOMPAT_METADATA_UUID (1ULL << 10)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800186#define BTRFS_FEATURE_INCOMPAT_RAID1C34 (1ULL << 11)
Christopher Ferris05667cd2021-02-16 16:01:34 -0800187#define BTRFS_FEATURE_INCOMPAT_ZONED (1ULL << 12)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700188#define BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2 (1ULL << 13)
Christopher Ferris0f795212024-01-17 14:17:28 -0800189#define BTRFS_FEATURE_INCOMPAT_RAID_STRIPE_TREE (1ULL << 14)
190#define BTRFS_FEATURE_INCOMPAT_SIMPLE_QUOTA (1ULL << 16)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700191struct btrfs_ioctl_feature_flags {
Tao Baod7db5942015-01-28 10:07:51 -0800192 __u64 compat_flags;
193 __u64 compat_ro_flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800194 __u64 incompat_flags;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700195};
Christopher Ferris38062f92014-07-09 15:33:25 -0700196#define BTRFS_BALANCE_CTL_PAUSE 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700197#define BTRFS_BALANCE_CTL_CANCEL 2
Christopher Ferris49f525c2016-12-12 14:55:36 -0800198struct btrfs_balance_args {
Tao Baod7db5942015-01-28 10:07:51 -0800199 __u64 profiles;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800200 union {
Christopher Ferris525ce912017-07-26 13:12:53 -0700201 __u64 usage;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800202 struct {
Christopher Ferris525ce912017-07-26 13:12:53 -0700203 __u32 usage_min;
204 __u32 usage_max;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800205 };
Christopher Ferris49f525c2016-12-12 14:55:36 -0800206 };
Tao Baod7db5942015-01-28 10:07:51 -0800207 __u64 devid;
208 __u64 pstart;
Tao Baod7db5942015-01-28 10:07:51 -0800209 __u64 pend;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800210 __u64 vstart;
Tao Baod7db5942015-01-28 10:07:51 -0800211 __u64 vend;
212 __u64 target;
Tao Baod7db5942015-01-28 10:07:51 -0800213 __u64 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800214 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800215 __u64 limit;
216 struct {
217 __u32 limit_min;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800218 __u32 limit_max;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800219 };
220 };
Christopher Ferris525ce912017-07-26 13:12:53 -0700221 __u32 stripes_min;
222 __u32 stripes_max;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800223 __u64 unused[6];
224} __attribute__((__packed__));
Ben Cheng655a7c02013-10-16 16:09:24 -0700225struct btrfs_balance_progress {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800226 __u64 expected;
Tao Baod7db5942015-01-28 10:07:51 -0800227 __u64 considered;
228 __u64 completed;
Ben Cheng655a7c02013-10-16 16:09:24 -0700229};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800230#define BTRFS_BALANCE_DATA (1ULL << 0)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700231#define BTRFS_BALANCE_SYSTEM (1ULL << 1)
232#define BTRFS_BALANCE_METADATA (1ULL << 2)
233#define BTRFS_BALANCE_TYPE_MASK (BTRFS_BALANCE_DATA | BTRFS_BALANCE_SYSTEM | BTRFS_BALANCE_METADATA)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800234#define BTRFS_BALANCE_FORCE (1ULL << 3)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700235#define BTRFS_BALANCE_RESUME (1ULL << 4)
236#define BTRFS_BALANCE_ARGS_PROFILES (1ULL << 0)
237#define BTRFS_BALANCE_ARGS_USAGE (1ULL << 1)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800238#define BTRFS_BALANCE_ARGS_DEVID (1ULL << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700239#define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3)
240#define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4)
241#define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800242#define BTRFS_BALANCE_ARGS_LIMIT_RANGE (1ULL << 6)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700243#define BTRFS_BALANCE_ARGS_STRIPES_RANGE (1ULL << 7)
244#define BTRFS_BALANCE_ARGS_USAGE_RANGE (1ULL << 10)
245#define BTRFS_BALANCE_ARGS_MASK (BTRFS_BALANCE_ARGS_PROFILES | BTRFS_BALANCE_ARGS_USAGE | BTRFS_BALANCE_ARGS_DEVID | BTRFS_BALANCE_ARGS_DRANGE | BTRFS_BALANCE_ARGS_VRANGE | BTRFS_BALANCE_ARGS_LIMIT | BTRFS_BALANCE_ARGS_LIMIT_RANGE | BTRFS_BALANCE_ARGS_STRIPES_RANGE | BTRFS_BALANCE_ARGS_USAGE_RANGE)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800246#define BTRFS_BALANCE_ARGS_CONVERT (1ULL << 8)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700247#define BTRFS_BALANCE_ARGS_SOFT (1ULL << 9)
Ben Cheng655a7c02013-10-16 16:09:24 -0700248#define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0)
Christopher Ferris38062f92014-07-09 15:33:25 -0700249#define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800250#define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700251struct btrfs_ioctl_balance_args {
Tao Baod7db5942015-01-28 10:07:51 -0800252 __u64 flags;
253 __u64 state;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800254 struct btrfs_balance_args data;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700255 struct btrfs_balance_args meta;
Tao Baod7db5942015-01-28 10:07:51 -0800256 struct btrfs_balance_args sys;
257 struct btrfs_balance_progress stat;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800258 __u64 unused[72];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700259};
Ben Cheng655a7c02013-10-16 16:09:24 -0700260#define BTRFS_INO_LOOKUP_PATH_MAX 4080
Christopher Ferris38062f92014-07-09 15:33:25 -0700261struct btrfs_ioctl_ino_lookup_args {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800262 __u64 treeid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700263 __u64 objectid;
Tao Baod7db5942015-01-28 10:07:51 -0800264 char name[BTRFS_INO_LOOKUP_PATH_MAX];
Christopher Ferris38062f92014-07-09 15:33:25 -0700265};
Christopher Ferris9ce28842018-10-25 12:11:39 -0700266#define BTRFS_INO_LOOKUP_USER_PATH_MAX (4080 - BTRFS_VOL_NAME_MAX - 1)
267struct btrfs_ioctl_ino_lookup_user_args {
268 __u64 dirid;
269 __u64 treeid;
270 char name[BTRFS_VOL_NAME_MAX + 1];
271 char path[BTRFS_INO_LOOKUP_USER_PATH_MAX];
272};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800273struct btrfs_ioctl_search_key {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700274 __u64 tree_id;
Tao Baod7db5942015-01-28 10:07:51 -0800275 __u64 min_objectid;
276 __u64 max_objectid;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800277 __u64 min_offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700278 __u64 max_offset;
Tao Baod7db5942015-01-28 10:07:51 -0800279 __u64 min_transid;
280 __u64 max_transid;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800281 __u32 min_type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700282 __u32 max_type;
Tao Baod7db5942015-01-28 10:07:51 -0800283 __u32 nr_items;
284 __u32 unused;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800285 __u64 unused1;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700286 __u64 unused2;
Tao Baod7db5942015-01-28 10:07:51 -0800287 __u64 unused3;
288 __u64 unused4;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800289};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700290struct btrfs_ioctl_search_header {
Tao Baod7db5942015-01-28 10:07:51 -0800291 __u64 transid;
292 __u64 objectid;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800293 __u64 offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700294 __u32 type;
Tao Baod7db5942015-01-28 10:07:51 -0800295 __u32 len;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800296} __attribute__((__may_alias__));
Christopher Ferris49f525c2016-12-12 14:55:36 -0800297#define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key))
Christopher Ferris106b3a82016-08-24 12:15:38 -0700298struct btrfs_ioctl_search_args {
Tao Baod7db5942015-01-28 10:07:51 -0800299 struct btrfs_ioctl_search_key key;
300 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
Christopher Ferris49f525c2016-12-12 14:55:36 -0800301};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700302struct btrfs_ioctl_search_args_v2 {
Tao Baod7db5942015-01-28 10:07:51 -0800303 struct btrfs_ioctl_search_key key;
304 __u64 buf_size;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700305 __u64 buf[];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700306};
Ben Cheng655a7c02013-10-16 16:09:24 -0700307struct btrfs_ioctl_clone_range_args {
Tao Baod7db5942015-01-28 10:07:51 -0800308 __s64 src_fd;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800309 __u64 src_offset, src_length;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700310 __u64 dest_offset;
Ben Cheng655a7c02013-10-16 16:09:24 -0700311};
312#define BTRFS_DEFRAG_RANGE_COMPRESS 1
Christopher Ferris49f525c2016-12-12 14:55:36 -0800313#define BTRFS_DEFRAG_RANGE_START_IO 2
Christopher Ferrisb830ddf2024-03-28 11:48:08 -0700314#define BTRFS_DEFRAG_RANGE_FLAGS_SUPP (BTRFS_DEFRAG_RANGE_COMPRESS | BTRFS_DEFRAG_RANGE_START_IO)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700315struct btrfs_ioctl_defrag_range_args {
316 __u64 start;
317 __u64 len;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800318 __u64 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700319 __u32 extent_thresh;
320 __u32 compress_type;
321 __u32 unused[4];
Christopher Ferris49f525c2016-12-12 14:55:36 -0800322};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700323#define BTRFS_SAME_DATA_DIFFERS 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700324struct btrfs_ioctl_same_extent_info {
Tao Baod7db5942015-01-28 10:07:51 -0800325 __s64 fd;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800326 __u64 logical_offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700327 __u64 bytes_deduped;
Tao Baod7db5942015-01-28 10:07:51 -0800328 __s32 status;
329 __u32 reserved;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800330};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700331struct btrfs_ioctl_same_args {
Tao Baod7db5942015-01-28 10:07:51 -0800332 __u64 logical_offset;
333 __u64 length;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800334 __u16 dest_count;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700335 __u16 reserved1;
Tao Baod7db5942015-01-28 10:07:51 -0800336 __u32 reserved2;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700337 struct btrfs_ioctl_same_extent_info info[];
Christopher Ferris49f525c2016-12-12 14:55:36 -0800338};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700339struct btrfs_ioctl_space_info {
Tao Baod7db5942015-01-28 10:07:51 -0800340 __u64 flags;
341 __u64 total_bytes;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800342 __u64 used_bytes;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700343};
Ben Cheng655a7c02013-10-16 16:09:24 -0700344struct btrfs_ioctl_space_args {
Tao Baod7db5942015-01-28 10:07:51 -0800345 __u64 space_slots;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800346 __u64 total_spaces;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700347 struct btrfs_ioctl_space_info spaces[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700348};
349struct btrfs_data_container {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800350 __u32 bytes_left;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700351 __u32 bytes_missing;
Tao Baod7db5942015-01-28 10:07:51 -0800352 __u32 elem_cnt;
353 __u32 elem_missed;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700354 __u64 val[];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700355};
Ben Cheng655a7c02013-10-16 16:09:24 -0700356struct btrfs_ioctl_ino_path_args {
Tao Baod7db5942015-01-28 10:07:51 -0800357 __u64 inum;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800358 __u64 size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700359 __u64 reserved[4];
Tao Baod7db5942015-01-28 10:07:51 -0800360 __u64 fspath;
Ben Cheng655a7c02013-10-16 16:09:24 -0700361};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800362struct btrfs_ioctl_logical_ino_args {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700363 __u64 logical;
Tao Baod7db5942015-01-28 10:07:51 -0800364 __u64 size;
Christopher Ferris934ec942018-01-31 15:29:16 -0800365 __u64 reserved[3];
366 __u64 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800367 __u64 inodes;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700368};
Christopher Ferris934ec942018-01-31 15:29:16 -0800369#define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700370enum btrfs_dev_stat_values {
Tao Baod7db5942015-01-28 10:07:51 -0800371 BTRFS_DEV_STAT_WRITE_ERRS,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800372 BTRFS_DEV_STAT_READ_ERRS,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700373 BTRFS_DEV_STAT_FLUSH_ERRS,
Tao Baod7db5942015-01-28 10:07:51 -0800374 BTRFS_DEV_STAT_CORRUPTION_ERRS,
375 BTRFS_DEV_STAT_GENERATION_ERRS,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800376 BTRFS_DEV_STAT_VALUES_MAX
Christopher Ferris106b3a82016-08-24 12:15:38 -0700377};
Ben Cheng655a7c02013-10-16 16:09:24 -0700378#define BTRFS_DEV_STATS_RESET (1ULL << 0)
379struct btrfs_ioctl_get_dev_stats {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800380 __u64 devid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700381 __u64 nr_items;
Tao Baod7db5942015-01-28 10:07:51 -0800382 __u64 flags;
383 __u64 values[BTRFS_DEV_STAT_VALUES_MAX];
Christopher Ferris49f525c2016-12-12 14:55:36 -0800384 __u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700385};
Ben Cheng655a7c02013-10-16 16:09:24 -0700386#define BTRFS_QUOTA_CTL_ENABLE 1
387#define BTRFS_QUOTA_CTL_DISABLE 2
Christopher Ferris49f525c2016-12-12 14:55:36 -0800388#define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
Christopher Ferris0f795212024-01-17 14:17:28 -0800389#define BTRFS_QUOTA_CTL_ENABLE_SIMPLE_QUOTA 4
Christopher Ferris106b3a82016-08-24 12:15:38 -0700390struct btrfs_ioctl_quota_ctl_args {
Tao Baod7db5942015-01-28 10:07:51 -0800391 __u64 cmd;
392 __u64 status;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800393};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700394struct btrfs_ioctl_quota_rescan_args {
Tao Baod7db5942015-01-28 10:07:51 -0800395 __u64 flags;
396 __u64 progress;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800397 __u64 reserved[6];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700398};
Ben Cheng655a7c02013-10-16 16:09:24 -0700399struct btrfs_ioctl_qgroup_assign_args {
Tao Baod7db5942015-01-28 10:07:51 -0800400 __u64 assign;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800401 __u64 src;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700402 __u64 dst;
Ben Cheng655a7c02013-10-16 16:09:24 -0700403};
404struct btrfs_ioctl_qgroup_create_args {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800405 __u64 create;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700406 __u64 qgroupid;
Ben Cheng655a7c02013-10-16 16:09:24 -0700407};
408struct btrfs_ioctl_timespec {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800409 __u64 sec;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700410 __u32 nsec;
Ben Cheng655a7c02013-10-16 16:09:24 -0700411};
412struct btrfs_ioctl_received_subvol_args {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800413 char uuid[BTRFS_UUID_SIZE];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700414 __u64 stransid;
Tao Baod7db5942015-01-28 10:07:51 -0800415 __u64 rtransid;
416 struct btrfs_ioctl_timespec stime;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800417 struct btrfs_ioctl_timespec rtime;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700418 __u64 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800419 __u64 reserved[16];
Ben Cheng655a7c02013-10-16 16:09:24 -0700420};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800421#define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1
Christopher Ferris106b3a82016-08-24 12:15:38 -0700422#define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2
Ben Cheng655a7c02013-10-16 16:09:24 -0700423#define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4
Christopher Ferrisa4792612022-01-10 13:51:15 -0800424#define BTRFS_SEND_FLAG_VERSION 0x8
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700425#define BTRFS_SEND_FLAG_COMPRESSED 0x10
426#define BTRFS_SEND_FLAG_MASK (BTRFS_SEND_FLAG_NO_FILE_DATA | BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | BTRFS_SEND_FLAG_OMIT_END_CMD | BTRFS_SEND_FLAG_VERSION | BTRFS_SEND_FLAG_COMPRESSED)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800427struct btrfs_ioctl_send_args {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700428 __s64 send_fd;
Tao Baod7db5942015-01-28 10:07:51 -0800429 __u64 clone_sources_count;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700430 __u64 * clone_sources;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800431 __u64 parent_root;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700432 __u64 flags;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800433 __u32 version;
434 __u8 reserved[28];
Ben Cheng655a7c02013-10-16 16:09:24 -0700435};
Christopher Ferris9ce28842018-10-25 12:11:39 -0700436struct btrfs_ioctl_get_subvol_info_args {
437 __u64 treeid;
438 char name[BTRFS_VOL_NAME_MAX + 1];
439 __u64 parent_id;
440 __u64 dirid;
441 __u64 generation;
442 __u64 flags;
443 __u8 uuid[BTRFS_UUID_SIZE];
444 __u8 parent_uuid[BTRFS_UUID_SIZE];
445 __u8 received_uuid[BTRFS_UUID_SIZE];
446 __u64 ctransid;
447 __u64 otransid;
448 __u64 stransid;
449 __u64 rtransid;
450 struct btrfs_ioctl_timespec ctime;
451 struct btrfs_ioctl_timespec otime;
452 struct btrfs_ioctl_timespec stime;
453 struct btrfs_ioctl_timespec rtime;
454 __u64 reserved[8];
455};
456#define BTRFS_MAX_ROOTREF_BUFFER_NUM 255
457struct btrfs_ioctl_get_subvol_rootref_args {
458 __u64 min_treeid;
459 struct {
460 __u64 treeid;
461 __u64 dirid;
462 } rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM];
463 __u8 num_items;
464 __u8 align[7];
465};
Christopher Ferris10a76e62022-06-08 13:31:52 -0700466struct btrfs_ioctl_encoded_io_args {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700467 const struct iovec * iov;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700468 unsigned long iovcnt;
469 __s64 offset;
470 __u64 flags;
471 __u64 len;
472 __u64 unencoded_len;
473 __u64 unencoded_offset;
474 __u32 compression;
475 __u32 encryption;
476 __u8 reserved[64];
477};
478#define BTRFS_ENCODED_IO_COMPRESSION_NONE 0
479#define BTRFS_ENCODED_IO_COMPRESSION_ZLIB 1
480#define BTRFS_ENCODED_IO_COMPRESSION_ZSTD 2
481#define BTRFS_ENCODED_IO_COMPRESSION_LZO_4K 3
482#define BTRFS_ENCODED_IO_COMPRESSION_LZO_8K 4
483#define BTRFS_ENCODED_IO_COMPRESSION_LZO_16K 5
484#define BTRFS_ENCODED_IO_COMPRESSION_LZO_32K 6
485#define BTRFS_ENCODED_IO_COMPRESSION_LZO_64K 7
486#define BTRFS_ENCODED_IO_COMPRESSION_TYPES 8
487#define BTRFS_ENCODED_IO_ENCRYPTION_NONE 0
488#define BTRFS_ENCODED_IO_ENCRYPTION_TYPES 1
Christopher Ferris49f525c2016-12-12 14:55:36 -0800489enum btrfs_err_code {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700490 BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1,
Tao Baod7db5942015-01-28 10:07:51 -0800491 BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
492 BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800493 BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700494 BTRFS_ERROR_DEV_TGT_REPLACE,
Tao Baod7db5942015-01-28 10:07:51 -0800495 BTRFS_ERROR_DEV_MISSING_NOT_FOUND,
496 BTRFS_ERROR_DEV_ONLY_WRITABLE,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800497 BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS,
498 BTRFS_ERROR_DEV_RAID1C3_MIN_NOT_MET,
499 BTRFS_ERROR_DEV_RAID1C4_MIN_NOT_MET,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700500};
Tao Baod7db5942015-01-28 10:07:51 -0800501#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, struct btrfs_ioctl_vol_args)
502#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, struct btrfs_ioctl_vol_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800503#define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, struct btrfs_ioctl_vol_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700504#define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, struct btrfs_ioctl_vol_args)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700505#define BTRFS_IOC_FORGET_DEV _IOW(BTRFS_IOCTL_MAGIC, 5, struct btrfs_ioctl_vol_args)
Ben Cheng655a7c02013-10-16 16:09:24 -0700506#define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6)
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800507#define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800508#define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700509#define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int)
Tao Baod7db5942015-01-28 10:07:51 -0800510#define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, struct btrfs_ioctl_vol_args)
511#define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, struct btrfs_ioctl_vol_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800512#define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, struct btrfs_ioctl_vol_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700513#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, struct btrfs_ioctl_clone_range_args)
Tao Baod7db5942015-01-28 10:07:51 -0800514#define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, struct btrfs_ioctl_vol_args)
515#define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, struct btrfs_ioctl_vol_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800516#define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, struct btrfs_ioctl_defrag_range_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700517#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, struct btrfs_ioctl_search_args)
Tao Baod7db5942015-01-28 10:07:51 -0800518#define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, struct btrfs_ioctl_search_args_v2)
519#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, struct btrfs_ioctl_ino_lookup_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800520#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700521#define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, struct btrfs_ioctl_space_args)
Ben Cheng655a7c02013-10-16 16:09:24 -0700522#define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64)
523#define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800524#define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, struct btrfs_ioctl_vol_args_v2)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700525#define BTRFS_IOC_SUBVOL_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 24, struct btrfs_ioctl_vol_args_v2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700526#define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64)
527#define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800528#define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, struct btrfs_ioctl_scrub_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700529#define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28)
Tao Baod7db5942015-01-28 10:07:51 -0800530#define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, struct btrfs_ioctl_scrub_args)
531#define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, struct btrfs_ioctl_dev_info_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800532#define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, struct btrfs_ioctl_fs_info_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700533#define BTRFS_IOC_BALANCE_V2 _IOWR(BTRFS_IOCTL_MAGIC, 32, struct btrfs_ioctl_balance_args)
Ben Cheng655a7c02013-10-16 16:09:24 -0700534#define BTRFS_IOC_BALANCE_CTL _IOW(BTRFS_IOCTL_MAGIC, 33, int)
Tao Baod7db5942015-01-28 10:07:51 -0800535#define BTRFS_IOC_BALANCE_PROGRESS _IOR(BTRFS_IOCTL_MAGIC, 34, struct btrfs_ioctl_balance_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800536#define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, struct btrfs_ioctl_ino_path_args)
537#define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, struct btrfs_ioctl_logical_ino_args)
Tao Baod7db5942015-01-28 10:07:51 -0800538#define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, struct btrfs_ioctl_received_subvol_args)
Ben Cheng655a7c02013-10-16 16:09:24 -0700539#define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800540#define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, struct btrfs_ioctl_vol_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700541#define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, struct btrfs_ioctl_quota_ctl_args)
Tao Baod7db5942015-01-28 10:07:51 -0800542#define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, struct btrfs_ioctl_qgroup_assign_args)
543#define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, struct btrfs_ioctl_qgroup_create_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800544#define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, struct btrfs_ioctl_qgroup_limit_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700545#define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, struct btrfs_ioctl_quota_rescan_args)
Tao Baod7db5942015-01-28 10:07:51 -0800546#define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, struct btrfs_ioctl_quota_rescan_args)
Christopher Ferris38062f92014-07-09 15:33:25 -0700547#define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
Christopher Ferris9584fa42019-12-09 15:36:13 -0800548#define BTRFS_IOC_GET_FSLABEL FS_IOC_GETFSLABEL
549#define BTRFS_IOC_SET_FSLABEL FS_IOC_SETFSLABEL
Tao Baod7db5942015-01-28 10:07:51 -0800550#define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, struct btrfs_ioctl_get_dev_stats)
551#define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, struct btrfs_ioctl_dev_replace_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800552#define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, struct btrfs_ioctl_same_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700553#define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags)
Tao Baod7db5942015-01-28 10:07:51 -0800554#define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags[2])
555#define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags[3])
Christopher Ferris49f525c2016-12-12 14:55:36 -0800556#define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, struct btrfs_ioctl_vol_args_v2)
Christopher Ferris934ec942018-01-31 15:29:16 -0800557#define BTRFS_IOC_LOGICAL_INO_V2 _IOWR(BTRFS_IOCTL_MAGIC, 59, struct btrfs_ioctl_logical_ino_args)
Christopher Ferris9ce28842018-10-25 12:11:39 -0700558#define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, struct btrfs_ioctl_get_subvol_info_args)
559#define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, struct btrfs_ioctl_get_subvol_rootref_args)
560#define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, struct btrfs_ioctl_ino_lookup_user_args)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700561#define BTRFS_IOC_SNAP_DESTROY_V2 _IOW(BTRFS_IOCTL_MAGIC, 63, struct btrfs_ioctl_vol_args_v2)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700562#define BTRFS_IOC_ENCODED_READ _IOR(BTRFS_IOCTL_MAGIC, 64, struct btrfs_ioctl_encoded_io_args)
563#define BTRFS_IOC_ENCODED_WRITE _IOW(BTRFS_IOCTL_MAGIC, 64, struct btrfs_ioctl_encoded_io_args)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800564#ifdef __cplusplus
565}
566#endif
Christopher Ferris38062f92014-07-09 15:33:25 -0700567#endif