Replaced config cache with a single state flag
This commit is contained in:
parent
a97a06d15a
commit
dff3b25c34
2 changed files with 8 additions and 14 deletions
|
|
@ -61,9 +61,7 @@
|
||||||
#define YANG_FLAG_INDEX 0x08 /* This yang node under list is (extra) index. --> you can access
|
#define YANG_FLAG_INDEX 0x08 /* This yang node under list is (extra) index. --> you can access
|
||||||
* list elements using this index with binary search */
|
* list elements using this index with binary search */
|
||||||
#endif
|
#endif
|
||||||
#define YANG_FLAG_CONFIG_CACHE 0x10 /* Ancestor config cache is active */
|
#define YANG_FLAG_STATE_LOCAL 0x10 /* Local inverted value of Y_CONFIG child */
|
||||||
#define YANG_FLAG_CONFIG_VALUE 0x20 /* Ancestor config cache value */
|
|
||||||
|
|
||||||
#define YANG_FLAG_DISABLED 0x40 /* Disabled due to if-feature evaluate to false
|
#define YANG_FLAG_DISABLED 0x40 /* Disabled due to if-feature evaluate to false
|
||||||
* Transformed to ANYDATA but some code may need to check
|
* Transformed to ANYDATA but some code may need to check
|
||||||
* why it is an ANYDATA
|
* why it is an ANYDATA
|
||||||
|
|
|
||||||
|
|
@ -3060,6 +3060,7 @@ ys_populate2(yang_stmt *ys,
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
clixon_handle h = (clixon_handle)arg;
|
clixon_handle h = (clixon_handle)arg;
|
||||||
|
cg_var *cv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
switch(ys->ys_keyword){
|
switch(ys->ys_keyword){
|
||||||
|
|
@ -3073,6 +3074,10 @@ ys_populate2(yang_stmt *ys,
|
||||||
case Y_REQUIRE_INSTANCE:
|
case Y_REQUIRE_INSTANCE:
|
||||||
if (ys_parse(ys, CGV_BOOL) == NULL)
|
if (ys_parse(ys, CGV_BOOL) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
if (ys->ys_keyword == Y_CONFIG){
|
||||||
|
if ((cv = yang_cv_get(ys)) != NULL && !cv_bool_get(cv))
|
||||||
|
yang_flag_set(yang_parent_get(ys), YANG_FLAG_STATE_LOCAL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -3536,21 +3541,12 @@ yang_config_ancestor(yang_stmt *ys)
|
||||||
|
|
||||||
yp = ys;
|
yp = ys;
|
||||||
do {
|
do {
|
||||||
if (yang_flag_get(yp, YANG_FLAG_CONFIG_CACHE))
|
if (yang_flag_get(yp, YANG_FLAG_STATE_LOCAL) != 0)
|
||||||
return yang_flag_get(yp, YANG_FLAG_CONFIG_VALUE)?1:0;
|
|
||||||
if (yang_config(yp) == 0){
|
|
||||||
yang_flag_set(yp, YANG_FLAG_CONFIG_CACHE);
|
|
||||||
yang_flag_reset(yp, YANG_FLAG_CONFIG_VALUE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
else if (yang_keyword_get(yp) == Y_INPUT || yang_keyword_get(yp) == Y_OUTPUT || yang_keyword_get(yp) == Y_NOTIFICATION){
|
||||||
if (yang_keyword_get(yp) == Y_INPUT || yang_keyword_get(yp) == Y_OUTPUT || yang_keyword_get(yp) == Y_NOTIFICATION){
|
|
||||||
yang_flag_set(yp, YANG_FLAG_CONFIG_CACHE);
|
|
||||||
yang_flag_reset(yp, YANG_FLAG_CONFIG_VALUE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} while((yp = yang_parent_get(yp)) != NULL);
|
} while((yp = yang_parent_get(yp)) != NULL);
|
||||||
yang_flag_set(ys, YANG_FLAG_CONFIG_CACHE);
|
|
||||||
yang_flag_set(ys, YANG_FLAG_CONFIG_VALUE);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue