1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright 2023 Red Hat
9 #include <linux/compiler.h>
10 #include <linux/types.h>
12 /* Custom error codes and error-related utilities */
15 /* Valid status codes for internal UDS functions. */
16 enum uds_status_codes
{
17 /* Successful return */
18 UDS_SUCCESS
= VDO_SUCCESS
,
19 /* Used as a base value for reporting internal errors */
20 UDS_ERROR_CODE_BASE
= 1024,
22 UDS_OVERFLOW
= UDS_ERROR_CODE_BASE
,
23 /* Invalid argument passed to internal routine */
25 /* UDS data structures are in an invalid state */
27 /* Attempt to enter the same name into an internal structure twice */
29 /* An assertion failed */
31 /* A request has been queued for later processing (not an error) */
33 /* This error range has already been registered */
34 UDS_ALREADY_REGISTERED
,
35 /* Attempt to read or write data outside the valid range */
37 /* The index session is disabled */
39 /* The index configuration or volume format is no longer supported */
40 UDS_UNSUPPORTED_VERSION
,
41 /* Some index structure is corrupt */
43 /* No index state found */
45 /* Attempt to access incomplete index save data */
46 UDS_INDEX_NOT_SAVED_CLEANLY
,
47 /* One more than the last UDS_INTERNAL error code */
49 /* One more than the last error this block will ever use */
50 UDS_ERROR_CODE_BLOCK_END
= UDS_ERROR_CODE_BASE
+ 440,
54 VDO_MAX_ERROR_NAME_SIZE
= 80,
55 VDO_MAX_ERROR_MESSAGE_SIZE
= 128,
63 const char * __must_check
uds_string_error(int errnum
, char *buf
, size_t buflen
);
65 const char *uds_string_error_name(int errnum
, char *buf
, size_t buflen
);
67 int uds_status_to_errno(int error
);
69 int uds_register_error_block(const char *block_name
, int first_error
,
70 int last_reserved_error
, const struct error_info
*infos
,
73 #endif /* UDS_ERRORS_H */