diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2011-03-02 11:54:09 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2011-03-02 11:54:09 -0800 |
commit | 521e99d155759a80b2b97c6d5b827d490426c0b6 (patch) | |
tree | 2f8fae72b1167216ef00f2a21a4ec26cfb0923a9 /src/common/unionfs.c | |
parent | 0acc2454cacb3ccab512b41b96cbaa024ebb0117 (diff) | |
download | vyatta-cfg-521e99d155759a80b2b97c6d5b827d490426c0b6.tar.gz vyatta-cfg-521e99d155759a80b2b97c6d5b827d490426c0b6.zip |
change indentation in commit code
Diffstat (limited to 'src/common/unionfs.c')
-rw-r--r-- | src/common/unionfs.c | 488 |
1 files changed, 244 insertions, 244 deletions
diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 0c95cab..6646e74 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -145,8 +145,8 @@ get_config_path(GNode *node) struct VyattaNode *d = (struct VyattaNode*)n->data; if (d == NULL) { if (g_debug) { - printf("unionfs::get_config_path(): data ptr is null\n"); - syslog(LOG_DEBUG,"unionfs::get_config_path(): data ptr is null"); + printf("unionfs::get_config_path(): data ptr is null\n"); + syslog(LOG_DEBUG,"unionfs::get_config_path(): data ptr is null"); } return NULL; } @@ -158,11 +158,11 @@ get_config_path(GNode *node) //need to check the configuration location for the existance of this node to determine if it's a multi if (G_NODE_IS_ROOT(n->parent) != TRUE && - ((struct VyattaNode*)(n->parent->data))->_config._multi == TRUE) { - sprintf(buf,"node.tag/%s",tmp); + ((struct VyattaNode*)(n->parent->data))->_config._multi == TRUE) { + sprintf(buf,"node.tag/%s",tmp); } else { - sprintf(buf,"%s/%s",d->_data._name,tmp); + sprintf(buf,"%s/%s",d->_data._name,tmp); } } n = n->parent; @@ -178,7 +178,7 @@ get_config_path(GNode *node) **/ void retrieve_data(char* rel_data_path, GNode *node, const char* root, - NODE_OPERATION op) + NODE_OPERATION op) { boolean final_node = FALSE; @@ -253,22 +253,22 @@ retrieve_data(char* rel_data_path, GNode *node, const char* root, memset(&def, 0, sizeof(def)); if ((lstat(buf,&s) == 0) && S_ISREG(s.st_mode)) { if (parse_def(&def, buf, FALSE) == 0) { - if (g_debug) { - printf("[FOUND node.def]"); - syslog(LOG_DEBUG,"[FOUND node.def]"); - } - - //either multi or tag--shouldn't have made a difference, but arkady was confused. - vn->_config._multi = (def.tag | def.multi); - if (def.def_tag != 0) { - vn->_config._limit = def.def_tag; - } - else if (def.def_multi != 0) { - vn->_config._limit = def.def_multi; - } - else { - vn->_config._limit = 0; - } + if (g_debug) { + printf("[FOUND node.def]"); + syslog(LOG_DEBUG,"[FOUND node.def]"); + } + + //either multi or tag--shouldn't have made a difference, but arkady was confused. + vn->_config._multi = (def.tag | def.multi); + if (def.def_tag != 0) { + vn->_config._limit = def.def_tag; + } + else if (def.def_multi != 0) { + vn->_config._limit = def.def_multi; + } + else { + vn->_config._limit = 0; + } } } @@ -288,28 +288,28 @@ retrieve_data(char* rel_data_path, GNode *node, const char* root, if (G_NODE_IS_ROOT(node) == FALSE) { struct VyattaNode* vn_parent = (struct VyattaNode*)node->parent->data; if (vn_parent->_config._multi == TRUE) { - ((struct VyattaNode*)node->data)->_data._value = TRUE; - - //patch up to preserve multinode behavior on value node, can also put node.def on node.tag with priority - //Need to do two things: - // 1. Come to agreement on where the behavior splits on priority multinodes - // 2. Not check for tag node in the def datastructure but use the new datastructure as at some point tag and multi will be the same - //now let's patch up the def multi-nodes - //move the def for the multinode from the parent to the value node - struct VyattaNode* vn2 = (struct VyattaNode*)node->data; - if (final_node == FALSE) { //non-term multi - if (g_node_n_children(node->parent) == 1) { - vn2->_config._def = ((struct VyattaNode*)node->parent->data)->_config._def; - memset(&((struct VyattaNode*)node->parent->data)->_config._def, 0, sizeof(vtw_def)); - } - else { //find node other than myself to copy defs across - GNode *first_child = g_node_first_child(node->parent); - if (first_child == node) { - first_child = g_node_next_sibling(first_child); - } - vn2->_config._def = ((struct VyattaNode*)first_child->data)->_config._def; - } - } + ((struct VyattaNode*)node->data)->_data._value = TRUE; + + //patch up to preserve multinode behavior on value node, can also put node.def on node.tag with priority + //Need to do two things: + // 1. Come to agreement on where the behavior splits on priority multinodes + // 2. Not check for tag node in the def datastructure but use the new datastructure as at some point tag and multi will be the same + //now let's patch up the def multi-nodes + //move the def for the multinode from the parent to the value node + struct VyattaNode* vn2 = (struct VyattaNode*)node->data; + if (final_node == FALSE) { //non-term multi + if (g_node_n_children(node->parent) == 1) { + vn2->_config._def = ((struct VyattaNode*)node->parent->data)->_config._def; + memset(&((struct VyattaNode*)node->parent->data)->_config._def, 0, sizeof(vtw_def)); + } + else { //find node other than myself to copy defs across + GNode *first_child = g_node_first_child(node->parent); + if (first_child == node) { + first_child = g_node_next_sibling(first_child); + } + vn2->_config._def = ((struct VyattaNode*)first_child->data)->_config._def; + } + } } } @@ -377,137 +377,137 @@ retrieve_data(char* rel_data_path, GNode *node, const char* root, whiteout_file_found = TRUE; } if (strcmp(dirp->d_name, ".") != 0 && - strcmp(dirp->d_name, "..") != 0 && - strcmp(dirp->d_name, MOD_NAME) != 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, VAL_NAME) != 0) { + strcmp(dirp->d_name, "..") != 0 && + strcmp(dirp->d_name, MOD_NAME) != 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, VAL_NAME) != 0) { processed = TRUE; NODE_ACTIVATE deactivated = K_NO_DISABLE_OP; if (G_NODE_IS_ROOT(node) == FALSE && ((struct VyattaNode*)node->data)->_data._disable_op != K_NO_DISABLE_OP) { - deactivated = ((struct VyattaNode*)node->data)->_data._disable_op; + deactivated = ((struct VyattaNode*)node->data)->_data._disable_op; } - else { //do a lstat check in the local dir - struct stat s; - - char namebuf[MAX_LENGTH_HELP_STR]; - if (strncmp(dirp->d_name,DELETED_NODE,4) == 0) { - strcpy(namebuf,dirp->d_name+4); //SKIP THE .WH. - } - else { - strcpy(namebuf,dirp->d_name); - } - - - char buf[MAX_LENGTH_HELP_STR]; - sprintf(buf,"%s/%s/%s/%s",get_mdirp(),rel_data_path,namebuf,DISABLE_FILE); - if (lstat(buf,&s) == 0) { - //need to check existence of file in active configuration here as well! - deactivated |= K_LOCAL_DISABLE_OP; - } - sprintf(buf,"%s/%s/%s/%s",get_adirp(),rel_data_path,namebuf,DISABLE_FILE); - if (lstat(buf,&s) == 0) { - deactivated |= K_ACTIVE_DISABLE_OP; - } + else { //do a lstat check in the local dir + struct stat s; + + char namebuf[MAX_LENGTH_HELP_STR]; + if (strncmp(dirp->d_name,DELETED_NODE,4) == 0) { + strcpy(namebuf,dirp->d_name+4); //SKIP THE .WH. + } + else { + strcpy(namebuf,dirp->d_name); + } + + + char buf[MAX_LENGTH_HELP_STR]; + sprintf(buf,"%s/%s/%s/%s",get_mdirp(),rel_data_path,namebuf,DISABLE_FILE); + if (lstat(buf,&s) == 0) { + //need to check existence of file in active configuration here as well! + deactivated |= K_LOCAL_DISABLE_OP; + } + sprintf(buf,"%s/%s/%s/%s",get_adirp(),rel_data_path,namebuf,DISABLE_FILE); + if (lstat(buf,&s) == 0) { + deactivated |= K_ACTIVE_DISABLE_OP; + } } // char *data_buf = malloc(MAX_LENGTH_DIR_PATH*sizeof(char)); char *data_buf = malloc(strlen(dirp->d_name)+5); 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. - vn->_data._operation = K_DEL_OP; - } - else { - 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_DEL_OP); + 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. + vn->_data._operation = K_DEL_OP; + } + else { + 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_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); - if (op == K_DEL_OP) { - vn->_data._operation = K_DEL_OP; - } - else { - 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(),vn->_data._operation); + //NEED TO RECURSE DOWN THE ACTIVE PATH THEN. + struct VyattaNode *vn = calloc(1,sizeof(struct VyattaNode)); + + strcpy(data_buf,dirp->d_name); + if (op == K_DEL_OP) { + vn->_data._operation = K_DEL_OP; + } + else { + 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(),vn->_data._operation); } else { - strcpy(data_buf,dirp->d_name); - //create new node and insert... - struct VyattaNode *vn = calloc(1,sizeof(struct VyattaNode)); - 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); - - char active_data_path[MAX_LENGTH_DIR_PATH]; - sprintf(active_data_path,"%s%s",get_adirp(),rel_data_path); - struct stat s; - - if (lstat(active_data_path,&s) == 0) { - vn->_data._operation = K_NO_OP; - } - else { - vn->_data._operation = K_CREATE_OP; - ((struct VyattaNode*)node->data)->_data._operation = K_CREATE_OP; - } - //set recursed entry op to del - if (op == K_DEL_OP) { - vn->_data._operation = K_DEL_OP; - } - 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 || vn->_data._disable_op != K_NO_DISABLE_OP) { - retrieve_data(new_data_path,new_node,get_adirp(),vn->_data._operation); - } - else { - retrieve_data(new_data_path,new_node,root,vn->_data._operation); - } + strcpy(data_buf,dirp->d_name); + //create new node and insert... + struct VyattaNode *vn = calloc(1,sizeof(struct VyattaNode)); + 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); + + char active_data_path[MAX_LENGTH_DIR_PATH]; + sprintf(active_data_path,"%s%s",get_adirp(),rel_data_path); + struct stat s; + + if (lstat(active_data_path,&s) == 0) { + vn->_data._operation = K_NO_OP; + } + else { + vn->_data._operation = K_CREATE_OP; + ((struct VyattaNode*)node->data)->_data._operation = K_CREATE_OP; + } + //set recursed entry op to del + if (op == K_DEL_OP) { + vn->_data._operation = K_DEL_OP; + } + 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 || vn->_data._disable_op != K_NO_DISABLE_OP) { + retrieve_data(new_data_path,new_node,get_adirp(),vn->_data._operation); + } + else { + retrieve_data(new_data_path,new_node,root,vn->_data._operation); + } } } } @@ -532,32 +532,32 @@ retrieve_data(char* rel_data_path, GNode *node, const char* root, sprintf(active_data_path,"%s%s",get_adirp(),rel_data_path); if ((dp_wo = opendir(active_data_path)) != NULL) { if (g_debug) { - //could also be a terminating value now - syslog(LOG_DEBUG,"unionfs::retrieve_data(), failed to open directory: %s\n", active_data_path); - printf("unionfs::retrieve_data(), failed to open directory: %s\n", active_data_path); + //could also be a terminating value now + syslog(LOG_DEBUG,"unionfs::retrieve_data(), failed to open directory: %s\n", active_data_path); + printf("unionfs::retrieve_data(), failed to open directory: %s\n", active_data_path); } struct dirent *dirp_wo = NULL; while ((dirp_wo = readdir(dp_wo)) != NULL) { - char tmp_new_data_path[MAX_LENGTH_DIR_PATH]; - sprintf(tmp_new_data_path,"%s/%s/%s",get_cdirp(),rel_data_path,dirp_wo->d_name); - struct stat s; - if (lstat(tmp_new_data_path,&s) != 0) { - //create new node and insert... - struct VyattaNode *vn = calloc(1,sizeof(struct VyattaNode)); - char *data_buf = malloc(strlen(dirp_wo->d_name)+1); - strcpy(data_buf,dirp_wo->d_name); - vn->_data._name = data_buf; - vn->_data._value = FALSE; - vn->_data._operation = K_DEL_OP; - vn->_config._priority = LOWEST_PRIORITY; - vn->_data._disable_op = K_NO_DISABLE_OP; - - GNode *new_node = g_node_new(vn); - new_node = insert_sibling_in_order(node,new_node); - char new_data_path[MAX_LENGTH_DIR_PATH]; - sprintf(new_data_path,"%s/%s",rel_data_path,dirp_wo->d_name); - retrieve_data(new_data_path,new_node,get_adirp(),K_DEL_OP); - } + char tmp_new_data_path[MAX_LENGTH_DIR_PATH]; + sprintf(tmp_new_data_path,"%s/%s/%s",get_cdirp(),rel_data_path,dirp_wo->d_name); + struct stat s; + if (lstat(tmp_new_data_path,&s) != 0) { + //create new node and insert... + struct VyattaNode *vn = calloc(1,sizeof(struct VyattaNode)); + char *data_buf = malloc(strlen(dirp_wo->d_name)+1); + strcpy(data_buf,dirp_wo->d_name); + vn->_data._name = data_buf; + vn->_data._value = FALSE; + vn->_data._operation = K_DEL_OP; + vn->_config._priority = LOWEST_PRIORITY; + vn->_data._disable_op = K_NO_DISABLE_OP; + + GNode *new_node = g_node_new(vn); + new_node = insert_sibling_in_order(node,new_node); + char new_data_path[MAX_LENGTH_DIR_PATH]; + sprintf(new_data_path,"%s/%s",rel_data_path,dirp_wo->d_name); + retrieve_data(new_data_path,new_node,get_adirp(),K_DEL_OP); + } } closedir(dp_wo); } @@ -622,8 +622,8 @@ common_set_parent_context(char *cpath, char *dpath) if (cpath[index] == '/') { while (TRUE) { if (cpath[--index] != '/') { - cpath[index] = '\0'; - break; + cpath[index] = '\0'; + break; } } } @@ -637,8 +637,8 @@ common_set_parent_context(char *cpath, char *dpath) if (dpath[index] == '/') { while (TRUE) { if (dpath[--index] != '/') { - dpath[index] = '\0'; - break; + dpath[index] = '\0'; + break; } } } @@ -705,12 +705,12 @@ set_path(char *path, boolean config) if (size < 1 || size > 1024) { /* if (g_debug) { - if (config == FALSE) { - printf("unionfs::set_path(): %s, %s\n", path,m_path.path); - } - else { - printf("unionfs::set_path(): %s, %s\n", path,t_path.path); - } + if (config == FALSE) { + printf("unionfs::set_path(): %s, %s\n", path,m_path.path); + } + else { + printf("unionfs::set_path(): %s, %s\n", path,t_path.path); + } } */ return; @@ -926,11 +926,11 @@ common_commit_clean_temp_config(GNode *root_node, boolean test_mode) sd._test_mode = test_mode; g_node_traverse(root_node, - G_PRE_ORDER, - G_TRAVERSE_ALL, - -1, - (GNodeTraverseFunc)delete_wh_func, - (gpointer)&sd); + G_PRE_ORDER, + G_TRAVERSE_ALL, + -1, + (GNodeTraverseFunc)delete_wh_func, + (gpointer)&sd); } /* originally the root "changed" marker was being removed here. this is now @@ -1043,13 +1043,13 @@ get_term_data_values(GNode *node) for (i = 0; tok_str_new != NULL && tok_str_new[i] != NULL; ++i) { gpointer g; if ((g = g_datalist_get_data(&datalist,tok_str_new[i])) == NULL) { - struct ValueData *data; - data = (struct ValueData*)calloc(1, sizeof(struct ValueData)); - data->_state = K_CREATE_OP; - g_datalist_set_data(&datalist, tok_str_new[i], data); + struct ValueData *data; + data = (struct ValueData*)calloc(1, sizeof(struct ValueData)); + data->_state = K_CREATE_OP; + g_datalist_set_data(&datalist, tok_str_new[i], data); } else { - ((struct ValueData*)g)->_state = K_NO_OP; + ((struct ValueData*)g)->_state = K_NO_OP; } } } @@ -1057,7 +1057,7 @@ get_term_data_values(GNode *node) struct ValueData *data; data = (struct ValueData*)calloc(1, sizeof(struct ValueData)); if ((tok_str_active == NULL || tok_str_active[0] == NULL) && - (tok_str_new == NULL || tok_str_new[0] == NULL)) { + (tok_str_new == NULL || tok_str_new[0] == NULL)) { cp = malloc(sizeof(char)); cp[0] = '\0'; data->_state = ((struct VyattaNode*)node->parent->data)->_data._operation; @@ -1073,12 +1073,12 @@ get_term_data_values(GNode *node) } else { if (strcmp(tok_str_active[0],tok_str_new[0]) != 0) { - data->_state = K_SET_OP; - g_datalist_set_data(&datalist, tok_str_new[0], data); + data->_state = K_SET_OP; + g_datalist_set_data(&datalist, tok_str_new[0], data); } else { - data->_state = K_NO_OP; - g_datalist_set_data(&datalist, tok_str_new[0], data); + data->_state = K_NO_OP; + g_datalist_set_data(&datalist, tok_str_new[0], data); } } } @@ -1131,16 +1131,16 @@ dlist_test_func(GQuark key_id,gpointer data,gpointer user_data) char *tmp = (char*)g_quark_to_string(key_id); char *slash = strchr(tmp,'/'); if (slash == NULL) { - strcat(buf,tmp); + strcat(buf,tmp); } else { - do { //escape '/' to %2F - strncat(buf,tmp,slash - tmp); - strncat(buf,"%2F",3); - ++slash; - tmp = slash; - } while ((slash = strchr(slash,'/')) != NULL); - strcat(buf,tmp); + do { //escape '/' to %2F + strncat(buf,tmp,slash - tmp); + strncat(buf,"%2F",3); + ++slash; + tmp = slash; + } while ((slash = strchr(slash,'/')) != NULL); + strcat(buf,tmp); } } new_vn->_data._path = (char*)realloc(new_vn->_data._path,strlen(buf)+1); @@ -1192,21 +1192,21 @@ piecewise_copy(GNode *root_node, boolean test_mode) //COPY FROM TOP DOWN g_node_traverse(root_node, - G_PRE_ORDER, - G_TRAVERSE_ALL, - -1, - (GNodeTraverseFunc)copy_func, - (gpointer)&sd); + G_PRE_ORDER, + G_TRAVERSE_ALL, + -1, + (GNodeTraverseFunc)copy_func, + (gpointer)&sd); //delete needs to apply to changes only as src sd._src = get_cdirp(); //changes only config //DELETE FROM BOTTOM UP, stop on finding children g_node_traverse(root_node, - G_POST_ORDER, - G_TRAVERSE_ALL, - -1, - (GNodeTraverseFunc)delete_func, - (gpointer)&sd); + G_POST_ORDER, + G_TRAVERSE_ALL, + -1, + (GNodeTraverseFunc)delete_func, + (gpointer)&sd); } /** @@ -1238,9 +1238,9 @@ copy_func(GNode *node, gpointer data) if (((struct VyattaNode*)(node->data))->_config._multi == FALSE) { //only for leaf char *parent_path = ((struct VyattaNode*)(node->parent->data))->_data._path; if (g_debug) { - printf("rm %s%sdef\n", sd->_dst, parent_path); - syslog(LOG_DEBUG, "rm %s%sdef", sd->_dst, parent_path); - fflush(NULL); + printf("rm %s%sdef\n", sd->_dst, parent_path); + syslog(LOG_DEBUG, "rm %s%sdef", sd->_dst, parent_path); + fflush(NULL); } if (sd->_test_mode == FALSE) { if (snprintf(buf, MAX_LENGTH_DIR_PATH, "%s%sdef", @@ -1277,9 +1277,9 @@ copy_func(GNode *node, gpointer data) } else { if (!IS_DELETE(((struct VyattaNode*)(node->data))->_data._operation)) { if (g_debug) { - printf("mkdir_p %s%s\n", sd->_dst, path); - syslog(LOG_DEBUG, "mkdir_p %s%s", sd->_dst, path); - fflush(NULL); + printf("mkdir_p %s%s\n", sd->_dst, path); + syslog(LOG_DEBUG, "mkdir_p %s%s", sd->_dst, path); + fflush(NULL); } if (sd->_test_mode == FALSE) { if (snprintf(buf, MAX_LENGTH_DIR_PATH, "%s%s", sd->_dst, path) @@ -1396,8 +1396,8 @@ delete_wh_func(GNode *node, gpointer data) //if this is a deletion operation, need to remove if (parent_node != NULL) { if (IS_DELETE(((struct VyattaNode*)(node->data))->_data._operation) && - !IS_ACTIVE(((struct VyattaNode*)(node->data))->_data._operation) && - !IS_DELETE(((struct VyattaNode*)(parent_node->data))->_data._operation)) { + !IS_ACTIVE(((struct VyattaNode*)(node->data))->_data._operation) && + !IS_DELETE(((struct VyattaNode*)(parent_node->data))->_data._operation)) { char *path = ((struct VyattaNode*)(node->data))->_data._path; sprintf(abuf,"%s%s",get_adirp(),path); @@ -1405,31 +1405,31 @@ delete_wh_func(GNode *node, gpointer data) char command[MAX_LENGTH_DIR_PATH]; sprintf(command,format0,abuf); if (g_debug) { - printf("%s\n",command); - syslog(LOG_DEBUG,"%s\n",command); - fflush(NULL); + printf("%s\n",command); + syslog(LOG_DEBUG,"%s\n",command); + fflush(NULL); } if (sd->_test_mode == FALSE) { - system(command); + system(command); } } } else { if (IS_DELETE(((struct VyattaNode*)(node->data))->_data._operation) && - !IS_ACTIVE(((struct VyattaNode*)(node->data))->_data._operation)) { + !IS_ACTIVE(((struct VyattaNode*)(node->data))->_data._operation)) { char *path = ((struct VyattaNode*)(node->data))->_data._path; sprintf(abuf,"%s%s",get_adirp(),path); //mkdir temp merge char command[MAX_LENGTH_DIR_PATH]; sprintf(command,format0,abuf); if (g_debug) { - printf("%s\n",command); - syslog(LOG_DEBUG,"%s\n",command); - fflush(NULL); + printf("%s\n",command); + syslog(LOG_DEBUG,"%s\n",command); + fflush(NULL); } if (sd->_test_mode == FALSE) { - system(command); + system(command); } } } |