diff options
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/btrfs.h | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h index 5ef0df545a2a..05aed70627e2 100644 --- a/include/uapi/linux/btrfs.h +++ b/include/uapi/linux/btrfs.h | |||
| @@ -447,6 +447,46 @@ struct btrfs_ioctl_send_args { | |||
| 447 | __u64 reserved[4]; /* in */ | 447 | __u64 reserved[4]; /* in */ |
| 448 | }; | 448 | }; |
| 449 | 449 | ||
| 450 | /* Error codes as returned by the kernel */ | ||
| 451 | enum btrfs_err_code { | ||
| 452 | notused, | ||
| 453 | BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET, | ||
| 454 | BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET, | ||
| 455 | BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET, | ||
| 456 | BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET, | ||
| 457 | BTRFS_ERROR_DEV_TGT_REPLACE, | ||
| 458 | BTRFS_ERROR_DEV_MISSING_NOT_FOUND, | ||
| 459 | BTRFS_ERROR_DEV_ONLY_WRITABLE, | ||
| 460 | BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS | ||
| 461 | }; | ||
| 462 | /* An error code to error string mapping for the kernel | ||
| 463 | * error codes | ||
| 464 | */ | ||
| 465 | static inline char *btrfs_err_str(enum btrfs_err_code err_code) | ||
| 466 | { | ||
| 467 | switch (err_code) { | ||
| 468 | case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET: | ||
| 469 | return "unable to go below two devices on raid1"; | ||
| 470 | case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET: | ||
| 471 | return "unable to go below four devices on raid10"; | ||
| 472 | case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET: | ||
| 473 | return "unable to go below two devices on raid5"; | ||
| 474 | case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET: | ||
| 475 | return "unable to go below three devices on raid6"; | ||
| 476 | case BTRFS_ERROR_DEV_TGT_REPLACE: | ||
| 477 | return "unable to remove the dev_replace target dev"; | ||
| 478 | case BTRFS_ERROR_DEV_MISSING_NOT_FOUND: | ||
| 479 | return "no missing devices found to remove"; | ||
| 480 | case BTRFS_ERROR_DEV_ONLY_WRITABLE: | ||
| 481 | return "unable to remove the only writeable device"; | ||
| 482 | case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS: | ||
| 483 | return "add/delete/balance/replace/resize operation "\ | ||
| 484 | "in progress"; | ||
| 485 | default: | ||
| 486 | return NULL; | ||
| 487 | } | ||
| 488 | } | ||
| 489 | |||
| 450 | #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ | 490 | #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ |
| 451 | struct btrfs_ioctl_vol_args) | 491 | struct btrfs_ioctl_vol_args) |
| 452 | #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ | 492 | #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ |
| @@ -530,6 +570,7 @@ struct btrfs_ioctl_send_args { | |||
| 530 | struct btrfs_ioctl_quota_rescan_args) | 570 | struct btrfs_ioctl_quota_rescan_args) |
| 531 | #define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \ | 571 | #define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \ |
| 532 | struct btrfs_ioctl_quota_rescan_args) | 572 | struct btrfs_ioctl_quota_rescan_args) |
| 573 | #define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) | ||
| 533 | #define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \ | 574 | #define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \ |
| 534 | char[BTRFS_LABEL_SIZE]) | 575 | char[BTRFS_LABEL_SIZE]) |
| 535 | #define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \ | 576 | #define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \ |
| @@ -538,5 +579,4 @@ struct btrfs_ioctl_send_args { | |||
| 538 | struct btrfs_ioctl_get_dev_stats) | 579 | struct btrfs_ioctl_get_dev_stats) |
| 539 | #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \ | 580 | #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \ |
| 540 | struct btrfs_ioctl_dev_replace_args) | 581 | struct btrfs_ioctl_dev_replace_args) |
| 541 | |||
| 542 | #endif /* _UAPI_LINUX_BTRFS_H */ | 582 | #endif /* _UAPI_LINUX_BTRFS_H */ |
