Minor doc and err handling fixes
This commit is contained in:
parent
04df38ddfa
commit
e885d63f68
5 changed files with 16 additions and 7 deletions
|
|
@ -51,7 +51,7 @@
|
||||||
* It is up to the validate callbacks to ensure that these changes are OK
|
* It is up to the validate callbacks to ensure that these changes are OK
|
||||||
* It is up to the commit callbacks to enforce these changes in the "state" of
|
* It is up to the commit callbacks to enforce these changes in the "state" of
|
||||||
* the system.
|
* the system.
|
||||||
* see also transaction_data in clixon_plugin.h
|
* @see transaction_data in clixon_plugin.h
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t td_id; /* Transaction id */
|
uint64_t td_id; /* Transaction id */
|
||||||
|
|
|
||||||
|
|
@ -428,7 +428,7 @@ example_statedata(clicon_handle h,
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
cxobj **xvec = NULL;
|
cxobj **xvec = NULL;
|
||||||
size_t xlen = 0;
|
size_t xlen = 0;
|
||||||
cbuf *cb = cbuf_new();
|
cbuf *cb = NULL;
|
||||||
int i;
|
int i;
|
||||||
cxobj *xt = NULL;
|
cxobj *xt = NULL;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
@ -437,6 +437,10 @@ example_statedata(clicon_handle h,
|
||||||
|
|
||||||
if (!_state)
|
if (!_state)
|
||||||
goto ok;
|
goto ok;
|
||||||
|
if ((cb = cbuf_new()) == NULL){
|
||||||
|
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
yspec = clicon_dbspec_yang(h);
|
yspec = clicon_dbspec_yang(h);
|
||||||
/* Example of statedata, in this case merging state data with
|
/* Example of statedata, in this case merging state data with
|
||||||
* state information. In this case adding dummy interface operation state
|
* state information. In this case adding dummy interface operation state
|
||||||
|
|
@ -1055,7 +1059,13 @@ upgrade_2016_to_2018(clicon_handle h,
|
||||||
if ((x = xpath_first(xi, NULL, "statistics/in-octets")) != NULL){
|
if ((x = xpath_first(xi, NULL, "statistics/in-octets")) != NULL){
|
||||||
if ((xb = xml_body_get(x)) != NULL){
|
if ((xb = xml_body_get(x)) != NULL){
|
||||||
uint64_t u64;
|
uint64_t u64;
|
||||||
cbuf *cb = cbuf_new();
|
cbuf *cb;
|
||||||
|
|
||||||
|
if ((cb = cbuf_new()) == NULL){
|
||||||
|
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
parse_uint64(xml_value(xb), &u64, NULL);
|
parse_uint64(xml_value(xb), &u64, NULL);
|
||||||
cprintf(cb, "%" PRIu64 ".%03d", u64/1000, (int)(u64%1000));
|
cprintf(cb, "%" PRIu64 ".%03d", u64/1000, (int)(u64%1000));
|
||||||
xml_value_set(xb, cbuf_get(cb));
|
xml_value_set(xb, cbuf_get(cb));
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ typedef void *pagination_data;
|
||||||
typedef int (plglockdb_t)(clicon_handle h, char *db, int lock, int id);
|
typedef int (plglockdb_t)(clicon_handle h, char *db, int lock, int id);
|
||||||
|
|
||||||
/* Transaction-data type
|
/* Transaction-data type
|
||||||
* @see clixon_backend_transaction.h for full transaction API
|
* @see transaction_data_t and clixon_backend_transaction.h for full transaction API
|
||||||
*/
|
*/
|
||||||
typedef void *transaction_data;
|
typedef void *transaction_data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -452,7 +452,6 @@ clixon_xml_bottom(cxobj *xtop,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Internal function to construct a get-config and query a value from the backend
|
/*! Internal function to construct a get-config and query a value from the backend
|
||||||
*
|
*
|
||||||
* @param[in] sock Socket
|
* @param[in] sock Socket
|
||||||
|
|
|
||||||
|
|
@ -900,7 +900,7 @@ text_modify(clicon_handle h,
|
||||||
* As an alternative, return in populate where this is detected first time.
|
* As an alternative, return in populate where this is detected first time.
|
||||||
*/
|
*/
|
||||||
if (yc != xml_spec(x1c)){
|
if (yc != xml_spec(x1c)){
|
||||||
clicon_err(OE_YANG, errno, "XML node %s not in namespace %s",
|
clicon_err(OE_YANG, errno, "XML node \"%s\" not in namespace %s",
|
||||||
x1cname, yang_find_mynamespace(y0));
|
x1cname, yang_find_mynamespace(y0));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
@ -1146,7 +1146,7 @@ text_modify_top(clicon_handle h,
|
||||||
* @param[in] h CLICON handle
|
* @param[in] h CLICON handle
|
||||||
* @param[in] db running or candidate
|
* @param[in] db running or candidate
|
||||||
* @param[in] op Top-level operation, can be superceded by other op in tree
|
* @param[in] op Top-level operation, can be superceded by other op in tree
|
||||||
* @param[in] xt xml-tree. Top-level symbol is dummy
|
* @param[in] x1 xml-tree. Top-level symbol is dummy
|
||||||
* @param[in] username User name for nacm
|
* @param[in] username User name for nacm
|
||||||
* @param[out] cbret Initialized cligen buffer. On exit contains XML if retval == 0
|
* @param[out] cbret Initialized cligen buffer. On exit contains XML if retval == 0
|
||||||
* @retval 1 OK
|
* @retval 1 OK
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue