dm vdo: slight cleanup of UDS error codes
authorMike Snitzer <snitzer@kernel.org>
Sat, 27 Jan 2024 02:42:27 +0000 (21:42 -0500)
committerMike Snitzer <snitzer@kernel.org>
Tue, 20 Feb 2024 18:43:17 +0000 (13:43 -0500)
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>
drivers/md/dm-vdo/errors.h
drivers/md/dm-vdo/status-codes.h

index 0129fa37d8d8a1cd3aa45455f140066b448bd64d..c37f198a159cd13289ab697618c12d53cc3dc68d 100644 (file)
 enum uds_status_codes {
        /* Successful return */
        UDS_SUCCESS = 0,
-
        /* Used as a base value for reporting internal errors */
        UDS_ERROR_CODE_BASE = 1024,
        /* Index overflow */
-       UDS_OVERFLOW = UDS_ERROR_CODE_BASE + 0,
+       UDS_OVERFLOW = UDS_ERROR_CODE_BASE,
        /* 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_BAD_STATE = UDS_ERROR_CODE_BASE + 2,
+       UDS_BAD_STATE,
        /* 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 */
-       UDS_ASSERTION_FAILED = UDS_ERROR_CODE_BASE + 4,
+       UDS_ASSERTION_FAILED,
        /* 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 */
-       UDS_BUFFER_ERROR = UDS_ERROR_CODE_BASE + 6,
+       UDS_BUFFER_ERROR,
        /* 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 */
-       UDS_ALREADY_REGISTERED = UDS_ERROR_CODE_BASE + 8,
+       UDS_ALREADY_REGISTERED,
        /* 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 */
-       UDS_EMODULE_LOAD = UDS_ERROR_CODE_BASE + 10,
+       UDS_EMODULE_LOAD,
        /* The index session is disabled */
-       UDS_DISABLED = UDS_ERROR_CODE_BASE + 11,
+       UDS_DISABLED,
        /* Unknown error */
-       UDS_UNKNOWN_ERROR = UDS_ERROR_CODE_BASE + 12,
+       UDS_UNKNOWN_ERROR,
        /* 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 */
-       UDS_CORRUPT_DATA = UDS_ERROR_CODE_BASE + 14,
+       UDS_CORRUPT_DATA,
        /* No index state found */
-       UDS_NO_INDEX = UDS_ERROR_CODE_BASE + 15,
+       UDS_NO_INDEX,
        /* 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 */
        UDS_ERROR_CODE_LAST,
        /* One more than the last error this block will ever use */
index c5da37ec8b55b3be47ffaf49e2edd7a500de1769..9e0126a83c6ba1efcada14ca6c4864ad1902f003 100644 (file)
@@ -12,14 +12,12 @@ enum {
        UDS_BLOCK_SIZE = UDS_ERROR_CODE_BLOCK_END - UDS_ERROR_CODE_BASE,
        VDO_BLOCK_START = UDS_ERROR_CODE_BLOCK_END,
        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. */
 enum vdo_status_codes {
        /* successful result */
-       VDO_SUCCESS,
+       VDO_SUCCESS = UDS_SUCCESS,
        /* base of all VDO errors */
        VDO_STATUS_CODE_BASE = VDO_BLOCK_START,
        /* we haven't written this yet */