/* 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;
static int
VolNameOK(char *name)
{
- size_t total;
+ int total;
+
total = strlen(name);
if (!strcmp(&name[total - 9], ".readonly")) {
static int
IsNumeric(char *name)
{
- int result, i;
- size_t len;
+ int result, len, i;
char *ptr;
result = 1;
/* set <server> and <part> to the correct values depending on
* <voltype> and <entry> */
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;
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;
}
static void
-PostVolumeStats(struct uvldbentry *entry)
+PostVolumeStats(struct nvldbentry *entry)
{
- SubEnumerateEntryU(entry);
+ SubEnumerateEntry(entry);
/* Check for VLOP_ALLOPERS */
PrintLocked(entry->flags);
return;
*------------------------------------------------------------------------*/
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 */
} /*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;
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;
(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",
}
if (verbose)
fprintf(STDOUT, "done\n");
- MapHostToNetworkU(&entry);
+ MapHostToNetwork(&entry);
if (entry.volumeId[RWVOL] == volid)
voltype = RWVOL;
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);
static int
SetFields(struct cmd_syndesc *as, void *arock)
{
- struct uvldbentry entry;
+ struct nvldbentry entry;
volintInfo info;
afs_uint32 volid;
afs_int32 code, err;
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) {
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;
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);
#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];
* 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",
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",
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) {
return ENOENT;
}
- server = htonl(entry.serverUnique[idx]);
+ server = htonl(entry.serverNumber[idx]);
partition = entry.serverPartition[idx];
}
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;
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);
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) {
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) {
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;
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++) {
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) {
/* 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))
"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,
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) {
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.
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;
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];
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);
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);
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",
PrintError("", vcode);
return (vcode);
}
- MapHostToNetworkU(rentry);
+ MapHostToNetwork(rentry);
if (volid == rentry->volumeId[ROVOL]) {
*voltype = ROVOL;
for (i = 0; i < rentry->nServers; i++) {
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",
}
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;
}
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;
/* 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);
/* 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))) {
"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;
}
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;
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);
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;
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) {
/* 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);
}
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,
/* 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);
}
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];
}
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);
}
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) {
}
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",
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;
}
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;
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,
}
}
- xdr_free((xdrproc_t) xdr_ubulkentries, &arrayEntries);
+ xdr_free((xdrproc_t) xdr_nbulkentries, &arrayEntries);
return 0;
}
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;
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",
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",
}
if (same) {
roindex = i;
- roserver = entry.serverUnique[i];
+ roserver = entry.serverNumber[i];
ropartition = entry.serverPartition[i];
break;
}
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;
}
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) {
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);
{ 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) \
#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);
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 <partId> into partition name <partName>*/
void
return 0;
}
-void
-init_volintInfo(struct volintInfo *vinfo) {
+void init_volintInfo(struct volintInfo *vinfo) {
memset(vinfo, 0, sizeof(struct volintInfo));
vinfo->maxquota = -1;
#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 <entry> */
-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)
{
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;
}
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;
/* 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 */
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",
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;
/* 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 */
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",
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;
} 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 */
/* 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);
}
* 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);
}
"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;
}
* 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);
}
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;
"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,
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 */
/* 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);
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);
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);
}
}
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) {
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) {
}
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");
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;
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 */
/* 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;
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",
}
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) {
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;
/* 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",
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.
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",
error = code;
goto bfail;
}
- MapHostToNetworkU(&entry);
+ MapHostToNetwork(&entry);
}
if (!ISNAMEVALID(entry.name)) {
/* 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) {
* 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)
*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 */
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) {
"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);
}
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) {
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;
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,
* 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");
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");
}
* 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;
* 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;
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]));
}
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 */
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");
/* 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;
}
-static void
+void
dump_sig_handler(int x)
{
fprintf(STDERR, "\nSignal handler: vos dump operation\n");
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;
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) {
/* 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",
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;
/*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",
}
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 =
/* 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;
* if its different from new site.
*/
same =
- VLDB_IsSameAddrs(toserver, entry.serverUnique[index],
+ VLDB_IsSameAddrs(toserver, entry.serverNumber[index],
&errcode);
if (errcode)
EPRINT2(errcode,
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],
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,
}
}
}
- 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) {
}
islocked = 0;
if (verbose)
- EnumerateEntryU(&entry);
+ EnumerateEntry(&entry);
}
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];
}
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",
error = VOLSERBADOP;
goto asfail;
}
- MapHostToNetworkU(&entry);
+ MapHostToNetwork(&entry);
/* See if it's too many entries */
if (entry.nServers >= NMAXNSERVERS) {
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",
*/
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;
}
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);
}
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",
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) {
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",
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 =
}
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;
}
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) {
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);
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",
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",
}
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) {
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;
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,
createentry = 1;
} else {
- MapHostToNetworkU(&entry);
+ MapHostToNetwork(&entry);
}
}
} else {
if ((entry.flags & RW_EXISTS) || (entry.flags & RO_EXISTS)
|| (entry.flags & BACK_EXISTS))
- EnumerateEntryU(&entry);
+ EnumerateEntry(&entry);
}
fprintf(STDOUT, "\n");
}
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) {
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 {
"*** 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,
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);
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);
" 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 {
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;
* 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++;
"*** 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++;
* 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++;
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;
*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",
if (pass == 1)
goto retry;
code =
- VLDB_ReplaceEntryU(rwvolid, RWVOL, &storeEntry,
+ VLDB_ReplaceEntry(rwvolid, RWVOL, &storeEntry,
LOCKREL_OPCODE | LOCKREL_AFSID |
LOCKREL_TIMESTAMP);
if (code) {
if (verbose) {
fprintf(STDOUT, "-- status after --\n");
if (modified)
- EnumerateEntryU(&entry);
+ EnumerateEntry(&entry);
else
fprintf(STDOUT, "\n**no change**\n");
}
return (error);
}
-static int
+int
sortVolumes(const void *a, const void *b)
{
volintInfo *v1 = (volintInfo *) a;
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;
}
/* 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) {
} else {
if ((vldbentry.flags & RW_EXISTS) || (vldbentry.flags & RO_EXISTS)
|| (vldbentry.flags & BACK_EXISTS))
- EnumerateEntryU(&vldbentry);
+ EnumerateEntry(&vldbentry);
}
fprintf(STDOUT, "\n");
}
if (deleted) {
fprintf(STDOUT, "\n**entry deleted**\n");
} else if (modified) {
- EnumerateEntryU(&vldbentry);
+ EnumerateEntry(&vldbentry);
} else {
fprintf(STDOUT, "\n**no change**\n");
}
* 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;
/* 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;
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.
}
} 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 */
"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);
}
}
} 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 */
"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);
}
*/
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++;
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;
}
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--;
"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);
}
}
/* CheckVldb()
* Ensure that <entry> 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;
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");
}
}
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);
}
}
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) {
if (delentry)
fprintf(STDOUT, "\n**entry deleted**\n");
else if (modentry)
- EnumerateEntryU(entry);
+ EnumerateEntry(entry);
else
fprintf(STDOUT, "\n**no change**\n");
}
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)
/* 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) {
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);
}
}
- if (arrayEntries.ubulkentries_val) {
- free(arrayEntries.ubulkentries_val);
- arrayEntries.ubulkentries_val = 0;
+ if (arrayEntries.nbulkentries_val) {
+ free(arrayEntries.nbulkentries_val);
+ arrayEntries.nbulkentries_val = 0;
}
}
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;
/*rename volume <oldname> to <newname>, 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];
}
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]);
/*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",
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);
}
/*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",
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);
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,
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) {
rx_DestroyConnection(aconn);
PrintError("", error);
return error;
+
}
/*report on all the active transactions on volser */
/*maps the host addresses in <old > (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;
/*maps the host entries in <entry> 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;
entry->serverNumber[i] = htonl(entry->serverNumber[i]);
}
}
-
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];
}
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)
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,
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;
}
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;
}
}
}
-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 =
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;
}
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,
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;
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;
if (serv1 == serv2)
return 1;
- if (newvlserver == vltype_old ||
- newvlserver == vltype_new) {
+ if (newvlserver == vltype_old || newvlserver == vltype_new) {
return 0;
}
if (!initcache) {
&addrs);
if (newvlserver == vltype_unknown) {
if (code == RXGEN_OPCODE) {
- newvlserver = vltype_new;
return 0;
} else if (!code) {
newvlserver = vltype_uuid;
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';
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;
/* 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];