Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com> |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * 3. The name of the author may not be used to endorse or promote products |
| 14 | * derived from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | #include "defs.h" |
| 29 | #include <linux/fs.h> |
| 30 | #ifdef HAVE_LINUX_BTRFS_H |
| 31 | /* |
| 32 | * Prior to Linux 3.12, the BTRFS_IOC_DEFAULT_SUBVOL used u64 in |
| 33 | * its definition, which isn't exported by the kernel. |
| 34 | */ |
| 35 | typedef __u64 u64; |
| 36 | |
| 37 | #include <linux/btrfs.h> |
| 38 | |
| 39 | #ifndef HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS |
| 40 | struct btrfs_ioctl_feature_flags { |
| 41 | uint64_t compat_flags; |
| 42 | uint64_t compat_ro_flags; |
| 43 | uint64_t incompat_flags; |
| 44 | }; |
| 45 | #endif |
| 46 | |
| 47 | #ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START |
| 48 | struct btrfs_ioctl_defrag_range_args { |
| 49 | uint64_t start; |
| 50 | uint64_t len; |
| 51 | uint64_t flags; |
| 52 | uint32_t extent_thresh; |
| 53 | uint32_t compress_type; |
| 54 | uint32_t unused[4]; |
| 55 | }; |
| 56 | #endif |
| 57 | |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 58 | #ifndef BTRFS_LABEL_SIZE |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 59 | # define BTRFS_LABEL_SIZE 256 |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 60 | #endif |
| 61 | |
| 62 | #ifndef BTRFS_FIRST_FREE_OBJECTID |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 63 | # define BTRFS_FIRST_FREE_OBJECTID 256ULL |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 64 | #endif |
| 65 | |
| 66 | #ifndef BTRFS_IOC_GET_FEATURES |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 67 | # define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ |
| 68 | struct btrfs_ioctl_feature_flags) |
| 69 | # define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \ |
| 70 | struct btrfs_ioctl_feature_flags[2]) |
| 71 | # define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ |
| 72 | struct btrfs_ioctl_feature_flags[3]) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 73 | #endif |
| 74 | |
| 75 | #ifndef BTRFS_IOC_TREE_SEARCH_V2 |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 76 | # define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \ |
| 77 | struct btrfs_ioctl_search_args_v2) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 78 | struct btrfs_ioctl_search_args_v2 { |
| 79 | struct btrfs_ioctl_search_key key; /* in/out - search parameters */ |
| 80 | uint64_t buf_size; /* in - size of buffer |
| 81 | * out - on EOVERFLOW: needed size |
| 82 | * to store item */ |
| 83 | uint64_t buf[0]; /* out - found items */ |
| 84 | }; |
| 85 | #endif |
| 86 | |
| 87 | #include "xlat/btrfs_balance_args.h" |
| 88 | #include "xlat/btrfs_balance_ctl_cmds.h" |
| 89 | #include "xlat/btrfs_balance_flags.h" |
| 90 | #include "xlat/btrfs_balance_state.h" |
| 91 | #include "xlat/btrfs_compress_types.h" |
| 92 | #include "xlat/btrfs_defrag_flags.h" |
| 93 | #include "xlat/btrfs_dev_replace_cmds.h" |
| 94 | #include "xlat/btrfs_dev_replace_results.h" |
| 95 | #include "xlat/btrfs_dev_replace_state.h" |
| 96 | #include "xlat/btrfs_dev_stats_flags.h" |
| 97 | #include "xlat/btrfs_dev_stats_values.h" |
| 98 | #include "xlat/btrfs_features_compat.h" |
| 99 | #include "xlat/btrfs_features_compat_ro.h" |
| 100 | #include "xlat/btrfs_features_incompat.h" |
| 101 | #include "xlat/btrfs_key_types.h" |
| 102 | #include "xlat/btrfs_qgroup_ctl_cmds.h" |
| 103 | #include "xlat/btrfs_qgroup_inherit_flags.h" |
| 104 | #include "xlat/btrfs_qgroup_limit_flags.h" |
| 105 | #include "xlat/btrfs_qgroup_status_flags.h" |
| 106 | #include "xlat/btrfs_scrub_flags.h" |
| 107 | #include "xlat/btrfs_send_flags.h" |
| 108 | #include "xlat/btrfs_snap_flags_v2.h" |
| 109 | #include "xlat/btrfs_space_info_flags.h" |
| 110 | #include "xlat/btrfs_tree_objectids.h" |
| 111 | |
| 112 | static inline char |
| 113 | prnibble(char v) |
| 114 | { |
| 115 | if (v >= 10) |
| 116 | return 'a' + (v - 10); |
| 117 | return '0' + v; |
| 118 | } |
| 119 | |
| 120 | /* 8-4-4-4-12 = 36 characters */ |
| 121 | #define UUID_STRING_SIZE 36 |
| 122 | |
| 123 | /* Formats uuid, returns 0 if it's all zeroes */ |
| 124 | static int |
| 125 | btrfs_unparse_uuid(unsigned char *uuid, char *out) |
| 126 | { |
| 127 | int i; |
| 128 | int ret = 0; |
| 129 | for (i = 0; i < BTRFS_UUID_SIZE; i++) { |
| 130 | if (i == 4 || i == 6 || i == 8 || i == 10) |
| 131 | *out++ = '-'; |
| 132 | *out++ = prnibble(uuid[i] >> 4); |
| 133 | *out++ = prnibble(uuid[i] & 0xf); |
| 134 | if (uuid[i]) |
| 135 | ret = 1; |
| 136 | } |
| 137 | *out = '\0'; |
| 138 | return ret; |
| 139 | } |
| 140 | |
| 141 | static void |
| 142 | print_u64(const char *name, uint64_t value) |
| 143 | { |
| 144 | tprintf(", %s=%" PRIu64, name, value); |
| 145 | if (value == UINT64_MAX) |
| 146 | tprints(" /* UINT64_MAX */"); |
| 147 | } |
| 148 | |
| 149 | #define print_member_u64(obj, name) print_u64(#name, obj->name) |
| 150 | |
| 151 | static void |
Dmitry V. Levin | b85d09f | 2016-05-24 00:56:08 +0000 | [diff] [blame] | 152 | btrfs_print_balance_args(const char *name, const struct btrfs_balance_args *bba) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 153 | { |
| 154 | tprintf(", %s={profiles=", name); |
| 155 | printflags64(btrfs_space_info_flags, bba->profiles, |
| 156 | "BTRFS_BLOCK_GROUP_???"); |
| 157 | print_member_u64(bba, usage); |
| 158 | print_member_u64(bba, devid); |
| 159 | print_member_u64(bba, pstart); |
| 160 | print_member_u64(bba, pend); |
| 161 | print_member_u64(bba, vstart); |
| 162 | print_member_u64(bba, vend); |
| 163 | print_member_u64(bba, target); |
| 164 | tprints(", flags="); |
| 165 | printflags64(btrfs_balance_args, bba->flags, "BTRFS_BALANCE_ARGS_???"); |
| 166 | tprints("}"); |
| 167 | } |
| 168 | |
| 169 | static void |
| 170 | btrfs_print_balance(struct tcb *tcp, const long arg, bool out) |
| 171 | { |
| 172 | struct btrfs_ioctl_balance_args balance_args; |
| 173 | |
| 174 | if (umove_or_printaddr(tcp, arg, &balance_args)) |
| 175 | return; |
| 176 | |
| 177 | tprints("{flags="); |
| 178 | printflags64(btrfs_balance_flags, balance_args.flags, |
| 179 | "BTRFS_BALANCE_???"); |
| 180 | if (out) { |
| 181 | tprints(", state="); |
| 182 | printflags64(btrfs_balance_state, balance_args.state, |
| 183 | "BTRFS_BALANCE_STATE_???"); |
| 184 | } |
| 185 | |
| 186 | if (balance_args.flags & BTRFS_BALANCE_DATA) |
| 187 | btrfs_print_balance_args("data", &balance_args.data); |
| 188 | if (balance_args.flags & BTRFS_BALANCE_METADATA) |
| 189 | btrfs_print_balance_args("meta", &balance_args.meta); |
| 190 | if (balance_args.flags & BTRFS_BALANCE_SYSTEM) |
| 191 | btrfs_print_balance_args("sys", &balance_args.sys); |
| 192 | tprints("}"); |
| 193 | } |
| 194 | |
| 195 | static void |
Dmitry V. Levin | b85d09f | 2016-05-24 00:56:08 +0000 | [diff] [blame] | 196 | btrfs_print_features(const struct btrfs_ioctl_feature_flags *flags) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 197 | { |
| 198 | tprints("{compat_flags="); |
| 199 | printflags64(btrfs_features_compat, flags->compat_flags, |
| 200 | "BTRFS_FEATURE_COMPAT_???"); |
| 201 | |
| 202 | tprints(", compat_ro_flags="); |
| 203 | printflags64(btrfs_features_compat_ro, flags->compat_ro_flags, |
| 204 | "BTRFS_FEATURE_COMPAT_RO_???"); |
| 205 | |
| 206 | tprints(", incompat_flags="); |
| 207 | printflags64(btrfs_features_incompat, flags->incompat_flags, |
| 208 | "BTRFS_FEATURE_INCOMPAT_???"); |
| 209 | tprints("}"); |
| 210 | } |
| 211 | |
| 212 | static void |
Dmitry V. Levin | b85d09f | 2016-05-24 00:56:08 +0000 | [diff] [blame] | 213 | btrfs_print_qgroup_limit(const struct btrfs_qgroup_limit *lim) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 214 | { |
| 215 | tprints("{flags="); |
| 216 | printflags64(btrfs_qgroup_limit_flags, lim->flags, |
| 217 | "BTRFS_QGROUP_LIMIT_???"); |
| 218 | tprintf(", max_rfer=%" PRI__u64 ", max_excl=%" PRI__u64 |
| 219 | ", rsv_rfer=%" PRI__u64 ", rsv_excl=%" PRI__u64 "}", |
| 220 | lim->max_rfer, lim->max_excl, |
| 221 | lim->rsv_rfer, lim->rsv_excl); |
| 222 | } |
| 223 | |
| 224 | static void |
| 225 | btrfs_print_key_type(uint32_t type) |
| 226 | { |
| 227 | const char *str = xlookup(btrfs_key_types, type); |
| 228 | tprintf("%u", type); |
| 229 | if (str) |
| 230 | tprintf(" /* %s */", str); |
| 231 | } |
| 232 | |
| 233 | static void |
| 234 | btrfs_print_objectid(uint64_t objectid) |
| 235 | { |
| 236 | const char *str = xlookup(btrfs_tree_objectids, objectid); |
| 237 | tprintf("%" PRIu64, objectid); |
| 238 | if (str) |
| 239 | tprintf(" /* %s */", str); |
| 240 | } |
| 241 | |
| 242 | static void |
Dmitry V. Levin | b85d09f | 2016-05-24 00:56:08 +0000 | [diff] [blame] | 243 | btrfs_print_data_container_header(const struct btrfs_data_container *container) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 244 | { |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 245 | tprintf("{bytes_left=%u, bytes_missing=%u" |
| 246 | ", elem_cnt=%u, elem_missed=%u, val=", |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 247 | container->bytes_left, container->bytes_missing, |
| 248 | container->elem_cnt, container->elem_missed); |
| 249 | } |
| 250 | |
| 251 | static void |
| 252 | btrfs_print_data_container_footer(void) |
| 253 | { |
| 254 | tprints("}"); |
| 255 | } |
| 256 | |
| 257 | static uint64_t |
| 258 | data_container_record_offset(unsigned int index) |
| 259 | { |
| 260 | return offsetof(struct btrfs_data_container, val[index]); |
| 261 | } |
| 262 | |
| 263 | static void |
Dmitry V. Levin | b85d09f | 2016-05-24 00:56:08 +0000 | [diff] [blame] | 264 | btrfs_print_logical_ino_container(struct tcb *tcp, |
| 265 | const uint64_t inodes_addr) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 266 | { |
| 267 | struct btrfs_data_container container; |
| 268 | uint32_t i; |
| 269 | uint32_t printed = 0; |
| 270 | |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 271 | if (umove_or_printaddr(tcp, inodes_addr, &container)) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 272 | return; |
| 273 | |
| 274 | btrfs_print_data_container_header(&container); |
| 275 | if (abbrev(tcp)) { |
| 276 | tprints("..."); |
| 277 | btrfs_print_data_container_footer(); |
| 278 | return; |
| 279 | } |
| 280 | |
| 281 | tprints("["); |
| 282 | |
| 283 | for (i = 0; i < container.elem_cnt; i += 3, printed++) { |
| 284 | uint64_t offset = data_container_record_offset(i); |
| 285 | uint64_t record[3]; |
| 286 | |
| 287 | if (i) |
| 288 | tprints(", "); |
| 289 | |
| 290 | if (printed > max_strlen || |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 291 | umove(tcp, inodes_addr + offset, &record)) { |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 292 | tprints("..."); |
| 293 | break; |
| 294 | } |
| 295 | tprintf("{inum=%" PRIu64 ", offset=%" PRIu64 |
| 296 | ", root=%" PRIu64 "}", record[0], record[1], record[2]); |
| 297 | } |
| 298 | tprints("]"); |
| 299 | btrfs_print_data_container_footer(); |
| 300 | } |
| 301 | |
| 302 | static void |
Dmitry V. Levin | b85d09f | 2016-05-24 00:56:08 +0000 | [diff] [blame] | 303 | btrfs_print_ino_path_container(struct tcb *tcp, |
| 304 | const uint64_t fspath_addr) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 305 | { |
| 306 | struct btrfs_data_container container; |
| 307 | uint32_t i; |
| 308 | |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 309 | if (umove_or_printaddr(tcp, fspath_addr, &container)) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 310 | return; |
| 311 | |
| 312 | btrfs_print_data_container_header(&container); |
| 313 | if (abbrev(tcp)) { |
| 314 | tprints("..."); |
| 315 | btrfs_print_data_container_footer(); |
| 316 | return; |
| 317 | } |
| 318 | |
| 319 | tprints("["); |
| 320 | |
| 321 | for (i = 0; i < container.elem_cnt; i++) { |
| 322 | uint64_t offset = data_container_record_offset(i); |
| 323 | uint64_t ptr; |
| 324 | |
| 325 | if (i) |
| 326 | tprints(", "); |
| 327 | |
| 328 | if (i > max_strlen || |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 329 | umove(tcp, fspath_addr + offset, &ptr)) { |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 330 | tprints("..."); |
| 331 | break; |
| 332 | } |
| 333 | |
| 334 | printpath(tcp, |
| 335 | fspath_addr + data_container_record_offset(0) + ptr); |
| 336 | } |
| 337 | tprints("]"); |
| 338 | btrfs_print_data_container_footer(); |
| 339 | } |
| 340 | |
| 341 | static void |
Dmitry V. Levin | b85d09f | 2016-05-24 00:56:08 +0000 | [diff] [blame] | 342 | btrfs_print_qgroup_inherit(struct tcb *tcp, const uint64_t qgi_addr) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 343 | { |
| 344 | struct btrfs_qgroup_inherit inherit; |
| 345 | |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 346 | if (umove_or_printaddr(tcp, qgi_addr, &inherit)) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 347 | return; |
| 348 | |
| 349 | tprintf("{flags="); |
| 350 | printflags64(btrfs_qgroup_inherit_flags, inherit.flags, |
| 351 | "BTRFS_QGROUP_INHERIT_???"); |
| 352 | tprintf(", num_qgroups=%" PRI__u64 ", num_ref_copies=%" PRI__u64 |
| 353 | ", num_excl_copies=%" PRI__u64 ", lim=", |
| 354 | inherit.num_qgroups, inherit.num_ref_copies, |
| 355 | inherit.num_excl_copies); |
| 356 | |
| 357 | btrfs_print_qgroup_limit(&inherit.lim); |
| 358 | |
| 359 | tprints(", qgroups="); |
| 360 | |
| 361 | if (abbrev(tcp)) { |
| 362 | tprints("..."); |
| 363 | } else { |
| 364 | uint32_t i; |
| 365 | |
| 366 | tprints("["); |
| 367 | for (i = 0; i < inherit.num_qgroups; i++) { |
| 368 | uint64_t offset = offsetof(typeof(inherit), qgroups[i]); |
| 369 | uint64_t record; |
| 370 | if (i) |
| 371 | tprints(", "); |
| 372 | if (i > max_strlen || |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 373 | umove(tcp, qgi_addr + offset, &record)) { |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 374 | tprints("..."); |
| 375 | break; |
| 376 | } |
| 377 | |
| 378 | tprintf("%" PRIu64, record); |
| 379 | } |
| 380 | tprints("]"); |
| 381 | } |
| 382 | tprints("}"); |
| 383 | } |
| 384 | |
| 385 | static void |
| 386 | print_key_value_internal(struct tcb *tcp, const char *name, uint64_t value) |
| 387 | { |
| 388 | if (value) { |
| 389 | tprintf(", %s=%" PRIu64, name, value); |
| 390 | if (value == UINT64_MAX) |
| 391 | tprints(" /* UINT64_MAX */"); |
| 392 | } |
| 393 | } |
| 394 | #define print_key_value(tcp, key, name) \ |
| 395 | print_key_value_internal((tcp), #name, (key)->name) |
| 396 | |
| 397 | static void |
| 398 | btrfs_print_tree_search(struct tcb *tcp, struct btrfs_ioctl_search_key *key, |
| 399 | uint64_t buf_addr, uint64_t buf_size, bool print_size) |
| 400 | { |
| 401 | if (entering(tcp)) { |
| 402 | tprintf("{key={tree_id="); |
| 403 | btrfs_print_objectid(key->tree_id); |
| 404 | |
| 405 | if (key->min_objectid != BTRFS_FIRST_FREE_OBJECTID || |
| 406 | !abbrev(tcp)) { |
| 407 | tprints(", min_objectid="); |
| 408 | btrfs_print_objectid(key->min_objectid); |
| 409 | } |
| 410 | |
| 411 | if (key->max_objectid != BTRFS_LAST_FREE_OBJECTID || |
| 412 | !abbrev(tcp)) { |
| 413 | tprints(", max_objectid="); |
| 414 | btrfs_print_objectid(key->max_objectid); |
| 415 | } |
| 416 | |
| 417 | print_key_value(tcp, key, min_offset); |
| 418 | print_key_value(tcp, key, max_offset); |
| 419 | print_key_value(tcp, key, min_transid); |
| 420 | print_key_value(tcp, key, max_transid); |
| 421 | |
| 422 | tprints(", min_type="); |
| 423 | btrfs_print_key_type(key->min_type); |
| 424 | tprints(", max_type="); |
| 425 | btrfs_print_key_type(key->max_type); |
| 426 | tprintf(", nr_items=%u}", key->nr_items); |
| 427 | if (print_size) |
| 428 | tprintf(", buf_size=%" PRIu64, buf_size); |
| 429 | tprints("}"); |
| 430 | return; |
| 431 | } |
| 432 | tprintf("{key={nr_items=%u}", key->nr_items); |
| 433 | if (print_size) |
| 434 | tprintf(", buf_size=%" PRIu64, buf_size); |
| 435 | tprints(", buf="); |
| 436 | if (abbrev(tcp)) |
| 437 | tprints("..."); |
| 438 | else { |
| 439 | uint64_t i; |
| 440 | uint64_t off = 0; |
| 441 | tprints("["); |
| 442 | for (i = 0; i < key->nr_items; i++) { |
| 443 | struct btrfs_ioctl_search_header sh; |
| 444 | uint64_t addr = buf_addr + off; |
| 445 | if (i) |
| 446 | tprints(", "); |
| 447 | if (i > max_strlen || |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 448 | umove(tcp, addr, &sh)) { |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 449 | tprints("..."); |
| 450 | break; |
| 451 | } |
| 452 | tprintf("{transid=%" PRI__u64 ", objectid=", |
| 453 | sh.transid); |
| 454 | btrfs_print_objectid(sh.objectid); |
| 455 | tprintf(", offset=%" PRI__u64 ", type=", sh.offset); |
| 456 | btrfs_print_key_type(sh.type); |
| 457 | tprintf(", len=%u}", sh.len); |
| 458 | off += sizeof(sh) + sh.len; |
| 459 | } |
| 460 | tprints("]"); |
| 461 | } |
| 462 | |
| 463 | tprints("}"); |
| 464 | } |
| 465 | |
| 466 | int |
| 467 | btrfs_ioctl(struct tcb *tcp, const unsigned int code, const long arg) |
| 468 | { |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 469 | switch (code) { |
Dmitry V. Levin | 3ce2dfc | 2016-05-24 00:45:05 +0000 | [diff] [blame] | 470 | /* Take no arguments; command only. */ |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 471 | case BTRFS_IOC_TRANS_START: |
| 472 | case BTRFS_IOC_TRANS_END: |
| 473 | case BTRFS_IOC_SYNC: |
| 474 | case BTRFS_IOC_SCRUB_CANCEL: |
| 475 | case BTRFS_IOC_QUOTA_RESCAN_WAIT: |
| 476 | /* |
| 477 | * The codes for these ioctls are based on each accepting a |
| 478 | * vol_args but none of them actually consume an argument. |
| 479 | */ |
| 480 | case BTRFS_IOC_DEFRAG: |
| 481 | case BTRFS_IOC_BALANCE: |
| 482 | break; |
| 483 | |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 484 | /* takes a signed int */ |
| 485 | case BTRFS_IOC_BALANCE_CTL: |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 486 | tprints(", "); |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 487 | printxval(btrfs_balance_ctl_cmds, arg, "BTRFS_BALANCE_CTL_???"); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 488 | break; |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 489 | |
| 490 | /* returns a 64 */ |
| 491 | case BTRFS_IOC_START_SYNC: /* R */ |
| 492 | if (entering(tcp)) |
| 493 | return 0; |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 494 | /* fall through */ |
| 495 | /* takes a u64 */ |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 496 | case BTRFS_IOC_DEFAULT_SUBVOL: /* W */ |
| 497 | case BTRFS_IOC_WAIT_SYNC: /* W */ |
| 498 | tprints(", "); |
| 499 | printnum_int64(tcp, arg, "%" PRIu64); |
| 500 | break; |
| 501 | |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 502 | /* u64 but describe a flags bitfield; we can make that symbolic */ |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 503 | case BTRFS_IOC_SUBVOL_GETFLAGS: { /* R */ |
| 504 | uint64_t flags; |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 505 | |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 506 | if (entering(tcp)) |
| 507 | return 0; |
| 508 | |
| 509 | tprints(", "); |
| 510 | |
| 511 | if (umove_or_printaddr(tcp, arg, &flags)) |
| 512 | break; |
| 513 | |
| 514 | printflags64(btrfs_snap_flags_v2, flags, "BTRFS_SUBVOL_???"); |
| 515 | break; |
| 516 | } |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 517 | |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 518 | case BTRFS_IOC_SUBVOL_SETFLAGS: { /* W */ |
| 519 | uint64_t flags; |
| 520 | |
| 521 | tprints(", "); |
| 522 | |
| 523 | if (umove_or_printaddr(tcp, arg, &flags)) |
| 524 | break; |
| 525 | |
| 526 | printflags64(btrfs_snap_flags_v2, flags, "BTRFS_SUBVOL_???"); |
| 527 | break; |
| 528 | } |
| 529 | |
| 530 | /* More complex types */ |
| 531 | case BTRFS_IOC_BALANCE_V2: /* RW */ |
| 532 | if (entering(tcp)) { |
| 533 | tprints(", "); |
| 534 | btrfs_print_balance(tcp, arg, false); |
| 535 | return 0; |
| 536 | } |
| 537 | |
| 538 | if (syserror(tcp)) |
| 539 | break; |
| 540 | |
| 541 | tprints(" => "); |
| 542 | btrfs_print_balance(tcp, arg, true); |
| 543 | break; |
| 544 | case BTRFS_IOC_BALANCE_PROGRESS: /* R */ |
| 545 | if (entering(tcp)) |
| 546 | return 0; |
| 547 | |
| 548 | tprints(", "); |
| 549 | btrfs_print_balance(tcp, arg, true); |
| 550 | break; |
| 551 | |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 552 | case BTRFS_IOC_DEFRAG_RANGE: { /* W */ |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 553 | struct btrfs_ioctl_defrag_range_args args; |
| 554 | |
| 555 | tprints(", "); |
| 556 | |
| 557 | if (umove_or_printaddr(tcp, arg, &args)) |
| 558 | break; |
| 559 | |
| 560 | tprintf("{start=%" PRIu64 ", len=", (uint64_t)args.start); |
| 561 | |
| 562 | tprintf("%" PRIu64, args.len); |
| 563 | if (args.len == UINT64_MAX) |
| 564 | tprints(" /* UINT64_MAX */"); |
| 565 | |
| 566 | tprints(", flags="); |
| 567 | printflags64(btrfs_defrag_flags, args.flags, |
| 568 | "BTRFS_DEFRAG_RANGE_???"); |
| 569 | tprintf(", extent_thresh=%u, compress_type=", |
| 570 | args.extent_thresh); |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 571 | printxval(btrfs_compress_types, args.compress_type, |
| 572 | "BTRFS_COMPRESS_???"); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 573 | tprints("}"); |
| 574 | break; |
| 575 | } |
| 576 | |
| 577 | case BTRFS_IOC_DEV_INFO: { /* RW */ |
| 578 | struct btrfs_ioctl_dev_info_args args; |
| 579 | char uuid[UUID_STRING_SIZE+1]; |
| 580 | int valid; |
| 581 | |
| 582 | if (entering(tcp)) |
| 583 | tprints(", "); |
| 584 | else if (syserror(tcp)) |
| 585 | break; |
| 586 | else |
| 587 | tprints(" => "); |
| 588 | if (umove_or_printaddr(tcp, arg, &args)) |
| 589 | break; |
| 590 | tprints("{"); |
| 591 | |
| 592 | valid = btrfs_unparse_uuid(args.uuid, uuid); |
| 593 | if (entering(tcp)) { |
| 594 | tprintf("devid=%" PRI__u64, args.devid); |
| 595 | if (valid) |
| 596 | tprintf(", uuid=%s", uuid); |
| 597 | tprints("}"); |
| 598 | return 0; |
| 599 | } |
| 600 | if (valid) |
| 601 | tprintf("uuid=%s, ", uuid); |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 602 | tprintf("bytes_used=%" PRI__u64 |
| 603 | ", total_bytes=%" PRI__u64 ", path=", |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 604 | args.bytes_used, args.total_bytes); |
| 605 | print_quoted_string((const char *)args.path, sizeof(args.path), |
| 606 | QUOTE_0_TERMINATED); |
| 607 | tprints("}"); |
| 608 | break; |
| 609 | } |
| 610 | |
| 611 | case BTRFS_IOC_DEV_REPLACE: { /* RW */ |
| 612 | struct btrfs_ioctl_dev_replace_args args; |
| 613 | |
| 614 | if (entering(tcp)) |
| 615 | tprints(", "); |
| 616 | else if (syserror(tcp)) |
| 617 | break; |
| 618 | else |
| 619 | tprints(" => "); |
| 620 | |
| 621 | if (umove_or_printaddr(tcp, arg, &args)) |
| 622 | break; |
| 623 | |
| 624 | if (entering(tcp)) { |
| 625 | tprints("{cmd="); |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 626 | printxval64(btrfs_dev_replace_cmds, args.cmd, |
| 627 | "BTRFS_IOCTL_DEV_REPLACE_CMD_???"); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 628 | if (args.cmd == BTRFS_IOCTL_DEV_REPLACE_CMD_START) { |
| 629 | const char *str; |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 630 | tprintf(", start={srcdevid=%" PRI__u64 |
| 631 | ", cont_reading_from_srcdev_mode=%" PRI__u64 |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 632 | ", srcdev_name=", |
| 633 | args.start.srcdevid, |
| 634 | args.start.cont_reading_from_srcdev_mode); |
| 635 | |
| 636 | str = (const char*) args.start.srcdev_name; |
| 637 | print_quoted_string(str, |
| 638 | sizeof(args.start.srcdev_name), |
| 639 | QUOTE_0_TERMINATED); |
| 640 | tprints(", tgtdev_name="); |
| 641 | str = (const char*) args.start.tgtdev_name; |
| 642 | print_quoted_string(str, |
| 643 | sizeof(args.start.tgtdev_name), |
| 644 | QUOTE_0_TERMINATED); |
| 645 | tprints("}"); |
| 646 | |
| 647 | } |
| 648 | tprints("}"); |
| 649 | return 0; |
| 650 | } |
| 651 | |
| 652 | tprints("{result="); |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 653 | printxval64(btrfs_dev_replace_results, args.result, |
| 654 | "BTRFS_IOCTL_DEV_REPLACE_RESULT_???"); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 655 | if (args.cmd == BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS) { |
| 656 | char buf[sizeof("HH:MM:SS") + 1]; |
| 657 | time_t time; |
| 658 | tprints(", "); |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 659 | printxval64(btrfs_dev_replace_state, |
| 660 | args.status.replace_state, |
| 661 | "BTRFS_IOCTL_DEV_REPLACE_STATE_???"); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 662 | tprintf(", progress_1000=%" PRI__u64 " /* ", |
| 663 | args.status.progress_1000); |
| 664 | if (args.status.progress_1000 <= 1000) |
| 665 | tprintf("%" PRI__u64 ".%.2" PRI__u64 "%%", |
| 666 | args.status.progress_1000 / 10, |
| 667 | args.status.progress_1000 % 10); |
| 668 | else |
| 669 | tprints("???"); |
| 670 | tprints(" */ ,"); |
| 671 | |
| 672 | time = args.status.time_started; |
| 673 | strftime(buf, sizeof(buf), "%T", |
| 674 | localtime(&time)); |
| 675 | tprintf("time_started=%" PRI__u64" /* %s */, ", |
| 676 | args.status.time_started, buf); |
| 677 | |
| 678 | time = args.status.time_stopped; |
| 679 | strftime(buf, sizeof(buf), "%T", |
| 680 | localtime(&time)); |
| 681 | tprintf("time_stopped=%" PRI__u64" /* %s */, ", |
| 682 | args.status.time_stopped, buf); |
| 683 | |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 684 | tprintf("num_write_errors=%" PRI__u64 |
| 685 | ", num_uncorrectable_read_errors=%" PRI__u64, |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 686 | args.status.num_write_errors, |
| 687 | args.status.num_uncorrectable_read_errors); |
| 688 | } |
| 689 | tprints("}"); |
| 690 | break; |
| 691 | } |
| 692 | |
| 693 | case BTRFS_IOC_GET_FEATURES: { /* R */ |
| 694 | struct btrfs_ioctl_feature_flags flags; |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 695 | |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 696 | if (entering(tcp)) |
| 697 | return 0; |
| 698 | |
| 699 | tprints(", "); |
| 700 | if (umove_or_printaddr(tcp, arg, &flags)) |
| 701 | break; |
| 702 | |
| 703 | btrfs_print_features(&flags); |
| 704 | break; |
| 705 | } |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 706 | |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 707 | case BTRFS_IOC_SET_FEATURES: { /* W */ |
| 708 | struct btrfs_ioctl_feature_flags flarg[2]; |
| 709 | |
| 710 | tprints(", "); |
| 711 | |
| 712 | if (umove_or_printaddr(tcp, arg, &flarg)) |
| 713 | break; |
| 714 | |
| 715 | tprints("["); |
| 716 | btrfs_print_features(&flarg[0]); |
| 717 | tprints(", "); |
| 718 | btrfs_print_features(&flarg[1]); |
| 719 | tprints("]"); |
| 720 | break; |
| 721 | } |
| 722 | |
| 723 | case BTRFS_IOC_GET_SUPPORTED_FEATURES: { /* R */ |
| 724 | struct btrfs_ioctl_feature_flags flarg[3]; |
| 725 | |
| 726 | if (entering(tcp)) |
| 727 | return 0; |
| 728 | |
| 729 | tprints(", "); |
| 730 | if (umove_or_printaddr(tcp, arg, &flarg)) |
| 731 | break; |
| 732 | |
| 733 | tprints("[ /* supported */ "); |
| 734 | btrfs_print_features(&flarg[0]); |
| 735 | |
| 736 | tprints(", /* safe to set */ "); |
| 737 | btrfs_print_features(&flarg[1]); |
| 738 | |
| 739 | tprints(", /* safe to clear */ "); |
| 740 | btrfs_print_features(&flarg[2]); |
| 741 | tprints("]"); |
| 742 | |
| 743 | break; |
| 744 | } |
| 745 | |
| 746 | case BTRFS_IOC_FS_INFO: { /* R */ |
| 747 | struct btrfs_ioctl_fs_info_args args; |
| 748 | char uuid[UUID_STRING_SIZE+1]; |
| 749 | uint32_t nodesize, sectorsize, clone_alignment; |
| 750 | #ifndef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE |
| 751 | __u32 *reserved32; |
| 752 | #endif |
| 753 | |
| 754 | if (entering(tcp)) |
| 755 | return 0; |
| 756 | |
| 757 | tprints(", "); |
| 758 | if (umove_or_printaddr(tcp, arg, &args)) |
| 759 | break; |
| 760 | |
| 761 | #ifdef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE |
| 762 | nodesize = args.nodesize, |
| 763 | sectorsize = args.sectorsize, |
| 764 | clone_alignment = args.clone_alignment; |
| 765 | #else |
| 766 | reserved32 = (__u32 *)args.reserved; |
| 767 | nodesize = reserved32[0]; |
| 768 | sectorsize = reserved32[1]; |
| 769 | clone_alignment = reserved32[2]; |
| 770 | #endif |
| 771 | btrfs_unparse_uuid(args.fsid, uuid); |
| 772 | |
| 773 | tprints("{"); |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 774 | tprintf("max_id=%" PRI__u64 ", num_devices=%" PRI__u64 |
| 775 | ", fsid=%s, nodesize=%u, sectorsize=%u" |
| 776 | ", clone_alignment=%u", |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 777 | args.max_id, args.num_devices, uuid, |
| 778 | nodesize, sectorsize, clone_alignment); |
| 779 | tprints("}"); |
| 780 | break; |
| 781 | } |
| 782 | |
| 783 | case BTRFS_IOC_GET_DEV_STATS: { /* RW */ |
| 784 | struct btrfs_ioctl_get_dev_stats args; |
Dmitry V. Levin | 92b9062 | 2016-05-24 01:04:56 +0000 | [diff] [blame] | 785 | uint64_t i; |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 786 | |
| 787 | if (entering(tcp)) |
| 788 | tprints(", "); |
| 789 | else if (syserror(tcp)) |
| 790 | break; |
| 791 | else |
| 792 | tprints(" => "); |
| 793 | if (umove_or_printaddr(tcp, arg, &args)) |
| 794 | break; |
| 795 | |
| 796 | tprints("{"); |
| 797 | |
| 798 | if (entering(tcp)) |
| 799 | tprintf("devid=%" PRI__u64 ", ", args.devid); |
| 800 | |
| 801 | tprintf("nr_items=%" PRI__u64 ", flags=", args.nr_items); |
| 802 | printflags64(btrfs_dev_stats_flags, args.flags, |
| 803 | "BTRFS_DEV_STATS_???"); |
| 804 | |
| 805 | if (entering(tcp)) { |
| 806 | tprints("}"); |
| 807 | return 0; |
| 808 | } |
| 809 | |
| 810 | /* |
| 811 | * The structure has a 1k limit; Let's make sure we don't |
| 812 | * go off into the middle of nowhere with a bad nr_items |
| 813 | * value. |
| 814 | */ |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 815 | tprints(", ["); |
| 816 | for (i = 0; i < args.nr_items; i++) { |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 817 | if (i) |
| 818 | tprints(", "); |
Dmitry V. Levin | 92b9062 | 2016-05-24 01:04:56 +0000 | [diff] [blame] | 819 | if (i >= ARRAY_SIZE(args.values)) { |
| 820 | tprints("..."); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 821 | break; |
| 822 | } |
Dmitry V. Levin | 92b9062 | 2016-05-24 01:04:56 +0000 | [diff] [blame] | 823 | const char *name = xlookup(btrfs_dev_stats_values, i); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 824 | if (name) |
| 825 | tprintf("/* %s */ ", name); |
| 826 | tprintf("%" PRI__u64, args.values[i]); |
| 827 | } |
| 828 | tprints("]}"); |
| 829 | break; |
| 830 | } |
| 831 | |
| 832 | case BTRFS_IOC_INO_LOOKUP: { /* RW */ |
| 833 | struct btrfs_ioctl_ino_lookup_args args; |
| 834 | |
| 835 | if (entering(tcp)) |
| 836 | tprints(", "); |
| 837 | else if (syserror(tcp)) |
| 838 | break; |
| 839 | else |
| 840 | tprints(" => "); |
| 841 | |
| 842 | if (umove_or_printaddr(tcp, arg, &args)) |
| 843 | break; |
| 844 | |
| 845 | if (entering(tcp)) { |
| 846 | /* Use subvolume id of the containing root */ |
| 847 | if (args.treeid == 0) |
| 848 | /* abuse of auxstr to retain state */ |
| 849 | tcp->auxstr = (void *)1; |
| 850 | else |
| 851 | tcp->auxstr = NULL; |
| 852 | |
| 853 | tprints("{treeid="); |
| 854 | btrfs_print_objectid(args.treeid); |
| 855 | tprints(", objectid="); |
| 856 | btrfs_print_objectid(args.objectid); |
| 857 | tprints("}"); |
| 858 | return 0; |
| 859 | } |
| 860 | |
| 861 | tprints("{"); |
| 862 | if (tcp->auxstr) { |
Dmitry V. Levin | 6638a5d | 2016-05-24 01:09:04 +0000 | [diff] [blame^] | 863 | tcp->auxstr = NULL; |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 864 | tprints("treeid="); |
| 865 | btrfs_print_objectid(args.treeid); |
| 866 | tprints(", "); |
| 867 | } |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 868 | |
| 869 | tprints("name="); |
| 870 | print_quoted_string(args.name, sizeof(args.name), |
| 871 | QUOTE_0_TERMINATED); |
| 872 | tprints("}"); |
| 873 | break; |
| 874 | } |
| 875 | |
| 876 | case BTRFS_IOC_INO_PATHS: { /* RW */ |
| 877 | struct btrfs_ioctl_ino_path_args args; |
| 878 | |
| 879 | if (entering(tcp)) |
| 880 | tprints(", "); |
| 881 | else if (syserror(tcp)) |
| 882 | break; |
| 883 | else |
| 884 | tprints(" => "); |
| 885 | |
| 886 | if (umove_or_printaddr(tcp, arg, &args)) |
| 887 | break; |
| 888 | |
| 889 | tprints("{"); |
| 890 | |
| 891 | if (entering(tcp)) { |
| 892 | tprintf("inum=%" PRI__u64 ", size=%" PRI__u64, |
| 893 | args.inum, args.size); |
| 894 | tprintf(", fspath=0x%" PRI__x64 "}", args.fspath); |
| 895 | return 0; |
| 896 | } |
| 897 | |
| 898 | tprints("fspath="); |
| 899 | btrfs_print_ino_path_container(tcp, args.fspath); |
| 900 | |
| 901 | tprints("}"); |
| 902 | break; |
| 903 | } |
| 904 | |
| 905 | case BTRFS_IOC_LOGICAL_INO: { /* RW */ |
| 906 | struct btrfs_ioctl_logical_ino_args args; |
| 907 | |
| 908 | if (entering(tcp)) |
| 909 | tprints(", "); |
| 910 | else if (syserror(tcp)) |
| 911 | break; |
| 912 | else |
| 913 | tprints(" => "); |
| 914 | |
| 915 | if (umove_or_printaddr(tcp, arg, &args)) |
| 916 | break; |
| 917 | |
| 918 | tprints("{"); |
| 919 | |
| 920 | if (entering(tcp)) { |
| 921 | tprintf("logical=%" PRI__u64 ", size=%" PRI__u64, |
| 922 | args.logical, args.size); |
| 923 | tprintf(", inodes=0x%" PRI__x64 "}", args.inodes); |
| 924 | return 0; |
| 925 | } |
| 926 | |
| 927 | tprints("inodes="); |
| 928 | btrfs_print_logical_ino_container(tcp, args.inodes); |
| 929 | |
| 930 | tprints("}"); |
| 931 | break; |
| 932 | } |
| 933 | |
| 934 | case BTRFS_IOC_QGROUP_ASSIGN: { /* W */ |
| 935 | struct btrfs_ioctl_qgroup_assign_args args; |
| 936 | |
| 937 | tprints(", "); |
| 938 | if (umove_or_printaddr(tcp, arg, &args)) |
| 939 | break; |
| 940 | |
| 941 | tprintf("{assign=%" PRI__u64 ", src=%" PRI__u64 |
| 942 | ", dst=%" PRI__u64 "}", |
| 943 | args.assign, args.src, args.dst); |
| 944 | break; |
| 945 | } |
| 946 | |
| 947 | case BTRFS_IOC_QGROUP_CREATE: { /* W */ |
| 948 | struct btrfs_ioctl_qgroup_create_args args; |
| 949 | |
| 950 | tprints(", "); |
| 951 | if (umove_or_printaddr(tcp, arg, &args)) |
| 952 | break; |
| 953 | |
| 954 | tprintf("{create=%" PRI__u64 ", qgroupid=%" PRI__u64 "}", |
| 955 | args.create, args.qgroupid); |
| 956 | break; |
| 957 | } |
| 958 | |
| 959 | case BTRFS_IOC_QGROUP_LIMIT: { /* R */ |
| 960 | struct btrfs_ioctl_qgroup_limit_args args; |
| 961 | |
| 962 | if (entering(tcp)) |
| 963 | return 0; |
| 964 | |
| 965 | tprints(", "); |
| 966 | if (umove_or_printaddr(tcp, arg, &args)) |
| 967 | break; |
| 968 | |
| 969 | tprintf("{qgroupid=%" PRI__u64 ", lim=", args.qgroupid); |
| 970 | btrfs_print_qgroup_limit(&args.lim); |
| 971 | tprints("}"); |
| 972 | break; |
| 973 | } |
| 974 | |
| 975 | case BTRFS_IOC_QUOTA_CTL: { /* W */ |
| 976 | struct btrfs_ioctl_quota_ctl_args args; |
| 977 | |
| 978 | tprints(", "); |
| 979 | if (umove_or_printaddr(tcp, arg, &args)) |
| 980 | break; |
| 981 | |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 982 | printxval64(btrfs_qgroup_ctl_cmds, args.cmd, |
| 983 | "BTRFS_QUOTA_CTL_???"); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 984 | tprints("}"); |
| 985 | |
| 986 | break; |
| 987 | } |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 988 | |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 989 | case BTRFS_IOC_QUOTA_RESCAN: { /* W */ |
| 990 | struct btrfs_ioctl_quota_rescan_args args; |
| 991 | |
| 992 | tprints(", "); |
| 993 | if (umove_or_printaddr(tcp, arg, &args)) |
| 994 | break; |
| 995 | |
| 996 | tprintf("{flags=%" PRI__u64 "}", args.flags); |
| 997 | break; |
| 998 | } |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 999 | |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1000 | case BTRFS_IOC_QUOTA_RESCAN_STATUS: { /* R */ |
| 1001 | struct btrfs_ioctl_quota_rescan_args args; |
| 1002 | |
| 1003 | if (entering(tcp)) |
| 1004 | return 0; |
| 1005 | |
| 1006 | tprints(", "); |
| 1007 | if (umove_or_printaddr(tcp, arg, &args)) |
| 1008 | break; |
| 1009 | |
| 1010 | tprintf("{flags=%" PRI__u64 ", progress=", args.flags); |
| 1011 | btrfs_print_objectid(args.progress); |
| 1012 | tprints("}"); |
| 1013 | break; |
| 1014 | } |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 1015 | |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1016 | case BTRFS_IOC_SET_RECEIVED_SUBVOL: { /* RW */ |
| 1017 | #ifdef BTRFS_IOC_SET_RECEIVED_SUBVOL_32 |
| 1018 | case BTRFS_IOC_SET_RECEIVED_SUBVOL_32: { /* RW */ |
| 1019 | struct btrfs_ioctl_received_subvol_args_32 args32; |
| 1020 | #endif |
| 1021 | struct btrfs_ioctl_received_subvol_args args; |
| 1022 | char uuid[UUID_STRING_SIZE+1]; |
| 1023 | |
| 1024 | if (entering(tcp)) |
| 1025 | tprints(", "); |
| 1026 | else if (syserror(tcp)) |
| 1027 | break; |
| 1028 | else |
| 1029 | tprints(" => "); |
| 1030 | |
| 1031 | #ifdef BTRFS_IOC_SET_RECEIVED_SUBVOL_32 |
| 1032 | /* |
| 1033 | * This is a compat ioctl for 32 bit tools on |
| 1034 | * 64 bit systems. |
| 1035 | */ |
| 1036 | if (code == BTRFS_IOC_SET_RECEIVED_SUBVOL_32) { |
| 1037 | if (umove_or_printaddr(tcp, arg, &args32)) |
| 1038 | break; |
| 1039 | memcpy(args.uuid, args32.uuid, sizeof(uuid)); |
| 1040 | args.stransid = args32.stransid; |
| 1041 | args.rtransid = args32.rtransid; |
| 1042 | args.stime.sec = args32.stime.sec; |
| 1043 | args.stime.nsec = args32.stime.nsec; |
| 1044 | args.rtime.sec = args32.rtime.sec; |
| 1045 | args.rtime.nsec = args32.rtime.nsec; |
| 1046 | args.flags = args32.flags; |
| 1047 | } else |
| 1048 | #endif |
| 1049 | if (umove_or_printaddr(tcp, arg, &args)) |
| 1050 | break; |
| 1051 | |
| 1052 | if (entering(tcp)) { |
| 1053 | btrfs_unparse_uuid((unsigned char *)args.uuid, uuid); |
| 1054 | tprintf("{uuid=%s, stransid=%" PRI__u64 |
| 1055 | ", stime=%" PRI__u64 ".%u, flags=%" PRI__u64 |
| 1056 | "}", uuid, args.stransid, args.stime.sec, |
| 1057 | args.stime.nsec, args.flags); |
| 1058 | return 0; |
| 1059 | } |
| 1060 | tprintf("{rtransid=%" PRI__u64 ", rtime=%" PRI__u64 ".%u}", |
| 1061 | args.rtransid, args.rtime.sec, args.rtime.nsec); |
| 1062 | break; |
| 1063 | } |
Dmitry V. Levin | 95577cf | 2016-05-24 00:35:49 +0000 | [diff] [blame] | 1064 | |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1065 | case BTRFS_IOC_SCRUB: /* RW */ |
| 1066 | case BTRFS_IOC_SCRUB_PROGRESS: { /* RW */ |
| 1067 | struct btrfs_ioctl_scrub_args args; |
| 1068 | |
| 1069 | if (entering(tcp)) |
| 1070 | tprints(", "); |
| 1071 | else if (syserror(tcp)) |
| 1072 | break; |
| 1073 | else |
| 1074 | tprints(" => "); |
| 1075 | |
| 1076 | if (umove_or_printaddr(tcp, arg, &args)) |
| 1077 | break; |
| 1078 | |
| 1079 | if (entering(tcp)) { |
| 1080 | tprintf("{devid=%" PRI__u64, args.devid); |
| 1081 | if (code == BTRFS_IOC_SCRUB) { |
| 1082 | tprintf(", start=%" PRI__u64 ", end=", |
| 1083 | args.start); |
| 1084 | tprintf("%" PRI__u64, args.end); |
| 1085 | if (args.end == UINT64_MAX) |
| 1086 | tprints(" /* UINT64_MAX */"); |
| 1087 | tprints(", flags="); |
| 1088 | printflags64(btrfs_scrub_flags, args.flags, |
| 1089 | "BTRFS_SCRUB_???"); |
| 1090 | } |
| 1091 | tprints("}"); |
| 1092 | return 0; |
| 1093 | } |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 1094 | tprintf("{data_extents_scrubbed=%" PRI__u64 |
| 1095 | ", tree_extents_scrubbed=%" PRI__u64 |
| 1096 | ", data_bytes_scrubbed=%" PRI__u64 |
| 1097 | ", tree_bytes_scrubbed=%" PRI__u64 |
| 1098 | ", read_errors=%" PRI__u64 |
| 1099 | ", csum_errors=%" PRI__u64 |
| 1100 | ", verify_errors=%" PRI__u64 |
| 1101 | ", no_csum=%" PRI__u64 |
| 1102 | ", csum_discards=%" PRI__u64 |
| 1103 | ", super_errors=%" PRI__u64 |
| 1104 | ", malloc_errors=%" PRI__u64 |
| 1105 | ", uncorrectable_errors=%" PRI__u64 |
| 1106 | ", corrected_errors=%" PRI__u64 |
| 1107 | ", last_physical=%" PRI__u64 |
| 1108 | ", unverified_errors=%" PRI__u64 "}", |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1109 | args.progress.data_extents_scrubbed, |
| 1110 | args.progress.tree_extents_scrubbed, |
| 1111 | args.progress.data_bytes_scrubbed, |
| 1112 | args.progress.tree_bytes_scrubbed, |
| 1113 | args.progress.read_errors, |
| 1114 | args.progress.csum_errors, |
| 1115 | args.progress.verify_errors, |
| 1116 | args.progress.no_csum, |
| 1117 | args.progress.csum_discards, |
| 1118 | args.progress.super_errors, |
| 1119 | args.progress.malloc_errors, |
| 1120 | args.progress.uncorrectable_errors, |
| 1121 | args.progress.corrected_errors, |
| 1122 | args.progress.last_physical, |
| 1123 | args.progress.unverified_errors); |
| 1124 | break; |
| 1125 | } |
| 1126 | |
| 1127 | case BTRFS_IOC_TREE_SEARCH: { /* RW */ |
| 1128 | struct btrfs_ioctl_search_args args; |
| 1129 | uint64_t buf_offset; |
| 1130 | |
| 1131 | if (entering(tcp)) |
| 1132 | tprints(", "); |
| 1133 | else if (syserror(tcp)) |
| 1134 | break; |
| 1135 | else |
| 1136 | tprints(" => "); |
| 1137 | |
| 1138 | if (umove_or_printaddr(tcp, arg, &args)) |
| 1139 | break; |
| 1140 | |
| 1141 | buf_offset = offsetof(struct btrfs_ioctl_search_args, buf); |
| 1142 | btrfs_print_tree_search(tcp, &args.key, arg + buf_offset, |
| 1143 | sizeof(args.buf), false); |
| 1144 | if (entering(tcp)) |
| 1145 | return 0; |
| 1146 | break; |
| 1147 | } |
| 1148 | |
| 1149 | case BTRFS_IOC_TREE_SEARCH_V2: { /* RW */ |
| 1150 | struct btrfs_ioctl_search_args_v2 args; |
| 1151 | uint64_t buf_offset; |
| 1152 | |
| 1153 | if (entering(tcp)) |
| 1154 | tprints(", "); |
| 1155 | else if (syserror(tcp)) { |
| 1156 | if (tcp->u_error == EOVERFLOW) { |
| 1157 | tcp->u_error = 0; |
| 1158 | if (!umove_or_printaddr(tcp, arg, &args)) |
| 1159 | tprintf(" => {buf_size=%" PRIu64 "}", |
| 1160 | (uint64_t)args.buf_size); |
| 1161 | tcp->u_error = EOVERFLOW; |
| 1162 | } |
| 1163 | break; |
| 1164 | } else |
| 1165 | tprints(" => "); |
| 1166 | |
| 1167 | if (umove_or_printaddr(tcp, arg, &args)) |
| 1168 | break; |
| 1169 | |
| 1170 | buf_offset = offsetof(struct btrfs_ioctl_search_args_v2, buf); |
| 1171 | btrfs_print_tree_search(tcp, &args.key, arg + buf_offset, |
| 1172 | args.buf_size, true); |
| 1173 | if (entering(tcp)) |
| 1174 | return 0; |
| 1175 | break; |
| 1176 | } |
| 1177 | |
| 1178 | case BTRFS_IOC_SEND: { /* W */ |
| 1179 | struct btrfs_ioctl_send_args args; |
| 1180 | uint64_t base_addr; |
| 1181 | uint64_t i; |
| 1182 | |
| 1183 | tprints(", "); |
| 1184 | if (umove_or_printaddr(tcp, arg, &args)) |
| 1185 | break; |
| 1186 | |
| 1187 | tprintf("{send_fd=%" PRI__d64 ", clone_sources_count=%" PRI__u64 |
| 1188 | ", clone_sources=", args.send_fd, |
| 1189 | args.clone_sources_count); |
| 1190 | |
| 1191 | if (abbrev(tcp)) { |
| 1192 | tprints("..."); |
| 1193 | } else { |
| 1194 | tprints("["); |
| 1195 | base_addr = (unsigned long)args.clone_sources; |
| 1196 | for (i = 0; i < args.clone_sources_count; i++) { |
| 1197 | uint64_t offset = sizeof(uint64_t) * i; |
| 1198 | uint64_t record; |
| 1199 | if (i) |
| 1200 | tprints(", "); |
| 1201 | if (i > max_strlen || |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 1202 | umove(tcp, base_addr + offset, &record)) { |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1203 | tprints("..."); |
| 1204 | break; |
| 1205 | } |
| 1206 | btrfs_print_objectid(record); |
| 1207 | } |
| 1208 | tprints("]"); |
| 1209 | } |
| 1210 | tprints(", parent_root="); |
| 1211 | btrfs_print_objectid(args.parent_root); |
| 1212 | tprints(", flags="); |
| 1213 | printflags64(btrfs_send_flags, args.flags, |
| 1214 | "BTRFS_SEND_FLAGS_???"); |
| 1215 | tprints("}"); |
| 1216 | break; |
| 1217 | } |
| 1218 | |
| 1219 | case BTRFS_IOC_SPACE_INFO: { /* RW */ |
| 1220 | struct btrfs_ioctl_space_args args; |
| 1221 | uint64_t i; |
| 1222 | |
| 1223 | if (entering(tcp)) |
| 1224 | tprints(", "); |
| 1225 | else if (syserror(tcp)) |
| 1226 | break; |
| 1227 | else |
| 1228 | tprints(" => "); |
| 1229 | |
| 1230 | if (umove_or_printaddr(tcp, arg, &args)) |
| 1231 | break; |
| 1232 | |
| 1233 | tprints("{"); |
| 1234 | if (entering(tcp)) { |
Dmitry V. Levin | 2be39ec | 2016-05-24 00:23:31 +0000 | [diff] [blame] | 1235 | tprintf("space_slots=%" PRI__u64 "}", args.space_slots); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1236 | return 0; |
| 1237 | } |
| 1238 | |
| 1239 | tprintf("total_spaces=%" PRI__u64, args.total_spaces); |
| 1240 | |
| 1241 | if (args.space_slots == 0 && args.total_spaces) { |
| 1242 | tprints("}"); |
| 1243 | break; |
| 1244 | } |
| 1245 | |
| 1246 | tprints(", spaces="); |
| 1247 | |
| 1248 | if (abbrev(tcp)) { |
| 1249 | tprints("...}"); |
| 1250 | break; |
| 1251 | } |
| 1252 | |
| 1253 | tprints("["); |
| 1254 | |
| 1255 | for (i = 0; i < args.total_spaces; i++) { |
| 1256 | struct btrfs_ioctl_space_info info; |
| 1257 | uint64_t off = offsetof(typeof(args), spaces[i]); |
| 1258 | if (i) |
| 1259 | tprints(", "); |
| 1260 | |
| 1261 | if (i > max_strlen || |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 1262 | umove(tcp, arg + off, &info)) { |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1263 | tprints("..."); |
| 1264 | break; |
| 1265 | } |
| 1266 | |
| 1267 | tprints("{flags="); |
| 1268 | printflags64(btrfs_space_info_flags, info.flags, |
| 1269 | "BTRFS_SPACE_INFO_???"); |
| 1270 | tprintf(", total_bytes=%" PRI__u64 |
| 1271 | ", used_bytes=%" PRI__u64 "}", |
| 1272 | info.total_bytes, info.used_bytes); |
| 1273 | } |
| 1274 | tprints("]}"); |
| 1275 | break; |
| 1276 | } |
| 1277 | |
| 1278 | case BTRFS_IOC_SNAP_CREATE: |
| 1279 | case BTRFS_IOC_RESIZE: |
| 1280 | case BTRFS_IOC_SCAN_DEV: |
| 1281 | case BTRFS_IOC_ADD_DEV: |
| 1282 | case BTRFS_IOC_RM_DEV: |
| 1283 | case BTRFS_IOC_SUBVOL_CREATE: |
| 1284 | case BTRFS_IOC_SNAP_DESTROY: |
| 1285 | case BTRFS_IOC_DEVICES_READY: { /* W */ |
| 1286 | struct btrfs_ioctl_vol_args args; |
| 1287 | |
| 1288 | tprints(", "); |
| 1289 | if (umove_or_printaddr(tcp, arg, &args)) |
| 1290 | break; |
| 1291 | |
| 1292 | tprintf("{fd=%" PRI__d64 ", name=", args.fd); |
| 1293 | print_quoted_string(args.name, sizeof(args.name), |
| 1294 | QUOTE_0_TERMINATED); |
| 1295 | tprints("}"); |
| 1296 | break; |
| 1297 | } |
| 1298 | |
| 1299 | case BTRFS_IOC_SNAP_CREATE_V2: |
| 1300 | case BTRFS_IOC_SUBVOL_CREATE_V2: { /* code is W, but is actually RW */ |
| 1301 | struct btrfs_ioctl_vol_args_v2 args; |
| 1302 | |
| 1303 | if (entering(tcp)) |
| 1304 | tprints(", "); |
| 1305 | else if (syserror(tcp)) |
| 1306 | break; |
| 1307 | else |
| 1308 | tprints(" => "); |
| 1309 | |
| 1310 | if (umove_or_printaddr(tcp, arg, &args)) |
| 1311 | break; |
| 1312 | |
| 1313 | if (entering(tcp)) { |
| 1314 | tprintf("{fd=%" PRI__d64 ", flags=", args.fd); |
| 1315 | printflags64(btrfs_snap_flags_v2, args.flags, |
| 1316 | "BTRFS_SUBVOL_???"); |
| 1317 | if (args.flags & BTRFS_SUBVOL_QGROUP_INHERIT) { |
| 1318 | tprintf(", size=%" PRI__u64 ", qgroup_inherit=", |
| 1319 | args.size); |
| 1320 | |
| 1321 | btrfs_print_qgroup_inherit(tcp, |
| 1322 | (unsigned long)args.qgroup_inherit); |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1323 | } |
| 1324 | tprintf(", name="); |
Dmitry V. Levin | 0cd7ea0 | 2016-05-24 00:59:40 +0000 | [diff] [blame] | 1325 | print_quoted_string(args.name, sizeof(args.name), |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1326 | QUOTE_0_TERMINATED); |
| 1327 | tprints("}"); |
| 1328 | return 0; |
| 1329 | } |
| 1330 | tprintf("{transid=%" PRI__u64 "}", args.transid); |
| 1331 | break; |
| 1332 | } |
| 1333 | case BTRFS_IOC_GET_FSLABEL: /* R */ |
| 1334 | case BTRFS_IOC_SET_FSLABEL: {/* W */ |
| 1335 | char label[BTRFS_LABEL_SIZE]; |
| 1336 | if (code == BTRFS_IOC_GET_FSLABEL && entering(tcp)) |
| 1337 | return 0; |
| 1338 | |
| 1339 | tprints(", "); |
Dmitry V. Levin | 90ffbc7 | 2016-05-24 00:49:50 +0000 | [diff] [blame] | 1340 | if (umove_or_printaddr(tcp, arg, &label)) |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1341 | break; |
| 1342 | print_quoted_string(label, sizeof(label), QUOTE_0_TERMINATED); |
| 1343 | break; |
| 1344 | } |
| 1345 | |
| 1346 | case BTRFS_IOC_CLONE: /* FICLONE */ |
| 1347 | case BTRFS_IOC_CLONE_RANGE: /* FICLONERANGE */ |
| 1348 | case BTRFS_IOC_FILE_EXTENT_SAME: /* FIDEDUPERANGE */ |
| 1349 | /* |
| 1350 | * FICLONE, FICLONERANGE, and FIDEDUPERANGE started out as |
| 1351 | * btrfs ioctls and the code was kept for the generic |
| 1352 | * implementations. We use the BTRFS_* names here because |
| 1353 | * they will be available on older systems. |
| 1354 | */ |
| 1355 | return file_ioctl(tcp, code, arg); |
| 1356 | |
| 1357 | default: |
| 1358 | return RVAL_DECODED; |
| 1359 | }; |
Dmitry V. Levin | 3ce2dfc | 2016-05-24 00:45:05 +0000 | [diff] [blame] | 1360 | return RVAL_DECODED | 1; |
Jeff Mahoney | 8cc6962 | 2016-05-18 18:09:39 -0400 | [diff] [blame] | 1361 | } |
| 1362 | #endif /* HAVE_LINUX_BTRFS_H */ |