dm vdo: slight cleanup of UDS error codes

No need to increment each UDS_ error code manually (relative to
UDS_ERROR_CODE_BASE).

Also, remove unused PRP_BLOCK_START and PRP_BLOCK_END.

Lastly, UDS_SUCCESS and VDO_SUCCESS are used interchangeably; so best
to explicitly set VDO_SUCCESS equal to UDS_SUCCESS.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
This commit is contained in:
Mike Snitzer 2024-01-26 21:42:27 -05:00
parent b06d5c37b8
commit 86492a3f69
2 changed files with 18 additions and 21 deletions

View file

@ -15,43 +15,42 @@
enum uds_status_codes { enum uds_status_codes {
/* Successful return */ /* Successful return */
UDS_SUCCESS = 0, UDS_SUCCESS = 0,
/* Used as a base value for reporting internal errors */ /* Used as a base value for reporting internal errors */
UDS_ERROR_CODE_BASE = 1024, UDS_ERROR_CODE_BASE = 1024,
/* Index overflow */ /* Index overflow */
UDS_OVERFLOW = UDS_ERROR_CODE_BASE + 0, UDS_OVERFLOW = UDS_ERROR_CODE_BASE,
/* Invalid argument passed to internal routine */ /* Invalid argument passed to internal routine */
UDS_INVALID_ARGUMENT = UDS_ERROR_CODE_BASE + 1, UDS_INVALID_ARGUMENT,
/* UDS data structures are in an invalid state */ /* UDS data structures are in an invalid state */
UDS_BAD_STATE = UDS_ERROR_CODE_BASE + 2, UDS_BAD_STATE,
/* Attempt to enter the same name into an internal structure twice */ /* Attempt to enter the same name into an internal structure twice */
UDS_DUPLICATE_NAME = UDS_ERROR_CODE_BASE + 3, UDS_DUPLICATE_NAME,
/* An assertion failed */ /* An assertion failed */
UDS_ASSERTION_FAILED = UDS_ERROR_CODE_BASE + 4, UDS_ASSERTION_FAILED,
/* A request has been queued for later processing (not an error) */ /* A request has been queued for later processing (not an error) */
UDS_QUEUED = UDS_ERROR_CODE_BASE + 5, UDS_QUEUED,
/* A problem has occurred with a buffer */ /* A problem has occurred with a buffer */
UDS_BUFFER_ERROR = UDS_ERROR_CODE_BASE + 6, UDS_BUFFER_ERROR,
/* No directory was found where one was expected */ /* No directory was found where one was expected */
UDS_NO_DIRECTORY = UDS_ERROR_CODE_BASE + 7, UDS_NO_DIRECTORY,
/* This error range has already been registered */ /* This error range has already been registered */
UDS_ALREADY_REGISTERED = UDS_ERROR_CODE_BASE + 8, UDS_ALREADY_REGISTERED,
/* Attempt to read or write data outside the valid range */ /* Attempt to read or write data outside the valid range */
UDS_OUT_OF_RANGE = UDS_ERROR_CODE_BASE + 9, UDS_OUT_OF_RANGE,
/* Could not load modules */ /* Could not load modules */
UDS_EMODULE_LOAD = UDS_ERROR_CODE_BASE + 10, UDS_EMODULE_LOAD,
/* The index session is disabled */ /* The index session is disabled */
UDS_DISABLED = UDS_ERROR_CODE_BASE + 11, UDS_DISABLED,
/* Unknown error */ /* Unknown error */
UDS_UNKNOWN_ERROR = UDS_ERROR_CODE_BASE + 12, UDS_UNKNOWN_ERROR,
/* The index configuration or volume format is no longer supported */ /* The index configuration or volume format is no longer supported */
UDS_UNSUPPORTED_VERSION = UDS_ERROR_CODE_BASE + 13, UDS_UNSUPPORTED_VERSION,
/* Some index structure is corrupt */ /* Some index structure is corrupt */
UDS_CORRUPT_DATA = UDS_ERROR_CODE_BASE + 14, UDS_CORRUPT_DATA,
/* No index state found */ /* No index state found */
UDS_NO_INDEX = UDS_ERROR_CODE_BASE + 15, UDS_NO_INDEX,
/* Attempt to access incomplete index save data */ /* Attempt to access incomplete index save data */
UDS_INDEX_NOT_SAVED_CLEANLY = UDS_ERROR_CODE_BASE + 16, UDS_INDEX_NOT_SAVED_CLEANLY,
/* One more than the last UDS_INTERNAL error code */ /* One more than the last UDS_INTERNAL error code */
UDS_ERROR_CODE_LAST, UDS_ERROR_CODE_LAST,
/* One more than the last error this block will ever use */ /* One more than the last error this block will ever use */

View file

@ -12,14 +12,12 @@ enum {
UDS_BLOCK_SIZE = UDS_ERROR_CODE_BLOCK_END - UDS_ERROR_CODE_BASE, UDS_BLOCK_SIZE = UDS_ERROR_CODE_BLOCK_END - UDS_ERROR_CODE_BASE,
VDO_BLOCK_START = UDS_ERROR_CODE_BLOCK_END, VDO_BLOCK_START = UDS_ERROR_CODE_BLOCK_END,
VDO_BLOCK_END = VDO_BLOCK_START + UDS_BLOCK_SIZE, VDO_BLOCK_END = VDO_BLOCK_START + UDS_BLOCK_SIZE,
PRP_BLOCK_START = VDO_BLOCK_END,
PRP_BLOCK_END = PRP_BLOCK_START + UDS_BLOCK_SIZE,
}; };
/* VDO-specific status codes. */ /* VDO-specific status codes. */
enum vdo_status_codes { enum vdo_status_codes {
/* successful result */ /* successful result */
VDO_SUCCESS, VDO_SUCCESS = UDS_SUCCESS,
/* base of all VDO errors */ /* base of all VDO errors */
VDO_STATUS_CODE_BASE = VDO_BLOCK_START, VDO_STATUS_CODE_BASE = VDO_BLOCK_START,
/* we haven't written this yet */ /* we haven't written this yet */