Give a default reason in *sync-debug
authorAndrew Deason <adeason@sinenomine.net>
Wed, 2 Mar 2011 19:12:25 +0000 (13:12 -0600)
committerDerrick Brashear <shadow@dementia.org>
Thu, 3 Mar 2011 18:52:58 +0000 (10:52 -0800)
If no -reason is given for fssync-debug calls, we currently just
transmit garbage to the fileserver or salvageserver. Instead, give a
default (the *_WHATEVER constant), so we do something consistent.

Change-Id: I8fb134c8b16a1fca1b1ed804241d0b232e7e2a7c
Reviewed-on: http://gerrit.openafs.org/4115
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/tsalvaged/salvsync-debug.c
src/vol/fssync-debug.c

index b1c62ee..3f64b7c 100644 (file)
@@ -199,7 +199,10 @@ common_prolog(struct cmd_syndesc * as, struct state * state)
 
     if ((ti = as->parms[COMMON_PARMS_OFFSET].items)) { /* -reason */
        state->reason = atoi(ti->data);
+    } else {
+       state->reason = SALVSYNC_REASON_WHATEVER;
     }
+
     if ((ti = as->parms[COMMON_PARMS_OFFSET+1].items)) {       /* -programtype */
        if (!strcmp(ti->data, "fileServer")) {
            programType = fileServer;
index 9831883..e0fb646 100644 (file)
@@ -333,7 +333,10 @@ common_prolog(struct cmd_syndesc * as, struct state * state)
 
     if ((ti = as->parms[COMMON_PARMS_OFFSET].items)) { /* -reason */
        state->reason = atoi(ti->data);
+    } else {
+       state->reason = FSYNC_WHATEVER;
     }
+
     if ((ti = as->parms[COMMON_PARMS_OFFSET+1].items)) {       /* -programtype */
        if (!strcmp(ti->data, "fileServer")) {
            programType = fileServer;
@@ -1493,8 +1496,6 @@ VGCDel(struct cmd_syndesc * as, void * rock)
     }
     child = atoi(ti->data);
 
-    state.reason = FSYNC_WHATEVER;
-
     common_prolog(as, &state);
     fprintf(stderr, "calling FSYNC_VCGDel\n");
     code = FSYNC_VGCDel(partName, parent, child, state.reason, &res);