Demand attach warning fixes
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Tue, 29 Sep 2009 10:26:55 +0000 (12:26 +0200)
committerDerrick Brashear <shadow|account-1000005@unknown>
Tue, 29 Sep 2009 19:11:37 +0000 (12:11 -0700)
Fix a whole host of warnings in the demand attach code.

Make a broken tvolser build stop the build, rather than carrying on
regardless.

Reviewed-on: http://gerrit.openafs.org/551
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

23 files changed:
Makefile.in
src/config/stds.h
src/rx/rx_globals.h
src/tsalvaged/salvsync-debug.c
src/tviced/serialize_state.c
src/tviced/state_analyzer.c
src/viced/callback.c
src/viced/host.c
src/vol/fssync-client.c
src/vol/fssync-server.c
src/vol/partition.c
src/vol/salvaged.c
src/vol/salvsync-client.c
src/vol/salvsync-server.c
src/vol/vnode_inline.h
src/vol/volinodes.h
src/vol/volume.c
src/vol/volume.h
src/vol/volume_inline.h
src/volser/dumpstuff.c
src/volser/volmain.c
src/volser/volprocs.c
src/volser/volser_prototypes.h

index 816555a..244b97b 100644 (file)
@@ -296,7 +296,7 @@ tvolser: project tviced usd libafsrpc libafsauthent volser
        *_darwin_[1-6][0-9])                                            \
                echo Not building MT volser for ${SYS_NAME} ;;          \
        *_darwin_*|alpha_dux*|sgi_*|sun*_5*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*obsd*)   \
-               ${COMPILE_PART1} tvolser ${COMPILE_PART2} ;             \
+               ${COMPILE_PART1} tvolser ${COMPILE_PART2} &&            \
                if [ "xyes" = "x$(ENABLE_PTHREADED_UNIK)" ] ; then      \
                        $(MAKE) $(COMPILE_PART2B)_vos;                                          \
                fi;;                                                    \
index df331ec..be65339 100644 (file)
@@ -316,9 +316,9 @@ hdr_static_inline(long) afs_printable_int32_ld(afs_int32 d) { return (long) d; }
 hdr_static_inline(unsigned long) afs_printable_uint32_lu(afs_uint32 d) { return (unsigned long) d; }
 
 #if !defined(__GNUC__) || __GNUC__ < 2
-#define AFS_UNUSED_FUNCTION
+#define AFS_UNUSED
 #else
-#define AFS_UNUSED_FUNCTION __attribute__((unused))
+#define AFS_UNUSED __attribute__((unused))
 #endif
 
 #endif /* OPENAFS_CONFIG_AFS_STDS_H */
index 94b544f..ab0ff58 100644 (file)
@@ -556,6 +556,7 @@ EXT int rxdebug_active;
 #define dpf(args) do { if (rxdebug_active) rxi_DebugPrint args; } while (0)
 #else
 #ifdef DPF_FSLOG
+#include <afs/afsutil.h>
 #define dpf(args) FSLog args
 #else
 #define dpf(args) do { if (rx_debugFile) rxi_DebugPrint args; } while (0)
index 914902e..027e361 100644 (file)
@@ -39,7 +39,7 @@
 #include <rx/xdr.h>
 #include <afs/afsint.h>
 #include <afs/assert.h>
-
+#include <afs/dir.h>
 
 #include <fcntl.h>
 
@@ -95,7 +95,6 @@ static int do_salvop(struct state *, afs_int32 command, SYNC_response * res);
 static char * response_code_to_string(afs_int32);
 static char * command_code_to_string(afs_int32);
 static char * reason_code_to_string(afs_int32);
-static char * program_type_to_string(afs_int32);
 static char * state_code_to_string(afs_int32);
 
 
@@ -137,8 +136,6 @@ main(int argc, char **argv)
 {
     struct cmd_syndesc *ts;
     int err = 0;
-    int i;
-    extern char cml_version_number[];
 
     /* Initialize directory paths */
     if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
@@ -217,7 +214,6 @@ static int
 common_salv_prolog(struct cmd_syndesc * as, struct state * state)
 {
     register struct cmd_item *ti;
-    char pname[100], *temp;
 
     state->sop = (struct salv_state *) calloc(1, sizeof(struct salv_state));
     assert(state->sop != NULL);
@@ -293,6 +289,8 @@ do_salvop(struct state * state, afs_int32 command, SYNC_response * res)
     printf("}\n");
 
     VDisconnectSALV();
+
+    return 0;
 }
 
 static char *
@@ -356,6 +354,7 @@ reason_code_to_string(afs_int32 reason)
     }
 }
 
+#if 0
 static char *
 program_type_to_string(afs_int32 type)
 {
@@ -372,6 +371,7 @@ program_type_to_string(afs_int32 type)
        return "**UNKNOWN**";
     }
 }
+#endif
 
 static char *
 state_code_to_string(afs_int32 state)
index 8e1a3c9..eeb1fbe 100644 (file)
@@ -862,7 +862,6 @@ fs_stateSync(struct fs_dump_state * state)
 
     msync(state->mmap.map, state->mmap.size, MS_SYNC);
 
- done:
     return ret;
 }
 #else /* !FS_STATE_USE_MMAP */
@@ -1073,7 +1072,7 @@ fs_stateAlloc(struct fs_dump_state * state)
     int ret = 0;
     memset(state, 0, sizeof(struct fs_dump_state));
     state->fd = -1;
-    state->fn = AFSDIR_SERVER_FSSTATE_FILEPATH;
+    state->fn = (char *)AFSDIR_SERVER_FSSTATE_FILEPATH;
     state->hdr = (struct fs_state_header *)malloc(sizeof(struct fs_state_header));
     state->h_hdr = (struct host_state_header *)malloc(sizeof(struct host_state_header));
     state->cb_hdr = (struct callback_state_header *)malloc(sizeof(struct callback_state_header));
index 35e13cf..99a9df5 100644 (file)
@@ -237,10 +237,6 @@ static struct {
     byte cb_valid;
 } cb_cursor;
 
-static struct {
-    void ** cursor;
-} cb_cache;
-
 static void
 usage(char * prog)
 {
@@ -251,7 +247,6 @@ int
 main(int argc, char ** argv)
 {
     banner();
-
     if (argc > 2 || (argc == 2 && !strcmp(argv[1], "-h"))) {
        usage(argv[0]);
        return 1;
@@ -263,7 +258,7 @@ main(int argc, char ** argv)
        if (openFile(argv[1]))
            return 1;
     } else {
-       if (openFile(AFSDIR_SERVER_FSSTATE_FILEPATH))
+       if (openFile((char *)AFSDIR_SERVER_FSSTATE_FILEPATH))
            return 1;
     }
 
@@ -302,7 +297,7 @@ openFile(char * path)
        goto done;
     }
 
-    printf("mapped %d bytes at 0x%x\n", map_len, map);
+    printf("mapped %lu bytes at %"AFS_PTR_FMT"\n", (unsigned long)map_len, map);
 
  done:
     if (ret) {
@@ -742,7 +737,7 @@ print_cb_help(void)
     do { \
         char * _p = (char *)addr; \
         char * _m = (char *)map; \
-        printf("loading structure from address 0x%x (offset %u)\n", \
+        printf("loading structure from address %"AFS_PTR_FMT" (offset %u)\n", \
                addr, _p-_m); \
     } while (0)
 
@@ -1346,7 +1341,6 @@ dump_he_interfaces(void)
 static void
 dump_he_hcps(void)
 {
-    char temp_str[40];
     afs_int32 * hcps;
     int len, i;
 
@@ -1434,14 +1428,13 @@ hexdump_map(afs_uint32 offset, afs_uint32 len)
 {
     int i;
     unsigned char * p = (unsigned char *)map;
-    afs_uint32 c32;
 
     if (!len)
        return;
 
     if ((offset + len) > map_len) {
-       fprintf(stderr, "offset + length exceeds memory map size (%u > %u)\n",
-               offset+len, map_len);
+       fprintf(stderr, "offset + length exceeds memory map size (%u > %lu)\n",
+               offset+len, (unsigned long)map_len);
        return;
     }
 
@@ -1605,8 +1598,6 @@ get_cb_timeout_hdr(void)
 static int
 get_cb_timeout(void)
 {
-    char * buf;
-
     if (hdrs.timeout)
        return 0;
 
@@ -1658,8 +1649,6 @@ get_cb_fehash_hdr(void)
 static int
 get_cb_fehash(void)
 {
-    char * buf;
-
     if (hdrs.fehash)
        return 0;
 
@@ -1861,7 +1850,6 @@ get_fe_entry(void)
 static int
 get_cb(afs_uint32 idx)
 {
-    int i;
     char * p;
 
     if (get_fe(fe_cursor.idx))
@@ -1895,6 +1883,7 @@ get_cb_entry(void)
     return 0;
 }
 
+#if 0
 static int
 find_he_by_index(afs_uint32 idx)
 {
@@ -1919,6 +1908,7 @@ find_he_by_index(afs_uint32 idx)
     }
     return 1;
 }
+#endif
 
 static int
 find_fe_by_index(afs_uint32 idx)
index 344ffd2..47c94dd 100644 (file)
@@ -1929,7 +1929,6 @@ cb_stateVerify(struct fs_dump_state * state)
        ret = 1;
     }
 
- done:
     return ret;
 }
 
@@ -1963,7 +1962,6 @@ cb_stateVerifyFEHash(struct fs_dump_state * state)
        }
     }
 
- done:
     return ret;
 }
 
@@ -1983,7 +1981,6 @@ cb_stateVerifyFE(struct fs_dump_state * state, struct FileEntry * fe)
        ret = 1;
     }
 
- done:
     return ret;
 }
 
@@ -2141,7 +2138,6 @@ cb_stateVerifyTimeoutQueues(struct fs_dump_state * state)
        }
     }
 
- done:
     return ret;
 }
 
@@ -2426,7 +2422,6 @@ cb_stateRestoreFE(struct fs_dump_state * state)
     struct CBDiskEntry cbdsk[16];
     struct iovec iov[16];
     struct FileEntry * fe;
-    struct CallBack * cb;
 
     iov[0].iov_base = (char *)&hdr;
     iov[0].iov_len = sizeof(hdr);
index e6445fe..f4c2b8a 100644 (file)
@@ -2710,7 +2710,8 @@ h_DumpHost(register struct host *host, int held, void *rock)
        sprintf(tmpStr, "%04x", host->holds[i]);
        (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
     }
-    sprintf(tmpStr, " slot/bit: %d/%d\n", h_holdSlot(), h_holdbit());
+    sprintf(tmpStr, " slot/bit: %ld/%d\n", (long int) h_holdSlot(), 
+           h_holdbit());
     (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
 
     H_UNLOCK;
@@ -2751,10 +2752,10 @@ h_DumpHosts(void)
 static int h_stateFillHeader(struct host_state_header * hdr);
 static int h_stateCheckHeader(struct host_state_header * hdr);
 static int h_stateAllocMap(struct fs_dump_state * state);
-static int h_stateSaveHost(register struct host * host, int held, struct fs_dump_state * state);
+static int h_stateSaveHost(struct host * host, int held, void *rock);
 static int h_stateRestoreHost(struct fs_dump_state * state);
-static int h_stateRestoreIndex(struct host * h, int held, struct fs_dump_state * state);
-static int h_stateVerifyHost(struct host * h, int held, struct fs_dump_state * state);
+static int h_stateRestoreIndex(struct host * h, int held, void *rock);
+static int h_stateVerifyHost(struct host * h, int held, void *rock);
 static int h_stateVerifyAddrHash(struct fs_dump_state * state, struct host * h, afs_uint32 addr, afs_uint16 port);
 static int h_stateVerifyUuidHash(struct fs_dump_state * state, struct host * h);
 static void h_hostToDiskEntry_r(struct host * in, struct hostDiskEntry * out);
@@ -2846,8 +2847,9 @@ h_stateRestoreIndices(struct fs_dump_state * state)
 }
 
 static int
-h_stateRestoreIndex(struct host * h, int held, struct fs_dump_state * state)
+h_stateRestoreIndex(struct host * h, int held, void *rock)
 {
+    struct fs_dump_state *state = (struct fs_dump_state *)rock;
     if (cb_OldToNew(state, h->cblist, &h->cblist)) {
        return H_ENUMERATE_BAIL(held);
     }
@@ -2862,8 +2864,9 @@ h_stateVerify(struct fs_dump_state * state)
 }
 
 static int
-h_stateVerifyHost(struct host * h, int held, struct fs_dump_state * state)
+h_stateVerifyHost(struct host * h, int held, void* rock)
 {
+    struct fs_dump_state *state = (struct fs_dump_state *)rock;
     int i;
 
     if (h == NULL) {
@@ -2889,7 +2892,6 @@ h_stateVerifyHost(struct host * h, int held, struct fs_dump_state * state)
        state->bail = 1;
     }
 
- done:
     return held;
 }
 
@@ -3005,6 +3007,7 @@ h_stateFillHeader(struct host_state_header * hdr)
 {
     hdr->stamp.magic = HOST_STATE_MAGIC;
     hdr->stamp.version = HOST_STATE_VERSION;
+    return 0;
 }
 
 /* check the contents of the host state header structure */
@@ -3036,9 +3039,10 @@ h_stateAllocMap(struct fs_dump_state * state)
 
 /* function called by h_Enumerate to save a host to disk */
 static int
-h_stateSaveHost(register struct host * host, int held, struct fs_dump_state * state)
+h_stateSaveHost(struct host * host, int held, void* rock)
 {
-    int i, if_len=0, hcps_len=0;
+    struct fs_dump_state *state = (struct fs_dump_state *) rock;
+    int if_len=0, hcps_len=0;
     struct hostDiskEntry hdsk;
     struct host_state_entry_header hdr;
     struct Interface * ifp = NULL;
@@ -3096,7 +3100,6 @@ h_stateSaveHost(register struct host * host, int held, struct fs_dump_state * st
 
     state->h_hdr->records++;
 
- done:
     if (ifp)
        free(ifp);
     if (hcps)
@@ -3276,7 +3279,6 @@ h_OldToNew(struct fs_dump_state * state, afs_uint32 old, afs_uint32 * new)
        *new = state->h_map.entries[old].new_idx;
     }
 
- done:
     return ret;
 }
 #endif /* AFS_DEMAND_ATTACH_FS */
index 13904e3..ad4ad2c 100644 (file)
@@ -88,7 +88,7 @@ static SYNC_client_state fssync_state =
 
 #ifdef AFS_PTHREAD_ENV
 static pthread_mutex_t vol_fsync_mutex;
-static volatile vol_fsync_mutex_init = 0;
+static volatile int vol_fsync_mutex_init = 0;
 #define VFSYNC_LOCK \
     assert(pthread_mutex_lock(&vol_fsync_mutex) == 0)
 #define VFSYNC_UNLOCK \
index 472b61b..83251ae 100644 (file)
@@ -508,7 +508,9 @@ static afs_int32
 FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res)
 {
     afs_int32 code = SYNC_OK;
+#ifndef AFS_DEMAND_ATTACH_FS
     char tvolName[VMAXPATHLEN];
+#endif
     Volume * vp;
     Error error;
 
@@ -630,7 +632,6 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res)
     Volume * vp;
     Error error;
 #ifdef AFS_DEMAND_ATTACH_FS
-    int reserved = 0;
     Volume *nvp;
 #endif
 
index 8542410..60f635b 100644 (file)
@@ -187,7 +187,6 @@ static struct DiskPartition64 *DiskPartitionTable[VOLMAXPARTS+1];
 
 static struct DiskPartition64 * VLookupPartition_r(char * path);
 static void AddPartitionToTable_r(struct DiskPartition64 *);
-static void DeletePartitionFromTable_r(struct DiskPartition64 *);
 #endif /* AFS_DEMAND_ATTACH_FS */
 
 #ifdef AFS_SGI_XFS_IOPS_ENV
@@ -1318,7 +1317,7 @@ VGetPartitionById_r(afs_int32 id, int abortp)
 struct DiskPartition64 *
 VGetPartitionById(afs_int32 id, int abortp)
 {
-    struct Diskpartition64 * dp;
+    struct DiskPartition64 * dp;
 
     VOL_LOCK;
     dp = VGetPartitionById_r(id, abortp);
@@ -1345,10 +1344,12 @@ AddPartitionToTable_r(struct DiskPartition64 *dp)
     DiskPartitionTable[dp->index] = dp;
 }
 
+#if 0
 static void 
 DeletePartitionFromTable_r(struct DiskPartition64 *dp)
 {
     assert(dp->index >= 0 && dp->index <= VOLMAXPARTS);
     DiskPartitionTable[dp->index] = NULL;
 }
+#endif
 #endif /* AFS_DEMAND_ATTACH_FS */
index c382200..2a79027 100644 (file)
@@ -99,6 +99,7 @@
 #include <afs/afsutil.h>
 #include <afs/fileutil.h>
 #include <afs/procmgmt.h>      /* signal(), kill(), wait(), etc. */
+#include <afs/dir.h>
 #ifndef AFS_NT40_ENV
 #include <syslog.h>
 #endif
 #include "salvsync.h"
 #include "viceinode.h"
 #include "salvage.h"
-#include "volinodes.h"         /* header magic number, etc. stuff */
 #include "vol-salvage.h"
 #ifdef AFS_NT40_ENV
 #include <pthread.h>
@@ -158,8 +158,6 @@ static int DoSalvageVolume(struct SalvageQueueNode * node, int slot);
 static void SalvageServer(void);
 static void SalvageClient(VolumeId vid, char * pname);
 
-static int ChildFailed(int status);
-
 static int Reap_Child(char * prog, int * pid, int * status);
 
 static void * SalvageLogCleanupThread(void *);
@@ -186,9 +184,7 @@ handleit(struct cmd_syndesc *as, void *arock)
 {
     register struct cmd_item *ti;
     char pname[100], *temp;
-    afs_int32 seenpart = 0, seenvol = 0, vid = 0, seenany = 0;
-    struct DiskPartition64 *partP;
-
+    afs_int32 seenpart = 0, seenvol = 0, vid = 0;
 
 #ifdef AFS_SGI_VNODE_GLUE
     if (afs_init_kernel_config(-1) < 0) {
@@ -264,7 +260,7 @@ handleit(struct cmd_syndesc *as, void *arock)
     }
 
     if ((ti = as->parms[15].items)) {  /* -datelogs */
-       TimeStampLogFile(AFSDIR_SERVER_SALSRVLOG_FILEPATH);
+       TimeStampLogFile((char *)AFSDIR_SERVER_SALSRVLOG_FILEPATH);
     }
 #endif
 
@@ -311,7 +307,6 @@ main(int argc, char **argv)
     int err = 0;
 
     int i;
-    extern char cml_version_number[];
 
 #ifdef AFS_AIX32_ENV
     /*
@@ -477,7 +472,7 @@ SalvageServer(void)
      * multiple salvagers appending to the log.
      */
 
-    CheckLogFile(AFSDIR_SERVER_SALSRVLOG_FILEPATH);
+    CheckLogFile((char *)AFSDIR_SERVER_SALSRVLOG_FILEPATH);
 #ifndef AFS_NT40_ENV
 #ifdef AFS_LINUX20_ENV
     fcntl(fileno(logFile), F_SETFL, O_APPEND); /* Isn't this redundant? */
@@ -582,7 +577,6 @@ static int
 DoSalvageVolume(struct SalvageQueueNode * node, int slot)
 {
     char childLog[AFSDIR_PATH_MAX];
-    int ret;
     struct DiskPartition64 * partP;
 
     /* do not allow further forking inside salvager */
@@ -624,10 +618,8 @@ DoSalvageVolume(struct SalvageQueueNode * node, int slot)
 static void *
 SalvageChildReaperThread(void * args)
 {
-    int slot, pid, status, code, found;
-    struct SalvageQueueNode *qp, *nqp;
+    int slot, pid, status;
     struct log_cleanup_node * cleanup;
-    SALVSYNC_command_info info;
 
     assert(pthread_mutex_lock(&worker_lock) == 0);
 
@@ -770,7 +762,6 @@ static void *
 SalvageLogScanningThread(void * arg)
 {
     struct rx_queue log_watch_queue;
-    struct log_cleanup_node * cleanup;
 
     queue_Init(&log_watch_queue);
 
index 3a8554a..f2255dc 100644 (file)
@@ -131,7 +131,6 @@ SALVSYNC_SalvageVolume(VolumeId volume, char *partName, int command, int reason,
     SYNC_response res_l, *res;
     SALVSYNC_command_hdr scom;
     SALVSYNC_response_hdr sres;
-    int n, tot;
 
     memset(&com, 0, sizeof(com));
     memset(&scom, 0, sizeof(scom));
@@ -174,7 +173,6 @@ SALVSYNC_LinkVolume(VolumeId parent,
     SYNC_response res_l, *res;
     SALVSYNC_command_hdr scom;
     SALVSYNC_response_hdr sres;
-    int n, tot;
 
     memset(&com, 0, sizeof(com));
     memset(&scom, 0, sizeof(scom));
index 0edcb8c..e9e66a7 100644 (file)
@@ -108,7 +108,6 @@ static int AddToSalvageQueue(struct SalvageQueueNode * node);
 static void DeleteFromSalvageQueue(struct SalvageQueueNode * node);
 static void AddToPendingQueue(struct SalvageQueueNode * node);
 static void DeleteFromPendingQueue(struct SalvageQueueNode * node);
-static struct SalvageQueueNode * LookupPendingCommand(SALVSYNC_command_hdr * qry);
 static struct SalvageQueueNode * LookupPendingCommandByPid(int pid);
 static void UpdateCommandPrio(struct SalvageQueueNode * node);
 static void HandlePrio(struct SalvageQueueNode * clone, 
@@ -123,7 +122,6 @@ static struct SalvageQueueNode * LookupNode(VolumeId vid, char * partName,
 static struct SalvageQueueNode * LookupNodeByCommand(SALVSYNC_command_hdr * qry,
                                                     struct SalvageQueueNode ** parent);
 static void AddNodeToHash(struct SalvageQueueNode * node);
-static void DeleteNodeFromHash(struct SalvageQueueNode * node);
 
 static afs_int32 SALVSYNC_com_Salvage(SALVSYNC_command * com, SALVSYNC_response * res);
 static afs_int32 SALVSYNC_com_Cancel(SALVSYNC_command * com, SALVSYNC_response * res);
@@ -250,6 +248,7 @@ AddNodeToHash(struct SalvageQueueNode * node)
     SalvageHashTable[idx].len++;
 }
 
+#if 0
 static void
 DeleteNodeFromHash(struct SalvageQueueNode * node)
 {
@@ -262,6 +261,7 @@ DeleteNodeFromHash(struct SalvageQueueNode * node)
     queue_Remove(&node->hash_chain);
     SalvageHashTable[idx].len--;
 }
+#endif
 
 void
 SALVSYNC_salvInit(void)
@@ -316,10 +316,7 @@ static fd_set SALVSYNC_readfds;
 static void *
 SALVSYNC_syncThread(void * args)
 {
-    int on = 1;
     int code;
-    int numTries;
-    int tid;
     SYNC_server_state_t * state = &salvsync_server_state;
 
     /* when we fork, the child needs to close the salvsync server sockets,
@@ -362,7 +359,9 @@ SALVSYNC_newconnection(int afd)
 #else  /* USE_UNIX_SOCKETS */
     struct sockaddr_in other;
 #endif
-    int junk, fd;
+    int fd;
+    socklen_t junk;
+
     junk = sizeof(other);
     fd = accept(afd, (struct sockaddr *)&other, &junk);
     if (fd == -1) {
@@ -1014,6 +1013,8 @@ HandlePrio(struct SalvageQueueNode * clone,
     case SALVSYNC_STATE_UNKNOWN:
        node->command.sop.prio = 0;
        break;
+    default:
+       break;
     }
 
     if (new_prio < clone->command.sop.prio) {
@@ -1099,6 +1100,7 @@ DeleteFromPendingQueue(struct SalvageQueueNode * node)
     }
 }
 
+#if 0
 static struct SalvageQueueNode *
 LookupPendingCommand(SALVSYNC_command_hdr * qry)
 {
@@ -1115,6 +1117,7 @@ LookupPendingCommand(SALVSYNC_command_hdr * qry)
        np = NULL;
     return np;
 }
+#endif
 
 static struct SalvageQueueNode *
 LookupPendingCommandByPid(int pid)
@@ -1167,10 +1170,10 @@ UpdateCommandPrio(struct SalvageQueueNode * node)
 struct SalvageQueueNode * 
 SALVSYNC_getWork(void)
 {
-    int i, ret;
+    int i;
     struct DiskPartition64 * dp = NULL, * fdp;
     static afs_int32 next_part_sched = 0;
-    struct SalvageQueueNode *node = NULL, *np;
+    struct SalvageQueueNode *node = NULL;
 
     VOL_LOCK;
 
@@ -1249,7 +1252,6 @@ SALVSYNC_getWork(void)
        }
     }
 
- bail:
     VOL_UNLOCK;
     return node;
 }
index e7cdefb..817a812 100644 (file)
@@ -195,8 +195,9 @@ VnIsExclusiveState(VnState state)
     case VN_STATE_EXCLUSIVE:
     case VN_STATE_STORE:
        return 1;
+    default: 
+       return 0;
     }
-    return 0;
 }
 
 /**
@@ -216,8 +217,9 @@ VnIsErrorState(VnState state)
     switch (state) {
     case VN_STATE_ERROR:
        return 1;
+    default:
+       return 0;
     }
-    return 0;
 }
 
 /**
index 1255e17..7df90ae 100644 (file)
@@ -26,6 +26,7 @@ private struct VolumeHeader tempHeader;
 #else
 #define NO_LINK_TABLE 1
 #endif
+AFS_UNUSED
 private struct stuff {
     struct versionStamp stamp;
     bit32 inodeType;
index 083b13e..93e7dc3 100644 (file)
@@ -352,7 +352,9 @@ static void VVByPListWait_r(struct DiskPartition64 * dp);
 /* online salvager */
 static int VCheckSalvage(register Volume * vp);
 static int VUpdateSalvagePriority_r(Volume * vp);
+#ifdef SALVSYNC_BUILD_CLIENT
 static int VScheduleSalvage_r(Volume * vp);
+#endif
 
 /* Volume hash table */
 static void VReorderHash_r(VolumeHashChainHead * head, Volume * pp, Volume * vp);
@@ -741,13 +743,12 @@ VAttachVolumesByPartition(struct DiskPartition64 *diskP, int * nAttached, int *
  *   shutdown all remaining volumes
  */
 
+#ifdef AFS_DEMAND_ATTACH_FS
+
 void
 VShutdown_r(void)
 {
     int i;
-    register Volume *vp, *np;
-    register afs_int32 code;
-#ifdef AFS_DEMAND_ATTACH_FS
     struct DiskPartition64 * diskP;
     struct diskpartition_queue_t * dpq;
     vshutdown_thread_t params;
@@ -862,7 +863,16 @@ VShutdown_r(void)
     }
 
     Log("VShutdown:  complete.\n");
+}
+
 #else /* AFS_DEMAND_ATTACH_FS */
+
+void
+VShutdown_r(void)
+{
+    int i;
+    register Volume *vp, *np;
+    register afs_int32 code;
     Log("VShutdown:  shutting down on-line volumes...\n");
     for (i = 0; i < VolumeHashTable.Size; i++) {
        /* try to hold first volume in the hash table */
@@ -879,8 +889,9 @@ VShutdown_r(void)
        }
     }
     Log("VShutdown:  complete.\n");
-#endif /* AFS_DEMAND_ATTACH_FS */
 }
+#endif /* AFS_DEMAND_ATTACH_FS */
+
 
 void
 VShutdown(void)
@@ -1006,7 +1017,7 @@ ShutdownCreateSchedule(vshutdown_thread_t * params)
     if (thr_left) {
        /* try to assign any leftover threads to partitions that
         * had volume lengths closer to needing thread_target+1 */
-       int max_residue, max_id;
+       int max_residue, max_id = 0;
 
        /* compute the residues */
        for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
@@ -1062,10 +1073,8 @@ ShutdownCreateSchedule(vshutdown_thread_t * params)
 static void *
 VShutdownThread(void * args)
 {
-    struct rx_queue *qp;
-    Volume * vp;
     vshutdown_thread_t * params;
-    int part, code, found, pass, schedule_version_save, count;
+    int found, pass, schedule_version_save, count;
     struct DiskPartition64 *diskP;
     struct diskpartition_queue_t * dpq;
     Device id;
@@ -1217,7 +1226,7 @@ VShutdownThread(void * args)
 int
 VShutdownByPartition_r(struct DiskPartition64 * dp)
 {
-    int pass, retVal;
+    int pass;
     int pass_stats[4];
     int total;
 
@@ -1242,7 +1251,7 @@ VShutdownByPartition_r(struct DiskPartition64 * dp)
     Log("VShutdownByPartition:  shut down %d volumes on %s (pass[0]=%d, pass[1]=%d, pass[2]=%d, pass[3]=%d)\n",
        total, VPartitionPath(dp), pass_stats[0], pass_stats[1], pass_stats[2], pass_stats[3]);
 
-    return retVal;
+    return 0;
 }
 
 /* internal shutdown functionality
@@ -1365,6 +1374,8 @@ VShutdownVolume_r(Volume * vp)
            VOffline_r(vp, "File server was shut down");
        }
        break;
+    default:
+       break;
     }
     
     VCancelReservation_r(vp);
@@ -2083,7 +2094,7 @@ VAttachVolumeByVp_r(Error * ec, Volume * vp, int mode)
     char path[64];
     int isbusy = 0;
     VolId volumeId;
-    Volume * nvp;
+    Volume * nvp = NULL;
     VolumeStats stats_save;
     *ec = 0;
 
@@ -2313,7 +2324,9 @@ attach2(Error * ec, VolId volumeId, char *path, register struct VolumeHeader * h
     }
 
 #ifdef AFS_DEMAND_ATTACH_FS
+# ifdef FSSYNC_BUILD_CLIENT
  disk_header_loaded:
+#endif
     if (!*ec) {
 
        /* check for pending volume operations */
@@ -2348,6 +2361,8 @@ attach2(Error * ec, VolId volumeId, char *path, register struct VolumeHeader * h
                if (VVolOpSetVBusy_r(vp, vp->pending_vol_op)) {
                    vp->specialStatus = VBUSY;
                }
+           default:
+               break;
            }
        }
 
@@ -3141,8 +3156,10 @@ VForceOffline(Volume * vp)
 void
 VOffline_r(Volume * vp, char *message)
 {
+#ifndef AFS_DEMAND_ATTACH_FS
     Error error;
     VolumeId vid = V_id(vp);
+#endif
 
     assert(programType != volumeUtility);
     if (!V_inUse(vp)) {
@@ -4079,10 +4096,12 @@ VRequestSalvage_r(Error * ec, Volume * vp, int reason, int flags)
 static int
 VUpdateSalvagePriority_r(Volume * vp)
 {
-    int code, ret=0;
-    afs_uint32 now;
+    int ret=0;
 
 #ifdef SALVSYNC_BUILD_CLIENT
+    afs_uint32 now;
+    int code;
+
     vp->salvage.prio++;
     now = FT_ApproxTime();
 
@@ -4107,6 +4126,7 @@ VUpdateSalvagePriority_r(Volume * vp)
 }
 
 
+#ifdef SALVSYNC_BUILD_CLIENT
 /**
  * schedule a salvage with the salvage server.
  *
@@ -4129,8 +4149,8 @@ VUpdateSalvagePriority_r(Volume * vp)
 static int
 VScheduleSalvage_r(Volume * vp)
 {
-    int code, ret=0;
-#ifdef SALVSYNC_BUILD_CLIENT
+    int ret=0;
+    int code;
     VolState state_save;
     VThreadOptions_t * thread_opts;
     char partName[16];
@@ -4202,11 +4222,9 @@ VScheduleSalvage_r(Volume * vp)
            }
        }
     }
-#endif /* SALVSYNC_BUILD_CLIENT */
     return ret;
 }
 
-#ifdef SALVSYNC_BUILD_CLIENT
 /**
  * connect to the salvageserver SYNC service.
  *
@@ -4271,11 +4289,10 @@ VConnectSALV_r(void)
 int
 VDisconnectSALV(void)
 {
-    int retVal;
     VOL_LOCK;
     VDisconnectSALV_r();
     VOL_UNLOCK;
-    return retVal;
+    return 0;
 }
 
 /**
@@ -5565,7 +5582,6 @@ VLRU_Delete_r(Volume * vp)
 static void
 VLRU_UpdateAccess_r(Volume * vp)
 {
-    afs_uint32 live_interval;
     Volume * rvp = NULL;
 
     if (!VLRU_enabled)
@@ -5677,8 +5693,6 @@ static void *
 VLRU_ScannerThread(void * args)
 {
     afs_uint32 now, min_delay, delay;
-    afs_uint32 next_scan[VLRU_GENERATIONS];
-    afs_uint32 next_promotion[VLRU_GENERATIONS];
     int i, min_idx, min_op, overdue, state;
 
     /* set t=0 for promotion cycle to be 
@@ -5821,7 +5835,7 @@ VLRU_Promote_r(int idx)
     int len, chaining, promote;
     afs_uint32 now, thresh;
     struct rx_queue *qp, *nqp;
-    Volume * vp, *start, *end;
+    Volume * vp, *start = NULL, *end = NULL;
 
     /* get exclusive access to two chains, and drop the glock */
     VLRU_Wait_r(&volume_LRU.q[idx]);
@@ -5884,7 +5898,7 @@ VLRU_Demote_r(int idx)
     int len, chaining, demote;
     afs_uint32 now, thresh;
     struct rx_queue *qp, *nqp;
-    Volume * vp, *start, *end;
+    Volume * vp, *start = NULL, *end = NULL;
     Volume ** salv_flag_vec = NULL;
     int salv_vec_offset = 0;
 
@@ -6161,6 +6175,8 @@ VSoftDetachVolume_r(Volume * vp, afs_uint32 thresh)
        V_attachFlags(vp) &= ~(VOL_ON_VLRU);
        VCancelReservation_r(vp);
        return 0;
+    default:
+       break;
     }
 
     /* hold the volume and take it offline.
@@ -6284,7 +6300,7 @@ GetVolumeHeader(register Volume * vp)
     static int everLogged = 0;
 
 #ifdef AFS_DEMAND_ATTACH_FS
-    VolState vp_save, back_save;
+    VolState vp_save = 0, back_save = 0;
 
     /* XXX debug 9/19/05 we've apparently got
      * a ref counting bug somewhere that's
@@ -7232,7 +7248,7 @@ vlru_idx_to_string(int idx)
 void
 VPrintExtendedCacheStats_r(int flags)
 {
-    int i, j;
+    int i;
     afs_uint32 vol_sum = 0;
     struct stats {
        double min;
index 082a4a3..96565bb 100644 (file)
@@ -815,6 +815,8 @@ extern int VRequestSalvage_r(Error * ec, Volume * vp, int reason, int flags);
 extern int VRegisterVolOp_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);
 extern int VDeregisterVolOp_r(Volume * vp);
 extern void VCancelReservation_r(Volume * vp);
+extern int VChildProcReconnectFS_r(void);
+extern void VOfflineForVolOp_r(Error *ec, Volume *vp, char *message);
 #endif /* AFS_DEMAND_ATTACH_FS */
 extern int VVolOpLeaveOnline_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);
 extern int VVolOpSetVBusy_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);
index 581ae56..d0bc2f2 100644 (file)
@@ -67,8 +67,9 @@ VIsExclusiveState(VolState state)
     case VOL_STATE_VNODE_CLOSE:
     case VOL_STATE_VNODE_RELEASE:
        return 1;
+    default:
+       return 0;
     }
-    return 0;
 }
 
 /**
@@ -89,8 +90,9 @@ VIsErrorState(VolState state)
     case VOL_STATE_ERROR:
     case VOL_STATE_SALVAGING:
        return 1;
+    default:
+       return 0;
     }
-    return 0;
 }
 
 /**
@@ -112,8 +114,9 @@ VIsOfflineState(VolState state)
     case VOL_STATE_ERROR:
     case VOL_STATE_SALVAGING:
        return 1;
+    default:
+       return 0;
     }
-    return 0;
 }
 
 /**
index 5ed27b6..c7d1dc6 100644 (file)
@@ -667,7 +667,7 @@ DumpStandardTag(register struct iod *iodp, char tag, afs_uint32 section)
     return 0;
 }
 
-AFS_UNUSED_FUNCTION
+AFS_UNUSED
 static afs_int32
 DumpStandardTagLen(register struct iod *iodp, char tag, afs_uint32 section,
                         afs_size_t length)
index 897b54d..e406711 100644 (file)
@@ -169,6 +169,7 @@ BKGLoop(void *unused)
 
 /* Background daemon for sleeping so the volserver does not become I/O bound */
 afs_int32 TTsleep, TTrun;
+#ifndef AFS_PTHREAD_ENV
 static void *
 BKGSleep(void *unused)
 {
@@ -200,6 +201,7 @@ BKGSleep(void *unused)
     }
     return NULL;
 }
+#endif
 
 #ifndef AFS_NT40_ENV
 int
index cf4e46c..3f35ca9 100644 (file)
@@ -1753,7 +1753,7 @@ XVolListPartitions(struct rx_call *acid, struct partEntries *pEntries)
     char namehead[9];
     struct partList partList;
     struct DiskPartition64 *dp;
-    int i, j = 0, k;
+    int i, j = 0;
 
     strcpy(namehead, "/vicep");        /*7 including null terminator */
 
@@ -1766,6 +1766,8 @@ XVolListPartitions(struct rx_call *acid, struct partEntries *pEntries)
            namehead[6] = i + 'a';
            namehead[7] = '\0';
        } else {
+           int k;
+
            k = i - 26;
            namehead[6] = 'a' + (k / 26);
            namehead[7] = 'a' + (k % 26);
index 88f707d..6372bb8 100644 (file)
@@ -11,9 +11,7 @@
 #define _VOLSER_PROTOTYPES_H
 
 /* common.c */
-#ifndef AFS_PTHREAD_ENV
 extern void Log(const char *, ...);
-#endif
 extern void InitErrTabs(void);
 
 /* vol_split.c */