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