summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/Vyatta/Config.pm2
-rwxr-xr-xlib/Vyatta/ConfigOutput.pm12
-rw-r--r--src/commit2.c13
-rw-r--r--src/common/unionfs.c43
-rw-r--r--src/common/unionfs.h2
5 files changed, 44 insertions, 28 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index 4ae578c..4c149cf 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -1,4 +1,4 @@
-# Author: An-Cheng Huang <ancheng@vyatta.com>
+# Author: Vyatta <eng@vyatta.com>
# Date: 2007
# Description: vyatta configuration parser
diff --git a/lib/Vyatta/ConfigOutput.pm b/lib/Vyatta/ConfigOutput.pm
index c92cee4..09713f9 100755
--- a/lib/Vyatta/ConfigOutput.pm
+++ b/lib/Vyatta/ConfigOutput.pm
@@ -1,4 +1,4 @@
-# Author: An-Cheng Huang <ancheng@vyatta.com>
+# Author: Vyatta <eng@vyatta.com>
# Date: 2007
# Description: Perl module for generating output of the configuration.
@@ -143,7 +143,8 @@ sub displayValues {
my @cnames = sort keys %cnodes;
if (defined($simple_show)) {
- if (!$cnodes{'def'} || $show_all) {
+ if (!defined($cnodes{'def'}) or $cnodes{'def'} eq 'deleted'
+ or $show_all) {
if ($is_password && $hide_password) {
$oval = $HIDE_PASSWORD;
}
@@ -164,15 +165,14 @@ sub displayValues {
$diff = '>';
}
}
- if (!$cnodes{'def'} || $show_all) {
+ # also need to handle the case where def marker is deleted.
+ if (!defined($cnodes{'def'}) or $cnodes{'def'} eq 'deleted'
+ or $show_all) {
if ($is_password && $hide_password) {
$value = $HIDE_PASSWORD;
}
print "$dis$diff$prefix$name $value\n";
}
- elsif ($cnodes{'def'} && ($diff eq '>' || $diff eq '-')) {
- print "$dis$diff$prefix$name $value\n";
- }
}
}
diff --git a/src/commit2.c b/src/commit2.c
index d5ed4d0..fabc7ae 100644
--- a/src/commit2.c
+++ b/src/commit2.c
@@ -752,7 +752,7 @@ sort_func(GNode *node, gpointer data, boolean priority_mode)
}
else if ((d->_disable_op & K_LOCAL_DISABLE_OP) && !(d->_disable_op & K_ACTIVE_DISABLE_OP)) {
//node will be deactivated on commit
- //LET'S SPOOF the operation... convert it to DELETE
+ //LET'S SPOOF the operation... convert it to DELETE
op = K_DEL_OP;
}
}
@@ -784,9 +784,10 @@ sort_func(GNode *node, gpointer data, boolean priority_mode)
while (TRUE) {
n = n->parent;
vtw_def def = ((struct VyattaNode*)(n->data))->_config._def;
- ((struct VyattaNode*)(n->data))->_data._operation = ((struct VyattaNode*)gp)->_data._operation;
+ // ((struct VyattaNode*)(n->data))->_data._operation = ((struct VyattaNode*)gp)->_data._operation;
//DON'T set active when only in disable state...
- if (((struct VyattaNode*)(n->data))->_data._disable_op == K_NO_DISABLE_OP) {
+ // if (((struct VyattaNode*)(n->data))->_data._disable_op == K_NO_DISABLE_OP) {
+ if (((struct VyattaNode*)(n->data))->_data._operation == K_NO_OP) {
((struct VyattaNode*)(n->data))->_data._operation |= K_ACTIVE_OP;
}
if (def.actions[end_act].vtw_list_head || def.actions[begin_act].vtw_list_head) {
@@ -967,13 +968,13 @@ dump_func(GNode *node, gpointer data)
char disable_op[2];
if (((struct VyattaNode*)gp)->_data._disable_op == (K_ACTIVE_DISABLE_OP | K_LOCAL_DISABLE_OP)) {
- disable_op[0] = 'c';
+ disable_op[0] = '!';
}
else if (((struct VyattaNode*)gp)->_data._disable_op == K_ACTIVE_DISABLE_OP) {
- disable_op[0] = 'u';
+ disable_op[0] = 'A';
}
else if (((struct VyattaNode*)gp)->_data._disable_op == K_LOCAL_DISABLE_OP) {
- disable_op[0] = 's';
+ disable_op[0] = 'D';
}
else {
disable_op[0] = ' ';
diff --git a/src/common/unionfs.c b/src/common/unionfs.c
index db3addd..d96ef0e 100644
--- a/src/common/unionfs.c
+++ b/src/common/unionfs.c
@@ -340,9 +340,11 @@ retrieve_data(char* rel_data_path, GNode *node, const char* root,
if (strcmp(dirp->d_name, ".") != 0 &&
strcmp(dirp->d_name, "..") != 0 &&
strcmp(dirp->d_name, MODIFIED_FILE) != 0 &&
+ strcmp(dirp->d_name, UNSAVED_FILE) != 0 &&
strcmp(dirp->d_name, DEF_FILE) != 0 &&
strcmp(dirp->d_name, DISABLE_FILE) != 0 &&
strcmp(dirp->d_name, WHITEOUT_FILE) != 0 &&
+ strcmp(dirp->d_name, WHITEOUT_DISABLE_FILE) != 0 &&
strcmp(dirp->d_name, VALUE_FILE) != 0) {
processed = TRUE;
@@ -365,24 +367,12 @@ retrieve_data(char* rel_data_path, GNode *node, const char* root,
}
char *data_buf = malloc(MAX_LENGTH_DIR_PATH*sizeof(char));
- if (strncmp(dirp->d_name,DELETED_NODE,4) == 0 ||
- deactivated != K_NO_DISABLE_OP) {
-
+ if (strncmp(dirp->d_name,DELETED_NODE,4) == 0) {
struct VyattaNode *vn = calloc(1,sizeof(struct VyattaNode));
if (strncmp(dirp->d_name,DELETED_NODE,4) == 0) {
strcpy(data_buf,dirp->d_name+4); //SKIP THE .WH.
-
- //special test for deleted .disable file.
- char buf[MAX_LENGTH_HELP_STR];
- sprintf(buf,"%s/%s/%s/%s",get_adirp(),rel_data_path,data_buf,DISABLE_FILE);
- struct stat s;
- if (lstat(buf,&s) == 0) {
- vn->_data._operation = K_NO_OP;
- }
- else {
- vn->_data._operation = K_DEL_OP;
- }
+ vn->_data._operation = K_DEL_OP;
}
else {
strcpy(data_buf,dirp->d_name);
@@ -405,6 +395,29 @@ retrieve_data(char* rel_data_path, GNode *node, const char* root,
//will need to enter a special recursion against the active configuration to mark nested delete nodes
retrieve_data(new_data_path,new_node,get_adirp(),K_DEL_OP);
}
+ else if (deactivated != K_NO_DISABLE_OP) {
+ //NEED TO RECURSE DOWN THE ACTIVE PATH THEN.
+ struct VyattaNode *vn = calloc(1,sizeof(struct VyattaNode));
+
+ strcpy(data_buf,dirp->d_name);
+ vn->_data._operation = K_NO_OP;
+
+ //create new node and insert...
+ vn->_data._name = data_buf;
+ vn->_data._value = FALSE;
+ vn->_config._priority = LOWEST_PRIORITY;
+ vn->_data._disable_op = deactivated;
+
+ char new_data_path[MAX_LENGTH_DIR_PATH];
+ sprintf(new_data_path,"%s/%s",rel_data_path,data_buf);
+
+ GNode *new_node = g_node_new(vn);
+ // new_node = g_node_insert(node, -1, new_node);
+ new_node = insert_sibling_in_order(node,new_node);
+
+ //will need to enter a special recursion against the active configuration to mark nested delete nodes
+ retrieve_data(new_data_path,new_node,get_adirp(),K_NO_OP);
+ }
else {
strcpy(data_buf,dirp->d_name);
//create new node and insert...
@@ -435,7 +448,7 @@ retrieve_data(char* rel_data_path, GNode *node, const char* root,
GNode *new_node = g_node_new(vn);
// new_node = g_node_insert(node, -1, new_node);
new_node = insert_sibling_in_order(node,new_node);
- if (op == K_DEL_OP) {
+ if (op == K_DEL_OP || vn->_data._disable_op != K_NO_DISABLE_OP) {
retrieve_data(new_data_path,new_node,get_adirp(),vn->_data._operation);
}
else {
diff --git a/src/common/unionfs.h b/src/common/unionfs.h
index 2933deb..7881594 100644
--- a/src/common/unionfs.h
+++ b/src/common/unionfs.h
@@ -23,9 +23,11 @@
#define NODE_TAG_FILE "node.tag"
#define VALUE_FILE "node.val"
#define MODIFIED_FILE ".modified"
+#define UNSAVED_FILE ".unsaved"
#define DISABLE_FILE ".disable"
#define DEF_FILE "def"
#define WHITEOUT_FILE ".wh.__dir_opaque"
+#define WHITEOUT_DISABLE_FILE ".wh..disable"
#define DELETED_NODE ".wh."
#define MAX_LENGTH_DIR_PATH 1024