From b21015242022872101b9c3c78df511e2a2dc6399 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 10 Jul 2009 12:54:10 +0100 Subject: [PATCH] Prototyping for the volser directory Prototyping and warning message reduction for the volser directory. Adds physio.h and dumpstuff.h as internal header files, Many error code variables are changed from being afs_int32, to the 'Error' typedef, to remove signed comparison errors. Reviewed-on: http://gerrit.openafs.org/19 Reviewed-by: Russ Allbery Verified-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/volser/Makefile.in | 2 +- src/volser/common.c | 13 ++- src/volser/dumpstuff.c | 38 ++---- src/volser/dumpstuff.h | 42 +++++++ src/volser/lockprocs.c | 1 - src/volser/physio.c | 3 +- src/volser/physio.h | 17 +++ src/volser/restorevol.c | 40 +++---- src/volser/vol-dump.c | 10 +- src/volser/vol_split.c | 19 +-- src/volser/volmain.c | 15 ++- src/volser/volprocs.c | 200 +++++++++++++++++++------------- src/volser/volser.p.h | 5 +- src/volser/volser_prototypes.h | 46 ++++++-- src/volser/voltrans.c | 10 +- src/volser/vos.c | 168 +++++++++------------------ src/volser/vsprocs.c | 22 +++- src/volser/vsutils.c | 4 +- src/volser/vsutils_prototypes.h | 2 +- 19 files changed, 364 insertions(+), 293 deletions(-) create mode 100644 src/volser/dumpstuff.h create mode 100644 src/volser/physio.h diff --git a/src/volser/Makefile.in b/src/volser/Makefile.in index b649d1533c..fe11c4eb6d 100644 --- a/src/volser/Makefile.in +++ b/src/volser/Makefile.in @@ -122,7 +122,7 @@ volint.cs.o: volint.cs.c ${INTINCLS} volint.ss.o: volint.ss.c ${INTINCLS} volint.xdr.o: volint.xdr.c ${INTINCLS} vsutils.o: vsutils.c ${VINCLS} ${RINCLS} ${INTINCLS} -volmain.o: volmain.c ${VINCLS} ${RINCLS} AFS_component_version_number.c +volmain.o: volmain.c ${VINCLS} ${RINCLS} ${INTINCLS} AFS_component_version_number.c volprocs.o: volprocs.c ${VINCLS} ${RINCLS} ${INTINCLS} dumpstuff.o: dumpstuff.c ${VINCLS} ${RINCLS} ${INTINCLS} voldump.o: voldump.c ${VINCLS} ${RINCLS} diff --git a/src/volser/common.c b/src/volser/common.c index 211e52f6e5..00b9081ce3 100644 --- a/src/volser/common.c +++ b/src/volser/common.c @@ -10,11 +10,22 @@ #include #include - #include +#include + #include #include +#ifndef AFS_PTHREAD_ENV +#include +#include +#include +#include + +#include +#include +#include "volser.h" +#endif + #ifndef AFS_PTHREAD_ENV /*@printflike@*/ void Log(const char *format, ...) diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 0cc0250f38..727aeb9eb0 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -46,8 +46,11 @@ #include #include #include +#include +#include #include "volser.h" #include "volint.h" +#include "dumpstuff.h" #ifndef AFS_NT40_ENV #ifdef O_LARGEFILE @@ -63,26 +66,6 @@ extern int DoLogging; -/* This iod stuff is a silly little package to emulate the old qi_in stuff, which - emulated the stdio stuff. There is a big assumption here, that the - rx_Read will never be called directly, by a routine like readFile, when - there is an old character that was pushed back with iod_ungetc. This - is really bletchy, and is here for compatibility only. Eventually, - we should define a volume format that doesn't require - the pushing back of characters (i.e. characters should not double both - as an end marker and a begin marker) */ -struct iod { - struct rx_call *call; /* call to which to write, might be an array */ - int device; /* dump device ID for volume */ - int parentId; /* dump parent ID for volume */ - struct DiskPartition64 *dumpPartition; /* Dump partition. */ - struct rx_call **calls; /* array of pointers to calls */ - int ncalls; /* how many calls/codes in array */ - int *codes; /* one return code for each call */ - char haveOldChar; /* state for pushing back a character */ - char oldChar; -}; - /* Forward Declarations */ static int DumpDumpHeader(register struct iod *iodp, register Volume * vp, @@ -202,7 +185,7 @@ iod_getc(register struct iod *iodp) static int ReadShort(register struct iod *iodp, register unsigned short *sp) { - register b1, b0; + register int b1, b0; b1 = iod_getc(iodp); if (b1 == EOF) return 0; @@ -237,7 +220,6 @@ static void ReadString(register struct iod *iodp, register char *to, register int maxa) { register int c; - int first = 1; *to = '\0'; if (maxa == 0) @@ -264,7 +246,7 @@ ReadByteString(register struct iod *iodp, register byte * to, static int ReadVolumeHeader(register struct iod *iodp, VolumeDiskData * vol) { - register tag; + register int tag; afs_uint32 trash; memset(vol, 0, sizeof(*vol)); while ((tag = iod_getc(iodp)) > D_MAX && tag != EOF) { @@ -486,7 +468,7 @@ DumpBool(register struct iod *iodp, char tag, unsigned int value) static int DumpString(register struct iod *iodp, char tag, register char *s) { - register n; + register int n; int code = 0; code = iod_Write(iodp, &tag, 1); if (code != 1) @@ -930,7 +912,7 @@ int ProcessIndex(Volume * vp, VnodeClass class, afs_int32 ** Bufp, int *sizep, int del) { - int i, nVnodes, offset, code, index = 0; + int i, nVnodes, offset, code; afs_int32 *Buf; int cnt = 0; int size; @@ -1130,7 +1112,7 @@ ReadVnodes(register struct iod *iodp, Volume * vp, int incremental, { afs_int32 vnodeNumber; char buf[SIZEOF_LARGEDISKVNODE]; - register tag; + register int tag; struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf; struct VnodeDiskObject oldvnode; int idx; @@ -1378,7 +1360,7 @@ volser_WriteFile(int vn, struct iod *iodp, FdHandle_t * handleP, int tag, static int ReadDumpHeader(register struct iod *iodp, struct DumpHeader *hp) { - register tag; + register int tag; afs_uint32 beginMagic; if (iod_getc(iodp) != D_DUMPHEADER || !ReadInt32(iodp, &beginMagic) || !ReadInt32(iodp, (afs_uint32 *) & hp->version) @@ -1547,7 +1529,7 @@ SizeDumpDumpHeader(register struct iod *iodp, register Volume * vp, afs_int32 fromtime, register struct volintSize *v_size) { int code = 0; - int UseLatestReadOnlyClone = 1; +/* int UseLatestReadOnlyClone = 1; */ /* afs_int32 dumpTimes[2]; */ afs_uint64 addvar; /* iodp->device = vp->device; */ diff --git a/src/volser/dumpstuff.h b/src/volser/dumpstuff.h new file mode 100644 index 0000000000..87b144730b --- /dev/null +++ b/src/volser/dumpstuff.h @@ -0,0 +1,42 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef _VOLSER_DUMPSTUFF_H +#define _VOLSER_DUMPSTUFF_H + +/* This iod stuff is a silly little package to emulate the old qi_in stuff, + * which emulated the stdio stuff. There is a big assumption here, that the + * rx_Read will never be called directly, by a routine like readFile, when + * there is an old character that was pushed back with iod_ungetc. This + * is really bletchy, and is here for compatibility only. Eventually, + * we should define a volume format that doesn't require the pushing back + * of characters (i.e. characters should not double both as an end marker + * and a begin marker) + */ +struct iod { + struct rx_call *call; /* call to which to write, might be an array */ + int device; /* dump device ID for volume */ + int parentId; /* dump parent ID for volume */ + struct DiskPartition64 *dumpPartition; /* Dump partition. */ + struct rx_call **calls; /* array of pointers to calls */ + int ncalls; /* how many calls/codes in array */ + int *codes; /* one return code for each call */ + char haveOldChar; /* state for pushing back a character */ + char oldChar; +}; + +extern int DumpVolume(struct rx_call *call, Volume *vp, afs_int32, int); +extern int DumpVolMulti(struct rx_call **, int, Volume *, afs_int32, int, + int *); +extern int RestoreVolume(struct rx_call *, Volume *, int, + struct restoreCookie *); +extern int SizeDumpVolume(struct rx_call *, Volume *, afs_int32, int, + struct volintSize *); + +#endif diff --git a/src/volser/lockprocs.c b/src/volser/lockprocs.c index d18bbda473..37ce2c0ea7 100644 --- a/src/volser/lockprocs.c +++ b/src/volser/lockprocs.c @@ -80,7 +80,6 @@ SetAValue(struct nvldbentry *entry, afs_int32 oserver, afs_int32 opart, afs_int32 nserver, afs_int32 npart, afs_int32 type) { int e; - afs_int32 error = 0; e = FindIndex(entry, oserver, opart, type); if (e == -1) diff --git a/src/volser/physio.c b/src/volser/physio.c index 254354d016..89980bca40 100644 --- a/src/volser/physio.c +++ b/src/volser/physio.c @@ -33,6 +33,7 @@ #include #include #include "vol.h" +#include "physio.h" /* returns 0 on success, errno on failure */ int @@ -106,7 +107,7 @@ void SetSalvageDirHandle(DirHandle * dir, afs_int32 volume, afs_int32 device, Inode inode) { - private SalvageCacheCheck = 1; + private int SalvageCacheCheck = 1; memset(dir, 0, sizeof(DirHandle)); dir->dirh_volume = volume; diff --git a/src/volser/physio.h b/src/volser/physio.h new file mode 100644 index 0000000000..c5a36dd57b --- /dev/null +++ b/src/volser/physio.h @@ -0,0 +1,17 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef _VOLSER_PHYSIO_H +#define _VOLSER_PHYSIO_H + +/* physio.c */ +extern void SetSalvageDirHandle(DirHandle *, afs_int32, afs_int32, Inode); +extern void FidZap(DirHandle *); + +#endif diff --git a/src/volser/restorevol.c b/src/volser/restorevol.c index 3449f4f5c7..abf445ef48 100644 --- a/src/volser/restorevol.c +++ b/src/volser/restorevol.c @@ -76,7 +76,7 @@ int inc_dump = 0; FILE *dumpfile; afs_int32 -readvalue(size) +readvalue(int size) { afs_int32 value, s; int code; @@ -99,11 +99,10 @@ readvalue(size) } char -readchar() +readchar(void) { char value; int code; - char *ptr; value = '\0'; code = fread(&value, 1, 1, dumpfile); @@ -117,9 +116,7 @@ readchar() char buf[BUFSIZE]; void -readdata(buffer, size) - char *buffer; - afs_sfsize_t size; +readdata(char *buffer, afs_sfsize_t size) { int code; afs_int32 s; @@ -146,10 +143,9 @@ readdata(buffer, size) } afs_int32 -ReadDumpHeader(dh) - struct DumpHeader *dh; /* Defined in dump.h */ +ReadDumpHeader(struct DumpHeader *dh) { - int code, i, done; + int i, done; char tag, c; afs_int32 magic; @@ -220,11 +216,10 @@ struct volumeHeader { }; afs_int32 -ReadVolumeHeader(count) - afs_int32 count; +ReadVolumeHeader(afs_int32 count) { struct volumeHeader vh; - int code, i, done, entries; + int i, done; char tag, c; /* memset(&vh, 0, sizeof(vh)); */ @@ -390,12 +385,11 @@ struct vNode { #define MAXNAMELEN 256 afs_int32 -ReadVNode(count) - afs_int32 count; +ReadVNode(afs_int32 count) { struct vNode vn; - int code, i, done, entries; - char tag, c; + int code, i, done; + char tag; char dirname[MAXNAMELEN], linkname[MAXNAMELEN], lname[MAXNAMELEN]; char parentdir[MAXNAMELEN], vflink[MAXNAMELEN]; char filename[MAXNAMELEN], fname[MAXNAMELEN]; @@ -730,8 +724,7 @@ ReadVNode(count) * also be a mount point. If the volume is being restored to AFS, this * will become a mountpoint. If not, it becomes a symlink to no-where. */ - int fid; - afs_int32 size, s; + afs_int32 s; /* Check if its vnode-file-link exists and create pathname * of the symbolic link. If it doesn't exist, @@ -794,12 +787,11 @@ ReadVNode(count) static int WorkerBee(struct cmd_syndesc *as, void *arock) { - int code = 0, c, len; + int code = 0, len; afs_int32 type, count, vcount; DIR *dirP, *dirQ; struct dirent *dirE, *dirF; - char fname[MAXNAMELEN], name[MAXNAMELEN], lname[MAXNAMELEN], - mname[MAXNAMELEN]; + char name[MAXNAMELEN]; char thisdir[MAXPATHLEN], *t; struct DumpHeader dh; /* Defined in dump.h */ #if 0/*ndef HAVE_GETCWD*/ /* XXX enable when autoconf happens */ @@ -967,12 +959,10 @@ WorkerBee(struct cmd_syndesc *as, void *arock) return (code); } -main(argc, argv) - int argc; - char **argv; +int +main(int argc, char **argv) { struct cmd_syndesc *ts; - struct cmd_item *ti; setlinebuf(stdout); diff --git a/src/volser/vol-dump.c b/src/volser/vol-dump.c index fa5885219e..78eab6f120 100644 --- a/src/volser/vol-dump.c +++ b/src/volser/vol-dump.c @@ -48,6 +48,7 @@ #include "viceinode.h" #include #include "acl.h" +#include #ifdef HAVE_UNISTD_H #include @@ -104,7 +105,6 @@ char name[VMAXPATHLEN]; int ReadHdr1(IHandle_t * ih, char *to, int size, u_int magic, u_int version) { - int bad = 0; int code; code = IH_IREAD(ih, 0, to, size); @@ -249,10 +249,9 @@ HandleVolume(struct DiskPartition64 *dp, char *name, char *filename, int fromtim { struct VolumeHeader header; struct VolumeDiskHeader diskHeader; - struct afs_stat status, stat; + struct afs_stat status; register int fd; Volume *vp; - IHandle_t *ih; char headerName[1024]; afs_int32 n; @@ -557,7 +556,7 @@ DumpFile(int dumpfd, int vnode, FdHandle_t * handleP, struct VnodeDiskObject *v #ifndef AFS_NT40_ENV struct afs_stat status; #endif - afs_sfsize_t size, tmpsize; + afs_sfsize_t size; #ifdef AFS_AIX_ENV #include struct statfs tstatfs; @@ -590,7 +589,8 @@ DumpFile(int dumpfd, int vnode, FdHandle_t * handleP, struct VnodeDiskObject *v if (verbose) fprintf(stderr, " howBig = %u, howMany = %u, fdh size = %u\n", - howBig, howMany, size); + (unsigned int) howBig, (unsigned int) howMany, + (unsigned int) size); #ifdef AFS_LARGEFILE_ENV { diff --git a/src/volser/vol_split.c b/src/volser/vol_split.c index 4a9cd9bfcc..f541041fe6 100644 --- a/src/volser/vol_split.c +++ b/src/volser/vol_split.c @@ -48,6 +48,10 @@ #include "partition.h" #include "viceinode.h" #include "vol.h" +#include "volint.h" +#include "volser.h" +#include "physio.h" +#include "volser_prototypes.h" #ifdef AFS_RXOSD_SUPPORT #include "rxosd.h" #include "vol_osd.h" @@ -158,8 +162,9 @@ ExtractVnodes(struct Msg *m, Volume *vol, afs_int32 class, } } if (m->verbose) { - sprintf(m->line, "Volume %u has %u %s vnodes in volume %uu\n", - V_parentId(vol), *length, class? "small":"large"); + sprintf(m->line, "Volume %u has %u %s vnodes in volume %u\n", + V_parentId(vol), *length, class? "small":"large", + V_id(vol)); rx_Write(m->call, m->line, strlen(m->line)); } @@ -317,7 +322,6 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)&buf; FdHandle_t *fdP = 0; FdHandle_t *newfdP = 0; - StreamHandle_t *newstream = 0; struct VnodeClassInfo *vcp = &VnodeClassInfo[class]; struct VnodeExtract *e; afs_uint64 size; @@ -358,9 +362,6 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, */ IHandle_t *newh = 0; IHandle_t *h = 0; - FdHandle_t *infdP = 0; - FdHandle_t *outfdP = 0; - char *tbuf = malloc(2048); #if defined(NEARINODE_HINT) && !defined(AFS_NAMEI_ENV) Inode nearInode; V_pref(vol,nearInode) @@ -525,13 +526,15 @@ createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent, afs_uint64 offset, size; afs_int32 class = vSmall; struct VnodeClassInfo *vcp = &VnodeClassInfo[class]; +#if defined(NEARINODE_HINT) && !defined(AFS_NAMEI_ENV) Inode nearInode = 0; +#endif AFSFid fid; struct timeval now; afs_uint32 newvN; char symlink[32]; - TM_GetTimeOfDay(&now, 0); + FT_GetTimeOfDay(&now, 0); fdP = IH_OPEN(vol->vnodeIndex[vSmall].handle); if (!fdP) { Log("split volume: error opening small vnode index of %u\n", V_id(vol)); @@ -709,7 +712,7 @@ afs_int32 split_volume(struct rx_call *call, Volume *vol, Volume *newvol, afs_uint32 where, afs_int32 verbose) { - afs_int32 code = 0; + Error code = 0; struct VnodeExtract *dirList = 0; struct VnodeExtract *fileList = 0; afs_uint64 blocks = 0; diff --git a/src/volser/volmain.c b/src/volser/volmain.c index 7c70921cc8..8f40a6df59 100644 --- a/src/volser/volmain.c +++ b/src/volser/volmain.c @@ -57,6 +57,10 @@ #include #include #include +#include +#include "volser.h" +#include "volint.h" +#include "volser_prototypes.h" /*@printflike@*/ extern void Log(const char *format, ...); /*@printflike@*/ extern void Abort(const char *format, ...); @@ -65,11 +69,6 @@ #define N_SECURITY_OBJECTS 3 extern struct Lock localLock; -extern struct volser_trans *TransList(); -#ifndef AFS_PTHREAD_ENV -extern int (*vol_PollProc) (); -extern int IOMGR_Poll(); -#endif char *GlobalNameHack = NULL; int hackIsIn = 0; afs_int32 GlobalVolCloneId, GlobalVolParentId; @@ -128,7 +127,7 @@ MyAfterProc(struct rx_call *acall, afs_int32 code) * if we're idle and there are no active transactions */ static void -TryUnlock() +TryUnlock(void) { /* if there are no running calls, and there are no active transactions, then * it should be safe to release any partition locks we've accumulated */ @@ -206,7 +205,7 @@ int volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5) { afs_uint32 rcode; - void (*old) (); + void (*old) (int); #ifndef AFS_LINUX20_ENV old = signal(SIGSYS, SIG_IGN); @@ -324,7 +323,7 @@ main(int argc, char **argv) rxMaxMTU = atoi(argv[++code]); if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) { - printf("rxMaxMTU %lu invalid; must be between %d-%d\n", + printf("rxMaxMTU %d invalid; must be between %d-%lu\n", rxMaxMTU, RX_MIN_PACKET_SIZE, RX_MAX_PACKET_DATA_SIZE); exit(1); diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 63222aacd1..8e34cfb4f1 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -60,19 +60,19 @@ #include #include "afs/audit.h" #include +#include +#include #include "volser.h" #include "volint.h" #include "volser_prototypes.h" +#include "physio.h" +#include "dumpstuff.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); /* Forward declarations */ @@ -85,20 +85,54 @@ static int GetPartName(afs_int32 partid, char *pname); #endif afs_int32 localTid = 1; -afs_int32 VolPartitionInfo(), VolNukeVolume(), VolCreateVolume(), -VolDeleteVolume(), VolClone(); -afs_int32 VolReClone(), VolTransCreate(), VolGetNthVolume(), VolGetFlags(), -VolForward(), VolDump(); -afs_int32 VolRestore(), VolEndTrans(), VolSetForwarding(), VolGetStatus(), -VolSetInfo(), VolGetName(); -afs_int32 VolListPartitions(), VolListOneVolume(), -VolXListOneVolume(), VolXListVolumes(); -afs_int32 VolListVolumes(), XVolListPartitions(), VolMonitor(), -VolSetIdsTypes(), VolSetDate(), VolSetFlags(); + +static afs_int32 VolPartitionInfo(struct rx_call *, char *pname, + struct diskPartition64 *); +static afs_int32 VolNukeVolume(struct rx_call *, afs_int32, afs_uint32); +static afs_int32 VolCreateVolume(struct rx_call *, afs_int32, char *, + afs_int32, afs_uint32, afs_uint32 *, + afs_int32 *); +static afs_int32 VolDeleteVolume(struct rx_call *, afs_int32); +static afs_int32 VolClone(struct rx_call *, afs_int32, afs_uint32, + afs_int32, char *, afs_uint32 *); +static afs_int32 VolReClone(struct rx_call *, afs_int32, afs_int32); +static afs_int32 VolTransCreate(struct rx_call *, afs_uint32, afs_int32, + afs_int32, afs_int32 *); +static afs_int32 VolGetNthVolume(struct rx_call *, afs_int32, afs_uint32 *, + afs_int32 *); +static afs_int32 VolGetFlags(struct rx_call *, afs_int32, afs_int32 *); +static afs_int32 VolSetFlags(struct rx_call *, afs_int32, afs_int32 ); +static afs_int32 VolForward(struct rx_call *, afs_int32, afs_int32, + struct destServer *destination, afs_int32, + struct restoreCookie *cookie); +static afs_int32 VolDump(struct rx_call *, afs_int32, afs_int32, afs_int32); +static afs_int32 VolRestore(struct rx_call *, afs_int32, afs_int32, + struct restoreCookie *); +static afs_int32 VolEndTrans(struct rx_call *, afs_int32, afs_int32 *); +static afs_int32 VolSetForwarding(struct rx_call *, afs_int32, afs_int32); +static afs_int32 VolGetStatus(struct rx_call *, afs_int32, + struct volser_status *); +static afs_int32 VolSetInfo(struct rx_call *, afs_int32, struct volintInfo *); +static afs_int32 VolGetName(struct rx_call *, afs_int32, char **); +static afs_int32 VolListPartitions(struct rx_call *, struct pIDs *); +static afs_int32 XVolListPartitions(struct rx_call *, struct partEntries *); +static afs_int32 VolListOneVolume(struct rx_call *, afs_int32, afs_uint32, + volEntries *); +static afs_int32 VolXListOneVolume(struct rx_call *, afs_int32, afs_uint32, + volXEntries *); +static afs_int32 VolListVolumes(struct rx_call *, afs_int32, afs_int32, + volEntries *); +static afs_int32 VolXListVolumes(struct rx_call *, afs_int32, afs_int32, + volXEntries *); +static afs_int32 VolMonitor(struct rx_call *, transDebugEntries *); +static afs_int32 VolSetIdsTypes(struct rx_call *, afs_int32, char [], + afs_int32, afs_uint32, afs_uint32, + afs_uint32); +static afs_int32 VolSetDate(struct rx_call *, afs_int32, afs_int32); /* this call unlocks all of the partition locks we've set */ int -VPFullUnlock() +VPFullUnlock(void) { register struct DiskPartition64 *tp; for (tp = DiskPartitionList; tp; tp = tp->next) { @@ -348,11 +382,12 @@ SAFSVolNukeVolume(struct rx_call *acid, afs_int32 apartID, afs_uint32 avolID) return code; } -afs_int32 +static afs_int32 VolNukeVolume(struct rx_call *acid, afs_int32 apartID, afs_uint32 avolID) { char partName[50]; afs_int32 error; + Error verror; register afs_int32 code; struct Volume *tvp; char caller[MAXKTCNAMELEN]; @@ -372,7 +407,7 @@ VolNukeVolume(struct rx_call *acid, afs_int32 apartID, afs_uint32 avolID) tvp = XAttachVolume(&error, avolID, apartID, V_VOLUPD); code = nuke(partName, avolID); if (tvp) - VDetachVolume(&error, tvp); + VDetachVolume(&verror, tvp); return code; } @@ -397,14 +432,14 @@ SAFSVolCreateVolume(struct rx_call *acid, afs_int32 apart, char *aname, return code; } -afs_int32 +static afs_int32 VolCreateVolume(struct rx_call *acid, afs_int32 apart, char *aname, afs_int32 atype, afs_uint32 aparent, afs_uint32 *avolid, afs_int32 *atrans) { - afs_int32 error; + Error error; register Volume *vp; - afs_int32 junk; /* discardable error code */ + Error junk; /* discardable error code */ afs_uint32 volumeID; afs_int32 doCreateRoot = 1; register struct volser_trans *tt; @@ -485,11 +520,11 @@ SAFSVolDeleteVolume(struct rx_call *acid, afs_int32 atrans) return code; } -afs_int32 +static afs_int32 VolDeleteVolume(struct rx_call *acid, afs_int32 atrans) { register struct volser_trans *tt; - afs_int32 error; + Error error; char caller[MAXKTCNAMELEN]; if (!afsconf_SuperUser(tdir, acid, caller)) @@ -519,12 +554,13 @@ VolDeleteVolume(struct rx_call *acid, afs_int32 atrans) /* make a clone of the volume associated with atrans, possibly giving it a new * number (allocate a new number if *newNumber==0, otherwise use *newNumber - * for the clone's id). The new clone is given the name newName. Finally, due to - * efficiency considerations, if purgeId is non-zero, we purge that volume when doing - * the clone operation. This may be useful when making new backup volumes, for instance - * since the net result of a clone and a purge generally leaves many inode ref counts - * the same, while doing them separately would result in far more iincs and idecs being - * peformed (and they are slow operations). + * for the clone's id). The new clone is given the name newName. Finally, + * due to efficiency considerations, if purgeId is non-zero, we purge that + * volume when doing the clone operation. This may be useful when making + * new backup volumes, for instance since the net result of a clone and a + * purge generally leaves many inode ref counts 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 @@ -540,7 +576,7 @@ SAFSVolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, return code; } -afs_int32 +static afs_int32 VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, afs_int32 newType, char *newName, afs_uint32 *newNumber) { @@ -724,7 +760,7 @@ SAFSVolReClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 cloneId) return code; } -afs_int32 +static afs_int32 VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId) { register struct Volume *originalvp, *clonevp; @@ -899,13 +935,14 @@ SAFSVolTransCreate(struct rx_call *acid, afs_uint32 volume, afs_int32 partition, return code; } -afs_int32 +static afs_int32 VolTransCreate(struct rx_call *acid, afs_uint32 volume, afs_int32 partition, afs_int32 iflags, afs_int32 *ttid) { register struct volser_trans *tt; register Volume *tv; - afs_int32 error, code; + afs_int32 error; + Error code; afs_int32 mode; char caller[MAXKTCNAMELEN]; @@ -964,8 +1001,8 @@ SAFSVolGetNthVolume(struct rx_call *acid, afs_int32 aindex, afs_uint32 *avolume, return code; } -afs_int32 -VolGetNthVolume(struct rx_call *acid, afs_int32 aindex, afs_int32 *avolume, +static afs_int32 +VolGetNthVolume(struct rx_call *acid, afs_int32 aindex, afs_uint32 *avolume, afs_int32 *apart) { Log("1 Volser: GetNthVolume: Not yet implemented\n"); @@ -985,7 +1022,7 @@ SAFSVolGetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 *aflags) return code; } -afs_int32 +static afs_int32 VolGetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 *aflags) { register struct volser_trans *tt; @@ -1024,12 +1061,12 @@ SAFSVolSetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 aflags) return code; } -afs_int32 +static afs_int32 VolSetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 aflags) { register struct volser_trans *tt; register struct Volume *vp; - afs_int32 error; + Error error; char caller[MAXKTCNAMELEN]; if (!afsconf_SuperUser(tdir, acid, caller)) @@ -1093,7 +1130,7 @@ SAFSVolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, return code; } -afs_int32 +static afs_int32 VolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, struct destServer *destination, afs_int32 destTrans, struct restoreCookie *cookie) @@ -1318,7 +1355,8 @@ SAFSVolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate) } afs_int32 -SAFSVolDumpV2(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, afs_int32 flags) +SAFSVolDumpV2(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, + afs_int32 flags) { afs_int32 code; @@ -1327,8 +1365,9 @@ SAFSVolDumpV2(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, afs return code; } -afs_int32 -VolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, afs_int32 flags) +static afs_int32 +VolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, + afs_int32 flags) { int code = 0; register struct volser_trans *tt; @@ -1365,7 +1404,7 @@ VolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, afs_int32 * Ha! No more helper process! */ afs_int32 -SAFSVolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags, +SAFSVolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags, struct restoreCookie *cookie) { afs_int32 code; @@ -1375,9 +1414,9 @@ SAFSVolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags, return code; } -afs_int32 -VolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags, - struct restoreCookie *cookie) +static afs_int32 +VolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags, + struct restoreCookie *cookie) { register struct volser_trans *tt; register afs_int32 code, tcode; @@ -1417,7 +1456,7 @@ SAFSVolEndTrans(struct rx_call *acid, afs_int32 destTrans, afs_int32 *rcode) return code; } -afs_int32 +static afs_int32 VolEndTrans(struct rx_call *acid, afs_int32 destTrans, afs_int32 *rcode) { register struct volser_trans *tt; @@ -1446,7 +1485,7 @@ SAFSVolSetForwarding(struct rx_call *acid, afs_int32 atid, afs_int32 anewsite) return code; } -afs_int32 +static afs_int32 VolSetForwarding(struct rx_call *acid, afs_int32 atid, afs_int32 anewsite) { register struct volser_trans *tt; @@ -1478,7 +1517,7 @@ VolSetForwarding(struct rx_call *acid, afs_int32 atid, afs_int32 anewsite) } afs_int32 -SAFSVolGetStatus(struct rx_call *acid, afs_int32 atrans, +SAFSVolGetStatus(struct rx_call *acid, afs_int32 atrans, register struct volser_status *astatus) { afs_int32 code; @@ -1488,9 +1527,9 @@ SAFSVolGetStatus(struct rx_call *acid, afs_int32 atrans, return code; } -afs_int32 -VolGetStatus(struct rx_call *acid, afs_int32 atrans, - register struct volser_status *astatus) +static afs_int32 +VolGetStatus(struct rx_call *acid, afs_int32 atrans, + register struct volser_status *astatus) { register struct Volume *tv; register struct VolumeDiskData *td; @@ -1540,7 +1579,7 @@ VolGetStatus(struct rx_call *acid, afs_int32 atrans, } afs_int32 -SAFSVolSetInfo(struct rx_call *acid, afs_int32 atrans, +SAFSVolSetInfo(struct rx_call *acid, afs_int32 atrans, register struct volintInfo *astatus) { afs_int32 code; @@ -1550,15 +1589,15 @@ SAFSVolSetInfo(struct rx_call *acid, afs_int32 atrans, return code; } -afs_int32 -VolSetInfo(struct rx_call *acid, afs_int32 atrans, +static afs_int32 +VolSetInfo(struct rx_call *acid, afs_int32 atrans, register struct volintInfo *astatus) { register struct Volume *tv; register struct VolumeDiskData *td; struct volser_trans *tt; char caller[MAXKTCNAMELEN]; - afs_int32 error; + Error error; if (!afsconf_SuperUser(tdir, acid, caller)) return VOLSERBAD_ACCESS; /*not a super user */ @@ -1611,7 +1650,7 @@ SAFSVolGetName(struct rx_call *acid, afs_int32 atrans, char **aname) return code; } -afs_int32 +static afs_int32 VolGetName(struct rx_call *acid, afs_int32 atrans, char **aname) { register struct Volume *tv; @@ -1659,7 +1698,7 @@ VolGetName(struct rx_call *acid, afs_int32 atrans, char **aname) /*this is a handshake to indicate that the next call will be SAFSVolRestore * - a noop now !*/ afs_int32 -SAFSVolSignalRestore(struct rx_call *acid, char volname[], int volType, +SAFSVolSignalRestore(struct rx_call *acid, char volname[], int volType, afs_uint32 parentId, afs_uint32 cloneId) { return 0; @@ -1678,11 +1717,11 @@ SAFSVolListPartitions(struct rx_call *acid, struct pIDs *partIds) return code; } -afs_int32 +static afs_int32 VolListPartitions(struct rx_call *acid, struct pIDs *partIds) { char namehead[9]; - char i; + int i; strcpy(namehead, "/vicep"); /*7 including null terminator */ @@ -1708,7 +1747,7 @@ SAFSVolXListPartitions(struct rx_call *acid, struct partEntries *pEntries) return code; } -afs_int32 +static afs_int32 XVolListPartitions(struct rx_call *acid, struct partEntries *pEntries) { char namehead[9]; @@ -1971,6 +2010,8 @@ FillVolInfo(Volume * vp, volint_info_handle_t * handle) return 0; } +#ifdef AFS_DEMAND_ATTACH_FS + /** * get struct Volume out of the fileserver. * @@ -2016,6 +2057,8 @@ GetVolObject(afs_uint32 volumeId, char * pname, Volume ** vp) return code; } +#endif + /** * mode of volume list operation. */ @@ -2049,7 +2092,7 @@ GetVolInfo(afs_uint32 partId, vol_info_list_mode_t mode) { int code = -1; - afs_int32 error; + Error error; struct volser_trans *ttc = NULL; struct Volume *fill_tv, *tv = NULL; #ifdef AFS_DEMAND_ATTACH_FS @@ -2172,14 +2215,13 @@ SAFSVolListOneVolume(struct rx_call *acid, afs_int32 partid, return code; } -afs_int32 +static afs_int32 VolListOneVolume(struct rx_call *acid, afs_int32 partid, afs_uint32 volumeId, volEntries *volumeInfo) { volintInfo *pntr; struct DiskPartition64 *partP; char pname[9], volname[20]; - afs_int32 error = 0; DIR *dirp; afs_uint32 volid; int found = 0; @@ -2272,7 +2314,7 @@ SAFSVolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, return code; } -afs_int32 +static afs_int32 VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, afs_uint32 a_volID, volXEntries *a_volumeXInfoP) { /*SAFSVolXListOneVolume */ @@ -2384,7 +2426,7 @@ SAFSVolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags, return code; } -afs_int32 +static afs_int32 VolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags, volEntries *volumeInfo) { @@ -2392,7 +2434,6 @@ VolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags, struct DiskPartition64 *partP; afs_int32 allocSize = 1000; /*to be changed to a larger figure */ char pname[9], volname[20]; - afs_int32 error = 0; DIR *dirp; afs_uint32 volid; int code; @@ -2445,7 +2486,6 @@ VolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags, /*just volids are needed */ } - drop: pntr++; volumeInfo->volEntries_len += 1; if ((allocSize - volumeInfo->volEntries_len) < 5) { @@ -2511,7 +2551,7 @@ SAFSVolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID, return code; } -afs_int32 +static afs_int32 VolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID, afs_int32 a_flags, volXEntries *a_volumeXInfoP) { /*SAFSVolXListVolumes */ @@ -2520,7 +2560,6 @@ VolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID, struct DiskPartition64 *partP; /*Ptr to partition */ afs_int32 allocSize = 1000; /*To be changed to a larger figure */ char pname[9], volname[20]; /*Partition, volume names */ - afs_int32 error = 0; /*Return code */ DIR *dirp; /*Partition directory ptr */ afs_uint32 volid; /*Current volume ID */ int code; @@ -2599,7 +2638,6 @@ VolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID, xInfoP->volid = volid; } - drop: /* * Bump the pointer in the data area we're building, along with * the count of the number of entries it contains. @@ -2658,7 +2696,7 @@ SAFSVolMonitor(struct rx_call *acid, transDebugEntries *transInfo) return code; } -afs_int32 +static afs_int32 VolMonitor(struct rx_call *acid, transDebugEntries *transInfo) { transDebugInfo *pntr; @@ -2715,7 +2753,9 @@ VolMonitor(struct rx_call *acid, transDebugEntries *transInfo) } afs_int32 -SAFSVolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], afs_int32 type, afs_uint32 pId, afs_uint32 cloneId, afs_uint32 backupId) +SAFSVolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], + afs_int32 type, afs_uint32 pId, afs_uint32 cloneId, + afs_uint32 backupId) { afs_int32 code; @@ -2726,11 +2766,13 @@ SAFSVolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], afs_int32 return code; } -afs_int32 -VolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], afs_int32 type, afs_uint32 pId, afs_uint32 cloneId, afs_uint32 backupId) +static afs_int32 +VolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], + afs_int32 type, afs_uint32 pId, afs_uint32 cloneId, + afs_uint32 backupId) { struct Volume *tv; - afs_int32 error = 0; + Error error = 0; register struct volser_trans *tt; char caller[MAXKTCNAMELEN]; @@ -2785,11 +2827,11 @@ SAFSVolSetDate(struct rx_call *acid, afs_int32 atid, afs_int32 cdate) return code; } -afs_int32 +static afs_int32 VolSetDate(struct rx_call *acid, afs_int32 atid, afs_int32 cdate) { struct Volume *tv; - afs_int32 error = 0; + Error error = 0; register struct volser_trans *tt; char caller[MAXKTCNAMELEN]; @@ -2917,11 +2959,11 @@ SAFSVolGetSize(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, } afs_int32 -SAFSVolSplitVolume(struct rx_call *acall, afs_uint32 vid, afs_uint32 new, +SAFSVolSplitVolume(struct rx_call *acall, afs_uint32 vid, afs_uint32 new, afs_uint32 where, afs_int32 verbose) { #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV) - afs_int32 code, code2; + Error code, code2; Volume *vol=0, *newvol=0; struct volser_trans *tt = 0, *tt2 = 0; char caller[MAXKTCNAMELEN]; diff --git a/src/volser/volser.p.h b/src/volser/volser.p.h index d9787f0bf7..c9013ef76e 100644 --- a/src/volser/volser.p.h +++ b/src/volser/volser.p.h @@ -175,7 +175,10 @@ struct partList { /*used by the backup system */ struct ubik_client; extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp); extern int vsu_ExtractName(char rname[], char name[]); -extern afs_int32 vsu_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth, struct ubik_client **uclientp, int (*secproc)()); +extern afs_int32 vsu_ClientInit(int noAuthFlag, char *confDir, + char *cellName, afs_int32 sauth, + struct ubik_client **uclientp, + int (*secproc)(struct rx_securityClass *, afs_int32)); extern void vsu_SetCrypt(int cryptflag); #endif /* _VOLSER_ */ diff --git a/src/volser/volser_prototypes.h b/src/volser/volser_prototypes.h index b2ce8764ad..c7bd0a5407 100644 --- a/src/volser/volser_prototypes.h +++ b/src/volser/volser_prototypes.h @@ -11,6 +11,27 @@ #define _VOLSER_PROTOTYPES_H /* common.c */ +#ifndef AFS_PTHREAD_ENV +extern void Log(const char *, ...); +#endif +extern void InitErrTabs(void); + +/* vol_split.c */ +extern afs_int32 split_volume(struct rx_call *, Volume *, Volume *, + afs_uint32, afs_int32); + +/* voltrans.c */ +extern struct volser_trans *FindTrans(afs_int32); +extern struct volser_trans *NewTrans(afs_int32, afs_int32); +extern struct volser_trans *TransList(void); +extern afs_int32 DeleteTrans(struct volser_trans *atrans, afs_int32 lock); +extern afs_int32 TRELE (struct volser_trans *); + +/* volprocs.c */ +extern int VPFullUnlock(void); + +/* voltrans.c */ +extern afs_int32 GCTrans(void); /* vsprocs.c */ struct nvldbentry; @@ -50,15 +71,21 @@ extern int UV_ReleaseVolume(afs_uint32 afromvol, afs_int32 afromserver, extern void dump_sig_handler(int x); extern int UV_DumpVolume(afs_uint32 afromvol, afs_int32 afromserver, afs_int32 afrompart, afs_int32 fromdate, - afs_int32(*DumpFunction) (), char *rock, afs_int32 flags); + afs_int32(*DumpFunction) (struct rx_call *, void *), + void *rock, afs_int32 flags); extern int UV_RestoreVolume(afs_int32 toserver, afs_int32 topart, - afs_uint32 tovolid, char tovolname[], int restoreflags, - afs_int32(*WriteData) (), char *rock); -extern int UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, afs_uint32 tovolid, - afs_int32 toparentid, char tovolname[], int flags, - afs_int32(*WriteData) (), char *rock); + afs_uint32 tovolid, char tovolname[], + int restoreflags, + afs_int32(*WriteData) (struct rx_call *, void *), + void *rock); +extern int UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, + afs_uint32 tovolid, afs_int32 toparentid, + char tovolname[], int flags, + afs_int32(*WriteData) (struct rx_call *, void *), + void *rock); extern int UV_LockRelease(afs_uint32 volid); -extern int UV_AddSite(afs_int32 server, afs_int32 part, afs_uint32 volid, afs_int32 valid); +extern int UV_AddSite(afs_int32 server, afs_int32 part, afs_uint32 volid, + afs_int32 valid); extern int UV_RemoveSite(afs_int32 server, afs_int32 part, afs_uint32 volid); extern int UV_ChangeLocation(afs_int32 server, afs_int32 part, afs_uint32 volid); @@ -113,8 +140,9 @@ extern int UV_CloneVolume(afs_int32 aserver, afs_int32 apart, afs_uint32 avolid, afs_uint32 acloneid, char *aname, int flags); extern int UV_DumpClonedVolume(afs_uint32 afromvol, afs_int32 afromserver, afs_int32 afrompart, afs_int32 fromdate, - afs_int32(*DumpFunction) (), char *rock, - afs_int32 flags); + afs_int32(*DumpFunction) + (struct rx_call *, void *), + void *rock, afs_int32 flags); extern int UV_GetSize(afs_uint32 afromvol, afs_int32 afromserver, afs_int32 afrompart, afs_int32 fromdate, struct volintSize *vol_size); diff --git a/src/volser/voltrans.c b/src/volser/voltrans.c index 23294f8794..4e7184191c 100644 --- a/src/volser/voltrans.c +++ b/src/volser/voltrans.c @@ -60,9 +60,9 @@ #include #include +#include "volint.h" #include "volser.h" - -/*@printflike@*/ extern void Log(const char *format, ...); +#include "volser_prototypes.h" static struct volser_trans *allTrans = 0; static afs_int32 transCounter = 1; @@ -126,7 +126,7 @@ afs_int32 DeleteTrans(register struct volser_trans *atrans, afs_int32 lock) { register struct volser_trans *tt, **lt; - afs_int32 error; + Error error; if (lock) VTRANS_LOCK; if (atrans->refCount > 1) { @@ -186,7 +186,7 @@ TRELE(register struct volser_trans *at) #define OLDTRANSWARN 300 /* seconds */ static int GCDeletes = 0; afs_int32 -GCTrans() +GCTrans(void) { register struct volser_trans *tt, *nt; afs_int32 now; @@ -217,7 +217,7 @@ GCTrans() /*return the head of the transaction list */ struct volser_trans * -TransList() +TransList(void) { return (allTrans); } diff --git a/src/volser/vos.c b/src/volser/vos.c index 0d97a553c4..c167a53f54 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -118,7 +118,7 @@ qPut(struct tqHead *ahead, afs_uint32 volid) } static void -qGet(struct tqHead *ahead, afs_int32 *volid) +qGet(struct tqHead *ahead, afs_uint32 *volid) { struct tqElem *tmp; @@ -313,9 +313,9 @@ SendFile(usd_handle_t ufd, register struct rx_call *call, long blksize) /* function invoked by UV_RestoreVolume, reads the data from rx_trx_stream and * writes it out to the volume. */ afs_int32 -WriteData(struct rx_call *call, char *rock) +WriteData(struct rx_call *call, void *rock) { - char *filename; + char *filename = (char *) rock; usd_handle_t ufd; long blksize; afs_int32 error, code; @@ -326,7 +326,6 @@ WriteData(struct rx_call *call, char *rock) error = 0; - filename = rock; if (!filename || !*filename) { usd_StandardInput(&ufd); blksize = 4096; @@ -421,8 +420,9 @@ ReceiveFile(usd_handle_t ufd, struct rx_call *call, long blksize) } afs_int32 -DumpFunction(struct rx_call *call, char *filename) +DumpFunction(struct rx_call *call, void *rock) { + char *filename = (char *)rock; usd_handle_t ufd; /* default is to stdout */ afs_int32 error = 0, code; afs_hyper_t size; @@ -478,12 +478,9 @@ vos_ctime(afs_int32 *timep) } static void -DisplayFormat(pntr, server, part, totalOK, totalNotOK, totalBusy, fast, - longlist, disp) - volintInfo *pntr; - afs_int32 server, part; - int *totalOK, *totalNotOK, *totalBusy; - int fast, longlist, disp; +DisplayFormat(volintInfo *pntr, afs_int32 server, afs_int32 part, + int *totalOK, int *totalNotOK, int *totalBusy, int fast, + int longlist, int disp) { char pname[10]; @@ -619,18 +616,9 @@ DisplayFormat(pntr, server, part, totalOK, totalNotOK, totalBusy, fast, *------------------------------------------------------------------------*/ static void -XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, a_totalNotOKP, - a_totalBusyP, a_fast, a_int32, a_showProblems) - volintXInfo *a_xInfoP; - afs_int32 a_servID; - afs_int32 a_partID; - int *a_totalOKP; - int *a_totalNotOKP; - int *a_totalBusyP; - int a_fast; - int a_int32; - int a_showProblems; - +XDisplayFormat(volintXInfo *a_xInfoP, afs_int32 a_servID, afs_int32 a_partID, + int *a_totalOKP, int *a_totalNotOKP, int *a_totalBusyP, + int a_fast, int a_int32, int a_showProblems) { /*XDisplayFormat */ char pname[10]; @@ -854,18 +842,9 @@ XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, a_totalNotOKP, *------------------------------------------------------------------------*/ static void -XDisplayFormat2(a_xInfoP, a_servID, a_partID, a_totalOKP, a_totalNotOKP, - a_totalBusyP, a_fast, a_int32, a_showProblems) - volintXInfo *a_xInfoP; - afs_int32 a_servID; - afs_int32 a_partID; - int *a_totalOKP; - int *a_totalNotOKP; - int *a_totalBusyP; - int a_fast; - int a_int32; - int a_showProblems; - +XDisplayFormat2(volintXInfo *a_xInfoP, afs_int32 a_servID, afs_int32 a_partID, + int *a_totalOKP, int *a_totalNotOKP, int *a_totalBusyP, + int a_fast, int a_int32, int a_showProblems) { /*XDisplayFormat */ if (a_fast) { /* @@ -1035,9 +1014,7 @@ XDisplayFormat2(a_xInfoP, a_servID, a_partID, a_totalOKP, a_totalNotOKP, #ifdef FULL_LISTVOL_SWITCH static void -DisplayFormat2(server, partition, pntr) - long server, partition; - volintInfo *pntr; +DisplayFormat2(long server, long partition, volintInfo *pntr) { static long server_cache = -1, partition_cache = -1; static char hostname[256], address[32], pname[16]; @@ -1127,9 +1104,7 @@ DisplayFormat2(server, partition, pntr) } static void -DisplayVolumes2(server, partition, pntr, count) - volintInfo *pntr; - long server, partition, count; +DisplayVolumes2(long server, long partition, volintInfo *pntr, long count) { long i; @@ -1144,11 +1119,9 @@ DisplayVolumes2(server, partition, pntr, count) #endif /* FULL_LISTVOL_SWITCH */ static void -DisplayVolumes(server, part, pntr, count, longlist, fast, quiet) - afs_int32 server, part; - volintInfo *pntr; - afs_int32 count, longlist, fast; - int quiet; +DisplayVolumes(afs_int32 server, afs_int32 part, volintInfo *pntr, + afs_int32 count, afs_int32 longlist, afs_int32 fast, + int quiet) { int totalOK, totalNotOK, totalBusy, i; afs_uint32 volid = 0; @@ -1212,16 +1185,9 @@ DisplayVolumes(server, part, pntr, count, longlist, fast, quiet) *------------------------------------------------------------------------*/ static void -XDisplayVolumes(a_servID, a_partID, a_xInfoP, a_count, a_int32, a_fast, - a_quiet) - afs_int32 a_servID; - afs_int32 a_partID; - volintXInfo *a_xInfoP; - afs_int32 a_count; - afs_int32 a_int32; - afs_int32 a_fast; - int a_quiet; - +XDisplayVolumes(afs_int32 a_servID, afs_int32 a_partID, volintXInfo *a_xInfoP, + afs_int32 a_count, afs_int32 a_int32, afs_int32 a_fast, + int a_quiet) { /*XDisplayVolumes */ int totalOK; /*Total OK volumes */ @@ -1303,16 +1269,9 @@ XDisplayVolumes(a_servID, a_partID, a_xInfoP, a_count, a_int32, a_fast, *------------------------------------------------------------------------*/ static void -XDisplayVolumes2(a_servID, a_partID, a_xInfoP, a_count, a_int32, a_fast, - a_quiet) - afs_int32 a_servID; - afs_int32 a_partID; - volintXInfo *a_xInfoP; - afs_int32 a_count; - afs_int32 a_int32; - afs_int32 a_fast; - int a_quiet; - +XDisplayVolumes2(afs_int32 a_servID, afs_int32 a_partID, volintXInfo *a_xInfoP, + afs_int32 a_count, afs_int32 a_int32, afs_int32 a_fast, + int a_quiet) { /*XDisplayVolumes */ int totalOK; /*Total OK volumes */ @@ -1375,11 +1334,8 @@ XDisplayVolumes2(a_servID, a_partID, a_xInfoP, a_count, a_int32, a_fast, /* set and to the correct values depending on * and */ static void -GetServerAndPart(entry, voltype, server, part, previdx) - struct nvldbentry *entry; - afs_int32 *server, *part; - int voltype; - int *previdx; +GetServerAndPart(struct nvldbentry *entry, int voltype, afs_int32 *server, + afs_int32 *part, int *previdx) { int i, istart, vtype; @@ -1444,13 +1400,8 @@ PostVolumeStats(struct nvldbentry *entry) *------------------------------------------------------------------------*/ static void -XVolumeStats(a_xInfoP, a_entryP, a_srvID, a_partID, a_volType) - volintXInfo *a_xInfoP; - struct nvldbentry *a_entryP; - afs_int32 a_srvID; - afs_int32 a_partID; - int a_volType; - +XVolumeStats(volintXInfo *a_xInfoP, struct nvldbentry *a_entryP, + afs_int32 a_srvID, afs_int32 a_partID, int a_volType) { /*XVolumeStats */ int totalOK, totalNotOK, totalBusy; /*Dummies - we don't really count here */ @@ -1702,7 +1653,6 @@ static int SetFields(register struct cmd_syndesc *as, void *arock) { struct nvldbentry entry; - afs_int32 vcode = 0; volintInfo info; afs_uint32 volid; afs_int32 code, err; @@ -1979,9 +1929,9 @@ CreateVolume(register struct cmd_syndesc *as, void *arock) return 0; } +#if 0 static afs_int32 -DeleteAll(entry) - struct nvldbentry *entry; +DeleteAll(struct nvldbentry *entry) { int i; afs_int32 error, code, curserver, curpart; @@ -2003,6 +1953,7 @@ DeleteAll(entry) } return error; } +#endif static int DeleteVolume(struct cmd_syndesc *as, void *arock) @@ -2125,7 +2076,7 @@ DeleteVolume(struct cmd_syndesc *as, void *arock) } #define TESTM 0 /* set for move space tests, clear for production */ -static +static int MoveVolume(register struct cmd_syndesc *as, void *arock) { @@ -2826,8 +2777,8 @@ ReleaseVolume(register struct cmd_syndesc *as, void *arock) return 0; } -static -DumpVolume(register struct cmd_syndesc *as, void *arock) +static int +DumpVolumeCmd(register struct cmd_syndesc *as, void *arock) { afs_uint32 avolid; afs_int32 aserver, apart, voltype, fromdate = 0, code, err, i, flags; @@ -2928,7 +2879,7 @@ retry_dump: #define TS_NEW 3 static int -RestoreVolume(register struct cmd_syndesc *as, void *arock) +RestoreVolumeCmd(register struct cmd_syndesc *as, void *arock) { afs_uint32 avolid, aparentid; afs_int32 aserver, apart, code, vcode, err; @@ -3442,8 +3393,7 @@ ListPartitions(register struct cmd_syndesc *as, void *arock) } static int -CompareVolName(p1, p2) - char *p1, *p2; +CompareVolName(const void *p1, const void *p2) { volintInfo *arg1, *arg2; @@ -3476,9 +3426,7 @@ CompareVolName(p1, p2) *------------------------------------------------------------------------*/ static int -XCompareVolName(a_obj1P, a_obj2P) - char *a_obj1P, *a_obj2P; - +XCompareVolName(const void *a_obj1P, const void *a_obj2P) { /*XCompareVolName */ return (strcmp @@ -3488,8 +3436,7 @@ XCompareVolName(a_obj1P, a_obj2P) } /*XCompareVolName */ static int -CompareVolID(p1, p2) - char *p1, *p2; +CompareVolID(const void *p1, const void *p2) { volintInfo *arg1, *arg2; @@ -3527,9 +3474,7 @@ CompareVolID(p1, p2) *------------------------------------------------------------------------*/ static int -XCompareVolID(a_obj1P, a_obj2P) - char *a_obj1P, *a_obj2P; - +XCompareVolID(const void *a_obj1P, const void *a_obj2P) { /*XCompareVolID */ afs_int32 id1, id2; /*Volume IDs we're comparing */ @@ -3565,7 +3510,7 @@ XCompareVolID(a_obj1P, a_obj2P) * As advertised. *------------------------------------------------------------------------*/ -static +static int ListVolumes(register struct cmd_syndesc *as, void *arock) { afs_int32 apart, int32list, fast; @@ -3859,9 +3804,8 @@ SyncServer(register struct cmd_syndesc *as, void *arock) } -static -VolumeInfoCmd(name) - char *name; +static int +VolumeInfoCmd(char *name) { struct nvldbentry entry; afs_int32 vcode; @@ -4361,8 +4305,7 @@ DeleteEntry(register struct cmd_syndesc *as, void *arock) static int -CompareVldbEntryByName(p1, p2) - char *p1, *p2; +CompareVldbEntryByName(const void *p1, const void *p2) { struct nvldbentry *arg1, *arg2; @@ -4372,8 +4315,7 @@ CompareVldbEntryByName(p1, p2) } /* -static int CompareVldbEntry(p1,p2) -char *p1,*p2; +static int CompareVldbEntry(char *p1, char *p2) { struct nvldbentry *arg1,*arg2; int i; @@ -4595,10 +4537,10 @@ BackSys(register struct cmd_syndesc *as, void *arock) int seenprefix, seenxprefix, exclude, ex, exp, noaction; afs_int32 totalBack = 0; afs_int32 totalFail = 0; - int previdx = -1, error, same; - int comp = 0; + int previdx = -1; + int error; + int same = 0; struct cmd_item *ti; - char *ccode; int match = 0; memset(&attributes, 0, sizeof(struct VldbListByAttributes)); @@ -4913,7 +4855,7 @@ static int UnlockVLDB(register struct cmd_syndesc *as, void *arock) { afs_int32 apart; - afs_int32 aserver = NULL; + afs_int32 aserver = 0; afs_int32 code; afs_int32 vcode; struct VldbListByAttributes attributes; @@ -5704,7 +5646,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock) } int -osi_audit() +osi_audit(void) { /* this sucks but it works for now. */ @@ -5713,9 +5655,8 @@ osi_audit() #include "AFS_component_version_number.c" -main(argc, argv) - int argc; - char **argv; +int +main(int argc, char **argv) { register afs_int32 code; @@ -5839,7 +5780,7 @@ main(argc, argv) "force a complete release"); COMMONPARMS; - ts = cmd_CreateSyntax("dump", DumpVolume, NULL, "dump a volume"); + ts = cmd_CreateSyntax("dump", DumpVolumeCmd, NULL, "dump a volume"); cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID"); cmd_AddParm(ts, "-time", CMD_SINGLE, CMD_OPTIONAL, "dump from time"); cmd_AddParm(ts, "-file", CMD_SINGLE, CMD_OPTIONAL, "dump file"); @@ -5851,7 +5792,8 @@ main(argc, argv) "omit unchanged directories from an incremental dump"); COMMONPARMS; - ts = cmd_CreateSyntax("restore", RestoreVolume, NULL, "restore a volume"); + ts = cmd_CreateSyntax("restore", RestoreVolumeCmd, NULL, + "restore a volume"); cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name"); cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name"); cmd_AddParm(ts, "-name", CMD_SINGLE, 0, "name of volume to be restored"); diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index ed5bb97ae3..f2de346902 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -43,6 +43,12 @@ #include #include #include +#include +#ifdef AFS_NT40_ENV +#include +#endif +#include +#include #include #define ERRCODE_RANGE 8 /* from error_table.h */ #define CLOCKSKEW 2 /* not really skew, but resolution */ @@ -3916,7 +3922,8 @@ dump_sig_handler(int x) */ int UV_DumpVolume(afs_uint32 afromvol, afs_int32 afromserver, afs_int32 afrompart, - afs_int32 fromdate, afs_int32(*DumpFunction) (), char *rock, + afs_int32 fromdate, + afs_int32(*DumpFunction) (struct rx_call *, void *), void *rock, afs_int32 flags) { struct rx_connection *fromconn = (struct rx_connection *)0; @@ -4005,13 +4012,14 @@ UV_DumpVolume(afs_uint32 afromvol, afs_int32 afromserver, afs_int32 afrompart, int UV_DumpClonedVolume(afs_uint32 afromvol, afs_int32 afromserver, afs_int32 afrompart, afs_int32 fromdate, - afs_int32(*DumpFunction) (), char *rock, afs_int32 flags) + afs_int32(*DumpFunction) (struct rx_call *, void *), + void *rock, afs_int32 flags) { struct rx_connection *fromconn = (struct rx_connection *)0; struct rx_call *fromcall = (struct rx_call *)0; afs_int32 fromtid = 0, rxError = 0, rcode = 0; afs_int32 clonetid = 0; - afs_int32 code = 0, vcode = 0, error = 0; + afs_int32 code = 0, error = 0; afs_uint32 clonevol = 0; char vname[64]; time_t tmv = fromdate; @@ -4148,7 +4156,8 @@ UV_DumpClonedVolume(afs_uint32 afromvol, afs_int32 afromserver, int UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, afs_uint32 tovolid, afs_int32 toparentid, char tovolname[], int flags, - afs_int32(*WriteData) (), char *rock) + afs_int32(*WriteData) (struct rx_call *, void *), + void *rock) { struct rx_connection *toconn, *tempconn; struct rx_call *tocall; @@ -4629,8 +4638,9 @@ UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, afs_uint32 tovolid, int UV_RestoreVolume(afs_int32 toserver, afs_int32 topart, afs_uint32 tovolid, - char tovolname[], int flags, afs_int32(*WriteData) (), - char *rock) + char tovolname[], int flags, + afs_int32(*WriteData) (struct rx_call *, void *), + void *rock) { return UV_RestoreVolume2(toserver, topart, tovolid, 0, tovolname, flags, WriteData, rock); diff --git a/src/volser/vsutils.c b/src/volser/vsutils.c index d9b9b61b99..10fd1c71ba 100644 --- a/src/volser/vsutils.c +++ b/src/volser/vsutils.c @@ -13,6 +13,7 @@ #include #include +#include #ifdef AFS_NT40_ENV #include #include @@ -384,7 +385,8 @@ vsu_SetCrypt(int cryptflag) */ afs_int32 vsu_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth, - struct ubik_client **uclientp, int (*secproc)()) + struct ubik_client **uclientp, + int (*secproc)(struct rx_securityClass *, afs_int32)) { return ugen_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp, secproc, "vsu_ClientInit", vsu_rxkad_level, diff --git a/src/volser/vsutils_prototypes.h b/src/volser/vsutils_prototypes.h index a4b16bf297..54d085b946 100644 --- a/src/volser/vsutils_prototypes.h +++ b/src/volser/vsutils_prototypes.h @@ -12,7 +12,7 @@ extern int VLDB_ListAttributesN2(VldbListByAttributes *attrp, char *name, afs_in extern int VLDB_IsSameAddrs(afs_int32 serv1, afs_int32 serv2, afs_int32 *errorp); extern void vsu_SetCrypt(int cryptflag); extern afs_int32 vsu_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth, - struct ubik_client **uclientp, int (*secproc)()); + struct ubik_client **uclientp, int (*secproc)(struct rx_securityClass *, afs_int32)); extern int vsu_ExtractName(char rname[], char name[]); extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp); #endif