Blame view
fs/btrfs/ioctl.h
8.66 KB
6cbd55707 Btrfs: add GPLv2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
/* * Copyright (C) 2007 Oracle. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ |
c5739bba5 Btrfs: snapshot p... |
18 19 20 21 22 23 |
#ifndef __IOCTL_ #define __IOCTL_ #include <linux/ioctl.h> #define BTRFS_IOCTL_MAGIC 0x94 #define BTRFS_VOL_NAME_MAX 255 |
8a4b83cc8 Btrfs: Add suppor... |
24 |
|
c071fcfdb Btrfs: fix ioctl ... |
25 |
/* this should be 4k */ |
72fd032e9 Btrfs: add SNAP_C... |
26 |
#define BTRFS_PATH_NAME_MAX 4087 |
c5739bba5 Btrfs: snapshot p... |
27 |
struct btrfs_ioctl_vol_args { |
3de4586c5 Btrfs: Allow subv... |
28 |
__s64 fd; |
8a4b83cc8 Btrfs: Add suppor... |
29 |
char name[BTRFS_PATH_NAME_MAX + 1]; |
c5739bba5 Btrfs: snapshot p... |
30 |
}; |
fdfb1e4f6 Btrfs: Make async... |
31 |
#define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0) |
b83cc9693 Btrfs: Add readon... |
32 |
#define BTRFS_SUBVOL_RDONLY (1ULL << 1) |
475f63874 btrfs: new ioctls... |
33 34 |
#define BTRFS_FSID_SIZE 16 #define BTRFS_UUID_SIZE 16 |
fdfb1e4f6 Btrfs: Make async... |
35 36 37 |
#define BTRFS_SUBVOL_NAME_MAX 4039 struct btrfs_ioctl_vol_args_v2 { |
72fd032e9 Btrfs: add SNAP_C... |
38 39 |
__s64 fd; __u64 transid; |
fdfb1e4f6 Btrfs: Make async... |
40 41 42 |
__u64 flags; __u64 unused[4]; char name[BTRFS_SUBVOL_NAME_MAX + 1]; |
72fd032e9 Btrfs: add SNAP_C... |
43 |
}; |
a2de733c7 btrfs: scrub |
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
/* * structure to report errors and progress to userspace, either as a * result of a finished scrub, a canceled scrub or a progress inquiry */ struct btrfs_scrub_progress { __u64 data_extents_scrubbed; /* # of data extents scrubbed */ __u64 tree_extents_scrubbed; /* # of tree extents scrubbed */ __u64 data_bytes_scrubbed; /* # of data bytes scrubbed */ __u64 tree_bytes_scrubbed; /* # of tree bytes scrubbed */ __u64 read_errors; /* # of read errors encountered (EIO) */ __u64 csum_errors; /* # of failed csum checks */ __u64 verify_errors; /* # of occurences, where the metadata * of a tree block did not match the * expected values, like generation or * logical */ __u64 no_csum; /* # of 4k data block for which no csum * is present, probably the result of * data written with nodatasum */ __u64 csum_discards; /* # of csum for which no data was found * in the extent tree. */ __u64 super_errors; /* # of bad super blocks encountered */ __u64 malloc_errors; /* # of internal kmalloc errors. These * will likely cause an incomplete * scrub */ __u64 uncorrectable_errors; /* # of errors where either no intact * copy was found or the writeback * failed */ __u64 corrected_errors; /* # of errors corrected */ __u64 last_physical; /* last physical address scrubbed. In * case a scrub was aborted, this can * be used to restart the scrub */ __u64 unverified_errors; /* # of occurences where a read for a * full (64k) bio failed, but the re- * check succeeded for each 4k piece. * Intermittent error. */ }; |
8628764e1 btrfs: add readon... |
80 |
#define BTRFS_SCRUB_READONLY 1 |
475f63874 btrfs: new ioctls... |
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
struct btrfs_ioctl_scrub_args { __u64 devid; /* in */ __u64 start; /* in */ __u64 end; /* in */ __u64 flags; /* in */ struct btrfs_scrub_progress progress; /* out */ /* pad to 1k */ __u64 unused[(1024-32-sizeof(struct btrfs_scrub_progress))/8]; }; #define BTRFS_DEVICE_PATH_NAME_MAX 1024 struct btrfs_ioctl_dev_info_args { __u64 devid; /* in/out */ __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */ __u64 bytes_used; /* out */ __u64 total_bytes; /* out */ __u64 unused[379]; /* pad to 4k */ __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */ }; struct btrfs_ioctl_fs_info_args { __u64 max_id; /* out */ __u64 num_devices; /* out */ __u8 fsid[BTRFS_FSID_SIZE]; /* out */ __u64 reserved[124]; /* pad to 1k */ }; |
ac8e9819d Btrfs: add search... |
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
#define BTRFS_INO_LOOKUP_PATH_MAX 4080 struct btrfs_ioctl_ino_lookup_args { __u64 treeid; __u64 objectid; char name[BTRFS_INO_LOOKUP_PATH_MAX]; }; struct btrfs_ioctl_search_key { /* which root are we searching. 0 is the tree of tree roots */ __u64 tree_id; /* keys returned will be >= min and <= max */ __u64 min_objectid; __u64 max_objectid; /* keys returned will be >= min and <= max */ __u64 min_offset; __u64 max_offset; /* max and min transids to search for */ __u64 min_transid; __u64 max_transid; /* keys returned will be >= min and <= max */ __u32 min_type; __u32 max_type; /* * how many items did userland ask for, and how many are we * returning */ __u32 nr_items; /* align to 64 bits */ __u32 unused; /* some extra for later */ __u64 unused1; __u64 unused2; __u64 unused3; __u64 unused4; }; struct btrfs_ioctl_search_header { __u64 transid; __u64 objectid; __u64 offset; __u32 type; __u32 len; }; #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key)) /* * the buf is an array of search headers where * each header is followed by the actual item * the type field is expanded to 32 bits for alignment */ struct btrfs_ioctl_search_args { struct btrfs_ioctl_search_key key; char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; }; |
c071fcfdb Btrfs: fix ioctl ... |
168 169 170 171 172 |
struct btrfs_ioctl_clone_range_args { __s64 src_fd; __u64 src_offset, src_length; __u64 dest_offset; }; |
1e701a329 Btrfs: add new de... |
173 174 175 |
/* flags for the defrag range ioctl */ #define BTRFS_DEFRAG_RANGE_COMPRESS 1 #define BTRFS_DEFRAG_RANGE_START_IO 2 |
1406e4327 Btrfs: add a "df"... |
176 |
struct btrfs_ioctl_space_info { |
ce769a290 Btrfs: use __u64 ... |
177 178 179 |
__u64 flags; __u64 total_bytes; __u64 used_bytes; |
1406e4327 Btrfs: add a "df"... |
180 181 182 |
}; struct btrfs_ioctl_space_args { |
ce769a290 Btrfs: use __u64 ... |
183 184 |
__u64 space_slots; __u64 total_spaces; |
1406e4327 Btrfs: add a "df"... |
185 186 |
struct btrfs_ioctl_space_info spaces[0]; }; |
1e701a329 Btrfs: add new de... |
187 |
|
a542ad1ba btrfs: added help... |
188 189 190 191 192 |
struct btrfs_data_container { __u32 bytes_left; /* out -- bytes not needed to deliver output */ __u32 bytes_missing; /* out -- additional bytes needed for result */ __u32 elem_cnt; /* out */ __u32 elem_missed; /* out */ |
740c3d226 Btrfs: fix the ne... |
193 |
__u64 val[0]; /* out */ |
a542ad1ba btrfs: added help... |
194 |
}; |
d7728c960 btrfs: new ioctls... |
195 196 197 198 |
struct btrfs_ioctl_ino_path_args { __u64 inum; /* in */ __u32 size; /* in */ __u64 reserved[4]; |
740c3d226 Btrfs: fix the ne... |
199 200 |
/* struct btrfs_data_container *fspath; out */ __u64 fspath; /* out */ |
d7728c960 btrfs: new ioctls... |
201 202 203 204 205 206 |
}; struct btrfs_ioctl_logical_ino_args { __u64 logical; /* in */ __u32 size; /* in */ __u64 reserved[4]; |
740c3d226 Btrfs: fix the ne... |
207 208 |
/* struct btrfs_data_container *inodes; out */ __u64 inodes; |
d7728c960 btrfs: new ioctls... |
209 |
}; |
c5739bba5 Btrfs: snapshot p... |
210 211 |
#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ struct btrfs_ioctl_vol_args) |
6702ed490 Btrfs: Add run ti... |
212 |
#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ |
8352d8a47 Btrfs: add disk i... |
213 |
struct btrfs_ioctl_vol_args) |
edbd8d4ef Btrfs: Support fo... |
214 215 |
#define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \ struct btrfs_ioctl_vol_args) |
8a4b83cc8 Btrfs: Add suppor... |
216 217 |
#define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \ struct btrfs_ioctl_vol_args) |
6bf13c0cc Btrfs: transactio... |
218 219 220 221 222 223 224 |
/* trans start and trans end are dangerous, and only for * use by applications that know how to avoid the * resulting deadlocks */ #define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6) #define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7) #define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8) |
f2eb0a241 Btrfs: Clone file... |
225 |
#define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int) |
788f20eb5 Btrfs: Add new io... |
226 227 228 229 230 231 |
#define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \ struct btrfs_ioctl_vol_args) |
c5c9cd4d1 Btrfs: allow clon... |
232 233 234 |
#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \ struct btrfs_ioctl_clone_range_args) |
3de4586c5 Btrfs: Allow subv... |
235 236 |
#define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \ struct btrfs_ioctl_vol_args) |
76dda93c6 Btrfs: add snapsh... |
237 238 |
#define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ struct btrfs_ioctl_vol_args) |
1e701a329 Btrfs: add new de... |
239 240 |
#define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \ struct btrfs_ioctl_defrag_range_args) |
ac8e9819d Btrfs: add search... |
241 242 243 244 |
#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ struct btrfs_ioctl_search_args) #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ struct btrfs_ioctl_ino_lookup_args) |
6ef5ed0d3 Btrfs: add ioctl ... |
245 |
#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, u64) |
1406e4327 Btrfs: add a "df"... |
246 247 |
#define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \ struct btrfs_ioctl_space_args) |
462045928 Btrfs: add START_... |
248 249 |
#define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64) #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64) |
fdfb1e4f6 Btrfs: Make async... |
250 251 |
#define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \ struct btrfs_ioctl_vol_args_v2) |
0caa102da Btrfs: Add BTRFS_... |
252 253 |
#define BTRFS_IOC_SUBVOL_GETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 25, __u64) #define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64) |
475f63874 btrfs: new ioctls... |
254 255 256 257 258 259 260 261 262 |
#define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \ struct btrfs_ioctl_scrub_args) #define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28) #define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, \ struct btrfs_ioctl_scrub_args) #define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \ struct btrfs_ioctl_dev_info_args) #define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \ struct btrfs_ioctl_fs_info_args) |
d7728c960 btrfs: new ioctls... |
263 264 265 266 |
#define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, \ struct btrfs_ioctl_ino_path_args) #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \ struct btrfs_ioctl_ino_path_args) |
c5739bba5 Btrfs: snapshot p... |
267 |
#endif |