X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=blobdiff_plain;f=error.h;h=f28c39de2dcc00efc2ae8aa29bcba3f59fd7748e;hp=e311807668b4a47d7e5ab65ad3dc3b54de72ee73;hb=a88534cd677dcd6cb2847060ec4f39d56e219bf7;hpb=5952112a37ecdaedf3b76e08f97d307f1056c512 diff --git a/error.h b/error.h index e311807..f28c39d 100644 --- a/error.h +++ b/error.h @@ -1,6 +1,4 @@ -extern char *__errlist[]; -extern char *__error_txt; - +#define FSCK_ERROR_BIT 29 /** * This bit indicates whether a number is considered a system error number * If yes, the system errno is just the result of clearing this bit from @@ -28,73 +26,3 @@ static inline int is_errno(int num, int _errno) assert(num > 0 && _errno > 0); return ERRNO_TO_ERROR(_errno) == num; } - -/** - * version of strerror(3). - * - * \param num The error number. - * - * \return The error text of \a num. - */ -static inline char *error_txt(int num) -{ - assert(num > 0); - if (IS_SYSTEM_ERROR(num)) - return strerror((num) & ((1 << SYSTEM_ERROR_BIT) - 1)); - else - return __errlist[num]; -} - -#define ALL_ERRORS \ - _ERROR(SUCCESS, "success") \ - _ERROR(BAD_DB_DIR, "invalid database directory") \ - _ERROR(NO_COLUMN_DESC, "missing column description") \ - _ERROR(BAD_NAME, "invalid name for a column/table") \ - _ERROR(BAD_STORAGE_TYPE, "invalid storage type") \ - _ERROR(BAD_STORAGE_FLAGS, "invalid storage flags") \ - _ERROR(NO_COLUMN_NAME, "missing column name") \ - _ERROR(NO_COLUMNS, "at least one column required") \ - _ERROR(BAD_COLUMN_NAME, "invalid name for a table column") \ - _ERROR(NO_UNIQUE_RBTREE_COLUMN, "need at least one mapped column with OSL_UNIQE and OSL_RBTREE") \ - _ERROR(NO_RBTREE_COL, "at least one column needs an rbtree") \ - _ERROR(DUPLICATE_COL_NAME, "column name given twice") \ - _ERROR(BAD_STORAGE_SIZE, "invalid storage size") \ - _ERROR(NO_COMPARE_FUNC, "missing compare function") \ - _ERROR(BAD_DATA_SIZE, "wrong data size for fixed-size column") \ - _ERROR(NOT_MAPPED, "file not mapped") \ - _ERROR(ALREADY_MAPPED, "file already mapped") \ - _ERROR(BAD_SIZE, "invalid size specified") \ - _ERROR(TRUNC, "failed to truncate file") \ - _ERROR(BAD_TABLE, "table not open") \ - _ERROR(BAD_TABLE_DESC, "invalid table description") \ - _ERROR(RB_KEY_EXISTS, "key already exists in rbtree") \ - _ERROR(RB_KEY_NOT_FOUND, "key not found in rbtree") \ - _ERROR(BAD_ROW_NUM, "invalid row number") \ - _ERROR(INDEX_CORRUPTION, "index corruption detected") \ - _ERROR(INVALID_OBJECT, "reference to invalid object") \ - _ERROR(STAT, "can not stat file") \ - _ERROR(WRITE, "write error") \ - _ERROR(LSEEK, "lseek error") \ - _ERROR(BUSY, "table is busy") \ - _ERROR(SHORT_TABLE, "table too short") \ - _ERROR(NO_MAGIC, "missing table header magic") \ - _ERROR(VERSION_MISMATCH, "table version not supported") \ - _ERROR(BAD_COLUMN_NUM, "invalid column number") \ - _ERROR(BAD_TABLE_FLAGS, "invalid flags in table description") \ - _ERROR(BAD_ROW, "invalid row") \ - _ERROR(EMPTY, "file empty") \ - _ERROR(MMAP, "mmap error") \ - - -/** - * This is temporarily defined to expand to its first argument (prefixed by - * 'E_') and gets later redefined to expand to the error text only - */ -#define _ERROR(err, msg) E_ ## err, - -enum error_codes { - ALL_ERRORS -}; -#undef _ERROR -#define _ERROR(err, msg) msg, -#define DEFINE_ERRLIST char *__errlist[] = {ALL_ERRORS}