00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#include <jf/jf_config.h>
00021
00022
00023
00024
#include <jf/jf_errors.h>
00025
00026
00027
00028 const char *
jf_strerror(
int ret_cod)
00029 {
00030
switch (ret_cod) {
00031
case JF_RC_OK:
00032
return "OK: no error";
00033
00034
case JF_RC_OBJ_NOT_FOUND:
00035
return "WARNING: object not found";
00036
case JF_RC_EOF:
00037
return "WARNING: end of file reached";
00038
case JF_RC_BYPASSED_OPERATION:
00039
return "WARNING: operation was not performed because it can "
00040
"not be requested";
00041
00042
case JF_RC_INTERNAL_ERROR:
00043
return "ERROR: internal error / unexpected condition / "
00044
"code bug";
00045
case JF_RC_OUT_OF_RANGE:
00046
return "ERROR: an argument is out of range";
00047
case JF_RC_MAGIC_NUMBER_ERROR:
00048
return "ERROR: wrong magic number in journal file";
00049
case JF_RC_VERSION_ERROR:
00050
return "ERROR: journal version is higher than library level";
00051
case JF_RC_NULL_OBJECT:
00052
return "ERROR: an argument is null";
00053
case JF_RC_CONTAINER_FULL:
00054
return "ERROR: the container is full and cannot store more "
00055
"elements";
00056
case JF_RC_OBJ_NOT_VOID:
00057
return "ERROR: object is not void";
00058
case JF_RC_OBJ_CORRUPTED:
00059
return "ERROR: object is corrupted";
00060
case JF_RC_INVALID_OPTION:
00061
return "ERROR: a specified option is not valid";
00062
case JF_RC_INVALID_STATUS:
00063
return "ERROR: invalid object status";
00064
case JF_RC_INVALID_CTRL_CODE:
00065
return "ERROR: invalid control code in journal record";
00066
case JF_RC_INVALID_STREAM_POSITION:
00067
return "ERROR: invalid stream position";
00068
case JF_RC_INVALID_PATH_NAME:
00069
return "ERROR: invalid path name";
00070
case JF_RC_FILE_ALREADY_EXISTS:
00071
return "ERROR: file can not be created because it already "
00072
"exists";
00073
case JF_RC_DESTINATION_TOO_SMALL:
00074
return "ERROR: destination object is too small to store "
00075
"passed data";
00076
case JF_RC_FILE_NOT_ABOVE_JOURNAL:
00077
return "ERROR: the file is not journaled by the specified "
00078
"journal";
00079
case JF_RC_COLD_RECOVERY_NEEDED:
00080
return "ERROR: at least one journaled file needs cold "
00081
"recovery";
00082
case JF_RC_DAMAGED_JOURNAL:
00083
return "ERROR: journal file is damaged; a forced cold "
00084
"recovery can be attempted to solve the issue";
00085
case JF_RC_JOURNAL_OUT_OF_SPACE:
00086
return "ERROR: journal file exceeds maximum desired size "
00087
"and operation can NOT be performed; a global "
00088
"sync/rollback is necessary to activate journal "
00089
"rotation";
00090
case JF_RC_MALLOC_ERROR:
00091
return "ERROR: 'malloc' function returned an error condition";
00092
case JF_RC_REALLOC_ERROR:
00093
return "ERROR: 'realloc' function returned an error condition";
00094
case JF_RC_FOPEN_ERROR:
00095
return "ERROR: 'fopen' function returned an error condition";
00096
case JF_RC_FCLOSE_ERROR:
00097
return "ERROR: 'fclose' function returned an error condition";
00098
case JF_RC_FWRITE_ERROR:
00099
return "ERROR: 'fwrite' function returned an error condition";
00100
case JF_RC_FREAD_ERROR:
00101
return "ERROR: 'fread' function returned an error condition";
00102
case JF_RC_FTELL_ERROR:
00103
return "ERROR: '"
00104
#ifdef HAVE_FTELLO
00105
"ftello"
00106
#else
00107
"ftell"
00108
#endif
00109
"' function returned an error condition";
00110
case JF_RC_FSEEK_ERROR:
00111
return "ERROR: '"
00112
#ifdef HAVE_FSEEKO
00113
"fseeko"
00114
#else
00115
"fseek"
00116
#endif
00117
"' function returned an error condition";
00118
case JF_RC_FFLUSH_ERROR:
00119
return "ERROR: 'fflush' function returned an error condition";
00120
case JF_RC_FSYNC_ERROR:
00121
return "ERROR: 'fsync' function returned an error condition";
00122
case JF_RC_FDATASYNC_ERROR:
00123
return "ERROR: 'fdatasync' function returned an error "
00124
"condition";
00125
case JF_RC_FPUTC_ERROR:
00126
return "ERROR: 'fputc' function (or 'putc' macro) returned an "
00127
"error condition";
00128
case JF_RC_FTRUNCATE_ERROR:
00129
return "ERROR: 'ftruncate' function returned an error "
00130
"condition";
00131
case JF_RC_FILENO_ERROR:
00132
return "ERROR: 'fileno' function returned an error "
00133
"condition";
00134
case JF_RC_RENAME_ERROR:
00135
return "ERROR: 'rename' function returned an error "
00136
"condition";
00137
case JF_RC_FSTAT_ERROR:
00138
return "ERROR: 'fstat' function returned an error "
00139
"condition";
00140
case JF_RC_VSNPRINTF_ERROR:
00141
return "ERROR: 'vsnprintf' function returned an error "
00142
"condition";
00143
case JF_RC_TIMES_ERROR:
00144
return "ERROR: 'times' function returned an error condition";
00145
case JF_RC_SYSCONF_ERROR:
00146
return "ERROR: 'sysconf' function returned an error condition";
00147
case JF_RC_GETTIMEOFDAY_ERROR:
00148
return "ERROR: 'gettimeofday' function returned an error "
00149
"condition";
00150
case JF_RC_UNLINK_ERROR:
00151
return "ERROR: 'unlink' function returned an error condition";
00152
case JF_RC_UNSUPPORTED_FUNCTION:
00153
return "ERROR: a useful but not essential function is not "
00154
"supported by this system; one or more features may "
00155
"be not available";
00156
default:
00157
return "ERROR: unknown error";
00158 }
00159 }