Loading...
Searching...
No Matches
fru_errno.h
Go to the documentation of this file.
#pragma once
#if defined(__GNUC__) && __GNUC__ < 13
#define FRU_THREAD_LOCAL __thread
#else
// Any other C23-compliant compiler
#define FRU_THREAD_LOCAL thread_local
#endif
typedef enum {
FENONE,
FEGENERIC,
FEINIT,
FENONPRINT,
FENONHEX,
FERANGE,
FENOTEVEN,
FEAUTOENC,
FEBADENC,
FE2SMALL,
FE2BIG,
FESIZE,
FEHDRVER,
FEHDRCKSUM,
FEHDRBADPTR,
FEDATACKSUM,
FEAREADUP,
FEAREANOTSUP,
FEAREABADTYPE,
FENOTERM,
FEBDATE,
FENOFIELD,
FENOREC,
FEBADDATA,
FENODATA,
FEMRMGMTBAD,
FEMRNOTSUP,
FEMREND,
FEAPOS,
FENOTEMPTY,
FEAENABLED,
FEADISABLED,
FELIB,
FETOTALCOUNT,
} fru_error_code_t;
typedef enum {
FERR_LOC_INTERNAL,
FERR_LOC_CHASSIS,
FERR_LOC_BOARD,
FERR_LOC_PRODUCT,
FERR_LOC_MR,
FERR_LOC_GENERAL,
FERR_LOC_CALLER,
FERR_LOC_SYSTEM,
FERR_LOC_COUNT
} fru_error_source_t;
typedef struct {
fru_error_code_t code;
fru_error_source_t src;
int index;
} fru_errno_t;
extern FRU_THREAD_LOCAL fru_errno_t fru_errno;
const char * fru_strerr(fru_errno_t);
void fru_clearerr(void);
/* @} */
FRU_THREAD_LOCAL
#define FRU_THREAD_LOCAL
Definition fru_errno.h:13
fru_error_source_t
fru_error_source_t
Describes an offending area, see fru_errno_t.
Definition fru_errno.h:69
fru_clearerr
void fru_clearerr(void)
Clear the error status of the library.
fru_strerr
const char * fru_strerr(fru_errno_t)
Get a description of the given fru_errno value.
fru_errno_t::src
fru_error_source_t src
The source of error.
Definition fru_errno.h:87
fru_errno_t::index
int index
Index of the offending entity within the source, that is, an index of a field (for FRU_*_INFO) or a r...
Definition fru_errno.h:88
fru_error_code_t
fru_error_code_t
Defines the errors specific to libfru.
Definition fru_errno.h:27
fru_errno_t::code
fru_error_code_t code
The error code.
Definition fru_errno.h:86
fru_errno
FRU_THREAD_LOCAL fru_errno_t fru_errno
Numeric code of an error.
FERR_LOC_MR
@ FERR_LOC_MR
The error is in the multirecord area.
Definition fru_errno.h:74
FERR_LOC_BOARD
@ FERR_LOC_BOARD
The error is in the board information area.
Definition fru_errno.h:72
FERR_LOC_GENERAL
@ FERR_LOC_GENERAL
The error is about FRU file or structure in general, not about any specific area.
Definition fru_errno.h:75
FERR_LOC_CHASSIS
@ FERR_LOC_CHASSIS
The error is in the chassis information area.
Definition fru_errno.h:71
FERR_LOC_SYSTEM
@ FERR_LOC_SYSTEM
The error occurred in a system call.
Definition fru_errno.h:81
FERR_LOC_COUNT
@ FERR_LOC_COUNT
The total count of possible error locations.
Definition fru_errno.h:82
FERR_LOC_INTERNAL
@ FERR_LOC_INTERNAL
The error is in the internal use area.
Definition fru_errno.h:70
FERR_LOC_PRODUCT
@ FERR_LOC_PRODUCT
The error is in the product information area.
Definition fru_errno.h:73
FERR_LOC_CALLER
@ FERR_LOC_CALLER
The error is in the calling code (bad arguments?).
Definition fru_errno.h:80
FETOTALCOUNT
@ FETOTALCOUNT
The total count of possible libfru error codes.
Definition fru_errno.h:61
FEHDRCKSUM
@ FEHDRCKSUM
Bad header checksum.
Definition fru_errno.h:41
FEAUTOENC
@ FEAUTOENC
Unable to auto-detect encoding.
Definition fru_errno.h:35
FENONPRINT
@ FENONPRINT
Field data contains non-printable bytes.
Definition fru_errno.h:31
FE2BIG
@ FE2BIG
Data or file is too big.
Definition fru_errno.h:38
FENOTERM
@ FENOTERM
Unterminated area.
Definition fru_errno.h:47
FEMREND
@ FEMREND
End of MR records (not an error).
Definition fru_errno.h:55
FEMRNOTSUP
@ FEMRNOTSUP
Unsupported record type.
Definition fru_errno.h:54
FEAREABADTYPE
@ FEAREABADTYPE
Bad area type (A completely wrong value).
Definition fru_errno.h:46
FEAPOS
@ FEAPOS
Invalid area position.
Definition fru_errno.h:56
FESIZE
@ FESIZE
Data size mismatch.
Definition fru_errno.h:39
FELIB
@ FELIB
Internal library error (bug).
Definition fru_errno.h:60
FERANGE
@ FERANGE
Field data exceeds range for the requested encoding.
Definition fru_errno.h:33
FEBDATE
@ FEBDATE
Board manufacturing date is out of range.
Definition fru_errno.h:48
FEGENERIC
@ FEGENERIC
Generic error, check errno.
Definition fru_errno.h:29
FEINIT
@ FEINIT
Uninitialized FRU structure.
Definition fru_errno.h:30
FENOFIELD
@ FENOFIELD
No such field.
Definition fru_errno.h:49
FEAREANOTSUP
@ FEAREANOTSUP
Unsupported area type (For a particular operation).
Definition fru_errno.h:45
FEAENABLED
@ FEAENABLED
Area is (already) enabled.
Definition fru_errno.h:58
FENOTEMPTY
@ FENOTEMPTY
List is not empty.
Definition fru_errno.h:57
FEBADENC
@ FEBADENC
Invalid encoding for a field.
Definition fru_errno.h:36
FEBADDATA
@ FEBADDATA
Malformed data.
Definition fru_errno.h:51
FENOTEVEN
@ FENOTEVEN
Not an even number of nibbles.
Definition fru_errno.h:34
FENODATA
@ FENODATA
No data.
Definition fru_errno.h:52
FEHDRBADPTR
@ FEHDRBADPTR
Area starts/spans beyond the end of file/buffer or overlaps next area.
Definition fru_errno.h:42
FEMRMGMTBAD
@ FEMRMGMTBAD
Bad management record subtype.
Definition fru_errno.h:53
FEHDRVER
@ FEHDRVER
Bad header version.
Definition fru_errno.h:40
FENOREC
@ FENOREC
No such record.
Definition fru_errno.h:50
FEAREADUP
@ FEAREADUP
Duplicate area in area order.
Definition fru_errno.h:44
FE2SMALL
@ FE2SMALL
File is too small.
Definition fru_errno.h:37
FEADISABLED
@ FEADISABLED
Area is (already) disabled.
Definition fru_errno.h:59
FENONE
@ FENONE
No libfru error.
Definition fru_errno.h:28
FEDATACKSUM
@ FEDATACKSUM
Bad data checksum.
Definition fru_errno.h:43
FENONHEX
@ FENONHEX
Input string contains non-hex characters.
Definition fru_errno.h:32
fru_errno_t
Definition fru_errno.h:85