/*
* Global shared hash table holding reference text for all defined errors.
*/
-pthread_mutex_t refs_mtx = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t refs_mtx = PTHREAD_MUTEX_INITIALIZER;
struct hash *refs;
-static int ferr_hash_cmp(const void *a, const void *b)
+static bool ferr_hash_cmp(const void *a, const void *b)
{
const struct log_ref *f_a = a;
const struct log_ref *f_b = b;
return f_a->code == f_b->code;
}
-static inline unsigned int ferr_hash_key(void *a)
+static inline unsigned int ferr_hash_key(const void *a)
{
- struct log_ref *f = a;
+ const struct log_ref *f = a;
return f->code;
}
if (code) {
ref = log_ref_get(code);
- if (!ref) {
- vty_out(vty, "Code %"PRIu32" - Unknown\n", code);
+ if (!ref)
return;
- }
listnode_add(errlist, ref);
}
DEFUN_NOSH(show_error_code,
show_error_code_cmd,
- "show error <(1-4294967296)|all> [json]",
+ "show error <(1-4294967295)|all> [json]",
SHOW_STR
"Information on errors\n"
"Error code to get info about\n"
"Error Reference Texts");
}
pthread_mutex_unlock(&refs_mtx);
-
- install_element(VIEW_NODE, &show_error_code_cmd);
}
void log_ref_fini(void)
pthread_mutex_unlock(&refs_mtx);
}
+void log_ref_vty_init(void)
+{
+ install_element(VIEW_NODE, &show_error_code_cmd);
+}
+
+
const struct ferr *ferr_get_last(ferr_r errval)
{
struct ferr *last_error = pthread_getspecific(errkey);