5 #include <linux/ioctl.h>
7 #define BTRFS_SUPER_MAGIC 0x9123683E
8 #define BTRFS_SUPER_INFO_OFFSET (64 * 1024)
9 #define BTRFS_SUPER_INFO_SIZE 4096
10 #define BTRFS_MAGIC "_BHRfS_M"
11 #define BTRFS_CSUM_SIZE 32
12 #define BTRFS_FSID_SIZE 16
21 #define BTRFS_ROOT_BACKREF_KEY 144
22 #define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL
23 #define BTRFS_DIR_ITEM_KEY 84
26 * * this is used for both forward and backward root refs
28 struct btrfs_root_ref {
32 } __attribute__ ((__packed__));
34 struct btrfs_disk_key {
38 } __attribute__ ((__packed__));
40 struct btrfs_dir_item {
41 struct btrfs_disk_key location;
46 } __attribute__ ((__packed__));
48 struct btrfs_super_block {
49 unsigned char csum[BTRFS_CSUM_SIZE];
50 /* the first 3 fields must match struct btrfs_header */
51 unsigned char fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
52 u64 bytenr; /* this block number */
55 /* allowed to be different from the btrfs_header from here own down */
57 } __attribute__ ((__packed__));
60 #define BTRFS_IOCTL_MAGIC 0x94
61 #define BTRFS_VOL_NAME_MAX 255
62 #define BTRFS_PATH_NAME_MAX 4087
64 struct btrfs_ioctl_vol_args {
66 char name[BTRFS_PATH_NAME_MAX + 1];
69 struct btrfs_ioctl_search_key {
70 /* which root are we searching. 0 is the tree of tree roots */
73 /* keys returned will be >= min and <= max */
77 /* keys returned will be >= min and <= max */
81 /* max and min transids to search for */
85 /* keys returned will be >= min and <= max */
90 * how many items did userland ask for, and how many are we
95 /* align to 64 bits */
98 /* some extra for later */
105 struct btrfs_ioctl_search_header {
111 } __attribute__((may_alias));
113 #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key))
115 * the buf is an array of search headers where
116 * each header is followed by the actual item
117 * the type field is expanded to 32 bits for alignment
119 struct btrfs_ioctl_search_args {
120 struct btrfs_ioctl_search_key key;
121 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
124 #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \
125 struct btrfs_ioctl_search_args)