From 063c8d664f22d22b98c8aabff0a70602cfb8a64f Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Thu, 4 Jan 2024 14:39:42 -0700 Subject: [PATCH] Messages can't be DETAIL alone so pair with DEFAULT --- apps/backend/backend_client.c | 10 +++++----- apps/backend/backend_commit.c | 2 +- apps/backend/backend_get.c | 4 ++-- apps/backend/backend_plugin.c | 18 +++++++++--------- apps/backend/backend_socket.c | 2 +- apps/cli/cli_generate.c | 12 ++++++------ apps/netconf/netconf_main.c | 2 +- apps/snmp/snmp_handler.c | 4 ++-- apps/snmp/snmp_lib.c | 6 +++--- apps/snmp/snmp_main.c | 2 +- lib/src/clixon_api_path_parse.y | 10 +++++----- lib/src/clixon_datastore.c | 6 +++--- lib/src/clixon_datastore_read.c | 11 ++++++----- lib/src/clixon_event.c | 8 ++++---- lib/src/clixon_file.c | 4 ++-- lib/src/clixon_instance_id_parse.y | 12 ++++++------ lib/src/clixon_json_parse.y | 8 ++++---- lib/src/clixon_netconf_input.c | 12 ++++++------ lib/src/clixon_netconf_lib.c | 2 +- lib/src/clixon_options.c | 8 ++++---- lib/src/clixon_plugin.c | 4 ++-- lib/src/clixon_proc.c | 4 ++-- lib/src/clixon_proto_client.c | 8 ++++---- lib/src/clixon_stream.c | 8 ++++---- 24 files changed, 84 insertions(+), 83 deletions(-) diff --git a/apps/backend/backend_client.c b/apps/backend/backend_client.c index 00f8187f..34e877f2 100644 --- a/apps/backend/backend_client.c +++ b/apps/backend/backend_client.c @@ -378,7 +378,7 @@ clixon_stats_datastore_get(clixon_handle h, size_t sz = 0; cxobj *xn = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, dbname); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, dbname); /* This is the db cache */ if ((xt = xmldb_cache_get(h, dbname)) == NULL){ /* Trigger cache if no exist (trick to ensure cache is present) */ @@ -1584,7 +1584,7 @@ from_client_msg(clixon_handle h, int nr = 0; cbuf *cbce = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); yspec = clicon_dbspec_yang(h); /* Return netconf message. Should be filled in by the dispatch(sub) functions * as wither rpc-error or by positive response. @@ -1812,7 +1812,7 @@ from_client_msg(clixon_handle h, // ok: retval = 0; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); if (xnacm){ xml_free(xnacm); if (clicon_nacm_cache_set(h, NULL) < 0) @@ -1853,7 +1853,7 @@ from_client(int s, int eof = 0; cbuf *cbce = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); if (s != ce->ce_s){ clixon_err(OE_NETCONF, EINVAL, "Internal error: s != ce->ce_s"); goto done; @@ -1871,7 +1871,7 @@ from_client(int s, goto done; retval = 0; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s retval=%d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval=%d", __FUNCTION__, retval); if (cbce) cbuf_free(cbce); if (msg) diff --git a/apps/backend/backend_commit.c b/apps/backend/backend_commit.c index bfadecd8..3b3a4c27 100644 --- a/apps/backend/backend_commit.c +++ b/apps/backend/backend_commit.c @@ -203,7 +203,7 @@ startup_common(clixon_handle h, if (xmldb_get0(h, db, YB_NONE, NULL, "/", 0, 0, &xt, msdiff, &xerr) < 0) goto done; } - clixon_debug_xml(CLIXON_DBG_DETAIL, xt, "startup"); + clixon_debug_xml(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, xt, "startup"); if (msdiff && msdiff->md_status == 0){ // Possibly check for CLICON_XMLDB_MODSTATE clixon_log(h, LOG_WARNING, "Modstate expected in startup datastore but not found\n" "This may indicate that the datastore is not initialized corrrectly, such as copy/pasted.\n" diff --git a/apps/backend/backend_get.c b/apps/backend/backend_get.c index 7119238d..ee210b14 100644 --- a/apps/backend/backend_get.c +++ b/apps/backend/backend_get.c @@ -872,7 +872,7 @@ get_common(clixon_handle h, char *wdefstr; wdef = WITHDEFAULTS_EXPLICIT; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); username = clicon_username_get(h); if ((yspec = clicon_dbspec_yang(h)) == NULL){ clixon_err(OE_YANG, ENOENT, "No yang spec9"); @@ -1049,7 +1049,7 @@ get_common(clixon_handle h, ok: retval = 0; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); if (xvec) free(xvec); if (xret) diff --git a/apps/backend/backend_plugin.c b/apps/backend/backend_plugin.c index 7b18e65d..4ceb344a 100644 --- a/apps/backend/backend_plugin.c +++ b/apps/backend/backend_plugin.c @@ -117,7 +117,7 @@ clixon_plugin_reset_all(clixon_handle h, int retval = -1; clixon_plugin_t *cp = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); /* Loop through all plugins, call callbacks in each */ while ((cp = clixon_plugin_each(h, cp)) != NULL) { if (clixon_plugin_reset_one(cp, h, db) < 0) @@ -179,7 +179,7 @@ clixon_plugin_pre_daemon_all(clixon_handle h) int retval = -1; clixon_plugin_t *cp = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); /* Loop through all plugins, call callbacks in each */ while ((cp = clixon_plugin_each(h, cp)) != NULL) { if (clixon_plugin_pre_daemon_one(cp, h) < 0) @@ -242,7 +242,7 @@ clixon_plugin_daemon_all(clixon_handle h) int retval = -1; clixon_plugin_t *cp = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); /* Loop through all plugins, call callbacks in each */ while ((cp = clixon_plugin_each(h, cp)) != NULL) { if (clixon_plugin_daemon_one(cp, h) < 0) @@ -347,7 +347,7 @@ clixon_plugin_statedata_all(clixon_handle h, cbuf *cberr = NULL; cxobj *xerr = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); while ((cp = clixon_plugin_each(h, cp)) != NULL) { if ((ret = clixon_plugin_statedata_one(cp, h, nsc, xpath, &x)) < 0) goto done; @@ -373,7 +373,7 @@ clixon_plugin_statedata_all(clixon_handle h, x = NULL; continue; } - clixon_debug_xml(CLIXON_DBG_DETAIL, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp)); + clixon_debug_xml(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp)); /* XXX: ret == 0 invalid yang binding should be handled as internal error */ if ((ret = xml_bind_yang(h, x, YB_MODULE, yspec, &xerr)) < 0) goto done; @@ -473,7 +473,7 @@ clixon_plugin_lockdb_all(clixon_handle h, int retval = -1; clixon_plugin_t *cp = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); while ((cp = clixon_plugin_each(h, cp)) != NULL) { if (clixon_plugin_lockdb_one(cp, h, db, lock, id) < 0) goto done; @@ -657,7 +657,7 @@ plugin_transaction_begin_all(clixon_handle h, int retval = -1; clixon_plugin_t *cp = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); while ((cp = clixon_plugin_each(h, cp)) != NULL) { if (plugin_transaction_begin_one(cp, h, td) < 0) goto done; @@ -1003,7 +1003,7 @@ plugin_transaction_end_all(clixon_handle h, int retval = -1; clixon_plugin_t *cp = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); while ((cp = clixon_plugin_each(h, cp)) != NULL) { if (plugin_transaction_end_one(cp, h, td) < 0) goto done; @@ -1056,7 +1056,7 @@ plugin_transaction_abort_all(clixon_handle h, int retval = -1; clixon_plugin_t *cp = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); while ((cp = clixon_plugin_each(h, cp)) != NULL) { if (plugin_transaction_abort_one(cp, h, td) < 0) ; /* dont abort on error */ diff --git a/apps/backend/backend_socket.c b/apps/backend/backend_socket.c index 27b68cba..c4c29d9e 100644 --- a/apps/backend/backend_socket.c +++ b/apps/backend/backend_socket.c @@ -245,7 +245,7 @@ backend_accept_client(int fd, uid_t guid; #endif - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); len = sizeof(from); if ((s = accept(fd, &from, &len)) < 0){ clixon_err(OE_UNIX, errno, "accept"); diff --git a/apps/cli/cli_generate.c b/apps/cli/cli_generate.c index 98a2159b..f37773d6 100644 --- a/apps/cli/cli_generate.c +++ b/apps/cli/cli_generate.c @@ -1266,11 +1266,11 @@ yang2cli_stmt(clixon_handle h, goto done; } if (yang_find(ys, Y_STATUS, "obsolete") != NULL){ - clixon_debug(CLIXON_DBG_DETAIL, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys))); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys))); goto ok; } if (yang_find(ys, Y_STATUS, "deprecated") != NULL){ - clixon_debug(CLIXON_DBG_DETAIL, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys))); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys))); } /* Check if autocli skip */ if (yang_extension_value(ys, "skip", CLIXON_AUTOCLI_NS, &extvalue, NULL) < 0) @@ -1543,11 +1543,11 @@ yang2cli_grouping(clixon_handle h, } /* Traverse YANG, loop through all modules and generate CLI, inline of yang2cli_stmt */ if (yang_find(ys, Y_STATUS, "obsolete") != NULL){ - clixon_debug(CLIXON_DBG_DETAIL, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys))); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys))); goto empty; } if (yang_find(ys, Y_STATUS, "deprecated") != NULL){ - clixon_debug(CLIXON_DBG_DETAIL, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys))); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys))); } /* Only produce autocli for YANG non-config only if autocli-treeref-state is true */ if (autocli_treeref_state(h, &treeref_state) < 0) @@ -1599,7 +1599,7 @@ yang2cli_grouping(clixon_handle h, clixon_log(h, LOG_NOTICE, "%s: Top-level cli-spec %s:\n%s", __FUNCTION__, treename, cbuf_get(cb)); else - clixon_debug(CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s", + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s", __FUNCTION__, treename, cbuf_get(cb)); if (cligen_parsetree_merge(pt0, NULL, pt) < 0){ clixon_err(OE_YANG, errno, "cligen_parsetree_merge"); @@ -1730,7 +1730,7 @@ yang2cli_yspec(clixon_handle h, clixon_log(h, LOG_NOTICE, "%s: Top-level cli-spec %s:\n%s", __FUNCTION__, treename, cbuf_get(cb)); else - clixon_debug(CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s", + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s", __FUNCTION__, treename, cbuf_get(cb)); if (cligen_parsetree_merge(pt0, NULL, pt) < 0){ clixon_err(OE_YANG, errno, "cligen_parsetree_merge"); diff --git a/apps/netconf/netconf_main.c b/apps/netconf/netconf_main.c index 834cfffe..dbfabb3f 100644 --- a/apps/netconf/netconf_main.c +++ b/apps/netconf/netconf_main.c @@ -469,7 +469,7 @@ netconf_input_cb(int s, &eom) < 0) goto done; if (eom == 0){ /* frame not complete */ - clixon_debug(CLIXON_DBG_DETAIL, "%s: frame: %lu", __FUNCTION__, cbuf_len(cbmsg)); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: frame: %lu", __FUNCTION__, cbuf_len(cbmsg)); /* Extra data to read, save data and continue on next round */ if (clicon_hash_add(cdat, NETCONF_FRAME_MSG, &cbmsg, sizeof(cbmsg)) == NULL) goto done; diff --git a/apps/snmp/snmp_handler.c b/apps/snmp/snmp_handler.c index 7c855bfd..27472da8 100644 --- a/apps/snmp/snmp_handler.c +++ b/apps/snmp/snmp_handler.c @@ -722,7 +722,7 @@ clixon_snmp_scalar_handler1(netsnmp_mib_handler *handler, netsnmp_variable_list *requestvb = request->requestvb; int ret; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); if (snmp_common_handler(handler, nhreg, reqinfo, request, 0, &sh) < 0) goto done; /* see net-snmp/agent/snmp_agent.h / net-snmp/library/snmp.h */ @@ -1303,7 +1303,7 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler, netsnmp_variable_list *requestvb; int err = 0; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); if ((ret = snmp_common_handler(handler, nhreg, reqinfo, request, 1, &sh)) < 0) goto done; if (sh->sh_ys == NULL){ diff --git a/apps/snmp/snmp_lib.c b/apps/snmp/snmp_lib.c index b66440d2..f9ed50ab 100644 --- a/apps/snmp/snmp_lib.c +++ b/apps/snmp/snmp_lib.c @@ -747,7 +747,7 @@ type_snmp2xml(yang_stmt *ys, } retval = 1; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); if (origtype) free(origtype); if (cv) @@ -836,7 +836,7 @@ type_xml2snmp_pre(char *xmlstr0, } retval = 1; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); if (cb) cbuf_free(cb); return retval; @@ -981,7 +981,7 @@ type_xml2snmp(char *snmpstr, } retval = 1; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); return retval; fail: retval = 0; diff --git a/apps/snmp/snmp_main.c b/apps/snmp/snmp_main.c index 739747f9..12b5274c 100644 --- a/apps/snmp/snmp_main.c +++ b/apps/snmp/snmp_main.c @@ -205,7 +205,7 @@ clixon_snmp_input_cb(int s, clixon_handle h = (clixon_handle)arg; int ret; - clixon_debug(CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, s); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, s); FD_ZERO(&readfds); FD_SET(s, &readfds); (void)snmp_read(&readfds); diff --git a/lib/src/clixon_api_path_parse.y b/lib/src/clixon_api_path_parse.y index 52bfcac1..0ac9eba5 100644 --- a/lib/src/clixon_api_path_parse.y +++ b/lib/src/clixon_api_path_parse.y @@ -161,7 +161,7 @@ static clixon_path * path_append(clixon_path *list, clixon_path *new) { - clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); if (new == NULL) return NULL; ADDQ(new, list); @@ -174,7 +174,7 @@ static clixon_path * path_add_keyvalue(clixon_path *cp, cvec *cvk) { - clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); if (cp) cp->cp_cvk = cvk; return cp; @@ -186,7 +186,7 @@ path_new(char *module_name, { clixon_path *cp = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s(%s,%s)", __FUNCTION__, module_name, id); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s,%s)", __FUNCTION__, module_name, id); if ((cp = malloc(sizeof(*cp))) == NULL){ clixon_err(OE_UNIX, errno, "malloc"); goto done; @@ -217,7 +217,7 @@ static cvec * keyval_add(cvec *cvv, cg_var *cv) { - clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); if (cv == NULL) goto done; if (cvv == NULL && @@ -243,7 +243,7 @@ keyval_set(char *name, { cg_var *cv = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s(%s=%s)", __FUNCTION__, name?name:"NULL", val); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s=%s)", __FUNCTION__, name?name:"NULL", val); if ((cv = cv_new(CGV_STRING)) == NULL){ clixon_err(OE_UNIX, errno, "cv_new"); goto done; diff --git a/lib/src/clixon_datastore.c b/lib/src/clixon_datastore.c index 7db1d1ba..90552c5f 100644 --- a/lib/src/clixon_datastore.c +++ b/lib/src/clixon_datastore.c @@ -384,7 +384,7 @@ xmldb_exists(clixon_handle h, char *filename = NULL; struct stat sb; - clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db); if (xmldb_db2file(h, db, &filename) < 0) goto done; if (lstat(filename, &sb) < 0) @@ -442,7 +442,7 @@ xmldb_delete(clixon_handle h, char *filename = NULL; struct stat sb; - clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db); if (xmldb_clear(h, db) < 0) goto done; if (xmldb_db2file(h, db, &filename) < 0) @@ -476,7 +476,7 @@ xmldb_create(clixon_handle h, db_elmnt *de = NULL; cxobj *xt = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db); if ((de = clicon_db_elmnt_get(h, db)) != NULL){ if ((xt = de->de_xml) != NULL){ xml_free(xt); diff --git a/lib/src/clixon_datastore_read.c b/lib/src/clixon_datastore_read.c index 1f5fc7e7..f4479e1c 100644 --- a/lib/src/clixon_datastore_read.c +++ b/lib/src/clixon_datastore_read.c @@ -859,13 +859,14 @@ xmldb_get_nocache(clixon_handle h, if (disable_nacm_on_empty(xt, yspec) < 0) goto done; } - if (clixon_debug_get()>1) + if (clixon_debug_isset(CLIXON_DBG_DEFAULT)) if (clixon_xml2file(stderr, xt, 0, 1, NULL, fprintf, 0, 0) < 0) goto done; *xtop = xt; xt = NULL; retval = 1; done: + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); if (xt) xml_free(xt); if (xvec) @@ -1053,11 +1054,11 @@ xmldb_get_cache(clixon_handle h, if (disable_nacm_on_empty(x1t, yspec) < 0) goto done; } - clixon_debug_xml(CLIXON_DBG_DETAIL, x1t, "%s", __FUNCTION__); + clixon_debug_xml(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, x1t, "%s", __FUNCTION__); *xtop = x1t; retval = 1; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); if (xvec) free(xvec); return retval; @@ -1202,13 +1203,13 @@ xmldb_get_zerocopy(clixon_handle h, if (disable_nacm_on_empty(x0t, yspec) < 0) goto done; } - if (clixon_debug_get() > 1) + if (clixon_debug_isset(CLIXON_DBG_DEFAULT)) if (clixon_xml2file(stderr, x0t, 0, 1, NULL, fprintf, 0, 0) < 0) goto done; *xtop = x0t; retval = 1; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); if (xvec) free(xvec); return retval; diff --git a/lib/src/clixon_event.c b/lib/src/clixon_event.c index a1eca051..0b0ad61c 100644 --- a/lib/src/clixon_event.c +++ b/lib/src/clixon_event.c @@ -199,7 +199,7 @@ clixon_event_reg_fd(int fd, e->e_type = EVENT_FD; e->e_next = ee; ee = e; - clixon_debug(CLIXON_DBG_DETAIL, "%s, registering %s", __FUNCTION__, e->e_string); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s, registering %s", __FUNCTION__, e->e_string); return 0; } @@ -293,7 +293,7 @@ clixon_event_reg_timeout(struct timeval t, } e->e_next = e1; *e_prev = e; - clixon_debug(CLIXON_DBG_DETAIL, "%s: %s", __FUNCTION__, str); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: %s", __FUNCTION__, str); retval = 0; done: return retval; @@ -435,7 +435,7 @@ clixon_event_loop(clixon_handle h) if (n==0){ /* Timeout */ e = ee_timers; ee_timers = ee_timers->e_next; - clixon_debug(CLIXON_DBG_DETAIL, "%s timeout: %s", __FUNCTION__, e->e_string); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s timeout: %s", __FUNCTION__, e->e_string); if ((*e->e_fn)(0, e->e_arg) < 0){ free(e); goto err; @@ -449,7 +449,7 @@ clixon_event_loop(clixon_handle h) } e_next = e->e_next; if(e->e_type == EVENT_FD && FD_ISSET(e->e_fd, &fdset)){ - clixon_debug(CLIXON_DBG_DETAIL, "%s: FD_ISSET: %s", __FUNCTION__, e->e_string); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: FD_ISSET: %s", __FUNCTION__, e->e_string); if ((*e->e_fn)(e->e_fd, e->e_arg) < 0){ clixon_debug(CLIXON_DBG_DEFAULT, "%s Error in: %s", __FUNCTION__, e->e_string); goto err; diff --git a/lib/src/clixon_file.c b/lib/src/clixon_file.c index 91122cf7..2fcb96c5 100644 --- a/lib/src/clixon_file.c +++ b/lib/src/clixon_file.c @@ -150,7 +150,7 @@ clicon_files_recursive(const char *dir, int res = 0; char errbuf[128]; - clixon_debug(CLIXON_DBG_DETAIL, "%s dir:%s", __FUNCTION__, dir); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s dir:%s", __FUNCTION__, dir); if (regexp && (res = regcomp(&re, regexp, REG_EXTENDED)) != 0) { regerror(res, &re, errbuf, sizeof(errbuf)); clixon_err(OE_DB, 0, "regcomp: %s", errbuf); @@ -243,7 +243,7 @@ clicon_file_dirent(const char *dir, clixon_err(OE_UNIX, errno, "realloc"); goto quit; } /* realloc */ - clixon_debug(CLIXON_DBG_DETAIL, "%s memcpy(%p %p %u", __FUNCTION__, &new[nent], dent, direntStructSize); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s memcpy(%p %p %u", __FUNCTION__, &new[nent], dent, direntStructSize); /* man (3) readdir: * By implication, the use sizeof(struct dirent) to capture the size of the record including * the size of d_name is also incorrect. */ diff --git a/lib/src/clixon_instance_id_parse.y b/lib/src/clixon_instance_id_parse.y index ff5792a5..4ac89398 100644 --- a/lib/src/clixon_instance_id_parse.y +++ b/lib/src/clixon_instance_id_parse.y @@ -167,7 +167,7 @@ static clixon_path * path_append(clixon_path *list, clixon_path *new) { - clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); if (new == NULL) return NULL; ADDQ(new, list); @@ -183,7 +183,7 @@ static clixon_path * path_add_keyvalue(clixon_path *cp, cvec *cvk) { - clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); if (cp == NULL) goto done; cp->cp_cvk = cvk; @@ -197,7 +197,7 @@ path_new(char *prefix, { clixon_path *cp = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s(%s,%s)", __FUNCTION__, prefix, id); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s,%s)", __FUNCTION__, prefix, id); if ((cp = malloc(sizeof(*cp))) == NULL){ clixon_err(OE_UNIX, errno, "malloc"); goto done; @@ -227,7 +227,7 @@ keyval_pos(char *uint) char *reason=NULL; int ret; - clixon_debug(CLIXON_DBG_DETAIL, "%s(%s)", __FUNCTION__, uint); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s)", __FUNCTION__, uint); if ((cvv = cvec_new(1)) == NULL) { clixon_err(OE_UNIX, errno, "cvec_new"); goto done; @@ -261,7 +261,7 @@ static cvec * keyval_add(cvec *cvv, cg_var *cv) { - clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__); if (cv == NULL) goto done; if (cvv == NULL && @@ -287,7 +287,7 @@ keyval_set(char *name, { cg_var *cv = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s(%s=%s)", __FUNCTION__, name, val); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s=%s)", __FUNCTION__, name, val); if ((cv = cv_new(CGV_STRING)) == NULL){ clixon_err(OE_UNIX, errno, "cv_new"); goto done; diff --git a/lib/src/clixon_json_parse.y b/lib/src/clixon_json_parse.y index 97c77604..2cc51639 100644 --- a/lib/src/clixon_json_parse.y +++ b/lib/src/clixon_json_parse.y @@ -188,7 +188,7 @@ json_current_new(clixon_json_yacc *jy, char *prefix = NULL; char *id = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); /* Find colon separator and if found split into prefix:name */ if (nodeid_split(name, &prefix, &id) < 0) goto done; @@ -215,7 +215,7 @@ json_current_new(clixon_json_yacc *jy, static int json_current_pop(clixon_json_yacc *jy) { - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); if (jy->jy_current) jy->jy_current = xml_parent(jy->jy_current); return 0; @@ -226,7 +226,7 @@ json_current_clone(clixon_json_yacc *jy) { cxobj *xn; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); if (jy->jy_current == NULL){ return -1; } @@ -258,7 +258,7 @@ json_current_body(clixon_json_yacc *jy, int retval = -1; cxobj *xn; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); if ((xn = xml_new("body", jy->jy_current, CX_BODY)) == NULL) goto done; if (value && xml_value_append(xn, value) < 0) diff --git a/lib/src/clixon_netconf_input.c b/lib/src/clixon_netconf_input.c index 88d67c6a..8344b0dd 100644 --- a/lib/src/clixon_netconf_input.c +++ b/lib/src/clixon_netconf_input.c @@ -103,14 +103,14 @@ netconf_input_read2(int s, goto done; } } /* read */ - clixon_debug(CLIXON_DBG_DETAIL, "%s len:%ld", __FUNCTION__, len); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s len:%ld", __FUNCTION__, len); if (len == 0){ /* EOF */ - clixon_debug(CLIXON_DBG_DETAIL, "%s len==0, closing", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s len==0, closing", __FUNCTION__); *eof = 1; } retval = len; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); return retval; } @@ -147,7 +147,7 @@ netconf_input_msg2(unsigned char **bufp, size_t len; char ch; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); len = *lenp; for (i=0; i0 nr of handlers called */ done: - clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); return retval; fail: retval = 0; diff --git a/lib/src/clixon_proc.c b/lib/src/clixon_proc.c index 297a0785..0a3c266f 100644 --- a/lib/src/clixon_proc.c +++ b/lib/src/clixon_proc.c @@ -1016,7 +1016,7 @@ clixon_process_sched_register(clixon_handle h, struct timeval t; struct timeval t1 = {0, 100000}; /* 100ms */ - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); gettimeofday(&t, NULL); if (delay) timeradd(&t, &t1, &t); @@ -1024,7 +1024,7 @@ clixon_process_sched_register(clixon_handle h, goto done; retval = 0; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval); return retval; } diff --git a/lib/src/clixon_proto_client.c b/lib/src/clixon_proto_client.c index 29fafba4..ff945830 100644 --- a/lib/src/clixon_proto_client.c +++ b/lib/src/clixon_proto_client.c @@ -206,7 +206,7 @@ clicon_rpc_msg(clixon_handle h, int s = -1; int eof = 0; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); #ifdef RPC_USERNAME_ASSERT assert(strstr(msg->op_body, "username")!=NULL); /* XXX */ #endif @@ -253,7 +253,7 @@ clicon_rpc_msg(clixon_handle h, } retval = 0; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); if (retdata) free(retdata); if (xret) @@ -1018,7 +1018,7 @@ clicon_rpc_get2(clixon_handle h, yang_stmt *yspec; cvec *nscd = NULL; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); if (session_id_check(h, &session_id) < 0) goto done; if ((cb = cbuf_new()) == NULL){ @@ -1105,7 +1105,7 @@ clicon_rpc_get2(clixon_handle h, } retval = 0; done: - clixon_debug(CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval); if (nscd) cvec_free(nscd); if (cb) diff --git a/lib/src/clixon_stream.c b/lib/src/clixon_stream.c index 0c2d76bf..4c302340 100644 --- a/lib/src/clixon_stream.c +++ b/lib/src/clixon_stream.c @@ -267,7 +267,7 @@ stream_timer_setup(int fd, struct stream_replay *r; struct stream_replay *r1; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); /* Go thru callbacks and see if any have timed out, if so remove them * Could also be done by a separate timer. */ @@ -519,7 +519,7 @@ stream_notify1(clixon_handle h, int retval = -1; struct stream_subscription *ss; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); /* Go thru all subscriptions and find matches */ if ((ss = es->es_subscription) != NULL) do { @@ -575,7 +575,7 @@ stream_notify(clixon_handle h, struct timeval tv; event_stream_t *es; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); if ((es = stream_find(h, stream)) == NULL) goto ok; va_start(args, event); @@ -652,7 +652,7 @@ stream_notify_xml(clixon_handle h, struct timeval tv; event_stream_t *es; - clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__); + clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__); if ((es = stream_find(h, stream)) == NULL) goto ok; if ((yspec = clicon_dbspec_yang(h)) == NULL){