00001 #include "qos_debug.h" 00002 00003 static char *qos_errors[] = { 00004 "Unspecified error", 00005 "Insufficient memory", 00006 "Invalid parameter(s)", 00007 "Unauthorized", 00008 "Unimplemented", 00009 "Missing component", 00010 "Inconsistent state", 00011 "System overload", 00012 "Internal error: report to authors, please", 00013 "Not found", 00014 "Full container", 00015 "Empty container" 00016 }; 00017 00018 qos_rv qos_err = QOS_OK; 00019 00021 atomic_t qos_log_msg_id = ATOMIC_INIT(0); 00022 00025 int indent_lev = 0; 00026 00027 char * func_names[MAX_INDENT_LEVEL]; 00028 00029 char *qos_strerror(qos_rv err) { 00030 int index; 00031 int err_num = qos_rv_int(err); 00032 if (err == QOS_OK) 00033 return "Success"; 00034 00035 index = -err_num - 16; 00036 if ( (index < 0) || (index >= (int) (sizeof(qos_errors) / sizeof(*qos_errors))) ) { 00037 qos_log_err("Invalid index: %d", index); 00038 return "Bug: unclassified error in qos_types.c"; 00039 } 00040 return qos_errors[index]; 00041 } 00042 00043 void qos_dump_stack(void) { 00044 int i; 00045 qos_log_crit("Stack dump:"); 00046 for (i = 0; i < indent_lev; ++i) 00047 qos_log_crit(" %s", func_names[i]); 00048 } 00049 00050 #if defined(QOS_KS) 00051 EXPORT_SYMBOL_GPL(qos_strerror); 00052 EXPORT_SYMBOL_GPL(qos_log_msg_id); 00053 EXPORT_SYMBOL_GPL(indent_lev); 00054 EXPORT_SYMBOL_GPL(func_names); 00055 EXPORT_SYMBOL_GPL(qos_dump_stack); 00056 #endif