diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-03-11 20:47:59 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-03-11 20:47:59 -0700 |
commit | f5f06eb9136b39834d9cf240d31236f9255e9c3f (patch) | |
tree | d724a945feed76700b6b3feaae5b5c545e36d4cb | |
parent | a7a8f7ab9a44071869945c0db085de2cd55f6db5 (diff) | |
parent | b04d003bd7fe306819ddcad8398f62d6f71edb9d (diff) | |
download | vyatta-cfg-f5f06eb9136b39834d9cf240d31236f9255e9c3f.tar.gz vyatta-cfg-f5f06eb9136b39834d9cf240d31236f9255e9c3f.zip |
Merge branch 'jenner' of 192.168.100.1:git/vyatta-cfg into jenner
-rw-r--r-- | src/cli_val.h | 6 | ||||
-rw-r--r-- | src/commit2.c | 8 | ||||
-rw-r--r-- | src/common/unionfs.c | 15 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/cli_val.h b/src/cli_val.h index a753c92..e8fbe83 100644 --- a/src/cli_val.h +++ b/src/cli_val.h @@ -4,8 +4,12 @@ #define BITWISE 0 /* no partial commit */ #define boolean int -#define TRUE 1 +#ifndef FALSE #define FALSE 0 +#endif +#ifndef TRUE +#define TRUE (!FALSE) +#endif /* allocation unit for vals in valstruct */ #define MULTI_ALLOC 5 /* we have room if cnt%MULTI_ALLOC != 0 */ diff --git a/src/commit2.c b/src/commit2.c index e6b63fa..bf5957d 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -2,16 +2,18 @@ #include <stdlib.h> #include <unistd.h> #include <syslog.h> +#include <string.h> #include <sys/time.h> #include <glib-2.0/glib.h> #include "common/common.h" +#include "cli_path_utils.h" boolean g_debug = FALSE; boolean g_display_error_node = FALSE; boolean g_coverage = FALSE; boolean g_dump_trans = FALSE; -int ActionOrder[top_act] = { +const int ActionOrder[top_act] = { 4, 5, 6, @@ -24,7 +26,7 @@ int ActionOrder[top_act] = { -char* ActionNames[top_act] = { +const char* ActionNames[top_act] = { "delete", //0 "create", //1 "activate", //2 @@ -81,7 +83,7 @@ also, the algorithm for collapsing the tree into a transaction list is: * **/ void -usage() +usage(void) { printf("commit2\n"); printf("\t-d\t\tdebug mode\n"); diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 7c29ad1..5e90c0c 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -43,6 +43,9 @@ copy_func(GNode *node, gpointer data); static gboolean delete_func(GNode *node, gpointer data); +static void +piecewise_copy(GNode *root_node, boolean test_mode); + /** * * @@ -528,14 +531,6 @@ common_commit_copy_to_live_config(GNode *node, boolean test_mode) static const char format1[]="cp -r -f %s/* %s"; /*mdirp, tmpp*/ static const char format2[]="sudo umount %s"; //mdirp - - static const char format4[]="rm -rf %s/{.*,*} >&/dev/null ; /bin/true"; /*cdirp*/ - - //walk up tree until diverge or skip - static const char format6[]="cp -rf %s/* -t %s";/*tmpp, adirp*/ - - static const char format7[]="rm -fr %s >&/dev/null ; /bin/true"; /*tmpp*/ - static const char format8[]="sudo mount -t unionfs -o dirs=%s=rw:%s=ro unionfs %s"; //cdirp, adirp, mdirp set_echo(TRUE); @@ -991,7 +986,7 @@ struct SrcDst { /** * **/ -void +static void piecewise_copy(GNode *root_node, boolean test_mode) { struct SrcDst sd; @@ -1046,7 +1041,7 @@ copy_func(GNode *node, gpointer data) //this is for the case where it is set by default, then unset at the node--i.e. no longer a default value. if (((struct VyattaNode*)(node->data))->_config._multi == FALSE) { //only for leaf char *parent_path = ((struct VyattaNode*)(node->parent->data))->_data._path; - sprintf(command,clear_def,sd->_dst,parent_path,sd->_dst,parent_path); + sprintf(command,clear_def,sd->_dst,parent_path); if (g_debug) { printf("%s\n",command); fflush(NULL); |