diff options
Diffstat (limited to 'fs/btrfs/ioctl.h')
-rw-r--r-- | fs/btrfs/ioctl.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h index bc49914475eb..424694aa517f 100644 --- a/fs/btrfs/ioctl.h +++ b/fs/btrfs/ioctl.h | |||
@@ -30,12 +30,114 @@ struct btrfs_ioctl_vol_args { | |||
30 | char name[BTRFS_PATH_NAME_MAX + 1]; | 30 | char name[BTRFS_PATH_NAME_MAX + 1]; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | #define BTRFS_INO_LOOKUP_PATH_MAX 4080 | ||
34 | struct btrfs_ioctl_ino_lookup_args { | ||
35 | __u64 treeid; | ||
36 | __u64 objectid; | ||
37 | char name[BTRFS_INO_LOOKUP_PATH_MAX]; | ||
38 | }; | ||
39 | |||
40 | struct btrfs_ioctl_search_key { | ||
41 | /* which root are we searching. 0 is the tree of tree roots */ | ||
42 | __u64 tree_id; | ||
43 | |||
44 | /* keys returned will be >= min and <= max */ | ||
45 | __u64 min_objectid; | ||
46 | __u64 max_objectid; | ||
47 | |||
48 | /* keys returned will be >= min and <= max */ | ||
49 | __u64 min_offset; | ||
50 | __u64 max_offset; | ||
51 | |||
52 | /* max and min transids to search for */ | ||
53 | __u64 min_transid; | ||
54 | __u64 max_transid; | ||
55 | |||
56 | /* keys returned will be >= min and <= max */ | ||
57 | __u32 min_type; | ||
58 | __u32 max_type; | ||
59 | |||
60 | /* | ||
61 | * how many items did userland ask for, and how many are we | ||
62 | * returning | ||
63 | */ | ||
64 | __u32 nr_items; | ||
65 | |||
66 | /* align to 64 bits */ | ||
67 | __u32 unused; | ||
68 | |||
69 | /* some extra for later */ | ||
70 | __u64 unused1; | ||
71 | __u64 unused2; | ||
72 | __u64 unused3; | ||
73 | __u64 unused4; | ||
74 | }; | ||
75 | |||
76 | struct btrfs_ioctl_search_header { | ||
77 | __u64 transid; | ||
78 | __u64 objectid; | ||
79 | __u64 offset; | ||
80 | __u32 type; | ||
81 | __u32 len; | ||
82 | }; | ||
83 | |||
84 | #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key)) | ||
85 | /* | ||
86 | * the buf is an array of search headers where | ||
87 | * each header is followed by the actual item | ||
88 | * the type field is expanded to 32 bits for alignment | ||
89 | */ | ||
90 | struct btrfs_ioctl_search_args { | ||
91 | struct btrfs_ioctl_search_key key; | ||
92 | char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; | ||
93 | }; | ||
94 | |||
33 | struct btrfs_ioctl_clone_range_args { | 95 | struct btrfs_ioctl_clone_range_args { |
34 | __s64 src_fd; | 96 | __s64 src_fd; |
35 | __u64 src_offset, src_length; | 97 | __u64 src_offset, src_length; |
36 | __u64 dest_offset; | 98 | __u64 dest_offset; |
37 | }; | 99 | }; |
38 | 100 | ||
101 | /* flags for the defrag range ioctl */ | ||
102 | #define BTRFS_DEFRAG_RANGE_COMPRESS 1 | ||
103 | #define BTRFS_DEFRAG_RANGE_START_IO 2 | ||
104 | |||
105 | struct btrfs_ioctl_defrag_range_args { | ||
106 | /* start of the defrag operation */ | ||
107 | __u64 start; | ||
108 | |||
109 | /* number of bytes to defrag, use (u64)-1 to say all */ | ||
110 | __u64 len; | ||
111 | |||
112 | /* | ||
113 | * flags for the operation, which can include turning | ||
114 | * on compression for this one defrag | ||
115 | */ | ||
116 | __u64 flags; | ||
117 | |||
118 | /* | ||
119 | * any extent bigger than this will be considered | ||
120 | * already defragged. Use 0 to take the kernel default | ||
121 | * Use 1 to say every single extent must be rewritten | ||
122 | */ | ||
123 | __u32 extent_thresh; | ||
124 | |||
125 | /* spare for later */ | ||
126 | __u32 unused[5]; | ||
127 | }; | ||
128 | |||
129 | struct btrfs_ioctl_space_info { | ||
130 | __u64 flags; | ||
131 | __u64 total_bytes; | ||
132 | __u64 used_bytes; | ||
133 | }; | ||
134 | |||
135 | struct btrfs_ioctl_space_args { | ||
136 | __u64 space_slots; | ||
137 | __u64 total_spaces; | ||
138 | struct btrfs_ioctl_space_info spaces[0]; | ||
139 | }; | ||
140 | |||
39 | #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ | 141 | #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ |
40 | struct btrfs_ioctl_vol_args) | 142 | struct btrfs_ioctl_vol_args) |
41 | #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ | 143 | #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ |
@@ -67,4 +169,13 @@ struct btrfs_ioctl_clone_range_args { | |||
67 | struct btrfs_ioctl_vol_args) | 169 | struct btrfs_ioctl_vol_args) |
68 | #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ | 170 | #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ |
69 | struct btrfs_ioctl_vol_args) | 171 | struct btrfs_ioctl_vol_args) |
172 | #define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \ | ||
173 | struct btrfs_ioctl_defrag_range_args) | ||
174 | #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ | ||
175 | struct btrfs_ioctl_search_args) | ||
176 | #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ | ||
177 | struct btrfs_ioctl_ino_lookup_args) | ||
178 | #define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, u64) | ||
179 | #define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \ | ||
180 | struct btrfs_ioctl_space_args) | ||
70 | #endif | 181 | #endif |