status-codes.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright 2023 Red Hat
  4. */
  5. #ifndef VDO_STATUS_CODES_H
  6. #define VDO_STATUS_CODES_H
  7. #include "errors.h"
  8. enum {
  9. UDS_ERRORS_BLOCK_SIZE = UDS_ERROR_CODE_BLOCK_END - UDS_ERROR_CODE_BASE,
  10. VDO_ERRORS_BLOCK_START = UDS_ERROR_CODE_BLOCK_END,
  11. VDO_ERRORS_BLOCK_END = VDO_ERRORS_BLOCK_START + UDS_ERRORS_BLOCK_SIZE,
  12. };
  13. /* VDO-specific status codes. */
  14. enum vdo_status_codes {
  15. /* base of all VDO errors */
  16. VDO_STATUS_CODE_BASE = VDO_ERRORS_BLOCK_START,
  17. /* we haven't written this yet */
  18. VDO_NOT_IMPLEMENTED = VDO_STATUS_CODE_BASE,
  19. /* input out of range */
  20. VDO_OUT_OF_RANGE,
  21. /* an invalid reference count would result */
  22. VDO_REF_COUNT_INVALID,
  23. /* a free block could not be allocated */
  24. VDO_NO_SPACE,
  25. /* improper or missing configuration option */
  26. VDO_BAD_CONFIGURATION,
  27. /* prior operation still in progress */
  28. VDO_COMPONENT_BUSY,
  29. /* page contents incorrect or corrupt data */
  30. VDO_BAD_PAGE,
  31. /* unsupported version of some component */
  32. VDO_UNSUPPORTED_VERSION,
  33. /* component id mismatch in decoder */
  34. VDO_INCORRECT_COMPONENT,
  35. /* parameters have conflicting values */
  36. VDO_PARAMETER_MISMATCH,
  37. /* no partition exists with a given id */
  38. VDO_UNKNOWN_PARTITION,
  39. /* a partition already exists with a given id */
  40. VDO_PARTITION_EXISTS,
  41. /* physical block growth of too few blocks */
  42. VDO_INCREMENT_TOO_SMALL,
  43. /* incorrect checksum */
  44. VDO_CHECKSUM_MISMATCH,
  45. /* a lock is held incorrectly */
  46. VDO_LOCK_ERROR,
  47. /* the VDO is in read-only mode */
  48. VDO_READ_ONLY,
  49. /* the VDO is shutting down */
  50. VDO_SHUTTING_DOWN,
  51. /* the recovery journal has corrupt entries or corrupt metadata */
  52. VDO_CORRUPT_JOURNAL,
  53. /* exceeds maximum number of slabs supported */
  54. VDO_TOO_MANY_SLABS,
  55. /* a compressed block fragment is invalid */
  56. VDO_INVALID_FRAGMENT,
  57. /* action is unsupported while rebuilding */
  58. VDO_RETRY_AFTER_REBUILD,
  59. /* a block map entry is invalid */
  60. VDO_BAD_MAPPING,
  61. /* bio_add_page failed */
  62. VDO_BIO_CREATION_FAILED,
  63. /* bad magic number */
  64. VDO_BAD_MAGIC,
  65. /* bad nonce */
  66. VDO_BAD_NONCE,
  67. /* sequence number overflow */
  68. VDO_JOURNAL_OVERFLOW,
  69. /* the VDO is not in a state to perform an admin operation */
  70. VDO_INVALID_ADMIN_STATE,
  71. /* one more than last error code */
  72. VDO_STATUS_CODE_LAST,
  73. VDO_STATUS_CODE_BLOCK_END = VDO_ERRORS_BLOCK_END
  74. };
  75. extern const struct error_info vdo_status_list[];
  76. int vdo_register_status_codes(void);
  77. int vdo_status_to_errno(int error);
  78. #endif /* VDO_STATUS_CODES_H */