]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-vol-prototypes-20090316
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Mon, 16 Mar 2009 13:11:55 +0000 (13:11 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 16 Mar 2009 13:11:55 +0000 (13:11 +0000)
LICENSE IPL10
FIXES 124252

prototype the vol directory

(cherry picked from commit f28659bd826c2bb7311c84122262000caf33316c)

20 files changed:
src/vol/clone.c
src/vol/daemon_com.c
src/vol/devname.c
src/vol/fssync-debug.c
src/vol/fssync-server.c
src/vol/gi.c
src/vol/ihandle.c
src/vol/namei_ops.c
src/vol/nuke.c
src/vol/partition.c
src/vol/physio.c
src/vol/purge.c
src/vol/salvager.c
src/vol/salvsync-server.c
src/vol/vnode.c
src/vol/vol-info.c
src/vol/vol-salvage.c
src/vol/volinodes.h
src/vol/volume.c
src/vol/volume.h

index a8d93a01ac02b2db04ac660a266ef03239429a8d..8d4936129707590c292a6ded266c3aeffeb53954 100644 (file)
@@ -56,7 +56,7 @@ RCSID
 
 /*@printflike@*/ extern void Log(const char *format, ...);
 
-int (*vol_PollProc) () = 0;    /* someone must init this */
+int (*vol_PollProc) (void) = 0;        /* someone must init this */
 
 #define ERROR_EXIT(code) {error = code; goto error_exit;}
 
@@ -80,8 +80,7 @@ struct clone_head {
     struct clone_items *last;
 };
 
-void CloneVolume();
-void CloneVolume_r();
+void CloneVolume(Error *, Volume *, Volume *, Volume *);
 
 static int
 ci_AddItem(struct clone_head *ah, Inode aino)
@@ -124,7 +123,7 @@ ci_InitHead(struct clone_head *ah)
 
 /* apply a function to all dudes in the set */
 int
-ci_Apply(struct clone_head *ah, int (*aproc) (), char *arock)
+ci_Apply(struct clone_head *ah, int (*aproc) (Inode,  void *), void *arock)
 {
     register struct clone_items *ti;
     register int i;
@@ -177,7 +176,6 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone)
 
     struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
     int ReadWriteOriginal = VolumeWriteable(rwvp);
-    Device device = rwvp->device;
 
     /* Open the RW volume's index file and seek to beginning */
     IH_COPY(rwH, rwvp->vnodeIndex[class].handle);
index 764f23483acfd7afbed0a355625a6406b0535c9c..a500afac685b919e96a9202033ceead2e5d69ef9 100644 (file)
@@ -63,7 +63,7 @@ RCSID
 
 /*@printflike@*/ extern void Log(const char *format, ...);
 
-int (*V_BreakVolumeCallbacks) ();
+int (*V_BreakVolumeCallbacks) (VolumeId);
 
 #define MAXHANDLERS    4       /* Up to 4 clients; must be at least 2, so that
                                 * move = dump+restore can run on single server */
@@ -211,7 +211,6 @@ SYNC_disconnect(SYNC_client_state * state)
 afs_int32
 SYNC_closeChannel(SYNC_client_state * state)
 {
-    afs_int32 code;
     SYNC_command com;
     SYNC_response res;
     SYNC_PROTO_BUF_DECL(ores);
@@ -631,7 +630,6 @@ SYNC_putRes(SYNC_server_state_t * state,
 int
 SYNC_verifyProtocolString(char * buf, size_t len)
 {
-    int ret = 0;
     size_t s_len;
 
     s_len = afs_strnlen(buf, len);
index c06544a611e5ba7aea97d532eb3757fb333784cd..f9fce94d7157e6db4c1c2d8c5e0eb00d68bc8af1 100644 (file)
@@ -96,7 +96,6 @@ vol_DevName(dev_t adev, char *wpath)
 {
     static char pbuffer[128];
     char pbuf[128], *ptr;
-    int code, i;
 #ifdef AFS_SUN5_ENV
     struct mnttab mnt;
     FILE *mntfile;
@@ -242,7 +241,6 @@ afs_rawname(char *devfile)
 {
     static char rawname[100];
     struct stat statbuf;
-    char *p;
     int code, i;
 
     i = strlen(devfile);
index abbc457a34a301b6c3a5012ac42f35b10f358327..4a5fe48be22d0d3d683e86885f96b4e84f28cf11 100644 (file)
@@ -145,8 +145,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)) {
@@ -264,7 +262,6 @@ static int
 common_volop_prolog(struct cmd_syndesc * as, struct state * state)
 {
     register struct cmd_item *ti;
-    char pname[100], *temp;
 
     state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state));
     assert(state->vop != NULL);
@@ -321,6 +318,9 @@ do_volop(struct state * state, afs_int32 command, SYNC_response * res)
            res->hdr.reason, reason_code_to_string(res->hdr.reason));
 
     VDisconnectFS();
+
+    return 0;
+
 }
 
 
@@ -658,7 +658,9 @@ VolQuery(struct cmd_syndesc * as, void * rock)
     SYNC_PROTO_BUF_DECL(res_buf);
     SYNC_response res;
     Volume v;
+#ifdef AFS_DEMAND_ATTACH_FS
     int hi, lo;
+#endif
 
     res.hdr.response_len = sizeof(res.hdr);
     res.payload.buf = res_buf;
@@ -674,12 +676,12 @@ VolQuery(struct cmd_syndesc * as, void * rock)
 
        printf("volume = {\n");
        printf("\thashid          = %u\n", v.hashid);
-       printf("\theader          = 0x%x\n", v.header);
+       printf("\theader          = %p\n", v.header);
        printf("\tdevice          = %d\n", v.device);
-       printf("\tpartition       = 0x%x\n", v.partition);
-       printf("\tlinkHandle      = 0x%x\n", v.linkHandle);
+       printf("\tpartition       = %p\n", v.partition);
+       printf("\tlinkHandle      = %p\n", v.linkHandle);
        printf("\tnextVnodeUnique = %u\n", v.nextVnodeUnique);
-       printf("\tdiskDataHandle  = 0x%x\n", v.diskDataHandle);
+       printf("\tdiskDataHandle  = %p\n", v.diskDataHandle);
        printf("\tvnodeHashOffset = %u\n", v.vnodeHashOffset);
        printf("\tshuttingDown    = %d\n", v.shuttingDown);
        printf("\tgoingOffline    = %d\n", v.goingOffline);
@@ -690,14 +692,14 @@ VolQuery(struct cmd_syndesc * as, void * rock)
        printf("\tupdateTime      = %u\n", v.updateTime);
        
        printf("\tvnodeIndex[vSmall] = {\n");
-        printf("\t\thandle       = 0x%x\n", v.vnodeIndex[vSmall].handle);
-        printf("\t\tbitmap       = 0x%x\n", v.vnodeIndex[vSmall].bitmap);
+        printf("\t\thandle       = %p\n", v.vnodeIndex[vSmall].handle);
+        printf("\t\tbitmap       = %p\n", v.vnodeIndex[vSmall].bitmap);
        printf("\t\tbitmapSize   = %u\n", v.vnodeIndex[vSmall].bitmapSize);
        printf("\t\tbitmapOffset = %u\n", v.vnodeIndex[vSmall].bitmapOffset);
        printf("\t}\n");
        printf("\tvnodeIndex[vLarge] = {\n");
-        printf("\t\thandle       = 0x%x\n", v.vnodeIndex[vLarge].handle);
-        printf("\t\tbitmap       = 0x%x\n", v.vnodeIndex[vLarge].bitmap);
+        printf("\t\thandle       = %p\n", v.vnodeIndex[vLarge].handle);
+        printf("\t\tbitmap       = %p\n", v.vnodeIndex[vLarge].bitmap);
        printf("\t\tbitmapSize   = %u\n", v.vnodeIndex[vLarge].bitmapSize);
        printf("\t\tbitmapOffset = %u\n", v.vnodeIndex[vLarge].bitmapOffset);
        printf("\t}\n");
@@ -766,7 +768,7 @@ VolQuery(struct cmd_syndesc * as, void * rock)
            printf("\t}\n");
 
            /* volume op state */
-           printf("\tpending_vol_op  = 0x%x\n", v.pending_vol_op);
+           printf("\tpending_vol_op  = %p\n", v.pending_vol_op);
        }
 #else /* !AFS_DEMAND_ATTACH_FS */
        if (res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS) {
@@ -863,7 +865,6 @@ VolOpQuery(struct cmd_syndesc * as, void * rock)
     SYNC_PROTO_BUF_DECL(res_buf);
     SYNC_response res;
     FSSYNC_VolOp_info vop;
-    int i;
 
     res.hdr.response_len = sizeof(res.hdr);
     res.payload.buf = res_buf;
@@ -897,7 +898,7 @@ VolOpQuery(struct cmd_syndesc * as, void * rock)
        printf("\t\treason         = %d (%s)\n", 
               vop.com.reason, reason_code_to_string(vop.com.reason));
        printf("\t\tcommand_len    = %u\n", vop.com.command_len);
-       printf("\t\tflags          = 0x%x\n", vop.com.flags);
+       printf("\t\tflags          = 0x%lux\n", afs_cast_uint32(vop.com.flags));
        printf("\t}\n");
 
        printf("\tvop = {\n");
@@ -920,7 +921,6 @@ static int
 vn_prolog(struct cmd_syndesc * as, struct state * state)
 {
     register struct cmd_item *ti;
-    char pname[100], *temp;
 
     state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state));
     assert(state->vop != NULL);
@@ -996,7 +996,6 @@ VnQuery(struct cmd_syndesc * as, void * rock)
     SYNC_PROTO_BUF_DECL(res_buf);
     SYNC_response res;
     Vnode v;
-    int hi, lo;
 
     res.hdr.response_len = sizeof(res.hdr);
     res.payload.buf = res_buf;
@@ -1013,19 +1012,19 @@ VnQuery(struct cmd_syndesc * as, void * rock)
        printf("vnode = {\n");
 
        printf("\tvid_hash = {\n");
-       printf("\t\tnext = 0x%lx\n", v.vid_hash.next);
-       printf("\t\tprev = 0x%lx\n", v.vid_hash.prev);
+       printf("\t\tnext = %p\n", v.vid_hash.next);
+       printf("\t\tprev = %p\n", v.vid_hash.prev);
        printf("\t}\n");
 
-       printf("\thashNext        = 0x%lx\n", v.hashNext);
-       printf("\tlruNext         = 0x%lx\n", v.lruNext);
-       printf("\tlruPrev         = 0x%lx\n", v.lruPrev);
+       printf("\thashNext        = %p\n", v.hashNext);
+       printf("\tlruNext         = %p\n", v.lruNext);
+       printf("\tlruPrev         = %p\n", v.lruPrev);
        printf("\thashIndex       = %hu\n", v.hashIndex);
        printf("\tchanged_newTime = %u\n", (unsigned int) v.changed_newTime);
        printf("\tchanged_oldTime = %u\n", (unsigned int) v.changed_oldTime);
        printf("\tdelete          = %u\n", (unsigned int) v.delete);
        printf("\tvnodeNumber     = %u\n", v.vnodeNumber);
-       printf("\tvolumePtr       = 0x%lx\n", v.volumePtr);
+       printf("\tvolumePtr       = %p\n", v.volumePtr);
        printf("\tnUsers          = %u\n", v.nUsers);
        printf("\tcacheCheck      = %u\n", v.cacheCheck);
 
@@ -1049,9 +1048,9 @@ VnQuery(struct cmd_syndesc * as, void * rock)
        }
 #endif /* !AFS_DEMAND_ATTACH_FS */
 
-       printf("\twriter          = %u\n", v.writer);
-       printf("\tvcp             = 0x%lx\n", v.vcp);
-       printf("\thandle          = 0x%lx\n", v.handle);
+       printf("\twriter          = %u\n", (unsigned int) v.writer);
+       printf("\tvcp             = %p\n", v.vcp);
+       printf("\thandle          = %p\n", v.handle);
 
        printf("\tdisk = {\n");
        printf("\t\ttype              = %u\n", v.disk.type);
@@ -1216,7 +1215,9 @@ StatsQuery(struct cmd_syndesc * as, void * rock)
 static void
 print_vol_stats_general(VolPkgStats * stats)
 {
+#ifdef AFS_DEMAND_ATTACH_FS
     int i;
+#endif
     afs_uint32 hi, lo;
 
     printf("VolPkgStats = {\n");
@@ -1297,7 +1298,9 @@ print_vol_stats_viceP(struct DiskPartitionStats64 * stats)
 static void
 print_vol_stats_hash(struct VolumeHashChainStats * stats)
 {
+#ifdef AFS_DEMAND_ATTACH_FS
     afs_uint32 hi, lo;
+#endif
 
     printf("DiskPartitionStats = {\n");
     printf("\ttable_size = %d\n", stats->table_size);
index d5256fd91a0c5e8d0db42abadd8604adebc6c5aa..7892842b7e9de0a9b3068f932bcef6cdfafb1cfe 100644 (file)
        Institution:    The Information Technology Center, Carnegie-Mellon University
 
  */
-#ifdef notdef
-
-/* All this is going away in early 1989 */
-int newVLDB;                   /* Compatibility flag */
-
-#endif
-static int newVLDB = 1;
-
-
 #ifndef AFS_PTHREAD_ENV
 #define USUAL_PRIORITY (LWP_MAX_PRIORITY - 2)
 
@@ -104,7 +95,7 @@ RCSID
 
 /*@printflike@*/ extern void Log(const char *format, ...);
 
-int (*V_BreakVolumeCallbacks) ();
+int (*V_BreakVolumeCallbacks) (VolumeId volume);
 
 #define MAXHANDLERS    4       /* Up to 4 clients; must be at least 2, so that
                                 * move = dump+restore can run on single server */
@@ -133,16 +124,16 @@ static SYNC_server_state_t fssync_server_state =
 
 /* Forward declarations */
 static void * FSYNC_sync(void *);
-static void FSYNC_newconnection();
-static void FSYNC_com();
-static void FSYNC_Drop();
-static void AcceptOn();
-static void AcceptOff();
-static void InitHandler();
-static int AddHandler();
-static int FindHandler();
-static int FindHandler_r();
-static int RemoveHandler();
+static void FSYNC_newconnection(int afd);
+static void FSYNC_com(int fd);
+static void FSYNC_Drop(int fd);
+static void AcceptOn(void);
+static void AcceptOff(void);
+static void InitHandler(void);
+static int AddHandler(int fd, void (*aproc)(int));
+static int FindHandler(int afd);
+static int FindHandler_r(int afd);
+static int RemoveHandler(int afd);
 #if defined(HAVE_POLL) && defined (AFS_PTHREAD_ENV)
 static void CallHandler(struct pollfd *fds, int nfds, int mask);
 static void GetHandler(struct pollfd *fds, int maxfds, int events, int *nfds);
@@ -154,7 +145,9 @@ extern int LogLevel;
 
 static afs_int32 FSYNC_com_VolOp(int fd, SYNC_command * com, SYNC_response * res);
 
+#ifdef AFS_DEMAND_ATTACH_FS
 static afs_int32 FSYNC_com_VolError(FSSYNC_VolOp_command * com, SYNC_response * res);
+#endif
 static afs_int32 FSYNC_com_VolOn(FSSYNC_VolOp_command * com, SYNC_response * res);
 static afs_int32 FSYNC_com_VolOff(FSSYNC_VolOp_command * com, SYNC_response * res);
 static afs_int32 FSYNC_com_VolMove(FSSYNC_VolOp_command * com, SYNC_response * res);
@@ -171,11 +164,13 @@ static afs_int32 FSYNC_com_VnQry(int fd, SYNC_command * com, SYNC_response * res
 static afs_int32 FSYNC_com_StatsOp(int fd, SYNC_command * com, SYNC_response * res);
 
 static afs_int32 FSYNC_com_StatsOpGeneral(FSSYNC_StatsOp_command * scom, SYNC_response * res);
+
+#ifdef AFS_DEMAND_ATTACH_FS
 static afs_int32 FSYNC_com_StatsOpViceP(FSSYNC_StatsOp_command * scom, SYNC_response * res);
 static afs_int32 FSYNC_com_StatsOpHash(FSSYNC_StatsOp_command * scom, SYNC_response * res);
 static afs_int32 FSYNC_com_StatsOpHdr(FSSYNC_StatsOp_command * scom, SYNC_response * res);
 static afs_int32 FSYNC_com_StatsOpVLRU(FSSYNC_StatsOp_command * scom, SYNC_response * res);
-
+#endif
 
 static void FSYNC_com_to_info(FSSYNC_VolOp_command * vcom, FSSYNC_VolOp_info * info);
 
@@ -221,13 +216,8 @@ static fd_set FSYNC_readfds;
 static void *
 FSYNC_sync(void * args)
 {
-#ifdef USE_UNIX_SOCKETS
-    char tbuffer[AFSDIR_PATH_MAX];
-#endif /* USE_UNIX_SOCKETS */
-    int on = 1;
     extern int VInit;
     int code;
-    int numTries;
 #ifdef AFS_PTHREAD_ENV
     int tid;
 #endif
@@ -304,6 +294,7 @@ FSYNC_sync(void * args)
            CallHandler(&FSYNC_readfds);
 #endif
     }
+    return NULL; /* hush now, little gcc */
 }
 
 static void
@@ -314,7 +305,8 @@ FSYNC_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) {
@@ -585,7 +577,7 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res)
     }
 #else /* !AFS_DEMAND_ATTACH_FS */
     tvolName[0] = '/';
-    snprintf(&tvolName[1], sizeof(tvolName)-1, VFORMAT, vcom->vop->volume);
+    snprintf(&tvolName[1], sizeof(tvolName)-1, VFORMAT, afs_cast_uint32(vcom->vop->volume));
     tvolName[sizeof(tvolName)-1] = '\0';
 
     vp = VAttachVolumeByName_r(&error, vcom->vop->partName, tvolName,
@@ -631,10 +623,11 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res)
     FSSYNC_VolOp_info info;
     afs_int32 code = SYNC_OK;
     int i;
-    Volume * vp, * nvp;
+    Volume * vp;
     Error error;
 #ifdef AFS_DEMAND_ATTACH_FS
     int reserved = 0;
+    Volume *nvp;
 #endif
 
     if (SYNC_verifyProtocolString(vcom->vop->partName, sizeof(vcom->vop->partName))) {
@@ -1168,7 +1161,6 @@ FSYNC_com_VolHdrQuery(FSSYNC_VolOp_command * vcom, SYNC_response * res)
     afs_int32 code = SYNC_FAILED;
     Error error;
     Volume * vp;
-    int hdr_ok = 0;
 
     if (SYNC_verifyProtocolString(vcom->vop->partName, sizeof(vcom->vop->partName))) {
        res->hdr.reason = SYNC_REASON_MALFORMED_PACKET;
@@ -1209,7 +1201,6 @@ FSYNC_com_VolHdrQuery(FSSYNC_VolOp_command * vcom, SYNC_response * res)
        goto done;
     }
 
- load_done:
     memcpy(res->payload.buf, &V_disk(vp), sizeof(VolumeDiskData));
     res->hdr.response_len += sizeof(VolumeDiskData);
 #ifndef AFS_DEMAND_ATTACH_FS
@@ -1495,7 +1486,7 @@ FSYNC_Drop(int fd)
            Volume *vp;
 
            tvolName[0] = '/';
-           sprintf(&tvolName[1], VFORMAT, p[i].volumeID);
+           sprintf(&tvolName[1], VFORMAT, afs_cast_uint32(p[i].volumeID));
            vp = VAttachVolumeByName_r(&error, p[i].partName, tvolName,
                                       V_VOLUPD);
            if (vp)
@@ -1516,7 +1507,7 @@ FSYNC_Drop(int fd)
 static int AcceptHandler = -1; /* handler id for accept, if turned on */
 
 static void
-AcceptOn()
+AcceptOn(void)
 {
     if (AcceptHandler == -1) {
        assert(AddHandler(fssync_server_state.fd, FSYNC_newconnection));
@@ -1525,7 +1516,7 @@ AcceptOn()
 }
 
 static void
-AcceptOff()
+AcceptOff(void)
 {
     if (AcceptHandler != -1) {
        assert(RemoveHandler(fssync_server_state.fd));
@@ -1536,10 +1527,10 @@ AcceptOff()
 /* The multiple FD handling code. */
 
 static int HandlerFD[MAXHANDLERS];
-static int (*HandlerProc[MAXHANDLERS]) ();
+static void (*HandlerProc[MAXHANDLERS]) (int);
 
 static void
-InitHandler()
+InitHandler(void)
 {
     register int i;
     ObtainWriteLock(&FSYNC_handler_lock);
@@ -1585,7 +1576,7 @@ CallHandler(fd_set * fdsetp)
 #endif
 
 static int
-AddHandler(int afd, int (*aproc) ())
+AddHandler(int afd, void (*aproc) (int))
 {
     register int i;
     ObtainWriteLock(&FSYNC_handler_lock);
index c9f5f9a4b0d52a29a2b3cd2cf9b53d295814bd3f..d59da4e58b30aa9330e7611917867d7f4e99ce39 100644 (file)
@@ -33,14 +33,13 @@ Perror(char *err, int a1, int a2, int a3)
 int
 main(int argc, char **argv)
 {
-    int error = 0;
-    struct stat status;
-    int dev, fd, inode;
-
 #if defined(AFS_NT40_ENV) || defined(AFS_NAMEI_ENV)
     fprintf(stderr, "gi not supported on NT or NAMEI systems.\n");
     exit(1);
 #else
+    int error = 0;
+    struct stat status;
+    int dev, fd, inode;
 
     argc--;
     argv++;
index 04c4b0b66ce4a04b8ae86252a269686f36e52817..743ddb80da28dbe61ad581cf1bb6ba1d7df439a4 100644 (file)
@@ -93,6 +93,7 @@ int fdInUseCount = 0;
 /* Hash table for inode handles */
 IHashBucket_t ihashTable[I_HANDLE_HASH_SIZE];
 
+void *ih_sync_thread(void *);
 
 #ifdef AFS_PTHREAD_ENV
 /* Initialize the global ihandle mutex */
@@ -151,7 +152,6 @@ ih_Initialize(void)
     fdCacheSize = MIN(fdMaxCacheSize, FD_DEFAULT_CACHESIZE);
 
     {
-       void *ih_sync_thread();
 #ifdef AFS_PTHREAD_ENV
        pthread_t syncer;
        pthread_attr_t tattr;
@@ -865,7 +865,8 @@ ih_condsync(IHandle_t * ihP)
 }
 
 void
-ih_sync_all() {
+ih_sync_all(void) {
+
     int ihash;
 
     IH_LOCK;
@@ -910,7 +911,7 @@ ih_sync_all() {
 }
 
 void *
-ih_sync_thread() {
+ih_sync_thread(void *dummy) {
     while(1) {
 
 #ifdef AFS_PTHREAD_ENV
@@ -924,6 +925,7 @@ ih_sync_thread() {
 #endif
         ih_sync_all();
     }
+    return NULL;
 }
 
 
index ec542582e8e02483a34bfd0a6aaeae6cea6fe036..b7145ccc2fb0d51f190c3903148f71bb38c09938 100644 (file)
@@ -1492,10 +1492,7 @@ DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, int volid)
  */
 
 static afs_int32
-convertVolumeInfo(fdr, fdw, vid)
-     int fdr;
-     int fdw;
-     afs_uint32 vid;
+convertVolumeInfo(int fdr, int fdw, afs_uint32 vid)
 {
     struct VolumeDiskData vd;
     char *p;
@@ -1561,7 +1558,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_int32 volumeId)
     char smallSeen = 0;
     char largeSeen = 0;
     char linkSeen = 0;
-    int code, fd, fd2, found;
+    int code, fd, fd2;
     char *p;
     DIR *dirp;
     Inode ino;
@@ -1569,7 +1566,6 @@ namei_ConvertROtoRWvolume(char *pname, afs_int32 volumeId)
     struct DiskPartition64 *partP;
     struct ViceInodeInfo info;
     struct VolumeDiskHeader h;
-    char volname[20];
     char headername[16];
     afs_int32 error = 0;
 
index 8c6ff93b90e93d33a5587a093b1fe6d1f9936803..45d8e6f21715ca07f3f5fd1423dae320267da8ac 100644 (file)
@@ -29,7 +29,8 @@ RCSID
 #else
 #include <strings.h>
 #endif
-
+#include <afs/afsutil.h>
+    
 #include <afs/assert.h>
 #include "nfs.h"
 #include "lwp.h"
@@ -54,7 +55,6 @@ RCSID
 
 
 struct Lock localLock;
-char *vol_DevName();
 
 #define MAXATONCE      100
 /* structure containing neatly packed set of inodes and the # of times we'll have
index 6db056e26e369d781273cb86e286a578b32d5dff..bf4fdff058aeefffd9ab83f5a526b555ed5f07a4 100644 (file)
@@ -350,7 +350,7 @@ VCheckPartition(char *part, char *devname)
 
        dirp = opendir(part);
        assert(dirp);
-       while (dp = readdir(dirp)) {
+       while ((dp = readdir(dirp))) {
            if (dp->d_name[0] == 'V') {
                Log("This program is compiled with AFS_NAMEI_ENV, but partition %s seems to contain volumes which don't use the namei-interface; aborting\n", part);
                closedir(dirp);
@@ -417,7 +417,7 @@ VIsAlwaysAttach(char *part)
  * partitions, in the NAMEI fileserver.
  */
 void
-VAttachPartitions2()
+VAttachPartitions2(void)
 {
 #ifdef AFS_NAMEI_ENV
     DIR *dirp;
@@ -628,7 +628,7 @@ VAttachPartitions(void)
        exit(-1);
     }
 
-    while (fsent = getfsent()) {
+    while ((fsent = getfsent())) {
        if (strcmp(fsent->fs_type, "rw") != 0)
            continue;
 
@@ -901,7 +901,7 @@ VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp)
 void
 VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp)
 {
-    int fd, bsize, code;
+    int bsize, code;
     afs_int64 totalblks, free, used, availblks;
     int reserved;
 #ifdef afs_statvfs
index c463a4e7d4c0020697239b3012e56f7284b60ea5..086b56b15db17b8dc120597cae3fa9bd595a9b22 100644 (file)
@@ -115,7 +115,7 @@ void
 SetSalvageDirHandle(DirHandle * dir, afs_int32 volume, Device device,
                    Inode inode)
 {
-    static SalvageCacheCheck = 1;
+    static int SalvageCacheCheck = 1;
     memset(dir, 0, sizeof(DirHandle));
 
     dir->dirh_device = device;
index 8c6c6303dafebdc04a341d6bbc3fa8eb4ec566a5..352e2d92d061b8295430eb0f50ef03f1e90796a5 100644 (file)
@@ -31,6 +31,7 @@ RCSID
 #include <string.h>
 #include <sys/stat.h>
 #include <afs/assert.h>
+#include <afs/afsutil.h>
 
 #include <rx/xdr.h>
 #include "afs/afsint.h"
@@ -52,10 +53,13 @@ RCSID
 /* forward declarations */
 static int ObliterateRegion(Volume * avp, VnodeClass aclass, StreamHandle_t * afile,
                            afs_int32 * aoffset);
+#if 0
 static void PurgeIndex(Volume * vp, VnodeClass class);
+static void PurgeHeader(Volume * vp);
+#endif 
+
 static void PurgeIndex_r(Volume * vp, VnodeClass class);
 static void PurgeHeader_r(Volume * vp);
-static void PurgeHeader(Volume * vp);
 
 /* No lock needed. Only the volserver will call this, and only one transaction
  * can have a given volume (volid/partition pair) in use at a time 
@@ -159,6 +163,7 @@ ObliterateRegion(Volume * avp, VnodeClass aclass, StreamHandle_t * afile,
     return -1;
 }
 
+#if 0
 static void
 PurgeIndex(Volume * vp, VnodeClass class)
 {
@@ -166,6 +171,7 @@ PurgeIndex(Volume * vp, VnodeClass class)
     PurgeIndex_r(vp, class);
     VOL_UNLOCK;
 }
+#endif
 
 static void
 PurgeIndex_r(Volume * vp, VnodeClass class)
@@ -197,6 +203,7 @@ PurgeIndex_r(Volume * vp, VnodeClass class)
     FDH_CLOSE(fdP);
 }
 
+#if 0
 static void
 PurgeHeader(Volume * vp)
 {
@@ -204,6 +211,7 @@ PurgeHeader(Volume * vp)
     PurgeHeader_r(vp);
     VOL_UNLOCK;
 }
+#endif
 
 static void
 PurgeHeader_r(Volume * vp)
index 3cd862d2bd38cf46778e96f1779da8fcad2bb515..04930aaa40fa6da7ee500e50d404966688bdf5bb 100644 (file)
@@ -141,7 +141,12 @@ 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;
+    afs_int32 seenpart = 0, seenvol = 0, vid = 0;
+   
+#ifdef FAST_RESTART
+    afs_int32  seenany = 0;
+#endif
+    
     struct DiskPartition64 *partP;
 
 #ifdef AFS_SGI_VNODE_GLUE
index 7b0a3bd63829c3f6b66f5bddcc697a8db5e95edc..59ef63d02953f10cc3f91b02e37cfc7cd9d28f85 100644 (file)
@@ -77,6 +77,18 @@ RCSID
 #define MAXHANDLERS    4       /* Up to 4 clients; must be at least 2, so that
                                 * move = dump+restore can run on single server */
 
+
+/*
+ * This lock controls access to the handler array.
+ */
+struct Lock SALVSYNC_handler_lock;
+
+
+#ifdef AFS_DEMAND_ATTACH_FS
+/*
+ * SALVSYNC is a feature specific to the demand attach fileserver
+ */
+
 /* Forward declarations */
 static void * SALVSYNC_syncThread(void *);
 static void SALVSYNC_newconnection(int fd);
@@ -92,18 +104,6 @@ static int FindHandler_r(register int afd);
 static int RemoveHandler(register int afd);
 static void GetHandler(fd_set * fdsetp, int *maxfdp);
 
-
-/*
- * This lock controls access to the handler array.
- */
-struct Lock SALVSYNC_handler_lock;
-
-
-#ifdef AFS_DEMAND_ATTACH_FS
-/*
- * SALVSYNC is a feature specific to the demand attach fileserver
- */
-
 static int AllocNode(struct SalvageQueueNode ** node);
 
 static int AddToSalvageQueue(struct SalvageQueueNode * node);
index 8f0ab80a3c3f0aace402577da6cac88da71025d6..9c1677bb2d8e2c98b524d891bd2baf92341f7ce4 100644 (file)
@@ -25,6 +25,7 @@ RCSID
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdarg.h>
 #ifdef AFS_PTHREAD_ENV
 #include <assert.h>
 #else /* AFS_PTHREAD_ENV */
@@ -72,8 +73,7 @@ RCSID
 
 struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES];
 
-private void StickOnLruChain_r(register Vnode * vnp,
-                              register struct VnodeClassInfo *vcp);
+void VNLog(afs_int32 aop, afs_int32 anparms, ... );
 
 extern int LogLevel;
 
@@ -109,17 +109,13 @@ extern int LogLevel;
 static afs_int32 theLog[THELOGSIZE];
 static afs_int32 vnLogPtr = 0;
 void
-VNLog(afs_int32 aop, afs_int32 anparms, afs_int32 av1, afs_int32 av2, 
-      afs_int32 av3, afs_int32 av4)
+VNLog(afs_int32 aop, afs_int32 anparms, ... )
 {
     register afs_int32 temp;
-    afs_int32 data[4];
+    va_list ap;
+
+    va_start(ap, anparms);
 
-    /* copy data to array */
-    data[0] = av1;
-    data[1] = av2;
-    data[2] = av3;
-    data[3] = av4;
     if (anparms > 4)
        anparms = 4;            /* do bounds checking */
 
@@ -128,10 +124,11 @@ VNLog(afs_int32 aop, afs_int32 anparms, afs_int32 av1, afs_int32 av2,
     if (vnLogPtr >= THELOGSIZE)
        vnLogPtr = 0;
     for (temp = 0; temp < anparms; temp++) {
-       theLog[vnLogPtr++] = data[temp];
+       theLog[vnLogPtr++] = va_arg(ap, afs_int32);
        if (vnLogPtr >= THELOGSIZE)
            vnLogPtr = 0;
     }
+    va_end(ap);
 }
 
 /* VolumeHashOffset -- returns a new value to be stored in the
@@ -592,7 +589,7 @@ VAllocVnode_r(Error * ec, Volume * vp, VnodeType type)
 {
     register Vnode *vnp;
     VnodeId vnodeNumber;
-    int bitNumber, code;
+    int bitNumber;
     register struct VnodeClassInfo *vcp;
     VnodeClass class;
     Unique unique;
@@ -1114,10 +1111,8 @@ Vnode *
 VGetVnode_r(Error * ec, Volume * vp, VnodeId vnodeNumber, int locktype)
 {                              /* READ_LOCK or WRITE_LOCK, as defined in lock.h */
     register Vnode *vnp;
-    int code;
     VnodeClass class;
     struct VnodeClassInfo *vcp;
-    Volume * oldvp = NULL;
 
     *ec = 0;
 
@@ -1317,7 +1312,6 @@ VPutVnode_r(Error * ec, register Vnode * vnp)
     int writeLocked;
     VnodeClass class;
     struct VnodeClassInfo *vcp;
-    int code;
 
     *ec = 0;
     assert(Vn_refcount(vnp) != 0);
@@ -1453,7 +1447,6 @@ VVnodeWriteToRead_r(Error * ec, register Vnode * vnp)
     int writeLocked;
     VnodeClass class;
     struct VnodeClassInfo *vcp;
-    int code;
 #ifdef AFS_PTHREAD_ENV
     pthread_t thisProcess;
 #else /* AFS_PTHREAD_ENV */
@@ -1515,7 +1508,6 @@ VVnodeWriteToRead_r(Error * ec, register Vnode * vnp)
        } else {
            VnStore(ec, vp, vnp, vcp, class);
        }
-    sane:
        vcp->writes++;
        vnp->changed_newTime = vnp->changed_oldTime = 0;
     }
index a00f3701b7e2f7734f163a8a9cff7f29f68d1940..28374a69120db4f49666c872bd1b09763025e402 100644 (file)
@@ -50,7 +50,8 @@ RCSID
 #include "viceinode.h"
 #include "volinodes.h"
 #include <afs/afssyscalls.h>
-
+#include <afs/afsutil.h>
+    
 #ifdef _AIX
 #include <time.h>
 #endif
@@ -106,7 +107,7 @@ date(time_t date)
 {
 #define MAX_DATE_RESULT        100
     static char results[8][MAX_DATE_RESULT];
-    static next;
+    static int next;
     struct tm *tm = localtime(&date);
     char buf[32];
 
@@ -334,7 +335,7 @@ handleit(struct cmd_syndesc *as, void *arock)
 #ifdef AFS_NT40_ENV
 #include <direct.h>
 struct DiskPartition64 *
-FindCurrentPartition()
+FindCurrentPartition(void)
 {
     int dr = _getdrive();
     struct DiskPartition64 *dp;
@@ -351,7 +352,7 @@ FindCurrentPartition()
 }
 #else
 struct DiskPartition64 *
-FindCurrentPartition()
+FindCurrentPartition(void)
 {
     char partName[1024];
     char tmp = '\0';
index b5942aa9cc00fb61337b98e0e02b527072015f65..4570a66d3ff735515e2f1b1c22e59ec6dc4df756 100644 (file)
@@ -880,6 +880,7 @@ DeleteExtraVolumeHeaderFile(register struct VolumeSummary *vsp)
     vsp->fileName = 0;
 }
 
+int
 CompareInodes(const void *_p1, const void *_p2)
 {
     register const struct ViceInodeInfo *p1 = _p1;
@@ -982,7 +983,7 @@ CountVolumeInodes(register struct ViceInodeInfo *ip, int maxInodes,
 {
     int volume = ip->u.vnode.volumeId;
     int rwvolume = volume;
-    register n, nSpecial;
+    register int n, nSpecial;
     register Unique maxunique;
     n = nSpecial = 0;
     maxunique = 0;
@@ -3299,7 +3300,7 @@ PrintInodeList(void)
     register struct ViceInodeInfo *ip;
     struct ViceInodeInfo *buf;
     struct afs_stat status;
-    register nInodes;
+    register int nInodes;
 
     assert(afs_fstat(inodeFd, &status) == 0);
     buf = (struct ViceInodeInfo *)malloc(status.st_size);
@@ -3364,8 +3365,7 @@ Fork(void)
 }
 
 void
-Exit(code)
-     int code;
+Exit(int code)
 {
     if (ShowLog)
        showlog();
index 37b00fef6b726b232aab00d025709fd777af23f6..1255e17638be056dc87105b1481c9c940a665f33 100644 (file)
@@ -58,6 +58,4 @@ LINKTABLEMAGIC, LINKTABLEVERSION}, VI_LINKTABLE,
    we require the table to be ordered */
 #define MAXINODETYPE VI_LINKTABLE
 
-Volume *VWaitAttachVolume();
-
 #endif /* __volinodes_h_ */
index d94c5fde4a05f74af2c62077c3e8e7c7a857c3df..06b62eded7bc02f611fd4dda51f18222ea59788e 100644 (file)
@@ -191,7 +191,9 @@ static void ReleaseVolumeHeader(register struct volHeader *hd);
 static void FreeVolumeHeader(register Volume * vp);
 static void AddVolumeToHashTable(register Volume * vp, int hashid);
 static void DeleteVolumeFromHashTable(register Volume * vp);
+#if 0
 static int VHold(Volume * vp);
+#endif
 static int VHold_r(Volume * vp);
 static void VGetBitmap_r(Error * ec, Volume * vp, VnodeClass class);
 static void VReleaseVolumeHandles_r(Volume * vp);
@@ -200,7 +202,9 @@ static void LoadVolumeHeader(Error * ec, Volume * vp);
 static int VCheckOffline(register Volume * vp);
 static int VCheckDetach(register Volume * vp);
 static Volume * GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, int flags);
+#if 0
 static int VolumeExternalName_r(VolumeId volumeId, char * name, size_t len);
+#endif
 
 int LogLevel;                  /* Vice loglevel--not defined as extern so that it will be
                                 * defined when not linked with vice, XXXX */
@@ -575,8 +579,6 @@ VInitVolumePackage(ProgramType pt, afs_uint32 nLargeVnodes, afs_uint32 nSmallVno
        assert(pthread_cond_destroy(&params.thread_done_cv) == 0);
 
 #else /* AFS_PTHREAD_ENV */
-       DIR *dirp;
-       struct dirent *dp;
 
        /* Attach all the volumes in this partition */
        for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
@@ -1754,7 +1756,7 @@ VAttachVolumeByName(Error * ec, char *partition, char *name, int mode)
 Volume *
 VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode)
 {
-    register Volume *vp = NULL, *svp = NULL;
+    register Volume *vp = NULL;
     int fd, n;
     struct afs_stat status;
     struct VolumeDiskHeader diskHeader;
@@ -1765,6 +1767,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode)
     VolId volumeId;
 #ifdef AFS_DEMAND_ATTACH_FS
     VolumeStats stats_save;
+    Volume *svp = NULL;
 #endif /* AFS_DEMAND_ATTACH_FS */
 
     *ec = 0;
@@ -2320,9 +2323,8 @@ attach2(Error * ec, VolId volumeId, char *path, register struct VolumeHeader * h
        Log("VAttachVolume: Error reading diskDataHandle vol header %s; error=%u\n", path, *ec);
     }
 
- disk_header_loaded:
-
 #ifdef AFS_DEMAND_ATTACH_FS
+ disk_header_loaded:
     if (!*ec) {
 
        /* check for pending volume operations */
@@ -2615,6 +2617,7 @@ VHold_r(register Volume * vp)
 }
 #endif /* AFS_DEMAND_ATTACH_FS */
 
+#if 0
 static int
 VHold(register Volume * vp)
 {
@@ -2624,6 +2627,7 @@ VHold(register Volume * vp)
     VOL_UNLOCK;
     return retVal;
 }
+#endif
 
 
 /***************************************************/
@@ -3638,7 +3642,6 @@ VCheckDetach(register Volume * vp)
 static int
 VCheckOffline(register Volume * vp)
 {
-    Volume * rvp = NULL;
     int ret = 0;
 
     if (vp->goingOffline && !vp->nUsers) {
@@ -4962,11 +4965,13 @@ VolumeExternalName(VolumeId volumeId)
  *
  * @internal volume package internal use only.
  */
+#ifdef AFS_DEMAND_ATTACH_FS
 static int
 VolumeExternalName_r(VolumeId volumeId, char * name, size_t len)
 {
     return afs_snprintf(name, len, VFORMAT, volumeId);
 }
+#endif
 
 
 /***************************************************/
@@ -6729,7 +6734,10 @@ Volume *
 VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint)
 {
     register int looks = 0;
-    Volume * vp, *np, *pp;
+    Volume * vp, *np;
+#ifdef AFS_DEMAND_ATTACH_FS
+    Volume *pp;
+#endif
     VolumeHashChainHead * head;
     *ec = 0;
 
index 079d9a259c4cee89e481e2e2a03fbd2f502cb621..51824d31f4d76833bbd54db4c0bf73a67ac5db19 100644 (file)
@@ -128,8 +128,9 @@ extern ProgramType programType;     /* The type of program using the package */
 
 /* Some initialization parameters for the volume package */
 /* Add new initialization parameters here */
-extern int (*V_BreakVolumeCallbacks) ();
-extern int (*vol_PollProc) ();
+extern int (*V_BreakVolumeCallbacks) (VolumeId);
+extern int (*vol_PollProc) (void);
+
 #define        DOPOLL  ((vol_PollProc)? (*vol_PollProc)() : 0)
 
 #ifdef AFS_DEMAND_ATTACH_FS
@@ -787,6 +788,8 @@ extern void VTakeOffline(register Volume * vp);
 extern Volume * VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint);
 extern void VGetVolumePath(Error * ec, VolId volumeId, char **partitionp,
                           char **namep);
+extern char *vol_DevName(dev_t adev, char *wpath);
+
 #ifdef AFS_DEMAND_ATTACH_FS
 extern Volume *VPreAttachVolumeByName(Error * ec, char *partition, char *name);
 extern Volume *VPreAttachVolumeByName_r(Error * ec, char *partition, char *name);