From f5c55d23a2a745e848c6e013c8b42cf3292c4691 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 29 Sep 2009 12:26:55 +0200 Subject: [PATCH] Demand attach warning fixes 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 Reviewed-by: Derrick Brashear --- Makefile.in | 2 +- src/config/stds.h | 4 +-- src/rx/rx_globals.h | 1 + src/tsalvaged/salvsync-debug.c | 10 +++---- src/tviced/serialize_state.c | 3 +- src/tviced/state_analyzer.c | 24 +++++---------- src/viced/callback.c | 5 ---- src/viced/host.c | 24 ++++++++------- src/vol/fssync-client.c | 2 +- src/vol/fssync-server.c | 3 +- src/vol/partition.c | 5 ++-- src/vol/salvaged.c | 19 ++++-------- src/vol/salvsync-client.c | 2 -- src/vol/salvsync-server.c | 20 +++++++------ src/vol/vnode_inline.h | 6 ++-- src/vol/volinodes.h | 1 + src/vol/volume.c | 68 ++++++++++++++++++++++++++---------------- src/vol/volume.h | 2 ++ src/vol/volume_inline.h | 9 ++++-- src/volser/dumpstuff.c | 2 +- src/volser/volmain.c | 2 ++ src/volser/volprocs.c | 4 ++- src/volser/volser_prototypes.h | 2 -- 23 files changed, 113 insertions(+), 107 deletions(-) diff --git a/Makefile.in b/Makefile.in index 816555a..244b97b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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;; \ diff --git a/src/config/stds.h b/src/config/stds.h index df331ec..be65339 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -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 */ diff --git a/src/rx/rx_globals.h b/src/rx/rx_globals.h index 94b544f..ab0ff58 100644 --- a/src/rx/rx_globals.h +++ b/src/rx/rx_globals.h @@ -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 #define dpf(args) FSLog args #else #define dpf(args) do { if (rx_debugFile) rxi_DebugPrint args; } while (0) diff --git a/src/tsalvaged/salvsync-debug.c b/src/tsalvaged/salvsync-debug.c index 914902e..027e361 100644 --- a/src/tsalvaged/salvsync-debug.c +++ b/src/tsalvaged/salvsync-debug.c @@ -39,7 +39,7 @@ #include #include #include - +#include #include @@ -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) diff --git a/src/tviced/serialize_state.c b/src/tviced/serialize_state.c index 8e1a3c9..eeb1fbe 100644 --- a/src/tviced/serialize_state.c +++ b/src/tviced/serialize_state.c @@ -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)); diff --git a/src/tviced/state_analyzer.c b/src/tviced/state_analyzer.c index 35e13cf..99a9df5 100644 --- a/src/tviced/state_analyzer.c +++ b/src/tviced/state_analyzer.c @@ -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) diff --git a/src/viced/callback.c b/src/viced/callback.c index 344ffd2..47c94dd 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -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); diff --git a/src/viced/host.c b/src/viced/host.c index e6445fe..f4c2b8a 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -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 */ diff --git a/src/vol/fssync-client.c b/src/vol/fssync-client.c index 13904e3..ad4ad2c 100644 --- a/src/vol/fssync-client.c +++ b/src/vol/fssync-client.c @@ -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 \ diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c index 472b61b..83251ae 100644 --- a/src/vol/fssync-server.c +++ b/src/vol/fssync-server.c @@ -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 diff --git a/src/vol/partition.c b/src/vol/partition.c index 8542410..60f635b 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -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 */ diff --git a/src/vol/salvaged.c b/src/vol/salvaged.c index c382200..2a79027 100644 --- a/src/vol/salvaged.c +++ b/src/vol/salvaged.c @@ -99,6 +99,7 @@ #include #include #include /* signal(), kill(), wait(), etc. */ +#include #ifndef AFS_NT40_ENV #include #endif @@ -116,7 +117,6 @@ #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 @@ -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); diff --git a/src/vol/salvsync-client.c b/src/vol/salvsync-client.c index 3a8554a..f2255dc 100644 --- a/src/vol/salvsync-client.c +++ b/src/vol/salvsync-client.c @@ -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)); diff --git a/src/vol/salvsync-server.c b/src/vol/salvsync-server.c index 0edcb8c..e9e66a7 100644 --- a/src/vol/salvsync-server.c +++ b/src/vol/salvsync-server.c @@ -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; } diff --git a/src/vol/vnode_inline.h b/src/vol/vnode_inline.h index e7cdefb..817a812 100644 --- a/src/vol/vnode_inline.h +++ b/src/vol/vnode_inline.h @@ -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; } /** diff --git a/src/vol/volinodes.h b/src/vol/volinodes.h index 1255e17..7df90ae 100644 --- a/src/vol/volinodes.h +++ b/src/vol/volinodes.h @@ -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; diff --git a/src/vol/volume.c b/src/vol/volume.c index 083b13e..93e7dc3 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -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; diff --git a/src/vol/volume.h b/src/vol/volume.h index 082a4a3..96565bb 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -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); diff --git a/src/vol/volume_inline.h b/src/vol/volume_inline.h index 581ae56..d0bc2f2 100644 --- a/src/vol/volume_inline.h +++ b/src/vol/volume_inline.h @@ -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; } /** diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 5ed27b6..c7d1dc6 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -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) diff --git a/src/volser/volmain.c b/src/volser/volmain.c index 897b54d..e406711 100644 --- a/src/volser/volmain.c +++ b/src/volser/volmain.c @@ -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 diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index cf4e46c..3f35ca9 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -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); diff --git a/src/volser/volser_prototypes.h b/src/volser/volser_prototypes.h index 88f707d..6372bb8 100644 --- a/src/volser/volser_prototypes.h +++ b/src/volser/volser_prototypes.h @@ -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 */ -- 1.9.4