From: Jeffrey Altman Date: Sat, 5 Mar 2011 05:40:13 +0000 (-0500) Subject: Revert "Convert from using nvldbentry to uvldbentry" X-Git-Tag: openafs-devel-1_7_1~850 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=9e539fbea456cdb416a487364d67ab54da1249a7;hp=ca0ae15d621dbd90339408a26715a107d1f69f23 Revert "Convert from using nvldbentry to uvldbentry" This reverts commit 4f1efdc8b73ed734197925766530d033c6f9794a. The conversion to uvldbentry produced too many negative side effects. Revisit support for multi-homed servers when vos is executed from a machine that can only see a random subset of the addresses assigned to the server in the future. Change-Id: Idec5f1a3126266609edb3f657c34c160086ecbe7 Reviewed-on: http://gerrit.openafs.org/4131 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/volser/lockprocs.c b/src/volser/lockprocs.c index 7ab1c57..fc4fa1f 100644 --- a/src/volser/lockprocs.c +++ b/src/volser/lockprocs.c @@ -44,8 +44,8 @@ * If server is zero, will match first index of ANY server and partition * Zero is a valid partition field. */ -static int -FindIndex(struct uvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 type) +int +FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 type) { int e; afs_int32 error = 0; @@ -54,7 +54,7 @@ FindIndex(struct uvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 if (!type || (entry->serverFlags[e] & type)) { if ((!server || (entry->serverPartition[e] == part)) && (!server - || VLDB_IsSameAddrs(entry->serverUnique[e], server, + || VLDB_IsSameAddrs(entry->serverNumber[e], server, &error))) break; if (type == ITSRWVOL) @@ -65,7 +65,7 @@ FindIndex(struct uvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 if (error) { fprintf(STDERR, "Failed to get info about server's %d address(es) from vlserver (err=%d)\n", - entry->serverUnique[e], error); + entry->serverNumber[e], error); return -1; } @@ -76,8 +76,8 @@ FindIndex(struct uvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 } /* Changes the rw site only */ -static void -SetAValue(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart, +void +SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart, afs_uint32 nserver, afs_int32 npart, afs_int32 type) { int e; @@ -86,13 +86,13 @@ SetAValue(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart, if (e == -1) return; /* If didn't find it, just return */ - entry->serverUnique[e] = nserver; + entry->serverNumber[e] = nserver; entry->serverPartition[e] = npart; /* Now move rest of entries up */ if ((nserver == 0L) && (npart == 0L)) { for (e++; e < entry->nServers; e++) { - entry->serverUnique[e - 1] = entry->serverUnique[e]; + entry->serverNumber[e - 1] = entry->serverNumber[e]; entry->serverPartition[e - 1] = entry->serverPartition[e]; entry->serverFlags[e - 1] = entry->serverFlags[e]; } @@ -101,18 +101,7 @@ SetAValue(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart, /* Changes the RW site only */ void -Lp_SetRWValue(struct nvldbentry *entryp, afs_uint32 oserver, afs_int32 opart, - afs_uint32 nserver, afs_int32 npart) -{ - struct uvldbentry uentry; - - nvlentry_to_uvlentry(entryp, &uentry); - SetAValue(&uentry, oserver, opart, nserver, npart, ITSRWVOL); - uvlentry_to_nvlentry(&uentry, entryp); -} - -void -Lp_SetRWValueU(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart, +Lp_SetRWValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart, afs_uint32 nserver, afs_int32 npart) { SetAValue(entry, oserver, opart, nserver, npart, ITSRWVOL); @@ -120,18 +109,7 @@ Lp_SetRWValueU(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart, /* Changes the RO site only */ void -Lp_SetROValue(struct nvldbentry *entryp, afs_uint32 oserver, - afs_int32 opart, afs_uint32 nserver, afs_int32 npart) -{ - struct uvldbentry uentry; - - nvlentry_to_uvlentry(entryp, &uentry); - SetAValue(&uentry, oserver, opart, nserver, npart, ITSROVOL); - uvlentry_to_nvlentry(&uentry, entryp); -} - -void -Lp_SetROValueU(struct uvldbentry *entry, afs_uint32 oserver, +Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart, afs_uint32 nserver, afs_int32 npart) { SetAValue(entry, oserver, opart, nserver, npart, ITSROVOL); @@ -140,20 +118,7 @@ Lp_SetROValueU(struct uvldbentry *entry, afs_uint32 oserver, /* Returns success if this server and partition matches the RW entry */ int Lp_Match(afs_uint32 server, afs_int32 part, - struct nvldbentry *entryp) -{ - struct uvldbentry uentry; - - nvlentry_to_uvlentry(entryp, &uentry); - if (FindIndex(&uentry, server, part, ITSRWVOL) == -1) - return 0; - uvlentry_to_nvlentry(&uentry, entryp); - return 1; -} - -int -Lp_MatchU(afs_uint32 server, afs_int32 part, - struct uvldbentry *entry) + struct nvldbentry *entry) { if (FindIndex(entry, server, part, ITSRWVOL) == -1) return 0; @@ -162,40 +127,14 @@ Lp_MatchU(afs_uint32 server, afs_int32 part, /* Return the index of the RO entry (plus 1) if it exists, else return 0 */ int -Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entryp) -{ - struct uvldbentry uentry; - int idx; - - nvlentry_to_uvlentry(entryp, &uentry); - idx = (FindIndex(&uentry, server, part, ITSROVOL) + 1); - if (idx) - uvlentry_to_nvlentry(&uentry, entryp); - return idx; -} - -int -Lp_ROMatchU(afs_uint32 server, afs_int32 part, struct uvldbentry *entry) +Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entry) { return (FindIndex(entry, server, part, ITSROVOL) + 1); } /* Return the index of the RW entry if it exists, else return -1 */ int -Lp_GetRwIndex(struct nvldbentry *entryp) -{ - struct uvldbentry uentry; - int idx; - - nvlentry_to_uvlentry(entryp, &uentry); - idx = (FindIndex(&uentry, 0, 0, ITSRWVOL)); - if (idx > -1) - uvlentry_to_nvlentry(&uentry, entryp); - return idx; -} - -int -Lp_GetRwIndexU(struct uvldbentry *entry) +Lp_GetRwIndex(struct nvldbentry *entry) { return (FindIndex(entry, 0, 0, ITSRWVOL)); } diff --git a/src/volser/lockprocs_prototypes.h b/src/volser/lockprocs_prototypes.h index 50b079a..9c9e990 100644 --- a/src/volser/lockprocs_prototypes.h +++ b/src/volser/lockprocs_prototypes.h @@ -1,6 +1,8 @@ #ifndef _LOCKPROCS_PROTOTYPES_H #define _LOCKPROCS_PROTOTYPES_H -/* older nvldbentry versions */ +extern int FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 type); +extern void SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart, + afs_uint32 nserver, afs_int32 npart, afs_int32 type); extern void Lp_SetRWValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart, afs_uint32 nserver, afs_int32 npart); extern void Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver, @@ -8,16 +10,6 @@ extern void Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver, extern int Lp_Match(afs_uint32 server, afs_int32 part, struct nvldbentry *entry); extern int Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entry); extern int Lp_GetRwIndex(struct nvldbentry *entry); - -/* newer uvldbentry versions */ -extern void Lp_SetRWValueU(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart, - afs_uint32 nserver, afs_int32 npart); -extern void Lp_SetROValueU(struct uvldbentry *entry, afs_uint32 oserver, - afs_int32 opart, afs_uint32 nserver, afs_int32 npart); -extern int Lp_MatchU(afs_uint32 server, afs_int32 part, struct uvldbentry *entry); -extern int Lp_ROMatchU(afs_uint32 server, afs_int32 part, struct uvldbentry *entry); -extern int Lp_GetRwIndexU(struct uvldbentry *entry); - extern void Lp_QInit(struct qHead *ahead); extern void Lp_QAdd(struct qHead *ahead, struct aqueue *elem); extern int Lp_QScan(struct qHead *ahead, afs_int32 id, int *success, struct aqueue **elem); diff --git a/src/volser/volint.xg b/src/volser/volint.xg index 55b98e4..4d20f0a 100644 --- a/src/volser/volint.xg +++ b/src/volser/volint.xg @@ -212,7 +212,7 @@ struct pIDs { struct diskPartition { char name[32]; /* Mounted partition name */ char devName[32]; - int lock_fd; /* assigned from DiskPartition FD_t (64-bit on Windows) */ + int lock_fd; int totalUsable; int free; int minFree; @@ -222,7 +222,7 @@ struct diskPartition { struct diskPartition64 { char name[256]; /* Mounted partition name */ char devName[256]; - int lock_fd; /* assigned from DiskPartition64 FD_t (64-bit on Windows) */ + int lock_fd; afs_int64 totalUsable; afs_int64 free; afs_int64 minFree; diff --git a/src/volser/volser_internal.h b/src/volser/volser_internal.h index 41d13a6..26a9e85 100644 --- a/src/volser/volser_internal.h +++ b/src/volser/volser_internal.h @@ -32,12 +32,10 @@ extern int VPFullUnlock(void); extern afs_int32 GCTrans(void); /* vsprocs.c */ -struct uvldbentry; struct nvldbentry; +extern int yesprompt(char *str); extern int PrintError(char *msg, afs_int32 errcode); extern void init_volintInfo(struct volintInfo *vinfo); -extern void SubEnumerateEntryU(struct uvldbentry *entry); -extern void EnumerateEntryU(struct uvldbentry *entry); extern void SubEnumerateEntry(struct nvldbentry *entry); extern void EnumerateEntry(struct nvldbentry *entry); extern int UV_NukeVolume(afs_uint32 server, afs_int32 partid, afs_uint32 volid); @@ -64,6 +62,7 @@ extern int UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid); extern int UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, int forceflag); +extern void dump_sig_handler(int x); extern int UV_DumpVolume(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, afs_int32 fromdate, afs_int32(*DumpFunction) (struct rx_call *, void *), @@ -97,16 +96,22 @@ extern int UV_XListVolumes(afs_uint32 a_serverID, afs_int32 a_partID, extern int UV_XListOneVolume(afs_uint32 a_serverID, afs_int32 a_partID, afs_uint32 a_volID, struct volintXInfo **a_resultPP); +extern int sortVolumes(const void *a, const void *b); extern int UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags); extern int UV_SyncVldb(afs_uint32 aserver, afs_int32 apart, int flags, int force); +extern afs_int32 VolumeExists(afs_uint32 server, afs_int32 partition, + afs_uint32 volumeid); +extern afs_int32 CheckVldbRWBK(struct nvldbentry *entry, + afs_int32 * modified); +extern int CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified); +extern afs_int32 CheckVldb(struct nvldbentry *entry, afs_int32 * modified, + afs_int32 *deleted); extern int UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force); extern int UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[]); -extern int UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], - char newname[]); extern int UV_VolserStatus(afs_uint32 server, transDebugInfo ** rpntr, afs_int32 * rcount); extern int UV_VolumeZap(afs_uint32 server, afs_int32 part, afs_uint32 volid); @@ -115,7 +120,6 @@ extern int UV_SetVolume(afs_uint32 server, afs_int32 partition, afs_int32 setflag, int sleeptime); extern int UV_SetVolumeInfo(afs_uint32 server, afs_int32 partition, afs_uint32 volid, volintInfo * infop); -extern void MapNetworkToHostU(struct uvldbentry *old, struct uvldbentry *new); extern void MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new); extern int UV_CopyVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, char *atovolname, diff --git a/src/volser/volser_prototypes.h b/src/volser/volser_prototypes.h index fb00e7d..e41f37c 100644 --- a/src/volser/volser_prototypes.h +++ b/src/volser/volser_prototypes.h @@ -11,7 +11,6 @@ #define AFS_SRC_VOLSER_PROTOTYPES_H struct nvldbentry; -struct uvldbentry; struct volintInfo; /* vsprocs.c */ @@ -19,8 +18,6 @@ extern void MapPartIdIntoName(afs_int32 partId, char *partName); extern void MapHostToNetwork(struct nvldbentry *entry); -extern void MapHostToNetworkU(struct uvldbentry *entry); - extern struct rx_connection *UV_Bind(afs_uint32 aserver, afs_int32 port); extern int UV_CreateVolume(afs_uint32 aserver, afs_int32 apart, char *aname, diff --git a/src/volser/vos.c b/src/volser/vos.c index c1bd3b1..90a5ab5 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -77,7 +77,7 @@ /* Local Prototypes */ int PrintDiagnostics(char *astring, afs_int32 acode); int GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, - afs_int32 *voltype, struct uvldbentry *rentry); + afs_int32 *voltype, struct nvldbentry *rentry); struct tqElem { afs_uint32 volid; @@ -170,7 +170,8 @@ FileExists(char *filename) static int VolNameOK(char *name) { - size_t total; + int total; + total = strlen(name); if (!strcmp(&name[total - 9], ".readonly")) { @@ -186,8 +187,7 @@ VolNameOK(char *name) static int IsNumeric(char *name) { - int result, i; - size_t len; + int result, len, i; char *ptr; result = 1; @@ -1382,7 +1382,7 @@ XDisplayVolumes2(afs_uint32 a_servID, afs_int32 a_partID, volintXInfo *a_xInfoP, /* set and to the correct values depending on * and */ static void -GetServerAndPart(struct uvldbentry *entry, int voltype, afs_uint32 *server, +GetServerAndPart(struct nvldbentry *entry, int voltype, afs_uint32 *server, afs_int32 *part, int *previdx) { int i, istart, vtype; @@ -1400,10 +1400,9 @@ GetServerAndPart(struct uvldbentry *entry, int voltype, afs_uint32 *server, istart = ((*previdx < 0) ? 0 : *previdx + 1); } - for (i = istart; i < entry->nServers && i < NMAXNSERVERS; i++) { + for (i = istart; i < entry->nServers; i++) { if (entry->serverFlags[i] & vtype) { - /* *uuid = entry->serverNumber[i]; */ - *server = entry->serverUnique[i]; + *server = entry->serverNumber[i]; *part = entry->serverPartition[i]; *previdx = i; return; @@ -1442,9 +1441,9 @@ PrintLocked(afs_int32 aflags) } static void -PostVolumeStats(struct uvldbentry *entry) +PostVolumeStats(struct nvldbentry *entry) { - SubEnumerateEntryU(entry); + SubEnumerateEntry(entry); /* Check for VLOP_ALLOPERS */ PrintLocked(entry->flags); return; @@ -1474,7 +1473,7 @@ PostVolumeStats(struct uvldbentry *entry) *------------------------------------------------------------------------*/ static void -XVolumeStats(volintXInfo *a_xInfoP, struct uvldbentry *a_entryP, +XVolumeStats(volintXInfo *a_xInfoP, struct nvldbentry *a_entryP, afs_int32 a_srvID, afs_int32 a_partID, int a_volType) { /*XVolumeStats */ @@ -1494,7 +1493,7 @@ XVolumeStats(volintXInfo *a_xInfoP, struct uvldbentry *a_entryP, } /*XVolumeStats */ static void -VolumeStats_int(volintInfo *pntr, struct uvldbentry *entry, afs_uint32 server, +VolumeStats_int(volintInfo *pntr, struct nvldbentry *entry, afs_uint32 server, afs_int32 part, int voltype) { int totalOK, totalNotOK, totalBusy; @@ -1574,7 +1573,7 @@ NukeVolume(struct cmd_syndesc *as) static int ExamineVolume(struct cmd_syndesc *as, void *arock) { - struct uvldbentry entry; + struct nvldbentry entry; afs_int32 vcode = 0; volintInfo *pntr = (volintInfo *) 0; volintXInfo *xInfoP = (volintXInfo *) 0; @@ -1603,7 +1602,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock) (unsigned long)volid); fflush(STDOUT); } - vcode = VLDB_GetEntryByIDU(volid, -1, &entry); + vcode = VLDB_GetEntryByID(volid, -1, &entry); if (vcode) { fprintf(STDERR, "Could not fetch the entry for volume number %lu from VLDB \n", @@ -1612,7 +1611,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock) } if (verbose) fprintf(STDOUT, "done\n"); - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); if (entry.volumeId[RWVOL] == volid) voltype = RWVOL; @@ -1674,7 +1673,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock) XVolumeStats(xInfoP, &entry, aserver, apart, voltype); else if (as->parms[2].items) { DisplayFormat2(aserver, apart, pntr); - EnumerateEntryU(&entry); + EnumerateEntry(&entry); isSubEnum = 1; } else VolumeStats_int(pntr, &entry, aserver, apart, voltype); @@ -1727,7 +1726,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock) static int SetFields(struct cmd_syndesc *as, void *arock) { - struct uvldbentry entry; + struct nvldbentry entry; volintInfo info; afs_uint32 volid; afs_int32 code, err; @@ -1745,14 +1744,14 @@ SetFields(struct cmd_syndesc *as, void *arock) return -1; } - code = VLDB_GetEntryByIDU(volid, RWVOL, &entry); + code = VLDB_GetEntryByID(volid, RWVOL, &entry); if (code) { fprintf(STDERR, "Could not fetch the entry for volume number %lu from VLDB \n", (unsigned long)volid); return (code); } - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); GetServerAndPart(&entry, RWVOL, &aserver, &apart, &previdx); if (previdx == -1) { @@ -1929,7 +1928,7 @@ CreateVolume(struct cmd_syndesc *as, void *arock) afs_uint32 volid = 0, rovolid = 0, bkvolid = 0; afs_uint32 *arovolid; afs_int32 code; - struct uvldbentry entry; + struct nvldbentry entry; afs_int32 vcode; afs_int32 quota; @@ -1974,7 +1973,7 @@ CreateVolume(struct cmd_syndesc *as, void *arock) as->parms[2].items->data); return EINVAL; } - vcode = VLDB_GetEntryByNameU(as->parms[2].items->data, &entry); + vcode = VLDB_GetEntryByName(as->parms[2].items->data, &entry); if (!vcode) { fprintf(STDERR, "Volume %s already exists\n", as->parms[2].items->data); @@ -2038,16 +2037,16 @@ CreateVolume(struct cmd_syndesc *as, void *arock) #if 0 static afs_int32 -DeleteAll(struct uvldbentry *entry) +DeleteAll(struct nvldbentry *entry) { int i; afs_int32 error, code, curserver, curpart; afs_uint32 volid; - MapHostToNetworkU(entry); + MapHostToNetwork(entry); error = 0; for (i = 0; i < entry->nServers; i++) { - curserver = entry->serverUnique[i]; + curserver = entry->serverNumber[i]; curpart = entry->serverPartition[i]; if (entry->serverFlags[i] & ITSROVOL) { volid = entry->volumeId[ROVOL]; @@ -2115,9 +2114,9 @@ DeleteVolume(struct cmd_syndesc *as, void *arock) * them in from the VLDB entry. */ if ((partition == -1) || !server) { - struct uvldbentry entry; + struct nvldbentry entry; - code = VLDB_GetEntryByIDU(volid, -1, &entry); + code = VLDB_GetEntryByID(volid, -1, &entry); if (code) { fprintf(STDERR, "Could not fetch the entry for volume %lu from VLDB\n", @@ -2129,8 +2128,8 @@ DeleteVolume(struct cmd_syndesc *as, void *arock) if (((volid == entry.volumeId[RWVOL]) && (entry.flags & RW_EXISTS)) || ((volid == entry.volumeId[BACKVOL]) && (entry.flags & BACK_EXISTS))) { - idx = Lp_GetRwIndexU(&entry); - if ((idx == -1) || (server && (server != entry.serverUnique[idx])) + idx = Lp_GetRwIndex(&entry); + if ((idx == -1) || (server && (server != entry.serverNumber[idx])) || ((partition != -1) && (partition != entry.serverPartition[idx]))) { fprintf(STDERR, "VLDB: Volume '%s' no match\n", @@ -2143,7 +2142,7 @@ DeleteVolume(struct cmd_syndesc *as, void *arock) if (entry.serverFlags[j] != ITSROVOL) continue; - if (((server == 0) || (server == entry.serverUnique[j])) + if (((server == 0) || (server == entry.serverNumber[j])) && ((partition == -1) || (partition == entry.serverPartition[j]))) { if (idx != -1) { @@ -2166,7 +2165,7 @@ DeleteVolume(struct cmd_syndesc *as, void *arock) return ENOENT; } - server = htonl(entry.serverUnique[idx]); + server = htonl(entry.serverNumber[idx]); partition = entry.serverPartition[idx]; } @@ -2320,7 +2319,7 @@ CopyVolume(struct cmd_syndesc *as, void *arock) afs_uint32 fromserver, toserver; afs_int32 frompart, topart, code, err, flags; char fromPartName[10], toPartName[10], *tovolume; - struct uvldbentry entry; + struct nvldbentry entry; struct diskPartition64 partition; /* for space check */ volintInfo *p; @@ -2365,7 +2364,7 @@ CopyVolume(struct cmd_syndesc *as, void *arock) tovolume); return EINVAL; } - code = VLDB_GetEntryByNameU(tovolume, &entry); + code = VLDB_GetEntryByName(tovolume, &entry); if (!code) { fprintf(STDERR, "Volume %s already exists\n", tovolume); PrintDiagnostics("copy", code); @@ -2666,7 +2665,7 @@ CloneVolume(struct cmd_syndesc *as, void *arock) afs_int32 part, voltype; char partName[10], *volname; afs_int32 code, err, flags; - struct uvldbentry entry; + struct nvldbentry entry; volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); if (volid == 0) { @@ -2779,12 +2778,12 @@ BackupVolume(struct cmd_syndesc *as, void *arock) afs_uint32 avolid; afs_uint32 aserver; afs_int32 apart, vtype, code, err; - struct uvldbentry entry; + struct nvldbentry entry; afs_uint32 buvolid; afs_uint32 buserver; afs_int32 bupart, butype; - struct uvldbentry buentry; + struct nvldbentry buentry; avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); if (avolid == 0) { @@ -2849,7 +2848,7 @@ static int ReleaseVolume(struct cmd_syndesc *as, void *arock) { - struct uvldbentry entry; + struct nvldbentry entry; afs_uint32 avolid; afs_uint32 aserver; afs_int32 apart, vtype, code, err; @@ -2899,7 +2898,7 @@ DumpVolumeCmd(struct cmd_syndesc *as, void *arock) afs_uint32 aserver; afs_int32 apart, voltype, fromdate = 0, code, err, i, flags; char filename[MAXPATHLEN]; - struct uvldbentry entry; + struct nvldbentry entry; rx_SetRxDeadTime(60 * 10); for (i = 0; i < MAXSERVERS; i++) { @@ -3006,7 +3005,7 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock) int readonly = 0, offline = 0, voltype = RWVOL; char afilename[MAXPATHLEN], avolname[VOLSER_MAXVOLNAME + 1], apartName[10]; char volname[VOLSER_MAXVOLNAME + 1]; - struct uvldbentry entry; + struct nvldbentry entry; aparentid = 0; if (as->parms[4].items) { @@ -3128,7 +3127,7 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock) /* Check if volume exists or not */ vsu_ExtractName(volname, avolname); - vcode = VLDB_GetEntryByNameU(volname, &entry); + vcode = VLDB_GetEntryByName(volname, &entry); if (vcode) { /* no volume - do a full restore */ restoreflags = RV_FULLRST; if ((aoverwrite == INC) || (aoverwrite == ABORT)) @@ -3136,8 +3135,8 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock) "Volume does not exist; Will perform a full restore\n"); } - else if ((!readonly && Lp_GetRwIndexU(&entry) == -1) /* RW volume does not exist - do a full */ - ||(readonly && !Lp_ROMatchU(0, 0, &entry))) { /* RO volume does not exist - do a full */ + else if ((!readonly && Lp_GetRwIndex(&entry) == -1) /* RW volume does not exist - do a full */ + ||(readonly && !Lp_ROMatch(0, 0, &entry))) { /* RO volume does not exist - do a full */ restoreflags = RV_FULLRST; if ((aoverwrite == INC) || (aoverwrite == ABORT)) fprintf(STDERR, @@ -3156,7 +3155,7 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock) else { /* volume exists - do we do a full incremental or abort */ afs_uint32 Oserver; afs_int32 Opart, Otype, vol_elsewhere = 0; - struct uvldbentry Oentry; + struct nvldbentry Oentry; int c, dc; if (avolid == 0) { @@ -3933,19 +3932,19 @@ SyncServer(struct cmd_syndesc *as, void *arock) static int VolumeInfoCmd(char *name) { - struct uvldbentry entry; + struct nvldbentry entry; afs_int32 vcode; /* The vlserver will handle names with the .readonly * and .backup extension as well as volume ids. */ - vcode = VLDB_GetEntryByNameU(name, &entry); + vcode = VLDB_GetEntryByName(name, &entry); if (vcode) { PrintError("", vcode); exit(1); } - MapHostToNetworkU(&entry); - EnumerateEntryU(&entry); + MapHostToNetwork(&entry); + EnumerateEntry(&entry); /* Defect #3027: grubby check to handle locked volume. * If VLOP_ALLOPERS is set, the entry is locked. @@ -3959,7 +3958,7 @@ VolumeInfoCmd(char *name) static int VolumeZap(struct cmd_syndesc *as, void *arock) { - struct uvldbentry entry; + struct nvldbentry entry; afs_uint32 volid, zapbackupid = 0, backupid = 0; afs_int32 code, server, part, err; @@ -4002,7 +4001,7 @@ VolumeZap(struct cmd_syndesc *as, void *arock) as->parms[1].items->data); exit(1); } - code = VLDB_GetEntryByIDU(volid, -1, &entry); + code = VLDB_GetEntryByID(volid, -1, &entry); if (!code) { if (volid == entry.volumeId[RWVOL]) backupid = entry.volumeId[BACKVOL]; @@ -4144,15 +4143,15 @@ static int RenameVolume(struct cmd_syndesc *as, void *arock) { afs_int32 code1, code2, code; - struct uvldbentry entry; + struct nvldbentry entry; - code1 = VLDB_GetEntryByNameU(as->parms[0].items->data, &entry); + code1 = VLDB_GetEntryByName(as->parms[0].items->data, &entry); if (code1) { fprintf(STDERR, "vos: Could not find entry for volume %s\n", as->parms[0].items->data); exit(1); } - code2 = VLDB_GetEntryByNameU(as->parms[1].items->data, &entry); + code2 = VLDB_GetEntryByName(as->parms[1].items->data, &entry); if ((!code1) && (!code2)) { /*the newname already exists */ fprintf(STDERR, "vos: volume %s already exists\n", as->parms[1].items->data); @@ -4187,10 +4186,10 @@ RenameVolume(struct cmd_syndesc *as, void *arock) as->parms[1].items->data); exit(1); } - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); code = - UV_RenameVolumeU(&entry, as->parms[0].items->data, - as->parms[1].items->data); + UV_RenameVolume(&entry, as->parms[0].items->data, + as->parms[1].items->data); if (code) { PrintDiagnostics("rename", code); exit(1); @@ -4202,12 +4201,12 @@ RenameVolume(struct cmd_syndesc *as, void *arock) int GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 *voltype, - struct uvldbentry *rentry) + struct nvldbentry *rentry) { afs_int32 vcode; int i, index = -1; - vcode = VLDB_GetEntryByIDU(volid, -1, rentry); + vcode = VLDB_GetEntryByID(volid, -1, rentry); if (vcode) { fprintf(STDERR, "Could not fetch the entry for volume %lu from VLDB \n", @@ -4215,7 +4214,7 @@ GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 * PrintError("", vcode); return (vcode); } - MapHostToNetworkU(rentry); + MapHostToNetwork(rentry); if (volid == rentry->volumeId[ROVOL]) { *voltype = ROVOL; for (i = 0; i < rentry->nServers; i++) { @@ -4230,12 +4229,12 @@ GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 * return -1; } - *server = rentry->serverUnique[index]; + *server = rentry->serverNumber[index]; *part = rentry->serverPartition[index]; return 0; } - index = Lp_GetRwIndexU(rentry); + index = Lp_GetRwIndex(rentry); if (index == -1) { fprintf(STDERR, "RW Volume is not found in VLDB entry for volume %lu\n", @@ -4244,13 +4243,13 @@ GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 * } if (volid == rentry->volumeId[RWVOL]) { *voltype = RWVOL; - *server = rentry->serverUnique[index]; + *server = rentry->serverNumber[index]; *part = rentry->serverPartition[index]; return 0; } if (volid == rentry->volumeId[BACKVOL]) { *voltype = BACKVOL; - *server = rentry->serverUnique[index]; + *server = rentry->serverNumber[index]; *part = rentry->serverPartition[index]; return 0; } @@ -4267,8 +4266,8 @@ DeleteEntry(struct cmd_syndesc *as, void *arock) afs_uint32 avolid; afs_int32 vcode; struct VldbListByAttributes attributes; - ubulkentries arrayEntries; - struct uvldbentry *vllist; + nbulkentries arrayEntries; + struct nvldbentry *vllist; struct cmd_item *itp; afs_int32 nentries; int j; @@ -4379,7 +4378,7 @@ DeleteEntry(struct cmd_syndesc *as, void *arock) /* Get all the VLDB entries on a server and/or partition */ memset(&arrayEntries, 0, sizeof(arrayEntries)); - vcode = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries); + vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); if (vcode) { fprintf(STDERR, "Could not access the VLDB for attributes\n"); PrintError("", vcode); @@ -4388,7 +4387,7 @@ DeleteEntry(struct cmd_syndesc *as, void *arock) /* Process each entry */ for (j = 0; j < nentries; j++) { - vllist = &arrayEntries.ubulkentries_val[j]; + vllist = &arrayEntries.nbulkentries_val[j]; if (seenprefix) { /* It only deletes the RW volumes */ if (strncmp(vllist->name, prefix, strlen(prefix))) { @@ -4431,7 +4430,7 @@ DeleteEntry(struct cmd_syndesc *as, void *arock) "Total VLDB entries deleted: %lu; failed to delete: %lu\n", (unsigned long)totalBack, (unsigned long)totalFail); - xdr_free((xdrproc_t) xdr_ubulkentries, &arrayEntries); + xdr_free((xdrproc_t) xdr_nbulkentries, &arrayEntries); return 0; } @@ -4439,24 +4438,24 @@ DeleteEntry(struct cmd_syndesc *as, void *arock) static int CompareVldbEntryByName(const void *p1, const void *p2) { - struct uvldbentry *arg1, *arg2; + struct nvldbentry *arg1, *arg2; - arg1 = (struct uvldbentry *)p1; - arg2 = (struct uvldbentry *)p2; + arg1 = (struct nvldbentry *)p1; + arg2 = (struct nvldbentry *)p2; return (strcmp(arg1->name, arg2->name)); } /* static int CompareVldbEntry(char *p1, char *p2) { - struct uvldbentry *arg1,*arg2; + struct nvldbentry *arg1,*arg2; int i; int pos1, pos2; char comp1[100],comp2[100]; char temp1[20],temp2[20]; - arg1 = (struct uvldbentry *)p1; - arg2 = (struct uvldbentry *)p2; + arg1 = (struct nvldbentry *)p1; + arg2 = (struct nvldbentry *)p2; pos1 = -1; pos2 = -1; @@ -4468,8 +4467,8 @@ static int CompareVldbEntry(char *p1, char *p2) pos1 = 0; pos2 = 0; } - sprintf(comp1,"%10u",arg1->serverUnique[pos1]); - sprintf(comp2,"%10u",arg2->serverUnique[pos2]); + sprintf(comp1,"%10u",arg1->serverNumber[pos1]); + sprintf(comp2,"%10u",arg2->serverNumber[pos2]); sprintf(temp1,"%10u",arg1->serverPartition[pos1]); sprintf(temp2,"%10u",arg2->serverPartition[pos2]); strcat(comp1,temp1); @@ -4489,8 +4488,8 @@ ListVLDB(struct cmd_syndesc *as, void *arock) afs_int32 code; afs_int32 vcode; struct VldbListByAttributes attributes; - ubulkentries arrayEntries; - struct uvldbentry *vllist, *tarray = 0, *ttarray; + nbulkentries arrayEntries; + struct nvldbentry *vllist, *tarray = 0, *ttarray; afs_int32 centries, nentries = 0; afs_int32 tarraysize = 0; afs_int32 parraysize; @@ -4570,12 +4569,12 @@ ListVLDB(struct cmd_syndesc *as, void *arock) nextindex = -1; vcode = - VLDB_ListAttributesN2U(&attributes, 0, thisindex, ¢ries, + VLDB_ListAttributesN2(&attributes, 0, thisindex, ¢ries, &arrayEntries, &nextindex); if (vcode == RXGEN_OPCODE) { /* Vlserver not running with ListAttributesN2. Fall back */ vcode = - VLDB_ListAttributesU(&attributes, ¢ries, &arrayEntries); + VLDB_ListAttributes(&attributes, ¢ries, &arrayEntries); nextindex = -1; } if (vcode) { @@ -4588,9 +4587,9 @@ ListVLDB(struct cmd_syndesc *as, void *arock) /* We don't sort, so just print the entries now */ if (!sort) { for (j = 0; j < centries; j++) { /* process each entry */ - vllist = &arrayEntries.ubulkentries_val[j]; - MapHostToNetworkU(vllist); - EnumerateEntryU(vllist); + vllist = &arrayEntries.nbulkentries_val[j]; + MapHostToNetwork(vllist); + EnumerateEntry(vllist); PrintLocked(vllist->flags); } @@ -4602,19 +4601,19 @@ ListVLDB(struct cmd_syndesc *as, void *arock) else if (centries > 0) { if (!tarray) { /* malloc the first bulk entries array */ - tarraysize = centries * sizeof(struct uvldbentry); + tarraysize = centries * sizeof(struct nvldbentry); tarray = malloc(tarraysize); if (!tarray) { fprintf(STDERR, "Could not allocate enough space for the VLDB entries\n"); goto bypass; } - memcpy((char*)tarray, arrayEntries.ubulkentries_val, tarraysize); + memcpy((char*)tarray, arrayEntries.nbulkentries_val, tarraysize); } else { /* Grow the tarray to keep the extra entries */ - parraysize = (centries * sizeof(struct uvldbentry)); + parraysize = (centries * sizeof(struct nvldbentry)); ttarray = - (struct uvldbentry *)realloc(tarray, + (struct nvldbentry *)realloc(tarray, tarraysize + parraysize); if (!ttarray) { fprintf(STDERR, @@ -4625,22 +4624,22 @@ ListVLDB(struct cmd_syndesc *as, void *arock) /* Copy them in */ memcpy(((char *)tarray) + tarraysize, - (char *)arrayEntries.ubulkentries_val, parraysize); + (char *)arrayEntries.nbulkentries_val, parraysize); tarraysize += parraysize; } } /* Free the bulk array */ - xdr_free((xdrproc_t) xdr_ubulkentries, &arrayEntries); + xdr_free((xdrproc_t) xdr_nbulkentries, &arrayEntries); } /* Here is where we now sort all the entries and print them */ if (sort && (nentries > 0)) { - qsort((char *)tarray, nentries, sizeof(struct uvldbentry), + qsort((char *)tarray, nentries, sizeof(struct nvldbentry), CompareVldbEntryByName); for (vllist = tarray, j = 0; j < nentries; j++, vllist++) { - MapHostToNetworkU(vllist); - EnumerateEntryU(vllist); + MapHostToNetwork(vllist); + EnumerateEntry(vllist); PrintLocked(vllist->flags); } @@ -4663,8 +4662,8 @@ BackSys(struct cmd_syndesc *as, void *arock) afs_int32 code, apart1; afs_int32 vcode; struct VldbListByAttributes attributes; - ubulkentries arrayEntries; - struct uvldbentry *vllist; + nbulkentries arrayEntries; + struct nvldbentry *vllist; afs_int32 nentries; int j; char pname[10]; @@ -4769,7 +4768,7 @@ BackSys(struct cmd_syndesc *as, void *arock) } memset(&arrayEntries, 0, sizeof(arrayEntries)); /* initialize to hint the stub to alloc space */ - vcode = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries); + vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); if (vcode) { fprintf(STDERR, "Could not access the VLDB for attributes\n"); PrintError("", vcode); @@ -4823,7 +4822,7 @@ BackSys(struct cmd_syndesc *as, void *arock) } for (j = 0; j < nentries; j++) { /* process each vldb entry */ - vllist = &arrayEntries.ubulkentries_val[j]; + vllist = &arrayEntries.nbulkentries_val[j]; if (seenprefix) { for (ti = as->parms[0].items; ti; ti = ti->next) { @@ -4935,7 +4934,7 @@ BackSys(struct cmd_syndesc *as, void *arock) } avolid = vllist->volumeId[RWVOL]; - MapHostToNetworkU(vllist); + MapHostToNetwork(vllist); GetServerAndPart(vllist, RWVOL, &aserver1, &apart1, &previdx); if (aserver1 == -1 || apart1 == -1) { fprintf(STDOUT, "could not backup %s, invalid VLDB entry\n", @@ -4983,7 +4982,7 @@ BackSys(struct cmd_syndesc *as, void *arock) fprintf(STDOUT, "Total volumes backed up: %lu; failed to backup: %lu\n", (unsigned long)totalBack, (unsigned long)totalFail); fflush(STDOUT); - xdr_free((xdrproc_t) xdr_ubulkentries, &arrayEntries); + xdr_free((xdrproc_t) xdr_nbulkentries, &arrayEntries); return 0; } @@ -4995,8 +4994,8 @@ UnlockVLDB(struct cmd_syndesc *as, void *arock) afs_int32 code; afs_int32 vcode; struct VldbListByAttributes attributes; - ubulkentries arrayEntries; - struct uvldbentry *vllist; + nbulkentries arrayEntries; + struct nvldbentry *vllist; afs_int32 nentries; int j; afs_uint32 volid; @@ -5039,14 +5038,14 @@ UnlockVLDB(struct cmd_syndesc *as, void *arock) attributes.flag = VLOP_ALLOPERS; attributes.Mask |= VLLIST_FLAG; memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub to alloc space */ - vcode = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries); + vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); if (vcode) { fprintf(STDERR, "Could not access the VLDB for attributes\n"); PrintError("", vcode); exit(1); } for (j = 0; j < nentries; j++) { /* process each entry */ - vllist = &arrayEntries.ubulkentries_val[j]; + vllist = &arrayEntries.nbulkentries_val[j]; volid = vllist->volumeId[RWVOL]; vcode = ubik_VL_ReleaseLock(cstruct, 0, volid, -1, @@ -5084,7 +5083,7 @@ UnlockVLDB(struct cmd_syndesc *as, void *arock) } } - xdr_free((xdrproc_t) xdr_ubulkentries, &arrayEntries); + xdr_free((xdrproc_t) xdr_nbulkentries, &arrayEntries); return 0; } @@ -5561,7 +5560,7 @@ ConvertRO(struct cmd_syndesc *as, void *arock) afs_uint32 volid; afs_uint32 server; afs_int32 code, i, same; - struct uvldbentry entry, storeEntry; + struct nvldbentry entry, storeEntry; afs_int32 vcode; afs_int32 rwindex = 0; afs_uint32 rwserver = 0; @@ -5606,7 +5605,7 @@ ConvertRO(struct cmd_syndesc *as, void *arock) if (as->parms[3].items) force = 1; - vcode = VLDB_GetEntryByIDU(volid, -1, &entry); + vcode = VLDB_GetEntryByID(volid, -1, &entry); if (vcode) { fprintf(STDERR, "Could not fetch the entry for volume %lu from VLDB\n", @@ -5620,15 +5619,15 @@ ConvertRO(struct cmd_syndesc *as, void *arock) if (volid != entry.volumeId[ROVOL]) volid = entry.volumeId[ROVOL]; - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); for (i = 0; i < entry.nServers; i++) { if (entry.serverFlags[i] & ITSRWVOL) { rwindex = i; - rwserver = entry.serverUnique[i]; + rwserver = entry.serverNumber[i]; rwpartition = entry.serverPartition[i]; } if (entry.serverFlags[i] & ITSROVOL) { - same = VLDB_IsSameAddrs(server, entry.serverUnique[i], &code); + same = VLDB_IsSameAddrs(server, entry.serverNumber[i], &code); if (code) { fprintf(STDERR, "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n", @@ -5637,7 +5636,7 @@ ConvertRO(struct cmd_syndesc *as, void *arock) } if (same) { roindex = i; - roserver = entry.serverUnique[i]; + roserver = entry.serverNumber[i]; ropartition = entry.serverPartition[i]; break; } @@ -5687,11 +5686,11 @@ ConvertRO(struct cmd_syndesc *as, void *arock) if (rwserver) { (entry.nServers)--; if (rwindex != entry.nServers) { - entry.serverUnique[rwindex] = entry.serverUnique[entry.nServers]; + entry.serverNumber[rwindex] = entry.serverNumber[entry.nServers]; entry.serverPartition[rwindex] = entry.serverPartition[entry.nServers]; entry.serverFlags[rwindex] = entry.serverFlags[entry.nServers]; - entry.serverUnique[entry.nServers] = 0; + entry.serverNumber[entry.nServers] = 0; entry.serverPartition[entry.nServers] = 0; entry.serverFlags[entry.nServers] = 0; } @@ -5703,9 +5702,9 @@ ConvertRO(struct cmd_syndesc *as, void *arock) entry.flags |= RO_EXISTS; } } - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); code = - VLDB_ReplaceEntryU(entry.volumeId[RWVOL], RWVOL, &storeEntry, + VLDB_ReplaceEntry(entry.volumeId[RWVOL], RWVOL, &storeEntry, (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP)); if (code) { @@ -5726,7 +5725,7 @@ Sizes(struct cmd_syndesc *as, void *arock) afs_uint32 avolid; afs_uint32 aserver; afs_int32 apart, voltype, fromdate = 0, code, err, i; - struct uvldbentry entry; + struct nvldbentry entry; volintSize vol_size; rx_SetRxDeadTime(60 * 10); diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 71870a1..4f71e0a 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -147,8 +147,6 @@ do { \ { if (verbose) { fprintf(STDOUT, (es), (p1), (p2)); fflush(STDOUT); } } #define VPRINT3(es, p1, p2, p3) \ { if (verbose) { fprintf(STDOUT, (es), (p1), (p2), (p3)); fflush(STDOUT); } } -#define VPRINT4(es, p1, p2, p3, p4) \ - { if (verbose) { fprintf(STDOUT, (es), (p1), (p2), (p3), (p4)); fflush(STDOUT); } } #define VDONE \ { if (verbose) { fprintf(STDOUT, " done\n"); fflush(STDOUT); } } #define VEPRINT(es) \ @@ -179,7 +177,7 @@ static afs_int32 CheckAndDeleteVolume(struct rx_connection *aconn, #endif static int DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part, afs_int32 flags); -static int GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index, +static int GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index, struct rx_connection **connPtr, afs_int32 * transPtr, afs_uint32 * crtimePtr, afs_uint32 * uptimePtr, afs_int32 *origflags); @@ -189,16 +187,8 @@ static int SimulateForwardMultiple(struct rx_connection *fromconn, void *cookie, manyResults * results); static afs_int32 CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, afs_int32 * modentry, - afs_uint32 * maxvolid, struct uvldbentry *aentry); -static void dump_sig_handler(int x); -static int sortVolumes(const void *a, const void *b); -static afs_int32 CheckVldbRWBK(struct uvldbentry *entry, - afs_int32 * modified); -static int CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified); -static afs_int32 CheckVldb(struct uvldbentry *entry, afs_int32 * modified, - afs_int32 *deleted); -static afs_int32 VolumeExists(afs_uint32 server, afs_int32 partition, - afs_uint32 volumeid); + afs_uint32 * maxvolid, struct nvldbentry *aentry); + /*map the partition into partition name */ void @@ -414,8 +404,7 @@ PrintError(char *msg, afs_int32 errcode) return 0; } -void -init_volintInfo(struct volintInfo *vinfo) { +void init_volintInfo(struct volintInfo *vinfo) { memset(vinfo, 0, sizeof(struct volintInfo)); vinfo->maxquota = -1; @@ -546,88 +535,7 @@ CheckAndDeleteVolume(struct rx_connection *aconn, afs_int32 apart, #endif -/* called by EnumerateEntryU, show vldb entry in a reasonable format */ -void -SubEnumerateEntryU(struct uvldbentry *entry) -{ - int i; - char pname[10]; - int isMixed = 0; - char hoststr[16]; - -#ifdef notdef - fprintf(STDOUT, " readWriteID %-10u ", entry->volumeId[RWVOL]); - if (entry->flags & RW_EXISTS) - fprintf(STDOUT, " valid \n"); - else - fprintf(STDOUT, " invalid \n"); - fprintf(STDOUT, " readOnlyID %-10u ", entry->volumeId[ROVOL]); - if (entry->flags & RO_EXISTS) - fprintf(STDOUT, " valid \n"); - else - fprintf(STDOUT, " invalid \n"); - fprintf(STDOUT, " backUpID %-10u ", entry->volumeId[BACKVOL]); - if (entry->flags & BACK_EXISTS) - fprintf(STDOUT, " valid \n"); - else - fprintf(STDOUT, " invalid \n"); - if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS)) - fprintf(STDOUT, " releaseClone %-10u \n", entry->cloneId); -#else - if (entry->flags & RW_EXISTS) - fprintf(STDOUT, " RWrite: %-10u", entry->volumeId[RWVOL]); - if (entry->flags & RO_EXISTS) - fprintf(STDOUT, " ROnly: %-10u", entry->volumeId[ROVOL]); - if (entry->flags & BACK_EXISTS) - fprintf(STDOUT, " Backup: %-10u", entry->volumeId[BACKVOL]); - if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS)) - fprintf(STDOUT, " RClone: %-10lu", (unsigned long)entry->cloneId); - fprintf(STDOUT, "\n"); -#endif - fprintf(STDOUT, " number of sites -> %lu\n", - (unsigned long)entry->nServers); - for (i = 0; i < entry->nServers; i++) { - if (entry->serverFlags[i] & NEW_REPSITE) - isMixed = 1; - } - for (i = 0; i < entry->nServers; i++) { - MapPartIdIntoName(entry->serverPartition[i], pname); - fprintf(STDOUT, " server %s partition %s ", - noresolve ? afs_inet_ntoa_r(entry->serverUnique[i], hoststr) : - hostutil_GetNameByINet(entry->serverUnique[i]), pname); - if (entry->serverFlags[i] & ITSRWVOL) - fprintf(STDOUT, "RW Site "); - else - fprintf(STDOUT, "RO Site "); - if (isMixed) { - if (entry->serverFlags[i] & NEW_REPSITE) - fprintf(STDOUT," -- New release"); - else - if (!(entry->serverFlags[i] & ITSRWVOL)) - fprintf(STDOUT," -- Old release"); - } else { - if (entry->serverFlags[i] & RO_DONTUSE) - fprintf(STDOUT, " -- Not released"); - } - fprintf(STDOUT, "\n"); - } - - return; - -} - -/*enumerate the vldb entry corresponding to */ -void -EnumerateEntryU(struct uvldbentry *entry) -{ - - fprintf(STDOUT, "\n"); - fprintf(STDOUT, "%s \n", entry->name); - SubEnumerateEntryU(entry); - return; -} - -/* called by EnumerateEntry, show vldb entry in a reasonable format */ +/* called by EmuerateEntry, show vldb entry in a reasonable format */ void SubEnumerateEntry(struct nvldbentry *entry) { @@ -808,7 +716,7 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname, afs_int32 error; afs_int32 rcode, vcode; afs_int32 lastid; - struct uvldbentry entry, storeEntry; /*the new vldb entry */ + struct nvldbentry entry, storeEntry; /*the new vldb entry */ struct volintInfo tstatus; tid = 0; @@ -828,7 +736,7 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname, } if (*anewid) { - vcode = VLDB_GetEntryByIDU(*anewid, -1, &entry); + vcode = VLDB_GetEntryByID(*anewid, -1, &entry); if (!vcode) { fprintf(STDERR, "Volume ID %d already exists\n", *anewid); return VVOLEXISTS; @@ -877,7 +785,7 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname, /* set up the vldb entry for this volume */ strncpy(entry.name, aname, VOLSER_OLDMAXVOLNAME); entry.nServers = 1; - entry.serverUnique[0] = aserver; /* this should have another + entry.serverNumber[0] = aserver; /* this should have another * level of indirection later */ entry.serverPartition[0] = apart; /* this should also have * another indirection level */ @@ -889,9 +797,9 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname, entry.cloneId = 0; /*map into right byte order, before passing to xdr, the stuff has to be in host * byte order. Xdr converts it into network order */ - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); /* create the vldb entry */ - vcode = VLDB_CreateEntryU(&storeEntry); + vcode = VLDB_CreateEntry(&storeEntry); if (vcode) { fprintf(STDERR, "Could not create a VLDB entry for the volume %s %lu\n", @@ -937,7 +845,7 @@ UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname, struct rx_connection *aconn; afs_int32 error; afs_int32 vcode; - struct uvldbentry entry, storeEntry; /*the new vldb entry */ + struct nvldbentry entry, storeEntry; /*the new vldb entry */ aconn = (struct rx_connection *)0; error = 0; @@ -945,7 +853,7 @@ UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname, /* set up the vldb entry for this volume */ strncpy(entry.name, aname, VOLSER_OLDMAXVOLNAME); entry.nServers = 1; - entry.serverUnique[0] = aserver; /* this should have another + entry.serverNumber[0] = aserver; /* this should have another * level of indirection later */ entry.serverPartition[0] = apart; /* this should also have * another indirection level */ @@ -962,9 +870,9 @@ UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname, entry.cloneId = 0; /*map into right byte order, before passing to xdr, the stuff has to be in host * byte order. Xdr converts it into network order */ - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); /* create the vldb entry */ - vcode = VLDB_CreateEntryU(&storeEntry); + vcode = VLDB_CreateEntry(&storeEntry); if (vcode) { fprintf(STDERR, "Could not create a VLDB entry for the volume %s %lu\n", @@ -992,7 +900,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) afs_int32 ttid = 0; afs_int32 code, rcode; afs_int32 error = 0; - struct uvldbentry entry, storeEntry; + struct nvldbentry entry, storeEntry; int islocked = 0; afs_int32 avoltype = -1, vtype; int notondisk = 0, notinvldb = 0; @@ -1008,13 +916,13 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) } else { islocked = 1; - code = VLDB_GetEntryByIDU(avolid, avoltype, &entry); + code = VLDB_GetEntryByID(avolid, avoltype, &entry); EGOTO1(error_exit, code, "Could not fetch VLDB entry for volume %u\n", avolid); - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); if (verbose) - EnumerateEntryU(&entry); + EnumerateEntry(&entry); } /* Whether volume is in the VLDB or not. Delete the volume on disk */ @@ -1052,7 +960,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) /* Its a backup volume, modify the VLDB entry. Check that the * backup volume is on the server/partition we asked to delete. */ - if (!(entry.flags & BACK_EXISTS) || !Lp_MatchU(aserver, apart, &entry)) { + if (!(entry.flags & BACK_EXISTS) || !Lp_Match(aserver, apart, &entry)) { notinvldb = 2; /* Not on this server and partition */ ERROR_EXIT(0); } @@ -1069,7 +977,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) * If flags does not have RO_EIXSTS set, then this may mean the RO * hasn't been released (and could exist in VLDB). */ - if (!Lp_ROMatchU(aserver, apart, &entry)) { + if (!Lp_ROMatch(aserver, apart, &entry)) { notinvldb = 2; /* Not found on this server and partition */ ERROR_EXIT(0); } @@ -1079,9 +987,9 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) "Marking the readonly volume %lu deleted in the VLDB\n", (unsigned long)avolid); - Lp_SetROValueU(&entry, aserver, apart, 0, 0); /* delete the site */ + Lp_SetROValue(&entry, aserver, apart, 0, 0); /* delete the site */ entry.nServers--; - if (!Lp_ROMatchU(0, 0, &entry)) + if (!Lp_ROMatch(0, 0, &entry)) entry.flags &= ~RO_EXISTS; /* This was the last ro volume */ vtype = ROVOL; } @@ -1091,7 +999,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) * Check that the readwrite volumes is on the server/partition we * asked to delete. */ - if (!(entry.flags & RW_EXISTS) || !Lp_MatchU(aserver, apart, &entry)) { + if (!(entry.flags & RW_EXISTS) || !Lp_Match(aserver, apart, &entry)) { notinvldb = 2; /* Not found on this server and partition */ ERROR_EXIT(0); } @@ -1129,7 +1037,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) flags & BACK_EXISTS) ? ", and its backup volume," : "")); - Lp_SetRWValueU(&entry, aserver, apart, 0L, 0L); + Lp_SetRWValue(&entry, aserver, apart, 0L, 0L); entry.nServers--; entry.flags &= ~(BACK_EXISTS | RW_EXISTS); vtype = RWVOL; @@ -1154,9 +1062,9 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) "Could not delete the VLDB entry for the volume %u \n", avolid); } else { - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); code = - VLDB_ReplaceEntryU(avolid, vtype, &storeEntry, + VLDB_ReplaceEntry(avolid, vtype, &storeEntry, (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP)); EGOTO1(error_exit, code, @@ -1293,7 +1201,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, struct volser_status tstatus; struct destServer destination; - struct uvldbentry entry, storeEntry; + struct nvldbentry entry, storeEntry; int i; afs_int32 error; char in, lf; /* for test code */ @@ -1341,7 +1249,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, /* or drop through */ } - vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry); + vcode = VLDB_GetEntryByID(afromvol, -1, &entry); EGOTO1(mfail, vcode, "Could not fetch the entry for the volume %u from the VLDB \n", afromvol); @@ -1355,17 +1263,17 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, EGOTO1(mfail, vcode, "Could not lock entry for volume %u \n", afromvol); islocked = 1; - vcode = VLDB_GetEntryByIDU(afromvol, RWVOL, &entry); + vcode = VLDB_GetEntryByID(afromvol, RWVOL, &entry); EGOTO1(mfail, vcode, "Could not fetch the entry for the volume %u from the VLDB \n", afromvol); backupId = entry.volumeId[BACKVOL]; - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); - if (!Lp_MatchU(afromserver, afrompart, &entry)) { + if (!Lp_Match(afromserver, afrompart, &entry)) { /* the from server and partition do not exist in the vldb entry corresponding to volid */ - if (!Lp_MatchU(atoserver, atopart, &entry)) { + if (!Lp_Match(atoserver, atopart, &entry)) { /* the to server and partition do not exist in the vldb entry corresponding to volid */ fprintf(STDERR, "The volume %lu is not on the specified site. \n", (unsigned long)afromvol); @@ -1375,8 +1283,8 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, char pname[10]; MapPartIdIntoName(entry.serverPartition[i], pname); fprintf(STDERR, " server %s partition %s \n", - noresolve ? afs_inet_ntoa_r(entry.serverUnique[i], hoststr) : - hostutil_GetNameByINet(entry.serverUnique[i]), + noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) : + hostutil_GetNameByINet(entry.serverNumber[i]), pname); } } @@ -1756,8 +1664,8 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, afromvol); VDONE; - Lp_SetRWValueU(&entry, afromserver, afrompart, atoserver, atopart); - MapNetworkToHostU(&entry, &storeEntry); + Lp_SetRWValue(&entry, afromserver, afrompart, atoserver, atopart); + MapNetworkToHost(&entry, &storeEntry); storeEntry.flags &= ~BACK_EXISTS; if (TESTC) { @@ -1780,7 +1688,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, VPRINT1("Releasing lock on VLDB entry for volume %u ...", afromvol); vcode = - VLDB_ReplaceEntryU(afromvol, -1, &storeEntry, + VLDB_ReplaceEntry(afromvol, -1, &storeEntry, (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP)); if (vcode) { @@ -2058,20 +1966,20 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, } VPRINT("Recovery: Accessing VLDB.\n"); - vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry); + vcode = VLDB_GetEntryByID(afromvol, -1, &entry); if (vcode) { fprintf(STDOUT, "FATAL: VLDB access error: abort cleanup\n"); fflush(STDOUT); goto done; } - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); /* Delete either the volume on the source location or the target location. * If the vldb entry still points to the source location, then we know the * volume move didn't finish so we remove the volume from the target * location. Otherwise, we remove the volume from the source location. */ - if (Lp_MatchU(afromserver, afrompart, &entry)) { /* didn't move - delete target volume */ + if (Lp_Match(afromserver, afrompart, &entry)) { /* didn't move - delete target volume */ if (pntg) { fprintf(STDOUT, "move incomplete - attempt cleanup of target partition - no guarantee\n"); @@ -2322,7 +2230,7 @@ UV_CopyVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, afs_int32 volflag; struct volser_status tstatus; struct destServer destination; - struct uvldbentry entry, newentry, storeEntry; + struct nvldbentry entry, newentry, storeEntry; afs_int32 error; afs_int32 tmp; afs_uint32 tmpVol; @@ -2341,11 +2249,11 @@ UV_CopyVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, goto mfail; (void)signal(SIGINT, sigint_handler); - vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry); + vcode = VLDB_GetEntryByID(afromvol, -1, &entry); EGOTO1(mfail, vcode, "Could not fetch the entry for the volume %u from the VLDB \n", afromvol); - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); pntg = 1; toconn = UV_Bind(atoserver, AFSCONF_VOLUMEPORT); /* get connections to the servers */ @@ -2655,7 +2563,7 @@ cpincr: /* create the vldb entry for the copied volume */ strncpy(newentry.name, atovolname, VOLSER_OLDMAXVOLNAME); newentry.nServers = 1; - newentry.serverUnique[0] = atoserver; + newentry.serverNumber[0] = atoserver; newentry.serverPartition[0] = atopart; newentry.flags = (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS; newentry.serverFlags[0] = (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL; @@ -2665,9 +2573,9 @@ cpincr: newentry.cloneId = 0; /*map into right byte order, before passing to xdr, the stuff has to be in host * byte order. Xdr converts it into network order */ - MapNetworkToHostU(&newentry, &storeEntry); + MapNetworkToHost(&newentry, &storeEntry); /* create the vldb entry */ - vcode = VLDB_CreateEntryU(&storeEntry); + vcode = VLDB_CreateEntry(&storeEntry); if (vcode) { fprintf(STDERR, "Could not create a VLDB entry for the volume %s %lu\n", @@ -2762,13 +2670,13 @@ cpincr: } VPRINT("Recovery: Accessing VLDB.\n"); - vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry); + vcode = VLDB_GetEntryByID(afromvol, -1, &entry); if (vcode) { fprintf(STDOUT, "FATAL: VLDB access error: abort cleanup\n"); fflush(STDOUT); goto done; } - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); /* common cleanup - delete local clone */ if (cloneVol) { @@ -2833,7 +2741,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) afs_uint32 backupID; afs_int32 code = 0, rcode = 0; char vname[VOLSER_MAXVOLNAME + 1]; - struct uvldbentry entry, storeEntry; + struct nvldbentry entry, storeEntry; afs_int32 error = 0; int vldblocked = 0, vldbmod = 0, backexists = 1; @@ -2841,7 +2749,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) /* the calls to VLDB will succeed only if avolid is a RW volume, * since we are following the RW hash chain for searching */ - code = VLDB_GetEntryByIDU(avolid, RWVOL, &entry); + code = VLDB_GetEntryByID(avolid, RWVOL, &entry); if (code) { fprintf(STDERR, "Could not fetch the entry for the volume %lu from the VLDB \n", @@ -2849,7 +2757,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) error = code; goto bfail; } - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); /* These operations require the VLDB be locked since it means the VLDB * will change or the vldb is already locked. @@ -2869,7 +2777,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) vldblocked = 1; /* Reread the vldb entry */ - code = VLDB_GetEntryByIDU(avolid, RWVOL, &entry); + code = VLDB_GetEntryByID(avolid, RWVOL, &entry); if (code) { fprintf(STDERR, "Could not fetch the entry for the volume %lu from the VLDB \n", @@ -2877,7 +2785,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) error = code; goto bfail; } - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); } if (!ISNAMEVALID(entry.name)) { @@ -3042,9 +2950,9 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid) /* Now update the vldb - if modified */ if (vldblocked) { if (vldbmod) { - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); code = - VLDB_ReplaceEntryU(avolid, RWVOL, &storeEntry, + VLDB_ReplaceEntry(avolid, RWVOL, &storeEntry, (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP)); if (code) { @@ -3318,7 +3226,7 @@ DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part, * be made (0 if it's a new volume) */ static int -GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index, +GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index, struct rx_connection **connPtr, afs_int32 * transPtr, afs_uint32 * crtimePtr, afs_uint32 * uptimePtr, afs_int32 *origflags) @@ -3335,7 +3243,7 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index, *uptimePtr = 0; /* get connection to the replication site */ - *connPtr = UV_Bind(vldbEntryPtr->serverUnique[index], AFSCONF_VOLUMEPORT); + *connPtr = UV_Bind(vldbEntryPtr->serverNumber[index], AFSCONF_VOLUMEPORT); if (!*connPtr) goto fail; /* server is down */ @@ -3356,9 +3264,9 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index, VPRINT1("Deleting extant RO_DONTUSE site on %s...", noresolve ? afs_inet_ntoa_r(vldbEntryPtr-> - serverUnique[index], hoststr) : + serverNumber[index], hoststr) : hostutil_GetNameByINet(vldbEntryPtr-> - serverUnique[index])); + serverNumber[index])); code = AFSVolDeleteVolume(*connPtr, *transPtr); if (code) { @@ -3404,9 +3312,9 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index, "Creating new volume %lu on replication site %s: ", (unsigned long)volid, noresolve ? afs_inet_ntoa_r(vldbEntryPtr-> - serverUnique[index], hoststr) : + serverNumber[index], hoststr) : hostutil_GetNameByINet(vldbEntryPtr-> - serverUnique[index])); + serverNumber[index])); fflush(STDOUT); } @@ -3439,8 +3347,8 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index, else { VPRINT2("Updating existing ro volume %u on %s ...\n", volid, noresolve ? afs_inet_ntoa_r(vldbEntryPtr-> - serverUnique[index], hoststr) : - hostutil_GetNameByINet(vldbEntryPtr->serverUnique[index])); + serverNumber[index], hoststr) : + hostutil_GetNameByINet(vldbEntryPtr->serverNumber[index])); code = AFSVolGetStatus(*connPtr, *transPtr, &tstatus); if (code) { @@ -3573,7 +3481,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 vcode, rcode, tcode; afs_uint32 cloneVolId, roVolId; struct replica *replicas = 0; - struct uvldbentry entry, storeEntry; + struct nvldbentry entry, storeEntry; int i, volcount, m, fullrelease, vldbindex; int failure; struct restoreCookie cookie; @@ -3615,13 +3523,13 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, islocked = 1; /* Get the vldb entry in readable format */ - vcode = VLDB_GetEntryByIDU(afromvol, RWVOL, &entry); + vcode = VLDB_GetEntryByID(afromvol, RWVOL, &entry); ONERROR(vcode, afromvol, "Could not fetch the entry for the volume %u from the VLDB.\n"); - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); if (verbose) - EnumerateEntryU(&entry); + EnumerateEntry(&entry); if (!ISNAMEVALID(entry.name)) ONERROR(VOLSERBADOP, entry.name, @@ -3641,9 +3549,9 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, * on the same partition a clone instead of a complete copy. */ - roindex = Lp_ROMatchU(afromserver, afrompart, &entry) - 1; + roindex = Lp_ROMatch(afromserver, afrompart, &entry) - 1; roclone = ((roindex == -1) ? 0 : 1); - rwindex = Lp_GetRwIndexU(&entry); + rwindex = Lp_GetRwIndex(&entry); if (rwindex < 0) ONERROR0(VOLSERNOVOL, "There is no RW volume \n"); @@ -3654,8 +3562,8 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, ONERROR(vcode, entry.name, "Cant allocate ID for RO volume of %s\n"); entry.volumeId[ROVOL] = roVolId; - MapNetworkToHostU(&entry, &storeEntry); - vcode = VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, 0); + MapNetworkToHost(&entry, &storeEntry); + vcode = VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, 0); ONERROR(vcode, entry.name, "Could not update vldb entry for %s.\n"); } @@ -3861,9 +3769,9 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, * up marking all the ROs as "old release" making the ROs * temporarily unavailable. */ - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); VPRINT1("Replacing VLDB entry for %s...", entry.name); - vcode = VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, 0); + vcode = VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, 0); ONERROR(vcode, entry.name, "Could not update vldb entry for %s.\n"); VDONE; @@ -3948,7 +3856,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, * volume). Each volume might have a different time. */ replicas[volcount].server.destHost = - ntohl(entry.serverUnique[vldbindex]); + ntohl(entry.serverNumber[vldbindex]); replicas[volcount].server.destPort = AFSCONF_VOLUMEPORT; replicas[volcount].server.destSSID = 1; times[volcount].vldbEntryIndex = vldbindex; @@ -4017,18 +3925,18 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, if (verbose) { fprintf(STDOUT, "Starting ForwardMulti from %lu to %u on %s", (unsigned long)cloneVolId, entry.volumeId[ROVOL], - noresolve ? afs_inet_ntoa_r(entry.serverUnique[times[0]. + noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[0]. vldbEntryIndex], hoststr) : hostutil_GetNameByINet(entry. - serverUnique[times[0]. + serverNumber[times[0]. vldbEntryIndex])); for (s = 1; s < volcount; s++) { fprintf(STDOUT, " and %s", - noresolve ? afs_inet_ntoa_r(entry.serverUnique[times[s]. + noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[s]. vldbEntryIndex], hoststr) : hostutil_GetNameByINet(entry. - serverUnique[times[s]. + serverNumber[times[s]. vldbEntryIndex])); } @@ -4128,8 +4036,8 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, toconns[s] = 0; } - MapNetworkToHostU(&entry, &storeEntry); - vcode = VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, 0); + MapNetworkToHost(&entry, &storeEntry); + vcode = VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, 0); ONERROR(vcode, afromvol, " Could not update VLDB entry for volume %u\n"); } /* for each index in the vldb */ @@ -4156,14 +4064,14 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, if (!(entry.serverFlags[i] & NEW_REPSITE)) { MapPartIdIntoName(entry.serverPartition[i], pname); fprintf(STDERR, "\t%35s %s\n", - noresolve ? afs_inet_ntoa_r(entry.serverUnique[i], hoststr) : - hostutil_GetNameByINet(entry.serverUnique[i]), pname); + noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) : + hostutil_GetNameByINet(entry.serverNumber[i]), pname); } } - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); vcode = - VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, + VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, LOCKREL_TIMESTAMP); ONERROR(vcode, afromvol, " Could not update VLDB entry for volume %u\n"); @@ -4190,9 +4098,9 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, /* Update the VLDB */ VPRINT("updating VLDB ..."); - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); vcode = - VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, + VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP); ONERROR(vcode, afromvol, " Could not update VLDB entry for volume %u\n"); VDONE; @@ -4270,7 +4178,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver, } -static void +void dump_sig_handler(int x) { fprintf(STDERR, "\nSignal handler: vos dump operation\n"); @@ -4547,7 +4455,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, afs_uint32 pvolid; afs_int32 temptid, pparentid; int success; - struct uvldbentry entry, storeEntry; + struct nvldbentry entry, storeEntry; afs_int32 error; int islocked; struct restoreCookie cookie; @@ -4581,7 +4489,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, pparentid = toparentid; toconn = UV_Bind(toserver, AFSCONF_VOLUMEPORT); if (pvolid == 0) { /*alot a new id if needed */ - vcode = VLDB_GetEntryByNameU(tovolname, &entry); + vcode = VLDB_GetEntryByName(tovolname, &entry); if (vcode == VL_NOENT) { vcode = ubik_VL_GetNewVolumeId(cstruct, 0, 1, &pvolid); if (vcode) { @@ -4792,7 +4700,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, /* Volume was restored on the file server, update the * VLDB to reflect the change. */ - vcode = VLDB_GetEntryByIDU(pvolid, voltype, &entry); + vcode = VLDB_GetEntryByID(pvolid, voltype, &entry); if (vcode && vcode != VL_NOENT && vcode != VL_ENTDELETED) { fprintf(STDERR, "Could not fetch the entry for volume number %lu from VLDB \n", @@ -4801,13 +4709,13 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, goto refail; } if (!vcode) - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); if (vcode == VL_NOENT) { /* it doesnot exist already */ /*make the vldb return this indication specifically */ VPRINT("------- Creating a new VLDB entry ------- \n"); strcpy(entry.name, tovolname); entry.nServers = 1; - entry.serverUnique[0] = toserver; /*should be indirect */ + entry.serverNumber[0] = toserver; /*should be indirect */ entry.serverPartition[0] = topart; entry.serverFlags[0] = (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL; entry.flags = (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS; @@ -4824,8 +4732,8 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, /*this should come from status info on the volume if non zero */ } else entry.volumeId[BACKVOL] = INVALID_BID; - MapNetworkToHostU(&entry, &storeEntry); - vcode = VLDB_CreateEntryU(&storeEntry); + MapNetworkToHost(&entry, &storeEntry); + vcode = VLDB_CreateEntry(&storeEntry); if (vcode) { fprintf(STDERR, "Could not create the VLDB entry for volume number %lu \n", @@ -4835,12 +4743,12 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, } islocked = 0; if (verbose) - EnumerateEntryU(&entry); + EnumerateEntry(&entry); } else { /*update the existing entry */ if (verbose) { fprintf(STDOUT, "Updating the existing VLDB entry\n"); fprintf(STDOUT, "------- Old entry -------\n"); - EnumerateEntryU(&entry); + EnumerateEntry(&entry); fprintf(STDOUT, "------- New entry -------\n"); } vcode = @@ -4858,12 +4766,12 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, /* Update the vlentry with the new information */ if (flags & RV_RDONLY) - index = Lp_ROMatchU(toserver, topart, &entry) - 1; + index = Lp_ROMatch(toserver, topart, &entry) - 1; else - index = Lp_GetRwIndexU(&entry); + index = Lp_GetRwIndex(&entry); if (index == -1) { /* Add the new site for the volume being restored */ - entry.serverUnique[entry.nServers] = toserver; + entry.serverNumber[entry.nServers] = toserver; entry.serverPartition[entry.nServers] = topart; entry.serverFlags[entry.nServers] = (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL; @@ -4873,7 +4781,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, * if its different from new site. */ same = - VLDB_IsSameAddrs(toserver, entry.serverUnique[index], + VLDB_IsSameAddrs(toserver, entry.serverNumber[index], &errcode); if (errcode) EPRINT2(errcode, @@ -4885,11 +4793,11 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, VPRINT2 ("Not deleting the previous volume %u on server %s, ...", pvolid, - noresolve ? afs_inet_ntoa_r(entry.serverUnique[index], hoststr) : - hostutil_GetNameByINet(entry.serverUnique[index])); + noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) : + hostutil_GetNameByINet(entry.serverNumber[index])); } else { tempconn = - UV_Bind(entry.serverUnique[index], + UV_Bind(entry.serverNumber[index], AFSCONF_VOLUMEPORT); MapPartIdIntoName(entry.serverPartition[index], @@ -4897,8 +4805,8 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, VPRINT3 ("Deleting the previous volume %u on server %s, partition %s ...", pvolid, - noresolve ? afs_inet_ntoa_r(entry.serverUnique[index], hoststr) : - hostutil_GetNameByINet(entry.serverUnique[index]), + noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) : + hostutil_GetNameByINet(entry.serverNumber[index]), apartName); code = AFSVolTransCreate_retry(tempconn, pvolid, @@ -4941,14 +4849,14 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, } } } - entry.serverUnique[index] = toserver; + entry.serverNumber[index] = toserver; entry.serverPartition[index] = topart; } entry.flags |= (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS; - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); vcode = - VLDB_ReplaceEntryU(pvolid, voltype, &storeEntry, + VLDB_ReplaceEntry(pvolid, voltype, &storeEntry, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP); if (vcode) { @@ -4960,7 +4868,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid, } islocked = 0; if (verbose) - EnumerateEntryU(&entry); + EnumerateEntry(&entry); } @@ -5061,7 +4969,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid, afs_uint32 rovolid, afs_int32 valid) { int j, nro = 0, islocked = 0; - struct uvldbentry entry, storeEntry, entry2; + struct nvldbentry entry, storeEntry, entry2; afs_int32 vcode, error = 0; char apartName[10]; @@ -5074,7 +4982,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid, } islocked = 1; - error = VLDB_GetEntryByIDU(volid, RWVOL, &entry); + error = VLDB_GetEntryByID(volid, RWVOL, &entry); if (error) { fprintf(STDERR, "Could not fetch the VLDB entry for volume number %lu \n", @@ -5089,7 +4997,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid, error = VOLSERBADOP; goto asfail; } - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); /* See if it's too many entries */ if (entry.nServers >= NMAXNSERVERS) { @@ -5103,7 +5011,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid, for (j = 0; j < entry.nServers; j++) { if (entry.serverFlags[j] & ITSROVOL) { nro++; - if (VLDB_IsSameAddrs(server, entry.serverUnique[j], &error)) { + if (VLDB_IsSameAddrs(server, entry.serverNumber[j], &error)) { if (error) { fprintf(STDERR, "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n", @@ -5134,7 +5042,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid, */ if (rovolid) { if (entry.volumeId[ROVOL] == INVALID_BID) { - vcode = VLDB_GetEntryByIDU(rovolid, -1, &entry2); + vcode = VLDB_GetEntryByID(rovolid, -1, &entry2); if (!vcode) { fprintf(STDERR, "Volume ID %d already exists\n", rovolid); return VVOLEXISTS; @@ -5148,7 +5056,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid, } VPRINT("Adding a new site ..."); - entry.serverUnique[entry.nServers] = server; + entry.serverNumber[entry.nServers] = server; entry.serverPartition[entry.nServers] = part; if (!valid) { entry.serverFlags[entry.nServers] = (ITSROVOL | RO_DONTUSE); @@ -5157,9 +5065,9 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid, } entry.nServers++; - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); error = - VLDB_ReplaceEntryU(volid, RWVOL, &storeEntry, + VLDB_ReplaceEntry(volid, RWVOL, &storeEntry, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP); if (error) { fprintf(STDERR, "Could not update entry for volume %lu \n", @@ -5191,7 +5099,7 @@ int UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid) { afs_int32 vcode; - struct uvldbentry entry, storeEntry; + struct nvldbentry entry, storeEntry; vcode = ubik_VL_SetLock(cstruct, 0, volid, RWVOL, VLOP_ADDSITE); if (vcode) { @@ -5200,7 +5108,7 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid) PrintError("", vcode); return (vcode); } - vcode = VLDB_GetEntryByIDU(volid, RWVOL, &entry); + vcode = VLDB_GetEntryByID(volid, RWVOL, &entry); if (vcode) { fprintf(STDERR, "Could not fetch the entry for volume number %lu from VLDB \n", @@ -5208,8 +5116,8 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid) PrintError("", vcode); return (vcode); } - MapHostToNetworkU(&entry); - if (!Lp_ROMatchU(server, part, &entry)) { + MapHostToNetwork(&entry); + if (!Lp_ROMatch(server, part, &entry)) { /*this site doesnot exist */ fprintf(STDERR, "This site is not a replication site \n"); vcode = @@ -5225,7 +5133,7 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid) } return VOLSERBADOP; } else { /*remove the rep site */ - Lp_SetROValueU(&entry, server, part, 0, 0); + Lp_SetROValue(&entry, server, part, 0, 0); entry.nServers--; if ((entry.nServers == 1) && (entry.flags & RW_EXISTS)) entry.flags &= ~RO_EXISTS; @@ -5242,12 +5150,12 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid) } VDONE; } - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); fprintf(STDOUT, "Deleting the replication site for volume %lu ...", (unsigned long)volid); fflush(STDOUT); vcode = - VLDB_ReplaceEntryU(volid, RWVOL, &storeEntry, + VLDB_ReplaceEntry(volid, RWVOL, &storeEntry, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP); if (vcode) { @@ -5269,7 +5177,7 @@ int UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid) { afs_int32 vcode; - struct uvldbentry entry, storeEntry; + struct nvldbentry entry, storeEntry; int index; vcode = ubik_VL_SetLock(cstruct, 0, volid, RWVOL, VLOP_ADDSITE); @@ -5279,7 +5187,7 @@ UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid) PrintError("", vcode); return (vcode); } - vcode = VLDB_GetEntryByIDU(volid, RWVOL, &entry); + vcode = VLDB_GetEntryByID(volid, RWVOL, &entry); if (vcode) { fprintf(STDERR, "Could not fetch the entry for volume number %lu from VLDB \n", @@ -5287,8 +5195,8 @@ UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid) PrintError("", vcode); return (vcode); } - MapHostToNetworkU(&entry); - index = Lp_GetRwIndexU(&entry); + MapHostToNetwork(&entry); + index = Lp_GetRwIndex(&entry); if (index < 0) { /* no RW site exists */ fprintf(STDERR, "No existing RW site for volume %lu", @@ -5305,11 +5213,11 @@ UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid) } return VOLSERBADOP; } else { /* change the RW site */ - entry.serverUnique[index] = server; + entry.serverNumber[index] = server; entry.serverPartition[index] = part; - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); vcode = - VLDB_ReplaceEntryU(volid, RWVOL, &storeEntry, + VLDB_ReplaceEntry(volid, RWVOL, &storeEntry, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP); if (vcode) { @@ -5759,12 +5667,12 @@ UV_XListOneVolume(afs_uint32 a_serverID, afs_int32 a_partID, afs_uint32 a_volID, static afs_int32 CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, afs_int32 * modentry, afs_uint32 * maxvolid, - struct uvldbentry *aentry) + struct nvldbentry *aentry) { int idx = 0; int j; afs_int32 code, error = 0; - struct uvldbentry entry, storeEntry; + struct nvldbentry entry, storeEntry; char pname[10]; int pass = 0, createentry, addvolume, modified, mod, doit = 1; afs_uint32 rwvolid; @@ -5801,7 +5709,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, memcpy(&entry, aentry, sizeof(entry)); } else { /* Read the entry from VLDB by its RW volume id */ - code = VLDB_GetEntryByIDU(rwvolid, RWVOL, &entry); + code = VLDB_GetEntryByID(rwvolid, RWVOL, &entry); if (code) { if (code != VL_NOENT) { fprintf(STDOUT, @@ -5815,7 +5723,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, createentry = 1; } else { - MapHostToNetworkU(&entry); + MapHostToNetwork(&entry); } } @@ -5827,7 +5735,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, } else { if ((entry.flags & RW_EXISTS) || (entry.flags & RO_EXISTS) || (entry.flags & BACK_EXISTS)) - EnumerateEntryU(&entry); + EnumerateEntry(&entry); } fprintf(STDOUT, "\n"); } @@ -5845,14 +5753,14 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, if (mod) modified++; - idx = Lp_GetRwIndexU(&entry); + idx = Lp_GetRwIndex(&entry); if (idx == -1) { /* RW index not found in the VLDB entry */ idx = entry.nServers; /* put it into next index */ entry.nServers++; addvolume++; } else { /* RW index found in the VLDB entry. */ /* Verify if this volume's location matches where the VLDB says it is */ - if (!Lp_MatchU(aserver, apart, &entry)) { + if (!Lp_Match(aserver, apart, &entry)) { if (entry.flags & RW_EXISTS) { /* The RW volume exists elsewhere - report this one a duplicate */ if (pass == 1) { @@ -5868,10 +5776,10 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, fprintf(STDERR, " VLDB reports RW volume %lu exists on %s %s\n", (unsigned long)rwvolid, - noresolve ? - afs_inet_ntoa_r(entry.serverUnique[idx], hoststr) : + noresolve ? + afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) : hostutil_GetNameByINet(entry. - serverUnique[idx]), + serverNumber[idx]), pname); } } else { @@ -5887,9 +5795,9 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, "*** Warning: Orphaned BK volume %u exists on %s %s\n", entry.volumeId[BACKVOL], noresolve ? - afs_inet_ntoa_r(entry.serverUnique[idx], hoststr) : + afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) : hostutil_GetNameByINet(entry. - serverUnique + serverNumber [idx]), pname); MapPartIdIntoName(apart, pname); fprintf(STDERR, @@ -5925,7 +5833,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, entry.volumeId[ROVOL] = volumeinfo->cloneID; entry.serverFlags[idx] = ITSRWVOL; - entry.serverUnique[idx] = aserver; + entry.serverNumber[idx] = aserver; entry.serverPartition[idx] = apart; strncpy(entry.name, volumeinfo->name, VOLSER_OLDMAXVOLNAME); @@ -5953,14 +5861,14 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, if (mod) modified++; - idx = Lp_GetRwIndexU(&entry); + idx = Lp_GetRwIndex(&entry); if (idx == -1) { /* RW index not found in the VLDB entry */ idx = entry.nServers; /* Put it into next index */ entry.nServers++; addvolume++; } else { /* RW index found in the VLDB entry */ /* Verify if this volume's location matches where the VLDB says it is */ - if (!Lp_MatchU(aserver, apart, &entry)) { + if (!Lp_Match(aserver, apart, &entry)) { /* VLDB says RW and/or BK is elsewhere - report this BK volume orphaned */ if (pass == 1) { MapPartIdIntoName(apart, pname); @@ -5975,9 +5883,9 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, " VLDB reports its RW/BK volume %lu exists on %s %s\n", (unsigned long)rwvolid, noresolve ? - afs_inet_ntoa_r(entry.serverUnique[idx], hoststr) : + afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) : hostutil_GetNameByINet(entry. - serverUnique[idx]), + serverNumber[idx]), pname); } } else { @@ -6029,7 +5937,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, entry.volumeId[RWVOL] = rwvolid; entry.volumeId[BACKVOL] = volumeinfo->volid; - entry.serverUnique[idx] = aserver; + entry.serverNumber[idx] = aserver; entry.serverPartition[idx] = apart; entry.serverFlags[idx] = ITSBACKVOL; @@ -6043,7 +5951,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, * VLDB so we avoid the CheckVldbRO() call (which checks if each * RO volume listed in the VLDB exists). */ - idx = Lp_ROMatchU(aserver, apart, &entry) - 1; + idx = Lp_ROMatch(aserver, apart, &entry) - 1; if (idx == -1) { idx = entry.nServers; entry.nServers++; @@ -6082,16 +5990,16 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, "*** Warning: Orphaned RO volume %u exists on %s %s\n", entry.volumeId[ROVOL], noresolve ? - afs_inet_ntoa_r(entry.serverUnique[j], hoststr) : + afs_inet_ntoa_r(entry.serverNumber[j], hoststr) : hostutil_GetNameByINet(entry. - serverUnique[j]), + serverNumber[j]), pname); fprintf(STDERR, " VLDB reports its RO volume ID is %lu\n", (unsigned long)volumeinfo->volid); } - Lp_SetRWValueU(&entry, entry.serverUnique[idx], + Lp_SetRWValue(&entry, entry.serverNumber[idx], entry.serverPartition[idx], 0L, 0L); entry.nServers--; modified++; @@ -6123,7 +6031,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, * and there exist RO volumes in the VLDB entry. See if any of them * are this one. If not, then we add it. */ - idx = Lp_ROMatchU(aserver, apart, &entry) - 1; + idx = Lp_ROMatch(aserver, apart, &entry) - 1; if (idx == -1) { idx = entry.nServers; entry.nServers++; @@ -6137,7 +6045,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, entry.volumeId[RWVOL] = rwvolid; entry.volumeId[ROVOL] = volumeinfo->volid; - entry.serverUnique[idx] = aserver; + entry.serverNumber[idx] = aserver; entry.serverPartition[idx] = apart; entry.serverFlags[idx] = ITSROVOL; @@ -6154,10 +6062,10 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, *maxvolid = entry.volumeId[RWVOL]; if (modified && doit) { - MapNetworkToHostU(&entry, &storeEntry); + MapNetworkToHost(&entry, &storeEntry); if (createentry) { - code = VLDB_CreateEntryU(&storeEntry); + code = VLDB_CreateEntry(&storeEntry); if (code) { fprintf(STDOUT, "Could not create a VLDB entry for the volume %lu\n", @@ -6168,7 +6076,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, if (pass == 1) goto retry; code = - VLDB_ReplaceEntryU(rwvolid, RWVOL, &storeEntry, + VLDB_ReplaceEntry(rwvolid, RWVOL, &storeEntry, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP); if (code) { @@ -6197,7 +6105,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, if (verbose) { fprintf(STDOUT, "-- status after --\n"); if (modified) - EnumerateEntryU(&entry); + EnumerateEntry(&entry); else fprintf(STDOUT, "\n**no change**\n"); } @@ -6207,7 +6115,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart, return (error); } -static int +int sortVolumes(const void *a, const void *b) { volintInfo *v1 = (volintInfo *) a; @@ -6252,7 +6160,7 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags) afs_int32 j, k, code, vcode, error = 0; afs_int32 tverbose; afs_int32 mod, modified = 0, deleted = 0; - struct uvldbentry vldbentry; + struct nvldbentry vldbentry; afs_uint32 volumeid = 0; volEntries volumeInfo; struct partList PartList; @@ -6276,13 +6184,13 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags) } /* Read the VLDB entry */ - vcode = VLDB_GetEntryByNameU(avolname, &vldbentry); + vcode = VLDB_GetEntryByName(avolname, &vldbentry); if (vcode && (vcode != VL_NOENT)) { fprintf(STDERR, "Could not access the VLDB for volume %s\n", avolname); ERROR_EXIT(vcode); } else if (!vcode) { - MapHostToNetworkU(&vldbentry); + MapHostToNetwork(&vldbentry); } if (tverbose) { @@ -6294,7 +6202,7 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags) } else { if ((vldbentry.flags & RW_EXISTS) || (vldbentry.flags & RO_EXISTS) || (vldbentry.flags & BACK_EXISTS)) - EnumerateEntryU(&vldbentry); + EnumerateEntry(&vldbentry); } fprintf(STDOUT, "\n"); } @@ -6417,7 +6325,7 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags) if (deleted) { fprintf(STDOUT, "\n**entry deleted**\n"); } else if (modified) { - EnumerateEntryU(&vldbentry); + EnumerateEntry(&vldbentry); } else { fprintf(STDOUT, "\n**no change**\n"); } @@ -6622,7 +6530,7 @@ UV_SyncVldb(afs_uint32 aserver, afs_int32 apart, int flags, int force) * Some error codes mean the volume is unavailable but * still exists - so we catch these error codes. */ -static afs_int32 +afs_int32 VolumeExists(afs_uint32 server, afs_int32 partition, afs_uint32 volumeid) { struct rx_connection *conn = (struct rx_connection *)0; @@ -6646,8 +6554,8 @@ VolumeExists(afs_uint32 server, afs_int32 partition, afs_uint32 volumeid) /* CheckVldbRWBK() * */ -static afs_int32 -CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified) +afs_int32 +CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified) { int modentry = 0; int idx; @@ -6657,7 +6565,7 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified) if (modified) *modified = 0; - idx = Lp_GetRwIndexU(entry); + idx = Lp_GetRwIndex(entry); /* Check to see if the RW volume exists and set the RW_EXISTS * flag accordingly. @@ -6669,7 +6577,7 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified) } } else { code = - VolumeExists(entry->serverUnique[idx], + VolumeExists(entry->serverNumber[idx], entry->serverPartition[idx], entry->volumeId[RWVOL]); if (code == 0) { /* RW volume exists */ if (!(entry->flags & RW_EXISTS)) { /* ... yet entry says RW does not exist */ @@ -6689,8 +6597,8 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified) "Transaction call failed for RW volume %u on server %s %s\n", entry->volumeId[RWVOL], noresolve ? - afs_inet_ntoa_r(entry->serverUnique[idx], hoststr) : - hostutil_GetNameByINet(entry->serverUnique[idx]), + afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) : + hostutil_GetNameByINet(entry->serverNumber[idx]), pname); ERROR_EXIT(code); } @@ -6707,7 +6615,7 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified) } } else { /* Found a RW entry */ code = - VolumeExists(entry->serverUnique[idx], + VolumeExists(entry->serverNumber[idx], entry->serverPartition[idx], entry->volumeId[BACKVOL]); if (code == 0) { /* BK volume exists */ @@ -6728,8 +6636,8 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified) "Transaction call failed for BK volume %u on server %s %s\n", entry->volumeId[BACKVOL], noresolve ? - afs_inet_ntoa_r(entry->serverUnique[idx], hoststr) : - hostutil_GetNameByINet(entry->serverUnique[idx]), + afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) : + hostutil_GetNameByINet(entry->serverNumber[idx]), pname); ERROR_EXIT(code); } @@ -6741,7 +6649,7 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified) */ if ((idx != -1) && !(entry->flags & RW_EXISTS) && !(entry->flags & BACK_EXISTS)) { - Lp_SetRWValueU(entry, entry->serverUnique[idx], + Lp_SetRWValue(entry, entry->serverNumber[idx], entry->serverPartition[idx], 0L, 0L); entry->nServers--; modentry++; @@ -6753,8 +6661,8 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified) return (error); } -static int -CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified) +int +CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified) { int idx; int foundro = 0, modentry = 0; @@ -6774,12 +6682,12 @@ CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified) } code = - VolumeExists(entry->serverUnique[idx], + VolumeExists(entry->serverNumber[idx], entry->serverPartition[idx], entry->volumeId[ROVOL]); if (code == 0) { /* RO volume exists */ foundro++; } else if (code == ENODEV) { /* RW volume does not exist */ - Lp_SetROValueU(entry, entry->serverUnique[idx], + Lp_SetROValue(entry, entry->serverNumber[idx], entry->serverPartition[idx], 0L, 0L); entry->nServers--; idx--; @@ -6790,8 +6698,8 @@ CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified) "Transaction call failed for RO %u on server %s %s\n", entry->volumeId[ROVOL], noresolve ? - afs_inet_ntoa_r(entry->serverUnique[idx], hoststr) : - hostutil_GetNameByINet(entry->serverUnique[idx]), pname); + afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) : + hostutil_GetNameByINet(entry->serverNumber[idx]), pname); ERROR_EXIT(code); } } @@ -6817,11 +6725,11 @@ CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified) /* CheckVldb() * Ensure that matches with the info on file servers */ -static afs_int32 -CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted) +afs_int32 +CheckVldb(struct nvldbentry * entry, afs_int32 * modified, afs_int32 * deleted) { afs_int32 code, error = 0; - struct uvldbentry storeEntry; + struct nvldbentry storeEntry; int islocked = 0, mod, modentry, delentry = 0; int pass = 0, doit=1; @@ -6835,7 +6743,7 @@ CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted) fprintf(STDOUT, "\n-- status before -- \n"); if ((entry->flags & RW_EXISTS) || (entry->flags & RO_EXISTS) || (entry->flags & BACK_EXISTS)) - EnumerateEntryU(entry); + EnumerateEntry(entry); fprintf(STDOUT, "\n"); } @@ -6860,13 +6768,13 @@ CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted) } islocked = 1; - code = VLDB_GetEntryByIDU(entry->volumeId[RWVOL], RWVOL, entry); + code = VLDB_GetEntryByID(entry->volumeId[RWVOL], RWVOL, entry); if (code) { fprintf(STDERR, "Could not read VLDB entry for volume %s\n", entry->name); ERROR_EXIT(code); } else { - MapHostToNetworkU(entry); + MapHostToNetwork(entry); } } @@ -6912,9 +6820,9 @@ CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted) delentry = 1; } else { /* Replace old entry with our new one */ - MapNetworkToHostU(entry, &storeEntry); + MapNetworkToHost(entry, &storeEntry); code = - VLDB_ReplaceEntryU(entry->volumeId[RWVOL], RWVOL, &storeEntry, + VLDB_ReplaceEntry(entry->volumeId[RWVOL], RWVOL, &storeEntry, (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP)); if (code) { @@ -6938,7 +6846,7 @@ CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted) if (delentry) fprintf(STDOUT, "\n**entry deleted**\n"); else if (modentry) - EnumerateEntryU(entry); + EnumerateEntry(entry); else fprintf(STDOUT, "\n**no change**\n"); } @@ -6972,9 +6880,9 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force) afs_int32 code, error = 0; afs_int32 nentries, tentries = 0; struct VldbListByAttributes attributes; - ubulkentries arrayEntries; + nbulkentries arrayEntries; afs_int32 failures = 0, modified, modifications = 0; - struct uvldbentry *vlentry; + struct nvldbentry *vlentry; afs_int32 si, nsi, j; if (flags & 2) @@ -6998,10 +6906,10 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force) /* Collect set of VLDB entries */ code = - VLDB_ListAttributesN2U(&attributes, 0, si, &nentries, + VLDB_ListAttributesN2(&attributes, 0, si, &nentries, &arrayEntries, &nsi); if (code == RXGEN_OPCODE) { - code = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries); + code = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries); nsi = -1; } if (code) { @@ -7011,8 +6919,8 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force) tentries += nentries; for (j = 0; j < nentries; j++) { - vlentry = &arrayEntries.ubulkentries_val[j]; - MapHostToNetworkU(vlentry); + vlentry = &arrayEntries.nbulkentries_val[j]; + MapHostToNetwork(vlentry); VPRINT1("Processing VLDB entry %d ...\n", j + 1); @@ -7041,9 +6949,9 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force) } } - if (arrayEntries.ubulkentries_val) { - free(arrayEntries.ubulkentries_val); - arrayEntries.ubulkentries_val = 0; + if (arrayEntries.nbulkentries_val) { + free(arrayEntries.nbulkentries_val); + arrayEntries.nbulkentries_val = 0; } } @@ -7058,8 +6966,8 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force) error_exit: if (aconn) rx_DestroyConnection(aconn); - if (arrayEntries.ubulkentries_val) - free(arrayEntries.ubulkentries_val); + if (arrayEntries.nbulkentries_val) + free(arrayEntries.nbulkentries_val); if (failures) error = VOLSERFAILEDOP; @@ -7069,26 +6977,11 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force) /*rename volume to , changing the names of the related *readonly and backup volumes. This operation is also idempotent. *salvager is capable of recovering from rename operation stopping halfway. - *to recover run syncserver on the affected machines, it will force renaming - *to completion. name clashes should have been detected before calling this proc */ -int -UV_RenameVolume(struct nvldbentry *entryp, char oldname[], char newname[]) -{ - struct uvldbentry uentry; - int error; - - nvlentry_to_uvlentry(entryp, &uentry); - error = UV_RenameVolumeU(&uentry, oldname, newname); - if (!error) - error = uvlentry_to_nvlentry(&uentry, entryp); - - return error; -} - + *to recover run syncserver on the affected machines,it will force renaming to completion. name clashes should have been detected before calling this proc */ int -UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[]) +UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[]) { - struct uvldbentry storeEntry; + struct nvldbentry storeEntry; afs_int32 vcode, code, rcode, error; int i, index; char nameBuffer[256]; @@ -7112,8 +7005,8 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[]) } islocked = 1; strncpy(entry->name, newname, VOLSER_OLDMAXVOLNAME); - MapNetworkToHostU(entry, &storeEntry); - vcode = VLDB_ReplaceEntryU(entry->volumeId[RWVOL], RWVOL, &storeEntry, 0); + MapNetworkToHost(entry, &storeEntry); + vcode = VLDB_ReplaceEntry(entry->volumeId[RWVOL], RWVOL, &storeEntry, 0); if (vcode) { fprintf(STDERR, "Could not update VLDB entry for %u\n", entry->volumeId[RWVOL]); @@ -7124,7 +7017,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[]) /*at this stage the intent to rename is recorded in the vldb, as far as the vldb * is concerned, oldname is lost */ if (entry->flags & RW_EXISTS) { - index = Lp_GetRwIndexU(entry); + index = Lp_GetRwIndex(entry); if (index == -1) { /* there is a serious discrepancy */ fprintf(STDERR, "There is a serious discrepancy in VLDB entry for volume %u\n", @@ -7133,7 +7026,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[]) error = VOLSERVLDB_ERROR; goto rvfail; } - aconn = UV_Bind(entry->serverUnique[index], AFSCONF_VOLUMEPORT); + aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT); code = AFSVolTransCreate_retry(aconn, entry->volumeId[RWVOL], entry->serverPartition[index], ITOffline, &tid); @@ -7174,7 +7067,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[]) } /*end rw volume processing */ if (entry->flags & BACK_EXISTS) { /*process the backup volume */ - index = Lp_GetRwIndexU(entry); + index = Lp_GetRwIndex(entry); if (index == -1) { /* there is a serious discrepancy */ fprintf(STDERR, "There is a serious discrepancy in the VLDB entry for the backup volume %u\n", @@ -7183,7 +7076,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[]) error = VOLSERVLDB_ERROR; goto rvfail; } - aconn = UV_Bind(entry->serverUnique[index], AFSCONF_VOLUMEPORT); + aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT); code = AFSVolTransCreate_retry(aconn, entry->volumeId[BACKVOL], entry->serverPartition[index], ITOffline, &tid); @@ -7233,7 +7126,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[]) if (entry->flags & RO_EXISTS) { /*process the ro volumes */ for (i = 0; i < entry->nServers; i++) { if (entry->serverFlags[i] & ITSROVOL) { - aconn = UV_Bind(entry->serverUnique[i], AFSCONF_VOLUMEPORT); + aconn = UV_Bind(entry->serverNumber[i], AFSCONF_VOLUMEPORT); code = AFSVolTransCreate_retry(aconn, entry->volumeId[ROVOL], entry->serverPartition[i], ITOffline, @@ -7261,9 +7154,9 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[]) VPRINT2("Renamed RO volume %s on host %s\n", nameBuffer, noresolve ? - afs_inet_ntoa_r(entry->serverUnique[i], hoststr) : + afs_inet_ntoa_r(entry->serverNumber[i], hoststr) : hostutil_GetNameByINet(entry-> - serverUnique[i])); + serverNumber[i])); code = AFSVolEndTrans(aconn, tid, &rcode); tid = 0; if (code) { @@ -7315,6 +7208,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[]) rx_DestroyConnection(aconn); PrintError("", error); return error; + } /*report on all the active transactions on volser */ @@ -7538,30 +7432,6 @@ UV_GetSize(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart, /*maps the host addresses in (present in network byte order) to that in< new> (present in host byte order )*/ void -MapNetworkToHostU(struct uvldbentry *old, struct uvldbentry *new) -{ - int i, count; - - /*copy all the fields */ - strcpy(new->name, old->name); -/* new->volumeType = old->volumeType;*/ - new->nServers = old->nServers; - count = old->nServers; - if (count < NMAXNSERVERS) - count++; - for (i = 0; i < count; i++) { - new->serverUnique[i] = ntohl(old->serverUnique[i]); - new->serverPartition[i] = old->serverPartition[i]; - new->serverFlags[i] = old->serverFlags[i]; - } - new->volumeId[RWVOL] = old->volumeId[RWVOL]; - new->volumeId[ROVOL] = old->volumeId[ROVOL]; - new->volumeId[BACKVOL] = old->volumeId[BACKVOL]; - new->cloneId = old->cloneId; - new->flags = old->flags; -} - -void MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new) { int i, count; @@ -7587,19 +7457,6 @@ MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new) /*maps the host entries in which are present in host byte order to network byte order */ void -MapHostToNetworkU(struct uvldbentry *entry) -{ - int i, count; - - count = entry->nServers; - if (count < NMAXNSERVERS) - count++; - for (i = 0; i < count; i++) { - entry->serverUnique[i] = htonl(entry->serverUnique[i]); - } -} - -void MapHostToNetwork(struct nvldbentry *entry) { int i, count; @@ -7611,4 +7468,3 @@ MapHostToNetwork(struct nvldbentry *entry) entry->serverNumber[i] = htonl(entry->serverNumber[i]); } } - diff --git a/src/volser/vsutils.c b/src/volser/vsutils.c index e6cfb79..13c7fd5 100644 --- a/src/volser/vsutils.c +++ b/src/volser/vsutils.c @@ -60,16 +60,7 @@ ovlentry_to_nvlentry(struct vldbentry *oentryp, memset(nentryp, 0, sizeof(struct nvldbentry)); strncpy(nentryp->name, oentryp->name, sizeof(nentryp->name)); for (i = 0; i < oentryp->nServers; i++) { - bulkaddrs m_addrs; - ListAddrByAttributes m_attrs; - afs_int32 m_nentries; - - m_attrs.Mask = VLADDR_IPADDR; - m_attrs.ipaddr = oentryp->serverNumber[i]; - m_nentries = 0; - m_addrs.bulkaddrs_val = 0; - m_addrs.bulkaddrs_len = 0; - nentryp->serverNumber[i] = oentryp->serverNumber[i]; + nentryp->serverNumber[i] = oentryp->serverNumber[i]; nentryp->serverPartition[i] = oentryp->serverPartition[i]; nentryp->serverFlags[i] = oentryp->serverFlags[i]; } @@ -80,8 +71,6 @@ ovlentry_to_nvlentry(struct vldbentry *oentryp, nentryp->flags = oentryp->flags; } -#if 0 -/* It is here for when we need it. Not currently used. */ static int nvlentry_to_ovlentry(struct nvldbentry *nentryp, struct vldbentry *oentryp) @@ -109,136 +98,6 @@ nvlentry_to_ovlentry(struct nvldbentry *nentryp, oentryp->flags = nentryp->flags; return 0; } -#endif - -static void -ovlentry_to_uvlentry(struct vldbentry *oentryp, - struct uvldbentry *uentryp) -{ - int i; - - memset(uentryp, 0, sizeof(struct uvldbentry)); - strncpy(uentryp->name, oentryp->name, sizeof(uentryp->name)); - for (i = 0; i < oentryp->nServers; i++) { - afs_int32 vcode, m_uniq=0; - bulkaddrs m_addrs; - ListAddrByAttributes m_attrs; - afs_int32 m_nentries; - - m_attrs.Mask = VLADDR_IPADDR; - m_attrs.ipaddr = oentryp->serverNumber[i]; - m_nentries = 0; - m_addrs.bulkaddrs_val = 0; - m_addrs.bulkaddrs_len = 0; - vcode = - ubik_VL_GetAddrsU(cstruct, 0, &m_attrs, - &uentryp->serverNumber[i], - &m_uniq, &m_nentries, - &m_addrs); - uentryp->serverUnique[i] = oentryp->serverNumber[i]; - uentryp->serverPartition[i] = oentryp->serverPartition[i]; - uentryp->serverFlags[i] = oentryp->serverFlags[i]; - } - uentryp->nServers = oentryp->nServers; - for (i = 0; i < MAXTYPES; i++) - uentryp->volumeId[i] = oentryp->volumeId[i]; - uentryp->cloneId = oentryp->cloneId; - uentryp->flags = oentryp->flags; -} - -static int -uvlentry_to_ovlentry(struct uvldbentry *uentryp, - struct vldbentry *oentryp) -{ - int i; - - memset(oentryp, 0, sizeof(struct vldbentry)); - strncpy(oentryp->name, uentryp->name, sizeof(oentryp->name)); - if (uentryp->nServers > OMAXNSERVERS) { - /* - * The alternative is to store OMAXSERVERS but it's always better - * to know what's going on... - */ - return VL_BADSERVER; - } - for (i = 0; i < uentryp->nServers; i++) { - oentryp->serverNumber[i] = uentryp->serverUnique[i]; - oentryp->serverPartition[i] = uentryp->serverPartition[i]; - oentryp->serverFlags[i] = uentryp->serverFlags[i]; - } - oentryp->nServers = i; - for (i = 0; i < MAXTYPES; i++) - oentryp->volumeId[i] = uentryp->volumeId[i]; - oentryp->cloneId = uentryp->cloneId; - oentryp->flags = uentryp->flags; - return 0; -} - -void -nvlentry_to_uvlentry(struct nvldbentry *nentryp, - struct uvldbentry *uentryp) -{ - int i; - - memset(uentryp, 0, sizeof(struct uvldbentry)); - strncpy(uentryp->name, nentryp->name, sizeof(uentryp->name)); - for (i = 0; i < nentryp->nServers; i++) { - afs_int32 vcode, m_uniq=0; - bulkaddrs m_addrs; - ListAddrByAttributes m_attrs; - afs_int32 m_nentries; - - m_attrs.Mask = VLADDR_IPADDR; - m_attrs.ipaddr = nentryp->serverNumber[i]; - m_nentries = 0; - m_addrs.bulkaddrs_val = 0; - m_addrs.bulkaddrs_len = 0; - vcode = - ubik_VL_GetAddrsU(cstruct, 0, &m_attrs, - &uentryp->serverNumber[i], - &m_uniq, &m_nentries, - &m_addrs); - uentryp->serverUnique[i] = m_uniq; - uentryp->serverPartition[i] = nentryp->serverPartition[i]; - uentryp->serverFlags[i] = nentryp->serverFlags[i]; - uentryp->serverFlags[i] |= VLSERVER_FLAG_UUID; - } - uentryp->nServers = nentryp->nServers; - for (i = 0; i < MAXTYPES; i++) - uentryp->volumeId[i] = nentryp->volumeId[i]; - uentryp->cloneId = nentryp->cloneId; - uentryp->flags = nentryp->flags; - uentryp->matchindex = nentryp->matchindex; -} - -int -uvlentry_to_nvlentry(struct uvldbentry *uentryp, - struct nvldbentry *nentryp) -{ - int i; - - memset(nentryp, 0, sizeof(struct vldbentry)); - strncpy(nentryp->name, uentryp->name, sizeof(nentryp->name)); - if (uentryp->nServers > NMAXNSERVERS) { - /* - * The alternative is to store NMAXSERVERS but it's always better - * to know what's going on... - */ - return VL_BADSERVER; - } - for (i = 0; i < uentryp->nServers; i++) { - nentryp->serverNumber[i] = uentryp->serverUnique[i]; - nentryp->serverPartition[i] = uentryp->serverPartition[i]; - nentryp->serverFlags[i] = uentryp->serverFlags[i]; - } - nentryp->nServers = i; - for (i = 0; i < MAXTYPES; i++) - nentryp->volumeId[i] = uentryp->volumeId[i]; - nentryp->cloneId = uentryp->cloneId; - nentryp->flags = uentryp->flags; - nentryp->matchindex = uentryp->matchindex; - return 0; -} enum _vlserver_type { vltype_unknown = 0, @@ -252,39 +111,25 @@ static enum _vlserver_type newvlserver = vltype_unknown; int VLDB_CreateEntry(struct nvldbentry *entryp) { - int code; - struct uvldbentry uentry; - - nvlentry_to_uvlentry(entryp, &uentry); - code = VLDB_CreateEntryU(&uentry); - if (!code) - code = uvlentry_to_nvlentry(&uentry, entryp); - return code; -} - -int -VLDB_CreateEntryU(struct uvldbentry *entryp) -{ - struct nvldbentry nentry; + struct vldbentry oentry; int code; if (newvlserver == vltype_old) { - struct vldbentry oentry; tryold: - code = uvlentry_to_ovlentry(entryp, &oentry); + code = nvlentry_to_ovlentry(entryp, &oentry); if (code) return code; code = ubik_VL_CreateEntry(cstruct, 0, &oentry); return code; } - - code = uvlentry_to_nvlentry(entryp, &nentry); - if (code) - return code; - code = ubik_VL_CreateEntryN(cstruct, 0, &nentry); - if (code == RXGEN_OPCODE) { - newvlserver = vltype_old; - goto tryold; + code = ubik_VL_CreateEntryN(cstruct, 0, entryp); + if (newvlserver == vltype_unknown) { + if (code == RXGEN_OPCODE) { + newvlserver = vltype_old; /* Doesn't support new interface */ + goto tryold; + } else if (!code) { + newvlserver = vltype_new; + } } return code; } @@ -292,128 +137,80 @@ VLDB_CreateEntryU(struct uvldbentry *entryp) int VLDB_GetEntryByID(afs_uint32 volid, afs_int32 voltype, struct nvldbentry *entryp) { - int code; - struct uvldbentry uentry; - - nvlentry_to_uvlentry(entryp, &uentry); - code = VLDB_GetEntryByIDU(volid, voltype, &uentry); - if (!code) - code = uvlentry_to_nvlentry(&uentry, entryp); - return code; -} - -int -VLDB_GetEntryByIDU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp) -{ - struct nvldbentry nentry; + struct vldbentry oentry; int code; if (newvlserver == vltype_old) { - struct vldbentry oentry; tryold: code = ubik_VL_GetEntryByID(cstruct, 0, volid, voltype, &oentry); if (!code) - ovlentry_to_uvlentry(&oentry, entryp); + ovlentry_to_nvlentry(&oentry, entryp); return code; } - - code = ubik_VL_GetEntryByIDN(cstruct, 0, volid, voltype, &nentry); - if (code == RXGEN_OPCODE) { - newvlserver = vltype_old; - goto tryold; + code = ubik_VL_GetEntryByIDN(cstruct, 0, volid, voltype, entryp); + if (newvlserver == vltype_unknown) { + if (code == RXGEN_OPCODE) { + newvlserver = vltype_old; /* Doesn't support new interface */ + goto tryold; + } else if (!code) { + newvlserver = vltype_new; + } } - if (!code) - nvlentry_to_uvlentry(&nentry, entryp); return code; } int VLDB_GetEntryByName(char *namep, struct nvldbentry *entryp) { - int code; - struct uvldbentry uentry; - - nvlentry_to_uvlentry(entryp, &uentry); - code = VLDB_GetEntryByNameU(namep, &uentry); - if (!code) - code = uvlentry_to_nvlentry(&uentry, entryp); - return code; -} - -int -VLDB_GetEntryByNameU(char *namep, struct uvldbentry *entryp) -{ + struct vldbentry oentry; int code; if (newvlserver == vltype_old) { - struct vldbentry oentry; tryold: code = ubik_VL_GetEntryByNameO(cstruct, 0, namep, &oentry); if (!code) - ovlentry_to_uvlentry(&oentry, entryp); + ovlentry_to_nvlentry(&oentry, entryp); return code; } - if (newvlserver == vltype_new) { - struct nvldbentry nentry; - trynew: - code = ubik_VL_GetEntryByNameN(cstruct, 0, namep, &nentry); - if (code == RXGEN_OPCODE) { - newvlserver = vltype_old; - goto tryold; - } - if (!code) - nvlentry_to_uvlentry(&nentry, entryp); - } - code = ubik_VL_GetEntryByNameU(cstruct, 0, namep, entryp); + code = ubik_VL_GetEntryByNameN(cstruct, 0, namep, entryp); if (newvlserver == vltype_unknown) { if (code == RXGEN_OPCODE) { - newvlserver = vltype_new; - goto trynew; + newvlserver = vltype_old; /* Doesn't support new interface */ + goto tryold; } else if (!code) { - newvlserver = vltype_uuid; + newvlserver = vltype_new; } } return code; } int -VLDB_ReplaceEntry(afs_uint32 volid, afs_int32 voltype, struct nvldbentry *nentryp, afs_int32 releasetype) +VLDB_ReplaceEntry(afs_uint32 volid, afs_int32 voltype, struct nvldbentry *entryp, afs_int32 releasetype) { - struct uvldbentry uentry; + struct vldbentry oentry; int code; - nvlentry_to_uvlentry(nentryp, &uentry); - code = VLDB_ReplaceEntryU(volid, voltype, &uentry, releasetype); - if (!code) - code = uvlentry_to_nvlentry(&uentry, nentryp); - - return code; -} - -int -VLDB_ReplaceEntryU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp, afs_int32 releasetype) -{ - int code; - struct nvldbentry nentry; - if (newvlserver == vltype_old) { - struct vldbentry oentry; tryold: - code = uvlentry_to_ovlentry(entryp, &oentry); + code = nvlentry_to_ovlentry(entryp, &oentry); if (code) return code; code = - ubik_VL_ReplaceEntry(cstruct, 0, volid, voltype, &oentry, releasetype); + ubik_VL_ReplaceEntry(cstruct, 0, volid, voltype, &oentry, + releasetype); return code; } - code = uvlentry_to_nvlentry(entryp, &nentry); - if (code) - return code; - code = ubik_VL_ReplaceEntryN(cstruct, 0, volid, voltype, &nentry, releasetype); - if (code == RXGEN_OPCODE) { - newvlserver = vltype_old; - goto tryold; + code = + ubik_VL_ReplaceEntryN(cstruct, 0, volid, voltype, entryp, + releasetype); + if (newvlserver == vltype_unknown) { + if (code == RXGEN_OPCODE) { + newvlserver = vltype_old; /* Doesn't support new interface */ + goto tryold; + } else if (!code) { + newvlserver = vltype_new; + } } return code; } @@ -435,47 +232,15 @@ convertBulkToNBulk(bulkentries *bulk, nbulkentries *nbulk) { } } -static void -convertBulkToUBulk(bulkentries *bulk, ubulkentries *ubulk) { - int i; - - if (bulk->bulkentries_len == 0) - return; - - ubulk->ubulkentries_len = bulk->bulkentries_len; - ubulk->ubulkentries_val = - xdr_alloc(bulk->bulkentries_len * sizeof(struct uvldbentry)); - for (i = 0; i < bulk->bulkentries_len; i++) { - ovlentry_to_uvlentry(&bulk->bulkentries_val[i], - &ubulk->ubulkentries_val[i]); - } -} - -static void -convertNBulkToUBulk(nbulkentries *nbulk, ubulkentries *ubulk) { - int i; - - if (nbulk->nbulkentries_len == 0) - return; - - ubulk->ubulkentries_len = nbulk->nbulkentries_len; - ubulk->ubulkentries_val = - xdr_alloc(nbulk->nbulkentries_len * sizeof(struct uvldbentry)); - for (i = 0; i < nbulk->nbulkentries_len; i++) { /* process each entry */ - nvlentry_to_uvlentry(&nbulk->nbulkentries_val[i], - &ubulk->ubulkentries_val[i]); - } -} - int VLDB_ListAttributes(VldbListByAttributes *attrp, afs_int32 *entriesp, nbulkentries *blkentriesp) { + bulkentries arrayEntries; int code; if (newvlserver == vltype_old) { - bulkentries arrayEntries; tryold: memset(&arrayEntries, 0, sizeof(arrayEntries)); code = @@ -496,17 +261,17 @@ VLDB_ListAttributes(VldbListByAttributes *attrp, xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries); return code; } - code = ubik_VL_ListAttributesN(cstruct, 0, attrp, entriesp, blkentriesp); - if (code == RXGEN_OPCODE) { - newvlserver = vltype_old; /* Doesn't support new interface */ - goto tryold; + if (newvlserver == vltype_unknown) { + if (code == RXGEN_OPCODE) { + newvlserver = vltype_old; /* Doesn't support new interface */ + goto tryold; + } else if (!code) { + newvlserver = vltype_new; + } } - if (code) - return code; - /* Ensure the number of entries claimed matches the no. returned */ if (*entriesp < 0) *entriesp = 0; @@ -517,58 +282,6 @@ VLDB_ListAttributes(VldbListByAttributes *attrp, } int -VLDB_ListAttributesU(VldbListByAttributes *attrp, - afs_int32 *entriesp, - ubulkentries *blkentriesp) -{ - nbulkentries narrayEntries; - int code; - - if (newvlserver == vltype_old) { - bulkentries arrayEntries; - tryold: - memset(&arrayEntries, 0, sizeof(arrayEntries)); - code = - ubik_VL_ListAttributes(cstruct, 0, attrp, entriesp, - &arrayEntries); - if (code) - return code; - - /* Ensure the number of entries claimed matches the no. returned */ - if (*entriesp < 0) - *entriesp = 0; - if (*entriesp > arrayEntries.bulkentries_len) - *entriesp = arrayEntries.bulkentries_len; - - convertBulkToUBulk(&arrayEntries, blkentriesp); - - xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries); - return code; - } - - memset(&narrayEntries, 0, sizeof(narrayEntries)); - code = - ubik_VL_ListAttributesN(cstruct, 0, attrp, entriesp, &narrayEntries); - if (code == RXGEN_OPCODE) { - newvlserver = vltype_old; /* Doesn't support new interface */ - goto tryold; - } - if (code) - return code; - - /* Ensure the number of entries claimed matches the no. returned */ - if (*entriesp < 0) - *entriesp = 0; - if (*entriesp > narrayEntries.nbulkentries_len) - *entriesp = narrayEntries.nbulkentries_len; - - convertNBulkToUBulk(&narrayEntries, blkentriesp); - - xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries); - return code; -} - -int VLDB_ListAttributesN2(VldbListByAttributes *attrp, char *name, afs_int32 thisindex, @@ -594,41 +307,6 @@ VLDB_ListAttributesN2(VldbListByAttributes *attrp, return code; } -int -VLDB_ListAttributesN2U(VldbListByAttributes *attrp, - char *name, - afs_int32 thisindex, - afs_int32 *nentriesp, - ubulkentries *blkentriesp, - afs_int32 *nextindexp) -{ - afs_int32 code = RXGEN_OPCODE; - - if (newvlserver != vltype_old) { - nbulkentries narrayEntries; - - memset(&narrayEntries, 0, sizeof(narrayEntries)); /*initialize to hint the stub to alloc space */ - code = - ubik_VL_ListAttributesN2(cstruct, 0, attrp, (name ? name : ""), - thisindex, nentriesp, &narrayEntries, nextindexp); - if (code) - return code; - - /* Ensure the number of entries claimed matches the no. returned */ - if (*nentriesp < 0) - *nentriesp = 0; - if (*nentriesp > narrayEntries.nbulkentries_len) - *nentriesp = narrayEntries.nbulkentries_len; - - convertNBulkToUBulk(&narrayEntries, blkentriesp); - - xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries); - return code; - } - return code; -} - - struct cacheips { afs_uint32 server; afs_int32 count; @@ -649,8 +327,8 @@ VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp) int code; ListAddrByAttributes attrs; bulkaddrs addrs; - afs_uint32 *addrp, f1, f2; - afs_int32 i, j, unique, nentries; + afs_uint32 *addrp, i, j, f1, f2; + afs_int32 unique, nentries; afsUUID uuid; static int initcache = 0; @@ -658,8 +336,7 @@ VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp) if (serv1 == serv2) return 1; - if (newvlserver == vltype_old || - newvlserver == vltype_new) { + if (newvlserver == vltype_old || newvlserver == vltype_new) { return 0; } if (!initcache) { @@ -697,7 +374,6 @@ VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp) &addrs); if (newvlserver == vltype_unknown) { if (code == RXGEN_OPCODE) { - newvlserver = vltype_new; return 0; } else if (!code) { newvlserver = vltype_uuid; @@ -767,7 +443,7 @@ int vsu_ExtractName(char rname[], char name[]) { char sname[VOLSER_OLDMAXVOLNAME + 1]; - size_t total; + int total; strncpy(sname, name, sizeof(sname)); sname[sizeof(sname) - 1] = '\0'; @@ -794,9 +470,9 @@ afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp) { char volname[VOLSER_OLDMAXVOLNAME + 1]; - struct uvldbentry entry; + struct nvldbentry entry; afs_int32 vcode = 0; - size_t total; + int total; *errp = 0; @@ -811,7 +487,7 @@ vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp) /* It was not a volume number but something else */ total = strlen(astring); vsu_ExtractName(volname, astring); - vcode = VLDB_GetEntryByNameU(volname, &entry); + vcode = VLDB_GetEntryByName(volname, &entry); if (!vcode) { if ((total >= 9) && (!strcmp(&astring[total - 9], ".readonly"))) return entry.volumeId[ROVOL]; diff --git a/src/volser/vsutils_prototypes.h b/src/volser/vsutils_prototypes.h index 2fa65c8..042e91a 100644 --- a/src/volser/vsutils_prototypes.h +++ b/src/volser/vsutils_prototypes.h @@ -9,26 +9,10 @@ extern int VLDB_ReplaceEntry(afs_uint32 volid, afs_int32 voltype, struct nvldben extern int VLDB_ListAttributes(VldbListByAttributes *attrp, afs_int32 *entriesp, nbulkentries *blkentriesp); extern int VLDB_ListAttributesN2(VldbListByAttributes *attrp, char *name, afs_int32 thisindex, afs_int32 *nentriesp, nbulkentries *blkentriesp, afs_int32 *nextindexp); - -extern int VLDB_CreateEntryU(struct uvldbentry *entryp); -extern int VLDB_GetEntryByIDU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp); -extern int VLDB_GetEntryByNameU(char *namep, struct uvldbentry *entryp); -extern int VLDB_ReplaceEntryU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp, afs_int32 releasetype); -extern int VLDB_ListAttributesU(VldbListByAttributes *attrp, afs_int32 *entriesp, ubulkentries *blkentriesp); -extern int VLDB_ListAttributesN2U(VldbListByAttributes *attrp, char *name, afs_int32 thisindex, - afs_int32 *nentriesp, ubulkentries *blkentriesp, afs_int32 *nextindexp); - extern int VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp); - extern void vsu_SetCrypt(int cryptflag); extern afs_int32 vsu_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 sauth, 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); - -/* private */ -extern void nvlentry_to_uvlentry(struct nvldbentry *nentryp, - struct uvldbentry *uentryp); -extern int uvlentry_to_nvlentry(struct uvldbentry *uentryp, - struct nvldbentry *nentryp); #endif