Re-added shared yang mounts
YANG: de-dperecated CLICON_YANG_SCHEMA_MOUNT_SHARE
This commit is contained in:
parent
f0bd103e79
commit
5ebc5a2219
5 changed files with 101 additions and 28 deletions
|
|
@ -887,10 +887,11 @@ yspec_new1(clixon_handle h,
|
|||
/*! Create or add a shared yspec
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] tag Typically an xpath
|
||||
* @param[in] tag Typically an xpath, saved in cvec
|
||||
* @param[in] yspec0 Input NULL if no previous shared exist, otherwise a shared yspec but new name
|
||||
* @retval yspec1 New or (previously shared)
|
||||
* @retval NULL Error
|
||||
* @note yspec name used by concatenating domain and a unique number.
|
||||
*/
|
||||
yang_stmt *
|
||||
yspec_new_shared(clixon_handle h,
|
||||
|
|
@ -899,13 +900,19 @@ yspec_new_shared(clixon_handle h,
|
|||
yang_stmt *yspec0)
|
||||
{
|
||||
yang_stmt *yspec1 = NULL;
|
||||
cbuf *cb = NULL;
|
||||
static int nr = 0;
|
||||
|
||||
if (yspec0 != NULL){ /* shared */
|
||||
yspec1 = yspec0;
|
||||
}
|
||||
else {
|
||||
// XXX domain used as name
|
||||
if ((yspec1 = yspec_new1(h, domain, domain)) == NULL)
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clixon_err(OE_YANG, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
cprintf(cb, "%s%d", domain, nr++);
|
||||
if ((yspec1 = yspec_new1(h, domain, cbuf_get(cb))) == NULL)
|
||||
goto done;
|
||||
yang_flag_set(yspec1, YANG_FLAG_SPEC_MOUNT);
|
||||
clixon_debug(CLIXON_DBG_YANG, "new yang-spec: %p", yspec1);
|
||||
|
|
@ -915,6 +922,8 @@ yspec_new_shared(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
done:
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return yspec1;
|
||||
}
|
||||
|
||||
|
|
@ -2313,10 +2322,10 @@ yang_print_cb(FILE *f,
|
|||
if (yang_print_cbuf(cb, yn, 0, 1) < 0)
|
||||
goto done;
|
||||
(*fn)(f, "%s", cbuf_get(cb));
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
retval = 0;
|
||||
done:
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue