blob: 0fdac6608d9dae8b368bf8326eef1d6d249fdc1a [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI_LINUX_BTRFS_H
20#define _UAPI_LINUX_BTRFS_H
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080021#ifdef __cplusplus
22extern "C" {
23#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070024#include <linux/types.h>
25#include <linux/ioctl.h>
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080026#include <linux/fs.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070027#define BTRFS_IOCTL_MAGIC 0x94
28#define BTRFS_VOL_NAME_MAX 255
Christopher Ferris106b3a82016-08-24 12:15:38 -070029#define BTRFS_LABEL_SIZE 256
Ben Cheng655a7c02013-10-16 16:09:24 -070030#define BTRFS_PATH_NAME_MAX 4087
Christopher Ferris106b3a82016-08-24 12:15:38 -070031struct btrfs_ioctl_vol_args {
Tao Baod7db5942015-01-28 10:07:51 -080032 __s64 fd;
33 char name[BTRFS_PATH_NAME_MAX + 1];
Ben Cheng655a7c02013-10-16 16:09:24 -070034};
Christopher Ferris106b3a82016-08-24 12:15:38 -070035#define BTRFS_DEVICE_PATH_NAME_MAX 1024
Christopher Ferris76a1d452018-06-27 14:12:29 -070036#define BTRFS_SUBVOL_NAME_MAX 4039
37#define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0)
38#define BTRFS_SUBVOL_RDONLY (1ULL << 1)
39#define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -070040#define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3)
Christopher Ferrisaf09c702020-06-01 20:29:29 -070041#define BTRFS_SUBVOL_SPEC_BY_ID (1ULL << 4)
42#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 -070043#define BTRFS_FSID_SIZE 16
Ben Cheng655a7c02013-10-16 16:09:24 -070044#define BTRFS_UUID_SIZE 16
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070045#define BTRFS_UUID_UNPARSED_SIZE 37
Christopher Ferris106b3a82016-08-24 12:15:38 -070046#define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0)
47#define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -070048#define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2)
49#define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3)
50#define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4)
51#define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5)
Christopher Ferris106b3a82016-08-24 12:15:38 -070052struct btrfs_qgroup_limit {
Tao Baod7db5942015-01-28 10:07:51 -080053 __u64 flags;
54 __u64 max_rfer;
55 __u64 max_excl;
Christopher Ferris106b3a82016-08-24 12:15:38 -070056 __u64 rsv_rfer;
Tao Baod7db5942015-01-28 10:07:51 -080057 __u64 rsv_excl;
Ben Cheng655a7c02013-10-16 16:09:24 -070058};
Christopher Ferris106b3a82016-08-24 12:15:38 -070059#define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -070060struct btrfs_qgroup_inherit {
Tao Baod7db5942015-01-28 10:07:51 -080061 __u64 flags;
Tao Baod7db5942015-01-28 10:07:51 -080062 __u64 num_qgroups;
63 __u64 num_ref_copies;
64 __u64 num_excl_copies;
65 struct btrfs_qgroup_limit lim;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070066 __u64 qgroups[];
Ben Cheng655a7c02013-10-16 16:09:24 -070067};
68struct btrfs_ioctl_qgroup_limit_args {
Tao Baod7db5942015-01-28 10:07:51 -080069 __u64 qgroupid;
Tao Baod7db5942015-01-28 10:07:51 -080070 struct btrfs_qgroup_limit lim;
Ben Cheng655a7c02013-10-16 16:09:24 -070071};
Christopher Ferrisaf09c702020-06-01 20:29:29 -070072#define BTRFS_DEVICE_REMOVE_ARGS_MASK (BTRFS_DEVICE_SPEC_BY_ID)
73#define BTRFS_SUBVOL_CREATE_ARGS_MASK (BTRFS_SUBVOL_RDONLY | BTRFS_SUBVOL_QGROUP_INHERIT)
74#define BTRFS_SUBVOL_DELETE_ARGS_MASK (BTRFS_SUBVOL_SPEC_BY_ID)
Christopher Ferris106b3a82016-08-24 12:15:38 -070075struct btrfs_ioctl_vol_args_v2 {
Tao Baod7db5942015-01-28 10:07:51 -080076 __s64 fd;
77 __u64 transid;
78 __u64 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -070079 union {
Tao Baod7db5942015-01-28 10:07:51 -080080 struct {
81 __u64 size;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -070082 struct btrfs_qgroup_inherit * qgroup_inherit;
Christopher Ferris106b3a82016-08-24 12:15:38 -070083 };
Tao Baod7db5942015-01-28 10:07:51 -080084 __u64 unused[4];
85 };
Christopher Ferris106b3a82016-08-24 12:15:38 -070086 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -070087 char name[BTRFS_SUBVOL_NAME_MAX + 1];
88 __u64 devid;
Christopher Ferrisaf09c702020-06-01 20:29:29 -070089 __u64 subvolid;
Christopher Ferris106b3a82016-08-24 12:15:38 -070090 };
Ben Cheng655a7c02013-10-16 16:09:24 -070091};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070092struct btrfs_scrub_progress {
Tao Baod7db5942015-01-28 10:07:51 -080093 __u64 data_extents_scrubbed;
94 __u64 tree_extents_scrubbed;
95 __u64 data_bytes_scrubbed;
Tao Baod7db5942015-01-28 10:07:51 -080096 __u64 tree_bytes_scrubbed;
97 __u64 read_errors;
98 __u64 csum_errors;
99 __u64 verify_errors;
Tao Baod7db5942015-01-28 10:07:51 -0800100 __u64 no_csum;
101 __u64 csum_discards;
102 __u64 super_errors;
103 __u64 malloc_errors;
Tao Baod7db5942015-01-28 10:07:51 -0800104 __u64 uncorrectable_errors;
105 __u64 corrected_errors;
106 __u64 last_physical;
107 __u64 unverified_errors;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700108};
Ben Cheng655a7c02013-10-16 16:09:24 -0700109#define BTRFS_SCRUB_READONLY 1
110struct btrfs_ioctl_scrub_args {
Tao Baod7db5942015-01-28 10:07:51 -0800111 __u64 devid;
Tao Baod7db5942015-01-28 10:07:51 -0800112 __u64 start;
113 __u64 end;
114 __u64 flags;
115 struct btrfs_scrub_progress progress;
Tao Baod7db5942015-01-28 10:07:51 -0800116 __u64 unused[(1024 - 32 - sizeof(struct btrfs_scrub_progress)) / 8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700117};
118#define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
119#define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700120struct btrfs_ioctl_dev_replace_start_params {
Tao Baod7db5942015-01-28 10:07:51 -0800121 __u64 srcdevid;
122 __u64 cont_reading_from_srcdev_mode;
123 __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1];
Tao Baod7db5942015-01-28 10:07:51 -0800124 __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1];
Ben Cheng655a7c02013-10-16 16:09:24 -0700125};
126#define BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED 0
127#define BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700128#define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700129#define BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED 3
130#define BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED 4
131struct btrfs_ioctl_dev_replace_status_params {
Tao Baod7db5942015-01-28 10:07:51 -0800132 __u64 replace_state;
133 __u64 progress_1000;
134 __u64 time_started;
135 __u64 time_stopped;
Tao Baod7db5942015-01-28 10:07:51 -0800136 __u64 num_write_errors;
137 __u64 num_uncorrectable_read_errors;
Ben Cheng655a7c02013-10-16 16:09:24 -0700138};
139#define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700140#define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700141#define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2
142#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0
143#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700144#define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800145#define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700146struct btrfs_ioctl_dev_replace_args {
Tao Baod7db5942015-01-28 10:07:51 -0800147 __u64 cmd;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800148 __u64 result;
Tao Baod7db5942015-01-28 10:07:51 -0800149 union {
150 struct btrfs_ioctl_dev_replace_start_params start;
151 struct btrfs_ioctl_dev_replace_status_params status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800152 };
Tao Baod7db5942015-01-28 10:07:51 -0800153 __u64 spare[64];
Ben Cheng655a7c02013-10-16 16:09:24 -0700154};
155struct btrfs_ioctl_dev_info_args {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800156 __u64 devid;
Tao Baod7db5942015-01-28 10:07:51 -0800157 __u8 uuid[BTRFS_UUID_SIZE];
158 __u64 bytes_used;
159 __u64 total_bytes;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800160 __u64 unused[379];
Tao Baod7db5942015-01-28 10:07:51 -0800161 __u8 path[BTRFS_DEVICE_PATH_NAME_MAX];
Ben Cheng655a7c02013-10-16 16:09:24 -0700162};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700163#define BTRFS_FS_INFO_FLAG_CSUM_INFO (1 << 0)
164#define BTRFS_FS_INFO_FLAG_GENERATION (1 << 1)
165#define BTRFS_FS_INFO_FLAG_METADATA_UUID (1 << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700166struct btrfs_ioctl_fs_info_args {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800167 __u64 max_id;
Tao Baod7db5942015-01-28 10:07:51 -0800168 __u64 num_devices;
169 __u8 fsid[BTRFS_FSID_SIZE];
170 __u32 nodesize;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800171 __u32 sectorsize;
Tao Baod7db5942015-01-28 10:07:51 -0800172 __u32 clone_alignment;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700173 __u16 csum_type;
174 __u16 csum_size;
175 __u64 flags;
176 __u64 generation;
177 __u8 metadata_uuid[BTRFS_FSID_SIZE];
178 __u8 reserved[944];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800179};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700180#define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800181#define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700182#define BTRFS_FEATURE_COMPAT_RO_VERITY (1ULL << 2)
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000183#define BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE (1ULL << 3)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700184#define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800185#define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700186#define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2)
187#define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3)
Christopher Ferris1308ad32017-11-14 17:32:13 -0800188#define BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD (1ULL << 4)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800189#define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700190#define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6)
191#define BTRFS_FEATURE_INCOMPAT_RAID56 (1ULL << 7)
192#define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA (1ULL << 8)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800193#define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9)
Christopher Ferrisd842e432019-03-07 10:21:59 -0800194#define BTRFS_FEATURE_INCOMPAT_METADATA_UUID (1ULL << 10)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800195#define BTRFS_FEATURE_INCOMPAT_RAID1C34 (1ULL << 11)
Christopher Ferris05667cd2021-02-16 16:01:34 -0800196#define BTRFS_FEATURE_INCOMPAT_ZONED (1ULL << 12)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700197#define BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2 (1ULL << 13)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700198struct btrfs_ioctl_feature_flags {
Tao Baod7db5942015-01-28 10:07:51 -0800199 __u64 compat_flags;
200 __u64 compat_ro_flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800201 __u64 incompat_flags;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700202};
Christopher Ferris38062f92014-07-09 15:33:25 -0700203#define BTRFS_BALANCE_CTL_PAUSE 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700204#define BTRFS_BALANCE_CTL_CANCEL 2
Christopher Ferris49f525c2016-12-12 14:55:36 -0800205struct btrfs_balance_args {
Tao Baod7db5942015-01-28 10:07:51 -0800206 __u64 profiles;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800207 union {
Christopher Ferris525ce912017-07-26 13:12:53 -0700208 __u64 usage;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800209 struct {
Christopher Ferris525ce912017-07-26 13:12:53 -0700210 __u32 usage_min;
211 __u32 usage_max;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800212 };
Christopher Ferris49f525c2016-12-12 14:55:36 -0800213 };
Tao Baod7db5942015-01-28 10:07:51 -0800214 __u64 devid;
215 __u64 pstart;
Tao Baod7db5942015-01-28 10:07:51 -0800216 __u64 pend;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800217 __u64 vstart;
Tao Baod7db5942015-01-28 10:07:51 -0800218 __u64 vend;
219 __u64 target;
Tao Baod7db5942015-01-28 10:07:51 -0800220 __u64 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800221 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800222 __u64 limit;
223 struct {
224 __u32 limit_min;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800225 __u32 limit_max;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800226 };
227 };
Christopher Ferris525ce912017-07-26 13:12:53 -0700228 __u32 stripes_min;
229 __u32 stripes_max;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800230 __u64 unused[6];
231} __attribute__((__packed__));
Ben Cheng655a7c02013-10-16 16:09:24 -0700232struct btrfs_balance_progress {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800233 __u64 expected;
Tao Baod7db5942015-01-28 10:07:51 -0800234 __u64 considered;
235 __u64 completed;
Ben Cheng655a7c02013-10-16 16:09:24 -0700236};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800237#define BTRFS_BALANCE_DATA (1ULL << 0)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700238#define BTRFS_BALANCE_SYSTEM (1ULL << 1)
239#define BTRFS_BALANCE_METADATA (1ULL << 2)
240#define BTRFS_BALANCE_TYPE_MASK (BTRFS_BALANCE_DATA | BTRFS_BALANCE_SYSTEM | BTRFS_BALANCE_METADATA)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800241#define BTRFS_BALANCE_FORCE (1ULL << 3)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700242#define BTRFS_BALANCE_RESUME (1ULL << 4)
243#define BTRFS_BALANCE_ARGS_PROFILES (1ULL << 0)
244#define BTRFS_BALANCE_ARGS_USAGE (1ULL << 1)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800245#define BTRFS_BALANCE_ARGS_DEVID (1ULL << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700246#define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3)
247#define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4)
248#define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800249#define BTRFS_BALANCE_ARGS_LIMIT_RANGE (1ULL << 6)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700250#define BTRFS_BALANCE_ARGS_STRIPES_RANGE (1ULL << 7)
251#define BTRFS_BALANCE_ARGS_USAGE_RANGE (1ULL << 10)
252#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 -0800253#define BTRFS_BALANCE_ARGS_CONVERT (1ULL << 8)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700254#define BTRFS_BALANCE_ARGS_SOFT (1ULL << 9)
Ben Cheng655a7c02013-10-16 16:09:24 -0700255#define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0)
Christopher Ferris38062f92014-07-09 15:33:25 -0700256#define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800257#define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700258struct btrfs_ioctl_balance_args {
Tao Baod7db5942015-01-28 10:07:51 -0800259 __u64 flags;
260 __u64 state;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800261 struct btrfs_balance_args data;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700262 struct btrfs_balance_args meta;
Tao Baod7db5942015-01-28 10:07:51 -0800263 struct btrfs_balance_args sys;
264 struct btrfs_balance_progress stat;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800265 __u64 unused[72];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700266};
Ben Cheng655a7c02013-10-16 16:09:24 -0700267#define BTRFS_INO_LOOKUP_PATH_MAX 4080
Christopher Ferris38062f92014-07-09 15:33:25 -0700268struct btrfs_ioctl_ino_lookup_args {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800269 __u64 treeid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700270 __u64 objectid;
Tao Baod7db5942015-01-28 10:07:51 -0800271 char name[BTRFS_INO_LOOKUP_PATH_MAX];
Christopher Ferris38062f92014-07-09 15:33:25 -0700272};
Christopher Ferris9ce28842018-10-25 12:11:39 -0700273#define BTRFS_INO_LOOKUP_USER_PATH_MAX (4080 - BTRFS_VOL_NAME_MAX - 1)
274struct btrfs_ioctl_ino_lookup_user_args {
275 __u64 dirid;
276 __u64 treeid;
277 char name[BTRFS_VOL_NAME_MAX + 1];
278 char path[BTRFS_INO_LOOKUP_USER_PATH_MAX];
279};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800280struct btrfs_ioctl_search_key {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700281 __u64 tree_id;
Tao Baod7db5942015-01-28 10:07:51 -0800282 __u64 min_objectid;
283 __u64 max_objectid;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800284 __u64 min_offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700285 __u64 max_offset;
Tao Baod7db5942015-01-28 10:07:51 -0800286 __u64 min_transid;
287 __u64 max_transid;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800288 __u32 min_type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700289 __u32 max_type;
Tao Baod7db5942015-01-28 10:07:51 -0800290 __u32 nr_items;
291 __u32 unused;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800292 __u64 unused1;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700293 __u64 unused2;
Tao Baod7db5942015-01-28 10:07:51 -0800294 __u64 unused3;
295 __u64 unused4;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800296};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700297struct btrfs_ioctl_search_header {
Tao Baod7db5942015-01-28 10:07:51 -0800298 __u64 transid;
299 __u64 objectid;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800300 __u64 offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700301 __u32 type;
Tao Baod7db5942015-01-28 10:07:51 -0800302 __u32 len;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800303} __attribute__((__may_alias__));
Christopher Ferris49f525c2016-12-12 14:55:36 -0800304#define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key))
Christopher Ferris106b3a82016-08-24 12:15:38 -0700305struct btrfs_ioctl_search_args {
Tao Baod7db5942015-01-28 10:07:51 -0800306 struct btrfs_ioctl_search_key key;
307 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
Christopher Ferris49f525c2016-12-12 14:55:36 -0800308};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700309struct btrfs_ioctl_search_args_v2 {
Tao Baod7db5942015-01-28 10:07:51 -0800310 struct btrfs_ioctl_search_key key;
311 __u64 buf_size;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700312 __u64 buf[];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700313};
Ben Cheng655a7c02013-10-16 16:09:24 -0700314struct btrfs_ioctl_clone_range_args {
Tao Baod7db5942015-01-28 10:07:51 -0800315 __s64 src_fd;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800316 __u64 src_offset, src_length;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700317 __u64 dest_offset;
Ben Cheng655a7c02013-10-16 16:09:24 -0700318};
319#define BTRFS_DEFRAG_RANGE_COMPRESS 1
Christopher Ferris49f525c2016-12-12 14:55:36 -0800320#define BTRFS_DEFRAG_RANGE_START_IO 2
Christopher Ferris106b3a82016-08-24 12:15:38 -0700321struct btrfs_ioctl_defrag_range_args {
322 __u64 start;
323 __u64 len;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800324 __u64 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700325 __u32 extent_thresh;
326 __u32 compress_type;
327 __u32 unused[4];
Christopher Ferris49f525c2016-12-12 14:55:36 -0800328};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700329#define BTRFS_SAME_DATA_DIFFERS 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700330struct btrfs_ioctl_same_extent_info {
Tao Baod7db5942015-01-28 10:07:51 -0800331 __s64 fd;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800332 __u64 logical_offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700333 __u64 bytes_deduped;
Tao Baod7db5942015-01-28 10:07:51 -0800334 __s32 status;
335 __u32 reserved;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800336};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700337struct btrfs_ioctl_same_args {
Tao Baod7db5942015-01-28 10:07:51 -0800338 __u64 logical_offset;
339 __u64 length;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800340 __u16 dest_count;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700341 __u16 reserved1;
Tao Baod7db5942015-01-28 10:07:51 -0800342 __u32 reserved2;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700343 struct btrfs_ioctl_same_extent_info info[];
Christopher Ferris49f525c2016-12-12 14:55:36 -0800344};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700345struct btrfs_ioctl_space_info {
Tao Baod7db5942015-01-28 10:07:51 -0800346 __u64 flags;
347 __u64 total_bytes;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800348 __u64 used_bytes;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700349};
Ben Cheng655a7c02013-10-16 16:09:24 -0700350struct btrfs_ioctl_space_args {
Tao Baod7db5942015-01-28 10:07:51 -0800351 __u64 space_slots;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800352 __u64 total_spaces;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700353 struct btrfs_ioctl_space_info spaces[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700354};
355struct btrfs_data_container {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800356 __u32 bytes_left;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700357 __u32 bytes_missing;
Tao Baod7db5942015-01-28 10:07:51 -0800358 __u32 elem_cnt;
359 __u32 elem_missed;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700360 __u64 val[];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700361};
Ben Cheng655a7c02013-10-16 16:09:24 -0700362struct btrfs_ioctl_ino_path_args {
Tao Baod7db5942015-01-28 10:07:51 -0800363 __u64 inum;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800364 __u64 size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700365 __u64 reserved[4];
Tao Baod7db5942015-01-28 10:07:51 -0800366 __u64 fspath;
Ben Cheng655a7c02013-10-16 16:09:24 -0700367};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800368struct btrfs_ioctl_logical_ino_args {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700369 __u64 logical;
Tao Baod7db5942015-01-28 10:07:51 -0800370 __u64 size;
Christopher Ferris934ec942018-01-31 15:29:16 -0800371 __u64 reserved[3];
372 __u64 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800373 __u64 inodes;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700374};
Christopher Ferris934ec942018-01-31 15:29:16 -0800375#define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700376enum btrfs_dev_stat_values {
Tao Baod7db5942015-01-28 10:07:51 -0800377 BTRFS_DEV_STAT_WRITE_ERRS,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800378 BTRFS_DEV_STAT_READ_ERRS,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700379 BTRFS_DEV_STAT_FLUSH_ERRS,
Tao Baod7db5942015-01-28 10:07:51 -0800380 BTRFS_DEV_STAT_CORRUPTION_ERRS,
381 BTRFS_DEV_STAT_GENERATION_ERRS,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800382 BTRFS_DEV_STAT_VALUES_MAX
Christopher Ferris106b3a82016-08-24 12:15:38 -0700383};
Ben Cheng655a7c02013-10-16 16:09:24 -0700384#define BTRFS_DEV_STATS_RESET (1ULL << 0)
385struct btrfs_ioctl_get_dev_stats {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800386 __u64 devid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700387 __u64 nr_items;
Tao Baod7db5942015-01-28 10:07:51 -0800388 __u64 flags;
389 __u64 values[BTRFS_DEV_STAT_VALUES_MAX];
Christopher Ferris49f525c2016-12-12 14:55:36 -0800390 __u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700391};
Ben Cheng655a7c02013-10-16 16:09:24 -0700392#define BTRFS_QUOTA_CTL_ENABLE 1
393#define BTRFS_QUOTA_CTL_DISABLE 2
Christopher Ferris49f525c2016-12-12 14:55:36 -0800394#define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
Christopher Ferris106b3a82016-08-24 12:15:38 -0700395struct btrfs_ioctl_quota_ctl_args {
Tao Baod7db5942015-01-28 10:07:51 -0800396 __u64 cmd;
397 __u64 status;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800398};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700399struct btrfs_ioctl_quota_rescan_args {
Tao Baod7db5942015-01-28 10:07:51 -0800400 __u64 flags;
401 __u64 progress;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800402 __u64 reserved[6];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700403};
Ben Cheng655a7c02013-10-16 16:09:24 -0700404struct btrfs_ioctl_qgroup_assign_args {
Tao Baod7db5942015-01-28 10:07:51 -0800405 __u64 assign;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800406 __u64 src;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700407 __u64 dst;
Ben Cheng655a7c02013-10-16 16:09:24 -0700408};
409struct btrfs_ioctl_qgroup_create_args {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800410 __u64 create;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700411 __u64 qgroupid;
Ben Cheng655a7c02013-10-16 16:09:24 -0700412};
413struct btrfs_ioctl_timespec {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800414 __u64 sec;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700415 __u32 nsec;
Ben Cheng655a7c02013-10-16 16:09:24 -0700416};
417struct btrfs_ioctl_received_subvol_args {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800418 char uuid[BTRFS_UUID_SIZE];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700419 __u64 stransid;
Tao Baod7db5942015-01-28 10:07:51 -0800420 __u64 rtransid;
421 struct btrfs_ioctl_timespec stime;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800422 struct btrfs_ioctl_timespec rtime;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700423 __u64 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800424 __u64 reserved[16];
Ben Cheng655a7c02013-10-16 16:09:24 -0700425};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800426#define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1
Christopher Ferris106b3a82016-08-24 12:15:38 -0700427#define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2
Ben Cheng655a7c02013-10-16 16:09:24 -0700428#define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4
Christopher Ferrisa4792612022-01-10 13:51:15 -0800429#define BTRFS_SEND_FLAG_VERSION 0x8
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700430#define BTRFS_SEND_FLAG_COMPRESSED 0x10
431#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 -0800432struct btrfs_ioctl_send_args {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700433 __s64 send_fd;
Tao Baod7db5942015-01-28 10:07:51 -0800434 __u64 clone_sources_count;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700435 __u64 * clone_sources;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800436 __u64 parent_root;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700437 __u64 flags;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800438 __u32 version;
439 __u8 reserved[28];
Ben Cheng655a7c02013-10-16 16:09:24 -0700440};
Christopher Ferris9ce28842018-10-25 12:11:39 -0700441struct btrfs_ioctl_get_subvol_info_args {
442 __u64 treeid;
443 char name[BTRFS_VOL_NAME_MAX + 1];
444 __u64 parent_id;
445 __u64 dirid;
446 __u64 generation;
447 __u64 flags;
448 __u8 uuid[BTRFS_UUID_SIZE];
449 __u8 parent_uuid[BTRFS_UUID_SIZE];
450 __u8 received_uuid[BTRFS_UUID_SIZE];
451 __u64 ctransid;
452 __u64 otransid;
453 __u64 stransid;
454 __u64 rtransid;
455 struct btrfs_ioctl_timespec ctime;
456 struct btrfs_ioctl_timespec otime;
457 struct btrfs_ioctl_timespec stime;
458 struct btrfs_ioctl_timespec rtime;
459 __u64 reserved[8];
460};
461#define BTRFS_MAX_ROOTREF_BUFFER_NUM 255
462struct btrfs_ioctl_get_subvol_rootref_args {
463 __u64 min_treeid;
464 struct {
465 __u64 treeid;
466 __u64 dirid;
467 } rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM];
468 __u8 num_items;
469 __u8 align[7];
470};
Christopher Ferris10a76e62022-06-08 13:31:52 -0700471struct btrfs_ioctl_encoded_io_args {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700472 const struct iovec * iov;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700473 unsigned long iovcnt;
474 __s64 offset;
475 __u64 flags;
476 __u64 len;
477 __u64 unencoded_len;
478 __u64 unencoded_offset;
479 __u32 compression;
480 __u32 encryption;
481 __u8 reserved[64];
482};
483#define BTRFS_ENCODED_IO_COMPRESSION_NONE 0
484#define BTRFS_ENCODED_IO_COMPRESSION_ZLIB 1
485#define BTRFS_ENCODED_IO_COMPRESSION_ZSTD 2
486#define BTRFS_ENCODED_IO_COMPRESSION_LZO_4K 3
487#define BTRFS_ENCODED_IO_COMPRESSION_LZO_8K 4
488#define BTRFS_ENCODED_IO_COMPRESSION_LZO_16K 5
489#define BTRFS_ENCODED_IO_COMPRESSION_LZO_32K 6
490#define BTRFS_ENCODED_IO_COMPRESSION_LZO_64K 7
491#define BTRFS_ENCODED_IO_COMPRESSION_TYPES 8
492#define BTRFS_ENCODED_IO_ENCRYPTION_NONE 0
493#define BTRFS_ENCODED_IO_ENCRYPTION_TYPES 1
Christopher Ferris49f525c2016-12-12 14:55:36 -0800494enum btrfs_err_code {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700495 BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1,
Tao Baod7db5942015-01-28 10:07:51 -0800496 BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
497 BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800498 BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700499 BTRFS_ERROR_DEV_TGT_REPLACE,
Tao Baod7db5942015-01-28 10:07:51 -0800500 BTRFS_ERROR_DEV_MISSING_NOT_FOUND,
501 BTRFS_ERROR_DEV_ONLY_WRITABLE,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800502 BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS,
503 BTRFS_ERROR_DEV_RAID1C3_MIN_NOT_MET,
504 BTRFS_ERROR_DEV_RAID1C4_MIN_NOT_MET,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700505};
Tao Baod7db5942015-01-28 10:07:51 -0800506#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, struct btrfs_ioctl_vol_args)
507#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, struct btrfs_ioctl_vol_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800508#define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, struct btrfs_ioctl_vol_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700509#define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, struct btrfs_ioctl_vol_args)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700510#define BTRFS_IOC_FORGET_DEV _IOW(BTRFS_IOCTL_MAGIC, 5, struct btrfs_ioctl_vol_args)
Ben Cheng655a7c02013-10-16 16:09:24 -0700511#define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6)
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800512#define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800513#define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700514#define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int)
Tao Baod7db5942015-01-28 10:07:51 -0800515#define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, struct btrfs_ioctl_vol_args)
516#define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, struct btrfs_ioctl_vol_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800517#define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, struct btrfs_ioctl_vol_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700518#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, struct btrfs_ioctl_clone_range_args)
Tao Baod7db5942015-01-28 10:07:51 -0800519#define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, struct btrfs_ioctl_vol_args)
520#define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, struct btrfs_ioctl_vol_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800521#define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, struct btrfs_ioctl_defrag_range_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700522#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, struct btrfs_ioctl_search_args)
Tao Baod7db5942015-01-28 10:07:51 -0800523#define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, struct btrfs_ioctl_search_args_v2)
524#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, struct btrfs_ioctl_ino_lookup_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800525#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700526#define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, struct btrfs_ioctl_space_args)
Ben Cheng655a7c02013-10-16 16:09:24 -0700527#define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64)
528#define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800529#define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, struct btrfs_ioctl_vol_args_v2)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700530#define BTRFS_IOC_SUBVOL_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 24, struct btrfs_ioctl_vol_args_v2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700531#define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64)
532#define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800533#define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, struct btrfs_ioctl_scrub_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700534#define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28)
Tao Baod7db5942015-01-28 10:07:51 -0800535#define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, struct btrfs_ioctl_scrub_args)
536#define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, struct btrfs_ioctl_dev_info_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800537#define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, struct btrfs_ioctl_fs_info_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700538#define BTRFS_IOC_BALANCE_V2 _IOWR(BTRFS_IOCTL_MAGIC, 32, struct btrfs_ioctl_balance_args)
Ben Cheng655a7c02013-10-16 16:09:24 -0700539#define BTRFS_IOC_BALANCE_CTL _IOW(BTRFS_IOCTL_MAGIC, 33, int)
Tao Baod7db5942015-01-28 10:07:51 -0800540#define BTRFS_IOC_BALANCE_PROGRESS _IOR(BTRFS_IOCTL_MAGIC, 34, struct btrfs_ioctl_balance_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800541#define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, struct btrfs_ioctl_ino_path_args)
542#define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, struct btrfs_ioctl_logical_ino_args)
Tao Baod7db5942015-01-28 10:07:51 -0800543#define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, struct btrfs_ioctl_received_subvol_args)
Ben Cheng655a7c02013-10-16 16:09:24 -0700544#define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800545#define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, struct btrfs_ioctl_vol_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700546#define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, struct btrfs_ioctl_quota_ctl_args)
Tao Baod7db5942015-01-28 10:07:51 -0800547#define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, struct btrfs_ioctl_qgroup_assign_args)
548#define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, struct btrfs_ioctl_qgroup_create_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800549#define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, struct btrfs_ioctl_qgroup_limit_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700550#define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, struct btrfs_ioctl_quota_rescan_args)
Tao Baod7db5942015-01-28 10:07:51 -0800551#define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, struct btrfs_ioctl_quota_rescan_args)
Christopher Ferris38062f92014-07-09 15:33:25 -0700552#define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
Christopher Ferris9584fa42019-12-09 15:36:13 -0800553#define BTRFS_IOC_GET_FSLABEL FS_IOC_GETFSLABEL
554#define BTRFS_IOC_SET_FSLABEL FS_IOC_SETFSLABEL
Tao Baod7db5942015-01-28 10:07:51 -0800555#define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, struct btrfs_ioctl_get_dev_stats)
556#define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, struct btrfs_ioctl_dev_replace_args)
Christopher Ferris49f525c2016-12-12 14:55:36 -0800557#define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, struct btrfs_ioctl_same_args)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700558#define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags)
Tao Baod7db5942015-01-28 10:07:51 -0800559#define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags[2])
560#define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, struct btrfs_ioctl_feature_flags[3])
Christopher Ferris49f525c2016-12-12 14:55:36 -0800561#define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, struct btrfs_ioctl_vol_args_v2)
Christopher Ferris934ec942018-01-31 15:29:16 -0800562#define BTRFS_IOC_LOGICAL_INO_V2 _IOWR(BTRFS_IOCTL_MAGIC, 59, struct btrfs_ioctl_logical_ino_args)
Christopher Ferris9ce28842018-10-25 12:11:39 -0700563#define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, struct btrfs_ioctl_get_subvol_info_args)
564#define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, struct btrfs_ioctl_get_subvol_rootref_args)
565#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 -0700566#define BTRFS_IOC_SNAP_DESTROY_V2 _IOW(BTRFS_IOCTL_MAGIC, 63, struct btrfs_ioctl_vol_args_v2)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700567#define BTRFS_IOC_ENCODED_READ _IOR(BTRFS_IOCTL_MAGIC, 64, struct btrfs_ioctl_encoded_io_args)
568#define BTRFS_IOC_ENCODED_WRITE _IOW(BTRFS_IOCTL_MAGIC, 64, struct btrfs_ioctl_encoded_io_args)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800569#ifdef __cplusplus
570}
571#endif
Christopher Ferris38062f92014-07-09 15:33:25 -0700572#endif