vol: Tidy header includes
[openafs.git] / src / vol / fssync-debug.c
index fb83e48..0c2780d 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <errno.h>
 #ifdef AFS_NT40_ENV
-#include <io.h>
 #include <WINNT/afsevent.h>
-#else
-#include <sys/param.h>
-#include <sys/file.h>
-#ifndef ITIMER_REAL
-#include <sys/time.h>
-#endif /* ITIMER_REAL */
 #endif
+
 #include <rx/xdr.h>
 #include <afs/afsint.h>
-#include <afs/assert.h>
-
-#include <fcntl.h>
+#include <afs/afs_assert.h>
 
 #ifndef AFS_NT40_ENV
 #include <afs/osi_inode.h>
@@ -332,7 +318,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;
@@ -362,7 +351,7 @@ common_volop_prolog(struct cmd_syndesc * as, struct state * state)
     struct cmd_item *ti;
 
     state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state));
-    assert(state->vop != NULL);
+    osi_Assert(state->vop != NULL);
 
     if ((ti = as->parms[COMMON_VOLOP_PARMS_OFFSET].items)) {   /* -volumeid */
        state->vop->volume = atoi(ti->data);
@@ -435,9 +424,7 @@ do_volop(struct state * state, afs_int32 command, SYNC_response * res)
 
 #define ENUMTOSTRING(en)  #en
 #define ENUMCASE(en) \
-    case en: \
-        return ENUMTOSTRING(en); \
-        break
+    case en: return ENUMTOSTRING(en)
 
 #define FLAGTOSTRING(fl)  #fl
 #define FLAGCASE(bitstr, fl, str, count) \
@@ -606,6 +593,7 @@ vol_state_to_string(VolState state)
        ENUMCASE(VOL_STATE_VNODE_RELEASE);
        ENUMCASE(VOL_STATE_VLRU_ADD);
        ENUMCASE(VOL_STATE_DELETED);
+       ENUMCASE(VOL_STATE_SALVAGE_REQ);
        ENUMCASE(VOL_STATE_FREED);
     default:
        return "**UNKNOWN**";
@@ -937,7 +925,7 @@ VolOpQuery(struct cmd_syndesc * as, void * rock)
 
        printf("\tvop = {\n");
        printf("\t\tvolume         = %u\n", vop.vop.volume);
-       if (afs_strnlen(vop.vop.partName, sizeof(vop.vop.partName)) <
+       if (strnlen(vop.vop.partName, sizeof(vop.vop.partName)) <
            sizeof(vop.vop.partName)) {
            printf("\t\tpartName       = '%s'\n", vop.vop.partName);
        } else {
@@ -957,7 +945,7 @@ vn_prolog(struct cmd_syndesc * as, struct state * state)
     struct cmd_item *ti;
 
     state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state));
-    assert(state->vop != NULL);
+    osi_Assert(state->vop != NULL);
 
     if ((ti = as->parms[CUSTOM_PARMS_OFFSET].items)) { /* -volumeid */
        state->vop->volume = atoi(ti->data);
@@ -1493,8 +1481,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);