logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

btrfs.h (37150B)


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