Commit | Line | Data |
---|---|---|
4fcb4290 MS |
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 { | |
ee8f6ec1 MS |
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, | |
4fcb4290 MS |
15 | }; |
16 | ||
17 | /* VDO-specific status codes. */ | |
18 | enum vdo_status_codes { | |
4fcb4290 | 19 | /* base of all VDO errors */ |
ee8f6ec1 | 20 | VDO_STATUS_CODE_BASE = VDO_ERRORS_BLOCK_START, |
4fcb4290 MS |
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, | |
4fcb4290 MS |
29 | /* improper or missing configuration option */ |
30 | VDO_BAD_CONFIGURATION, | |
4fcb4290 MS |
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, | |
4fcb4290 MS |
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, | |
4fcb4290 MS |
45 | /* physical block growth of too few blocks */ |
46 | VDO_INCREMENT_TOO_SMALL, | |
47 | /* incorrect checksum */ | |
48 | VDO_CHECKSUM_MISMATCH, | |
4fcb4290 MS |
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, | |
4fcb4290 MS |
63 | /* a block map entry is invalid */ |
64 | VDO_BAD_MAPPING, | |
4fcb4290 MS |
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 | /* failure adding a sysfs node */ | |
76 | VDO_CANT_ADD_SYSFS_NODE, | |
77 | /* one more than last error code */ | |
78 | VDO_STATUS_CODE_LAST, | |
ee8f6ec1 | 79 | VDO_STATUS_CODE_BLOCK_END = VDO_ERRORS_BLOCK_END |
4fcb4290 MS |
80 | }; |
81 | ||
82 | extern const struct error_info vdo_status_list[]; | |
83 | ||
84 | int vdo_register_status_codes(void); | |
85 | ||
f7c1c2e0 | 86 | int vdo_status_to_errno(int error); |
4fcb4290 MS |
87 | |
88 | #endif /* VDO_STATUS_CODES_H */ |