partly-revert-volser-restore-timestamp-cleanup-20041018
[openafs.git] / src / volser / volprocs.c
index 481d184..6f049b8 100644 (file)
@@ -40,7 +40,11 @@ RCSID
 #include <rx/rxkad.h>
 #include <afs/afsint.h>
 #include <signal.h>
+#ifdef AFS_PTHREAD_ENV
+#include <assert.h>
+#else /* AFS_PTHREAD_ENV */
 #include <afs/assert.h>
+#endif /* AFS_PTHREAD_ENV */
 #include <afs/prs_fs.h>
 #include <afs/nfs.h>
 #include <lwp.h>
@@ -65,11 +69,13 @@ RCSID
 #include "volser.h"
 #include "volint.h"
 
-#include <volser_prototypes.h>
+#include "volser_prototypes.h"
 
 extern int DoLogging;
 extern struct volser_trans *FindTrans(), *NewTrans(), *TransList();
 extern struct afsconf_dir *tdir;
+
+/* Needed by Irix. Leave, or include a header */
 extern char *volutil_PartitionName();
 
 extern void LogError(afs_int32 errcode);
@@ -88,15 +94,15 @@ afs_int32 VolPartitionInfo(), VolNukeVolume(), VolCreateVolume(),
 VolDeleteVolume(), VolClone();
 afs_int32 VolReClone(), VolTransCreate(), VolGetNthVolume(), VolGetFlags(),
 VolForward(), VolDump();
-afs_int32 VolForwardMultiple();
 afs_int32 VolRestore(), VolEndTrans(), VolSetForwarding(), VolGetStatus(),
 VolSetInfo(), VolGetName();
-afs_int32 VolSignalRestore(), VolListPartitions(), VolListOneVolume(),
+afs_int32 VolListPartitions(), VolListOneVolume(),
 VolXListOneVolume(), VolXListVolumes();
 afs_int32 VolListVolumes(), XVolListPartitions(), VolMonitor(),
 VolSetIdsTypes(), VolSetDate(), VolSetFlags();
 
 /* this call unlocks all of the partition locks we've set */
+int 
 VPFullUnlock()
 {
     register struct DiskPartition *tp;
@@ -111,8 +117,7 @@ VPFullUnlock()
 
 /* get partition id from a name */
 afs_int32
-PartitionID(aname)
-     char *aname;
+PartitionID(char *aname)
 {
     register char tc;
     register int code = 0;
@@ -149,10 +154,7 @@ PartitionID(aname)
 }
 
 static int
-ConvertVolume(avol, aname, asize)
-     afs_int32 avol;
-     char *aname;
-     afs_int32 asize;
+ConvertVolume(afs_int32 avol, char *aname, afs_int32 asize)
 {
     if (asize < 18)
        return -1;
@@ -162,10 +164,7 @@ ConvertVolume(avol, aname, asize)
 }
 
 static int
-ConvertPartition(apartno, aname, asize)
-     int apartno;
-     char *aname;
-     int asize;
+ConvertPartition(int apartno, char *aname, int asize)
 {
     if (asize < 10)
        return E2BIG;
@@ -186,11 +185,7 @@ ConvertPartition(apartno, aname, asize)
 
 /* the only attach function that takes a partition is "...ByName", so we use it */
 struct Volume *
-XAttachVolume(error, avolid, apartid, amode)
-     afs_int32 *error;
-     afs_int32 avolid;
-     afs_int32 apartid;
-     int amode;
+XAttachVolume(afs_int32 *error, afs_int32 avolid, afs_int32 apartid, int amode)
 {
     char pbuf[30], vbuf[20];
     register struct Volume *tv;
@@ -208,9 +203,8 @@ XAttachVolume(error, avolid, apartid, amode)
 }
 
 /* Adapted from the file server; create a root directory for this volume */
-static
-ViceCreateRoot(vp)
-     Volume *vp;
+static int
+ViceCreateRoot(Volume *vp)
 {
     DirHandle dir;
     struct acl_accessList *ACL;
@@ -292,10 +286,8 @@ ViceCreateRoot(vp)
 }
 
 afs_int32
-SAFSVolPartitionInfo(acid, pname, partition)
-     struct rx_call *acid;
-     char *pname;
-     struct diskPartition *partition;
+SAFSVolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition 
+                    *partition)
 {
     afs_int32 code;
 
@@ -305,10 +297,8 @@ SAFSVolPartitionInfo(acid, pname, partition)
 }
 
 afs_int32
-VolPartitionInfo(acid, pname, partition)
-     struct rx_call *acid;
-     char *pname;
-     struct diskPartition *partition;
+VolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition 
+                *partition)
 {
     register struct DiskPartition *dp;
 
@@ -330,9 +320,7 @@ VolPartitionInfo(acid, pname, partition)
 
 /* obliterate a volume completely, and slowly. */
 afs_int32
-SAFSVolNukeVolume(acid, apartID, avolID)
-     struct rx_call *acid;
-     afs_int32 apartID, avolID;
+SAFSVolNukeVolume(struct rx_call *acid, afs_int32 apartID, afs_int32 avolID)
 {
     afs_int32 code;
 
@@ -342,9 +330,7 @@ SAFSVolNukeVolume(acid, apartID, avolID)
 }
 
 afs_int32
-VolNukeVolume(acid, apartID, avolID)
-     struct rx_call *acid;
-     afs_int32 apartID, avolID;
+VolNukeVolume(struct rx_call *acid, afs_int32 apartID, afs_int32 avolID)
 {
     register char *tp;
     char partName[50];
@@ -381,14 +367,9 @@ VolNukeVolume(acid, apartID, avolID)
  * Return the new volume id in *avolid.
  */
 afs_int32
-SAFSVolCreateVolume(acid, apart, aname, atype, aparent, avolid, atrans)
-     struct rx_call *acid;
-     afs_int32 apart;
-     afs_int32 atype;
-     char *aname;
-     afs_int32 aparent;
-     afs_int32 *atrans;
-     afs_int32 *avolid;
+SAFSVolCreateVolume(struct rx_call *acid, afs_int32 apart, char *aname, 
+                   afs_int32 atype, afs_int32 aparent, afs_int32 *avolid, 
+                   afs_int32 *atrans)
 {
     afs_int32 code;
 
@@ -401,14 +382,9 @@ SAFSVolCreateVolume(acid, apart, aname, atype, aparent, avolid, atrans)
 }
 
 afs_int32
-VolCreateVolume(acid, apart, aname, atype, aparent, avolid, atrans)
-     struct rx_call *acid;
-     afs_int32 apart;
-     afs_int32 atype;
-     char *aname;
-     afs_int32 aparent;
-     afs_int32 *atrans;
-     afs_int32 *avolid;
+VolCreateVolume(struct rx_call *acid, afs_int32 apart, char *aname, 
+                   afs_int32 atype, afs_int32 aparent, afs_int32 *avolid, 
+                   afs_int32 *atrans)
 {
     afs_int32 error;
     register Volume *vp;
@@ -449,7 +425,7 @@ VolCreateVolume(acid, apart, aname, atype, aparent, avolid, atrans)
     if (error) {
        Log("1 Volser: CreateVolume: Unable to create the volume; aborted, error code %u\n", error);
        LogError(error);
-       DeleteTrans(tt);
+       DeleteTrans(tt, 1);
        return EIO;
     }
     V_uniquifier(vp) = 1;
@@ -466,7 +442,7 @@ VolCreateVolume(acid, apart, aname, atype, aparent, avolid, atrans)
     if (error) {
        Log("1 Volser: create UpdateVolume failed, code %d\n", error);
        LogError(error);
-       DeleteTrans(tt);
+       DeleteTrans(tt, 1);
        VDetachVolume(&junk, vp);       /* rather return the real error code */
        return error;
     }
@@ -483,9 +459,7 @@ VolCreateVolume(acid, apart, aname, atype, aparent, avolid, atrans)
 
 /* delete the volume associated with this transaction */
 afs_int32
-SAFSVolDeleteVolume(acid, atrans)
-     afs_int32 atrans;
-     struct rx_call *acid;
+SAFSVolDeleteVolume(struct rx_call *acid, afs_int32 atrans)
 {
     afs_int32 code;
 
@@ -495,9 +469,7 @@ SAFSVolDeleteVolume(acid, atrans)
 }
 
 afs_int32
-VolDeleteVolume(acid, atrans)
-     afs_int32 atrans;
-     struct rx_call *acid;
+VolDeleteVolume(struct rx_call *acid, afs_int32 atrans)
 {
     register struct volser_trans *tt;
     afs_int32 error;
@@ -536,14 +508,10 @@ VolDeleteVolume(acid, atrans)
  * the same, while doing them separately would result in far more iincs and idecs being
  * peformed (and they are slow operations).
  */
+/* for efficiency reasons, sometimes faster to piggyback a purge here */
 afs_int32
-SAFSVolClone(acid, atrans, purgeId, newType, newName, newNumber)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     afs_int32 newType;
-     afs_int32 *newNumber;
-     afs_int32 purgeId;                /* for efficiency reasons, sometimes faster to piggyback a purge here */
-     char *newName;
+SAFSVolClone(struct rx_call *acid, afs_int32 atrans, afs_int32 purgeId, 
+            afs_int32 newType, char *newName, afs_int32 *newNumber)
 {
     afs_int32 code;
 
@@ -555,13 +523,8 @@ SAFSVolClone(acid, atrans, purgeId, newType, newName, newNumber)
 }
 
 afs_int32
-VolClone(acid, atrans, purgeId, newType, newName, newNumber)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     afs_int32 newType;
-     afs_int32 *newNumber;
-     afs_int32 purgeId;                /* for efficiency reasons, sometimes faster to piggyback a purge here */
-     char *newName;
+VolClone(struct rx_call *acid, afs_int32 atrans, afs_int32 purgeId, 
+            afs_int32 newType, char *newName, afs_int32 *newNumber)
 {
     VolumeId newId;
     register struct Volume *originalvp, *purgevp, *newvp;
@@ -714,7 +677,7 @@ VolClone(acid, atrans, purgeId, newType, newName, newNumber)
        error = VOLSERTRELE_ERROR;
        goto fail;
     }
-    DeleteTrans(ttc);
+    DeleteTrans(ttc, 1);
     return 0;
 
   fail:
@@ -727,16 +690,13 @@ VolClone(acid, atrans, purgeId, newType, newName, newNumber)
        TRELE(tt);
     }
     if (ttc)
-       DeleteTrans(ttc);
+       DeleteTrans(ttc, 1);
     return error;
 }
 
 /* reclone this volume into the specified id */
 afs_int32
-SAFSVolReClone(acid, atrans, cloneId)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     afs_int32 cloneId;
+SAFSVolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId)
 {
     afs_int32 code;
 
@@ -747,10 +707,7 @@ SAFSVolReClone(acid, atrans, cloneId)
 }
 
 afs_int32
-VolReClone(acid, atrans, cloneId)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     afs_int32 cloneId;
+VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId)
 {
     register struct Volume *originalvp, *clonevp;
     Error error, code;
@@ -883,7 +840,7 @@ VolReClone(acid, atrans, cloneId)
        goto fail;
     }
 
-    DeleteTrans(ttc);
+    DeleteTrans(ttc, 1);
 
     {
        struct DiskPartition *tpartp = originalvp->partition;
@@ -899,7 +856,7 @@ VolReClone(acid, atrans, cloneId)
        TRELE(tt);
     }
     if (ttc)
-       DeleteTrans(ttc);
+       DeleteTrans(ttc, 1);
     return error;
 }
 
@@ -908,12 +865,8 @@ VolReClone(acid, atrans, cloneId)
  * See volser.h for definition of iflags (the constants are named IT*).
  */
 afs_int32
-SAFSVolTransCreate(acid, volume, partition, iflags, ttid)
-     struct rx_call *acid;
-     afs_int32 volume;
-     afs_int32 partition;
-     afs_int32 iflags;
-     afs_int32 *ttid;
+SAFSVolTransCreate(struct rx_call *acid, afs_int32 volume, afs_int32 partition,
+                  afs_int32 iflags, afs_int32 *ttid)
 {
     afs_int32 code;
 
@@ -924,12 +877,8 @@ SAFSVolTransCreate(acid, volume, partition, iflags, ttid)
 }
 
 afs_int32
-VolTransCreate(acid, volume, partition, iflags, ttid)
-     struct rx_call *acid;
-     afs_int32 volume;
-     afs_int32 partition;
-     afs_int32 iflags;
-     afs_int32 *ttid;
+VolTransCreate(struct rx_call *acid, afs_int32 volume, afs_int32 partition,
+                  afs_int32 iflags, afs_int32 *ttid)
 {
     register struct volser_trans *tt;
     register Volume *tv;
@@ -964,7 +913,7 @@ VolTransCreate(acid, volume, partition, iflags, ttid)
        /* give up */
        if (tv)
            VDetachVolume(&code, tv);
-       DeleteTrans(tt);
+       DeleteTrans(tt, 1);
        return error;
     }
     tt->volume = tv;
@@ -982,11 +931,8 @@ VolTransCreate(acid, volume, partition, iflags, ttid)
  * Both the volume number and partition number (one-based) are returned.
  */
 afs_int32
-SAFSVolGetNthVolume(acid, aindex, avolume, apart)
-     struct rx_call *acid;
-     afs_int32 aindex;
-     afs_int32 *avolume;
-     afs_int32 *apart;
+SAFSVolGetNthVolume(struct rx_call *acid, afs_int32 aindex, afs_int32 *avolume,
+                   afs_int32 *apart)
 {
     afs_int32 code;
 
@@ -996,11 +942,8 @@ SAFSVolGetNthVolume(acid, aindex, avolume, apart)
 }
 
 afs_int32
-VolGetNthVolume(acid, aindex, avolume, apart)
-     struct rx_call *acid;
-     afs_int32 aindex;
-     afs_int32 *avolume;
-     afs_int32 *apart;
+VolGetNthVolume(struct rx_call *acid, afs_int32 aindex, afs_int32 *avolume,
+                   afs_int32 *apart)
 {
     Log("1 Volser: GetNthVolume: Not yet implemented\n");
     return VOLSERNO_OP;
@@ -1010,10 +953,7 @@ VolGetNthVolume(acid, aindex, avolume, apart)
  * transaction.
  */
 afs_int32
-SAFSVolGetFlags(acid, atid, aflags)
-     struct rx_call *acid;
-     afs_int32 atid;
-     afs_int32 *aflags;
+SAFSVolGetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 *aflags)
 {
     afs_int32 code;
 
@@ -1023,10 +963,7 @@ SAFSVolGetFlags(acid, atid, aflags)
 }
 
 afs_int32
-VolGetFlags(acid, atid, aflags)
-     struct rx_call *acid;
-     afs_int32 atid;
-     afs_int32 *aflags;
+VolGetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 *aflags)
 {
     register struct volser_trans *tt;
 
@@ -1054,10 +991,7 @@ VolGetFlags(acid, atid, aflags)
  * remains attached as usual by the transaction.
  */
 afs_int32
-SAFSVolSetFlags(acid, atid, aflags)
-     struct rx_call *acid;
-     afs_int32 atid;
-     afs_int32 aflags;
+SAFSVolSetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 aflags)
 {
     afs_int32 code;
 
@@ -1068,10 +1002,7 @@ SAFSVolSetFlags(acid, atid, aflags)
 }
 
 afs_int32
-VolSetFlags(acid, atid, aflags)
-     struct rx_call *acid;
-     afs_int32 atid;
-     afs_int32 aflags;
+VolSetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 aflags)
 {
     register struct volser_trans *tt;
     register struct Volume *vp;
@@ -1126,13 +1057,9 @@ VolSetFlags(acid, atid, aflags)
  * specified by the destServer structure.
  */
 afs_int32
-SAFSVolForward(acid, fromTrans, fromDate, destination, destTrans, cookie)
-     struct rx_call *acid;
-     afs_int32 fromTrans;
-     afs_int32 fromDate;
-     struct destServer *destination;
-     struct restoreCookie *cookie;
-     afs_int32 destTrans;
+SAFSVolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
+              struct destServer *destination, afs_int32 destTrans, 
+              struct restoreCookie *cookie)
 {
     afs_int32 code;
 
@@ -1144,13 +1071,9 @@ SAFSVolForward(acid, fromTrans, fromDate, destination, destTrans, cookie)
 }
 
 afs_int32
-VolForward(acid, fromTrans, fromDate, destination, destTrans, cookie)
-     struct rx_call *acid;
-     afs_int32 fromTrans;
-     afs_int32 fromDate;
-     struct destServer *destination;
-     struct restoreCookie *cookie;
-     afs_int32 destTrans;
+VolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
+              struct destServer *destination, afs_int32 destTrans, 
+              struct restoreCookie *cookie)
 {
     register struct volser_trans *tt;
     register afs_int32 code;
@@ -1243,15 +1166,9 @@ VolForward(acid, fromTrans, fromDate, destination, destTrans, cookie)
  * what we're doing. 
  */
 afs_int32
-SAFSVolForwardMultiple(acid, fromTrans, fromDate, destinations, spare, cookie,
-                      results)
-     struct rx_call *acid;
-     afs_int32 fromTrans;
-     afs_int32 fromDate;
-     afs_int32 spare;
-     manyDests *destinations;
-     struct restoreCookie *cookie;
-     manyResults *results;
+SAFSVolForwardMultiple(struct rx_call *acid, afs_int32 fromTrans, afs_int32 
+                      fromDate, manyDests *destinations, afs_int32 spare,
+                      struct restoreCookie *cookie, manyResults *results)
 {
     afs_int32 securityIndex;
     struct rx_securityClass *securityObject;
@@ -1261,7 +1178,7 @@ SAFSVolForwardMultiple(acid, fromTrans, fromDate, destinations, spare, cookie,
     struct rx_connection **tcons;
     struct rx_call **tcalls;
     struct Volume *vp;
-    int i, nconns, is_incremental;
+    int i, is_incremental;
 
     if (results)
        memset(results, 0, sizeof(manyResults));
@@ -1358,10 +1275,7 @@ SAFSVolForwardMultiple(acid, fromTrans, fromDate, destinations, spare, cookie,
 }
 
 afs_int32
-SAFSVolDump(acid, fromTrans, fromDate)
-     struct rx_call *acid;
-     afs_int32 fromTrans;
-     afs_int32 fromDate;
+SAFSVolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate)
 {
     afs_int32 code;
 
@@ -1371,10 +1285,7 @@ SAFSVolDump(acid, fromTrans, fromDate)
 }
 
 afs_int32
-VolDump(acid, fromTrans, fromDate)
-     struct rx_call *acid;
-     afs_int32 fromTrans;
-     afs_int32 fromDate;
+VolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate)
 {
     int code = 0;
     register struct volser_trans *tt;
@@ -1410,11 +1321,8 @@ VolDump(acid, fromTrans, fromDate)
  * Ha!  No more helper process!
  */
 afs_int32
-SAFSVolRestore(acid, atrans, aflags, cookie)
-     struct rx_call *acid;
-     afs_int32 aflags;
-     afs_int32 atrans;
-     struct restoreCookie *cookie;
+SAFSVolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags, 
+              struct restoreCookie *cookie)
 {
     afs_int32 code;
 
@@ -1424,11 +1332,8 @@ SAFSVolRestore(acid, atrans, aflags, cookie)
 }
 
 afs_int32
-VolRestore(acid, atrans, aflags, cookie)
-     struct rx_call *acid;
-     int aflags;
-     afs_int32 atrans;
-     struct restoreCookie *cookie;
+VolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags, 
+              struct restoreCookie *cookie)
 {
     register struct volser_trans *tt;
     register afs_int32 code, tcode;
@@ -1446,6 +1351,9 @@ VolRestore(acid, atrans, aflags, cookie)
     }
     strcpy(tt->lastProcName, "Restore");
     tt->rxCallPtr = acid;
+
+    DFlushVolume(V_parentId(tt->volume)); /* Ensure dir buffers get dropped */
+
     code = RestoreVolume(acid, tt->volume, (aflags & 1), cookie);      /* last is incrementalp */
     FSYNC_askfs(tt->volid, NULL, FSYNC_RESTOREVOLUME, 0l);     /*break call backs on the
                                                                 * restored volume */
@@ -1457,10 +1365,7 @@ VolRestore(acid, atrans, aflags, cookie)
 
 /* end a transaction, returning the transaction's final error code in rcode */
 afs_int32
-SAFSVolEndTrans(acid, destTrans, rcode)
-     struct rx_call *acid;
-     afs_int32 destTrans;
-     afs_int32 *rcode;
+SAFSVolEndTrans(struct rx_call *acid, afs_int32 destTrans, afs_int32 *rcode)
 {
     afs_int32 code;
 
@@ -1470,10 +1375,7 @@ SAFSVolEndTrans(acid, destTrans, rcode)
 }
 
 afs_int32
-VolEndTrans(acid, destTrans, rcode)
-     struct rx_call *acid;
-     afs_int32 destTrans;
-     afs_int32 *rcode;
+VolEndTrans(struct rx_call *acid, afs_int32 destTrans, afs_int32 *rcode)
 {
     register struct volser_trans *tt;
     char caller[MAXKTCNAMELEN];
@@ -1485,16 +1387,13 @@ VolEndTrans(acid, destTrans, rcode)
        return ENOENT;
     }
     *rcode = tt->returnCode;
-    DeleteTrans(tt);           /* this does an implicit TRELE */
+    DeleteTrans(tt, 1);                /* this does an implicit TRELE */
 
     return 0;
 }
 
 afs_int32
-SAFSVolSetForwarding(acid, atid, anewsite)
-     struct rx_call *acid;
-     afs_int32 atid;
-     afs_int32 anewsite;
+SAFSVolSetForwarding(struct rx_call *acid, afs_int32 atid, afs_int32 anewsite)
 {
     afs_int32 code;
 
@@ -1505,12 +1404,8 @@ SAFSVolSetForwarding(acid, atid, anewsite)
 }
 
 afs_int32
-VolSetForwarding(acid, atid, anewsite)
-     struct rx_call *acid;
-     afs_int32 atid;
-     afs_int32 anewsite;
+VolSetForwarding(struct rx_call *acid, afs_int32 atid, afs_int32 anewsite)
 {
-
     register struct volser_trans *tt;
     char caller[MAXKTCNAMELEN];
 
@@ -1536,10 +1431,8 @@ VolSetForwarding(acid, atid, anewsite)
 }
 
 afs_int32
-SAFSVolGetStatus(acid, atrans, astatus)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     register struct volser_status *astatus;
+SAFSVolGetStatus(struct rx_call *acid, afs_int32 atrans, 
+                register struct volser_status *astatus)
 {
     afs_int32 code;
 
@@ -1549,10 +1442,8 @@ SAFSVolGetStatus(acid, atrans, astatus)
 }
 
 afs_int32
-VolGetStatus(acid, atrans, astatus)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     register struct volser_status *astatus;
+VolGetStatus(struct rx_call *acid, afs_int32 atrans, 
+                register struct volser_status *astatus)
 {
     register struct Volume *tv;
     register struct VolumeDiskData *td;
@@ -1602,10 +1493,8 @@ VolGetStatus(acid, atrans, astatus)
 }
 
 afs_int32
-SAFSVolSetInfo(acid, atrans, astatus)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     register struct volintInfo *astatus;
+SAFSVolSetInfo(struct rx_call *acid, afs_int32 atrans, 
+              register struct volintInfo *astatus)
 {
     afs_int32 code;
 
@@ -1615,10 +1504,8 @@ SAFSVolSetInfo(acid, atrans, astatus)
 }
 
 afs_int32
-VolSetInfo(acid, atrans, astatus)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     register struct volintInfo *astatus;
+VolSetInfo(struct rx_call *acid, afs_int32 atrans, 
+              register struct volintInfo *astatus)
 {
     register struct Volume *tv;
     register struct VolumeDiskData *td;
@@ -1662,10 +1549,7 @@ VolSetInfo(acid, atrans, astatus)
 
 
 afs_int32
-SAFSVolGetName(acid, atrans, aname)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     char **aname;
+SAFSVolGetName(struct rx_call *acid, afs_int32 atrans, char **aname)
 {
     afs_int32 code;
 
@@ -1675,10 +1559,7 @@ SAFSVolGetName(acid, atrans, aname)
 }
 
 afs_int32
-VolGetName(acid, atrans, aname)
-     struct rx_call *acid;
-     afs_int32 atrans;
-     char **aname;
+VolGetName(struct rx_call *acid, afs_int32 atrans, char **aname)
 {
     register struct Volume *tv;
     register struct VolumeDiskData *td;
@@ -1722,11 +1603,8 @@ VolGetName(acid, atrans, aname)
 /*this is a handshake to indicate that the next call will be SAFSVolRestore
  * - a noop now !*/
 afs_int32
-SAFSVolSignalRestore(acid, volname, volType, parentId, cloneId)
-     struct rx_call *acid;
-     char volname[];
-     afs_int32 parentId, cloneId;
-     int volType;
+SAFSVolSignalRestore(struct rx_call *acid, char volname[], int volType, 
+                    afs_int32 parentId, afs_int32 cloneId)
 {
     return 0;
 }
@@ -1735,9 +1613,7 @@ SAFSVolSignalRestore(acid, volname, volType, parentId, cloneId)
 /*return a list of all partitions on the server. The non mounted
  *partitions are returned as -1 in the corresponding slot in partIds*/
 afs_int32
-SAFSVolListPartitions(acid, partIds)
-     struct rx_call *acid;
-     struct pIDs *partIds;
+SAFSVolListPartitions(struct rx_call *acid, struct pIDs *partIds)
 {
     afs_int32 code;
 
@@ -1747,12 +1623,9 @@ SAFSVolListPartitions(acid, partIds)
 }
 
 afs_int32
-VolListPartitions(acid, partIds)
-     struct rx_call *acid;
-     struct pIDs *partIds;
+VolListPartitions(struct rx_call *acid, struct pIDs *partIds)
 {
     char namehead[9];
-    int code;
     char i;
 
     strcpy(namehead, "/vicep");        /*7 including null terminator */
@@ -1771,9 +1644,7 @@ VolListPartitions(acid, partIds)
 /*return a list of all partitions on the server. The non mounted
  *partitions are returned as -1 in the corresponding slot in partIds*/
 afs_int32
-SAFSVolXListPartitions(acid, pEntries)
-     struct rx_call *acid;
-     struct partEntries *pEntries;
+SAFSVolXListPartitions(struct rx_call *acid, struct partEntries *pEntries)
 {
     afs_int32 code;
 
@@ -1783,9 +1654,7 @@ SAFSVolXListPartitions(acid, pEntries)
 }
 
 afs_int32
-XVolListPartitions(acid, pEntries)
-     struct rx_call *acid;
-     struct partEntries *pEntries;
+XVolListPartitions(struct rx_call *acid, struct partEntries *pEntries)
 {
     struct stat rbuf, pbuf;
     char namehead[9];
@@ -1820,8 +1689,7 @@ XVolListPartitions(acid, pEntries)
 
 /*extract the volume id from string vname. Its of the form " V0*<id>.vol  "*/
 afs_int32
-ExtractVolId(vname)
-     char vname[];
+ExtractVolId(char vname[])
 {
     int i;
     char name[VOLSER_MAXVOLNAME + 1];
@@ -1837,13 +1705,13 @@ ExtractVolId(vname)
 
 /*return the name of the next volume header in the directory associated with dirp and dp.
 *the volume id is  returned in volid, and volume header name is returned in volname*/
+int
 GetNextVol(DIR * dirp, char *volname, afs_int32 * volid)
 {
     struct dirent *dp;
 
     dp = readdir(dirp);                /*read next entry in the directory */
     if (dp) {
-
        if ((dp->d_name[0] == 'V') && !strcmp(&(dp->d_name[11]), VHDREXT)) {
            *volid = ExtractVolId(dp->d_name);
            strcpy(volname, dp->d_name);
@@ -1861,10 +1729,8 @@ GetNextVol(DIR * dirp, char *volname, afs_int32 * volid)
 
 /*return the header information about the <volid> */
 afs_int32
-SAFSVolListOneVolume(acid, partid, volumeId, volumeInfo)
-     struct rx_call *acid;
-     afs_int32 volumeId, partid;
-     volEntries *volumeInfo;
+SAFSVolListOneVolume(struct rx_call *acid, afs_int32 partid, afs_int32 
+                    volumeId, volEntries *volumeInfo)
 {
     afs_int32 code;
 
@@ -1874,10 +1740,8 @@ SAFSVolListOneVolume(acid, partid, volumeId, volumeInfo)
 }
 
 afs_int32
-VolListOneVolume(acid, partid, volumeId, volumeInfo)
-     struct rx_call *acid;
-     afs_int32 volumeId, partid;
-     volEntries *volumeInfo;
+VolListOneVolume(struct rx_call *acid, afs_int32 partid, afs_int32 
+                    volumeId, volEntries *volumeInfo)
 {
     volintInfo *pntr;
     register struct Volume *tv;
@@ -1913,7 +1777,9 @@ VolListOneVolume(acid, partid, volumeId, volumeInfo)
 
        if (volid == volumeId) {        /*copy other things too */
            found = 1;
+#ifndef AFS_PTHREAD_ENV
            IOMGR_Poll();       /*make sure that the client doesnot time out */
+#endif
            ttc = NewTrans(volid, partid);
            if (!ttc) {
                pntr->status = VBUSY;
@@ -1998,7 +1864,7 @@ VolListOneVolume(acid, partid, volumeId, volumeInfo)
        tv = (Volume *) 0;
     }
     if (ttc) {
-       DeleteTrans(ttc);
+       DeleteTrans(ttc, 1);
        ttc = (struct volser_trans *)0;
     }
 
@@ -2033,11 +1899,8 @@ VolListOneVolume(acid, partid, volumeId, volumeInfo)
  *------------------------------------------------------------------------*/
 
 afs_int32
-SAFSVolXListOneVolume(a_rxCidP, a_partID, a_volID, a_volumeXInfoP)
-     struct rx_call *a_rxCidP;
-     afs_int32 a_partID;
-     afs_int32 a_volID;
-     volXEntries *a_volumeXInfoP;
+SAFSVolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, 
+                     afs_int32 a_volID, volXEntries *a_volumeXInfoP)
 {
     afs_int32 code;
 
@@ -2047,12 +1910,8 @@ SAFSVolXListOneVolume(a_rxCidP, a_partID, a_volID, a_volumeXInfoP)
 }
 
 afs_int32
-VolXListOneVolume(a_rxCidP, a_partID, a_volID, a_volumeXInfoP)
-     struct rx_call *a_rxCidP;
-     afs_int32 a_partID;
-     afs_int32 a_volID;
-     volXEntries *a_volumeXInfoP;
-
+VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, 
+                     afs_int32 a_volID, volXEntries *a_volumeXInfoP)
 {                              /*SAFSVolXListOneVolume */
 
     volintXInfo *xInfoP;       /*Ptr to the extended vol info */
@@ -2124,7 +1983,9 @@ VolXListOneVolume(a_rxCidP, a_partID, a_volID, a_volumeXInfoP)
             * doesn't time out) and to set up a transaction on the volume.
             */
            found = 1;
+#ifndef AFS_PTHREAD_ENV
            IOMGR_Poll();
+#endif
            ttc = NewTrans(currVolID, a_partID);
            if (!ttc) {
                /*
@@ -2234,7 +2095,7 @@ VolXListOneVolume(a_rxCidP, a_partID, a_volID, a_volumeXInfoP)
        tv = (Volume *) 0;
     }
     if (ttc) {
-       DeleteTrans(ttc);
+       DeleteTrans(ttc, 1);
        ttc = (struct volser_trans *)0;
     }
 
@@ -2250,10 +2111,8 @@ VolXListOneVolume(a_rxCidP, a_partID, a_volID, a_volumeXInfoP)
 /*returns all the volumes on partition partid. If flags = 1 then all the 
 * relevant info about the volumes  is also returned */
 afs_int32
-SAFSVolListVolumes(acid, partid, flags, volumeInfo)
-     struct rx_call *acid;
-     afs_int32 flags, partid;
-     volEntries *volumeInfo;
+SAFSVolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags, 
+                  volEntries *volumeInfo)
 {
     afs_int32 code;
 
@@ -2263,10 +2122,8 @@ SAFSVolListVolumes(acid, partid, flags, volumeInfo)
 }
 
 afs_int32
-VolListVolumes(acid, partid, flags, volumeInfo)
-     struct rx_call *acid;
-     afs_int32 flags, partid;
-     volEntries *volumeInfo;
+VolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags, 
+                  volEntries *volumeInfo)
 {
     volintInfo *pntr;
     register struct Volume *tv;
@@ -2301,7 +2158,9 @@ VolListVolumes(acid, partid, flags, volumeInfo)
        }
 
        if (flags) {            /*copy other things too */
+#ifndef AFS_PTHREAD_ENV
            IOMGR_Poll();       /*make sure that the client doesnot time out */
+#endif
            ttc = NewTrans(volid, partid);
            if (!ttc) {
                pntr->status = VBUSY;
@@ -2378,7 +2237,7 @@ VolListVolumes(acid, partid, flags, volumeInfo)
 
       drop:
        if (ttc) {
-           DeleteTrans(ttc);
+           DeleteTrans(ttc, 1);
            ttc = (struct volser_trans *)0;
        }
        pntr++;
@@ -2395,7 +2254,7 @@ VolListVolumes(acid, partid, flags, volumeInfo)
                    tv = (Volume *) 0;
                }
                if (ttc) {
-                   DeleteTrans(ttc);
+                   DeleteTrans(ttc, 1);
                    ttc = (struct volser_trans *)0;
                }
                closedir(dirp);
@@ -2413,7 +2272,7 @@ VolListVolumes(acid, partid, flags, volumeInfo)
            tv = (Volume *) 0;
        }
        if (ttc) {
-           DeleteTrans(ttc);
+           DeleteTrans(ttc, 1);
            ttc = (struct volser_trans *)0;
        }
        GetNextVol(dirp, volname, &volid);
@@ -2421,7 +2280,7 @@ VolListVolumes(acid, partid, flags, volumeInfo)
     }
     closedir(dirp);
     if (ttc)
-       DeleteTrans(ttc);
+       DeleteTrans(ttc, 1);
 
     return 0;
 }
@@ -2454,11 +2313,8 @@ VolListVolumes(acid, partid, flags, volumeInfo)
  *------------------------------------------------------------------------*/
 
 afs_int32
-SAFSVolXListVolumes(a_rxCidP, a_partID, a_flags, a_volumeXInfoP)
-     struct rx_call *a_rxCidP;
-     afs_int32 a_partID;
-     afs_int32 a_flags;
-     volXEntries *a_volumeXInfoP;
+SAFSVolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID,
+                   afs_int32 a_flags, volXEntries *a_volumeXInfoP)
 {
     afs_int32 code;
 
@@ -2468,12 +2324,8 @@ SAFSVolXListVolumes(a_rxCidP, a_partID, a_flags, a_volumeXInfoP)
 }
 
 afs_int32
-VolXListVolumes(a_rxCidP, a_partID, a_flags, a_volumeXInfoP)
-     struct rx_call *a_rxCidP;
-     afs_int32 a_partID;
-     afs_int32 a_flags;
-     volXEntries *a_volumeXInfoP;
-
+VolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID,
+                   afs_int32 a_flags, volXEntries *a_volumeXInfoP)
 {                              /*SAFSVolXListVolumes */
 
     volintXInfo *xInfoP;       /*Ptr to the extended vol info */
@@ -2540,7 +2392,9 @@ VolXListVolumes(a_rxCidP, a_partID, a_flags, a_volumeXInfoP)
             * Full info about the volume desired.  Poll to make sure the
             * client doesn't time out, then start up a new transaction.
             */
+#ifndef AFS_PTHREAD_ENV
            IOMGR_Poll();
+#endif
            ttc = NewTrans(volid, a_partID);
            if (!ttc) {
                /*
@@ -2637,7 +2491,7 @@ VolXListVolumes(a_rxCidP, a_partID, a_flags, a_volumeXInfoP)
         * Drop the transaction we have for this volume.
         */
        if (ttc) {
-           DeleteTrans(ttc);
+           DeleteTrans(ttc, 1);
            ttc = (struct volser_trans *)0;
        }
 
@@ -2664,7 +2518,7 @@ VolXListVolumes(a_rxCidP, a_partID, a_flags, a_volumeXInfoP)
                    tv = (Volume *) 0;
                }
                if (ttc) {
-                   DeleteTrans(ttc);
+                   DeleteTrans(ttc, 1);
                    ttc = (struct volser_trans *)0;
                }
                closedir(dirp);
@@ -2692,7 +2546,7 @@ VolXListVolumes(a_rxCidP, a_partID, a_flags, a_volumeXInfoP)
            tv = (Volume *) 0;
        }
        if (ttc) {
-           DeleteTrans(ttc);
+           DeleteTrans(ttc, 1);
            ttc = (struct volser_trans *)0;
        }
        GetNextVol(dirp, volname, &volid);
@@ -2704,7 +2558,7 @@ VolXListVolumes(a_rxCidP, a_partID, a_flags, a_volumeXInfoP)
      */
     closedir(dirp);
     if (ttc)
-       DeleteTrans(ttc);
+       DeleteTrans(ttc, 1);
     return (0);
 
 }                              /*SAFSVolXListVolumes */
@@ -2712,9 +2566,7 @@ VolXListVolumes(a_rxCidP, a_partID, a_flags, a_volumeXInfoP)
 /*this call is used to monitor the status of volser for debugging purposes.
  *information about all the active transactions is returned in transInfo*/
 afs_int32
-SAFSVolMonitor(acid, transInfo)
-     struct rx_call *acid;
-     transDebugEntries *transInfo;
+SAFSVolMonitor(struct rx_call *acid, transDebugEntries *transInfo)
 {
     afs_int32 code;
 
@@ -2724,9 +2576,7 @@ SAFSVolMonitor(acid, transInfo)
 }
 
 afs_int32
-VolMonitor(acid, transInfo)
-     struct rx_call *acid;
-     transDebugEntries *transInfo;
+VolMonitor(struct rx_call *acid, transDebugEntries *transInfo)
 {
     transDebugInfo *pntr;
     afs_int32 allocSize = 50;
@@ -2780,10 +2630,7 @@ VolMonitor(acid, transInfo)
 }
 
 afs_int32
-SAFSVolSetIdsTypes(acid, atid, name, type, pId, cloneId, backupId)
-     struct rx_call *acid;
-     afs_int32 type, pId, cloneId, backupId, atid;
-     char name[];
+SAFSVolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], afs_int32 type, afs_int32 pId, afs_int32 cloneId, afs_int32 backupId)
 {
     afs_int32 code;
 
@@ -2795,10 +2642,7 @@ SAFSVolSetIdsTypes(acid, atid, name, type, pId, cloneId, backupId)
 }
 
 afs_int32
-VolSetIdsTypes(acid, atid, name, type, pId, cloneId, backupId)
-     struct rx_call *acid;
-     afs_int32 type, pId, cloneId, backupId, atid;
-     char name[];
+VolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], afs_int32 type, afs_int32 pId, afs_int32 cloneId, afs_int32 backupId)
 {
     struct Volume *tv;
     afs_int32 error = 0;
@@ -2846,9 +2690,7 @@ VolSetIdsTypes(acid, atid, name, type, pId, cloneId, backupId)
 }
 
 afs_int32
-SAFSVolSetDate(acid, atid, cdate)
-     struct rx_call *acid;
-     afs_int32 atid, cdate;
+SAFSVolSetDate(struct rx_call *acid, afs_int32 atid, afs_int32 cdate)
 {
     afs_int32 code;
 
@@ -2859,9 +2701,7 @@ SAFSVolSetDate(acid, atid, cdate)
 }
 
 afs_int32
-VolSetDate(acid, atid, cdate)
-     struct rx_call *acid;
-     afs_int32 atid, cdate;
+VolSetDate(struct rx_call *acid, afs_int32 atid, afs_int32 cdate)
 {
     struct Volume *tv;
     afs_int32 error = 0;
@@ -2920,10 +2760,8 @@ VolSetDate(acid, atid, cdate)
 #endif /* AFS_NAMEI_ENV */
 
 afs_int32
-SAFSVolConvertROtoRWvolume(acid, partId, volumeId)
-     struct rx_call *acid;
-     afs_int32 partId;
-     afs_int32 volumeId;
+SAFSVolConvertROtoRWvolume(struct rx_call *acid, afs_int32 partId,
+                          afs_int32 volumeId)
 {
 #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
     DIR *dirp;
@@ -3017,11 +2855,8 @@ SAFSVolConvertROtoRWvolume(acid, partId, volumeId)
 }
 
 afs_int32
-SAFSVolGetSize(acid, fromTrans, fromDate, size)
-     struct rx_call *acid;
-     afs_int32 fromTrans;
-     afs_int32 fromDate;
-     register struct volintSize *size;
+SAFSVolGetSize(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
+              register struct volintSize *size)
 {
     int code = 0;
     register struct volser_trans *tt;