summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-10-21 16:52:42 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-10-21 16:52:42 -0700
commit9817f6e3a0581263cdec34a8c914bf41052c73ed (patch)
tree36f92d2248a714e2c1e19120b062bfddf70c2564
parent0cab54b9bec323ebb2d92ec36f4c99c08e7336d2 (diff)
downloadvyatta-cfg-9817f6e3a0581263cdec34a8c914bf41052c73ed.tar.gz
vyatta-cfg-9817f6e3a0581263cdec34a8c914bf41052c73ed.zip
preserve priorities in hierarchy. old priority still active, but commit -s will now display both priorities:
interfaces (t: 0, p: 850,850) the first value is from the old priority file and is the active value, the second value is the value retrieved from the node.def and is not used (yet).
-rw-r--r--src/commit2.c2
-rw-r--r--src/common/unionfs.c15
2 files changed, 9 insertions, 8 deletions
diff --git a/src/commit2.c b/src/commit2.c
index 52bcd68..90c2846 100644
--- a/src/commit2.c
+++ b/src/commit2.c
@@ -793,7 +793,7 @@ dump_func(GNode *node, gpointer data)
for (i = 0; i < depth; ++i) {
fprintf(out," ");
}
- fprintf(out,"%s (t: %d, p: %d)", ((struct VyattaNode*)gp)->_data._name,((struct VyattaNode*)gp)->_config._def.def_type,((struct VyattaNode*)gp)->_priority);
+ fprintf(out,"%s (t: %d, p: %d,%d)", ((struct VyattaNode*)gp)->_data._name,((struct VyattaNode*)gp)->_config._def.def_type,((struct VyattaNode*)gp)->_priority,((struct VyattaNode*)gp)->_config._priority);
if (((struct VyattaNode*)gp)->_data._value == TRUE) {
fprintf(out," [VALUE]");
}
diff --git a/src/common/unionfs.c b/src/common/unionfs.c
index 3f845df..8f7341a 100644
--- a/src/common/unionfs.c
+++ b/src/common/unionfs.c
@@ -195,7 +195,7 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op)
vn->_data._name = cp;
vn->_data._value = FALSE;//TRUE; //data value
vn->_data._operation = op;
- vn->_priority = LOWEST_PRIORITY;
+ vn->_priority = vn->_config._priority = LOWEST_PRIORITY;
vn->_data._path = malloc(MAX_LENGTH_DIR_PATH*sizeof(char));
sprintf(vn->_data._path,"%s",rel_data_path);
final_node = TRUE;
@@ -231,7 +231,7 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op)
}
//either multi or tag--shouldn't have made a difference, but arkady was confused.
vn->_config._multi = (def.tag | def.multi);
- vn->_priority = def.def_priority;
+ vn->_config._priority = def.def_priority;
}
}
@@ -322,7 +322,7 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op)
vn->_data._name = data_buf;
vn->_data._value = FALSE;
vn->_data._operation = K_DEL_OP;
- vn->_priority = LOWEST_PRIORITY;
+ vn->_priority = vn->_config._priority = LOWEST_PRIORITY;
char new_data_path[MAX_LENGTH_DIR_PATH];
sprintf(new_data_path,"%s/%s",rel_data_path,data_buf);
@@ -340,7 +340,7 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op)
struct VyattaNode *vn = calloc(1,sizeof(struct VyattaNode));
vn->_data._name = data_buf;
vn->_data._value = FALSE;
- vn->_priority = LOWEST_PRIORITY;
+ vn->_priority = vn->_config._priority = LOWEST_PRIORITY;
char new_data_path[MAX_LENGTH_DIR_PATH];
sprintf(new_data_path,"%s/%s",rel_data_path,data_buf);
@@ -410,7 +410,7 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op)
vn->_data._name = data_buf;
vn->_data._value = FALSE;
vn->_data._operation = K_DEL_OP;
- vn->_priority = LOWEST_PRIORITY;
+ vn->_priority = vn->_config._priority = LOWEST_PRIORITY;
GNode *new_node = g_node_new(vn);
new_node = insert_sibling_in_order(node,new_node);
@@ -440,7 +440,7 @@ common_get_local_session_data()
struct VyattaNode *vn = calloc(1,sizeof(struct VyattaNode));
vn->_data._name = NULL; //root node has null
vn->_data._operation = K_NO_OP;
- vn->_priority = LOWEST_PRIORITY;
+ vn->_priority = vn->_config._priority = LOWEST_PRIORITY;
//create first node
GNode *root_node = g_node_new(vn);
@@ -957,7 +957,8 @@ copy_vyatta_node(struct VyattaNode* vn)
new_vn->_data._operation = vn->_data._operation;
new_vn->_priority = vn->_priority;
- new_vn->_config._multi = new_vn->_config._multi;
+ new_vn->_config._multi = vn->_config._multi;
+ new_vn->_config._priority = vn->_config._priority;
// new_vn->_config._def = new_vn->_config._def; //cpy this?
if (vn->_config._default != NULL) {
new_vn->_config._default = malloc(MAX_LENGTH_DIR_PATH*sizeof(char));