ei = entries[e].matchindex & 0xffff;
et = (entries[e].matchindex >> 16) & 0xffff;
switch (et) {
- case ITSRWVOL:{
+ case VLSF_RWVOL:{
et = RWVOL;
break;
}
- case ITSBACKVOL:{
+ case VLSF_BACKVOL:{
et = BACKVOL;
break;
}
- case ITSROVOL:{
+ case VLSF_ROVOL:{
et = ROVOL;
break;
}
/* If the RW name matches the volume set entry, take
* it and exit. First choice is to use the RW volume.
*/
- if (entry.serverFlags[srvpartpair] & ITSRWVOL) {
- if (entry.flags & RW_EXISTS) {
+ if (entry.serverFlags[srvpartpair] & VLSF_RWVOL) {
+ if (entry.flags & VLF_RWEXISTS) {
sprintf(patt, "%s", entry.name);
#ifdef HAVE_POSIX_REGEX
code = regexec(&re, patt, 0, NULL, 0);
/* If the BK name matches the volume set entry, take
* it and exit. Second choice is to use the BK volume.
*/
- if (entry.flags & BACK_EXISTS) {
+ if (entry.flags & VLF_BACKEXISTS) {
sprintf(patt, "%s.backup", entry.name);
#ifdef HAVE_POSIX_REGEX
code = regexec(&re, patt, 0, NULL, 0);
* it, but continue searching. Further entries may be
* RW or backup entries that will match.
*/
- else if (!found && (entry.serverFlags[srvpartpair] & ITSROVOL)
- && (entry.flags & RO_EXISTS)) {
+ else if (!found && (entry.serverFlags[srvpartpair] & VLSF_ROVOL)
+ && (entry.flags & VLF_ROEXISTS)) {
sprintf(patt, "%s.readonly", entry.name);
#ifdef HAVE_POSIX_REGEX
code = regexec(&re, patt, 0, NULL, 0);
switch (curDump->vtype) {
case BACKVOL:
- if (!(vldbEntry.flags & BACK_EXISTS)) {
+ if (!(vldbEntry.flags & VLF_BACKEXISTS)) {
ErrorLog(0, taskId, 0, 0,
"Volume %s (%u) failed - Backup volume no longer exists\n",
curDump->name, curDump->vid);
case RWVOL:
for (e = 0; e < vldbEntry.nServers; e++) { /* Find the RW volume */
- if (vldbEntry.serverFlags[e] & ITSRWVOL)
+ if (vldbEntry.serverFlags[e] & VLSF_RWVOL)
break;
}
break;
if (e >= vldbEntry.nServers) { /* Didn't find RO volume */
for (e = 0; e < vldbEntry.nServers; e++) { /* Find the first RO volume */
- if (vldbEntry.serverFlags[e] & ITSROVOL)
+ if (vldbEntry.serverFlags[e] & VLSF_ROVOL)
break;
}
}
/* Doesn't check for non-existance of backup volume */
if ((voltype == RWVOL) || (voltype == BACKVOL)) {
- vtype = ITSRWVOL;
+ vtype = VLSF_RWVOL;
istart = 0; /* seach the entire entry */
} else {
- vtype = ITSROVOL;
+ vtype = VLSF_ROVOL;
/* Seach from beginning of entry or pick up where we left off */
istart = ((*previdx < 0) ? 0 : *previdx + 1);
}
* same server as volumeId
*/
- if (rw_vol_entry.flags & BACK_EXISTS) {
+ if (rw_vol_entry.flags & VLF_BACKEXISTS) {
if (!GetVolumeInfo
(c_handle, rw_vol_entry.volumeId[BACKVOL], &bk_vol_entry,
&bk_server, &bk_partition, &bk_vol_type, &tst)) {
* Skip entries that don't have a RW volume
*/
- if (!(entry->flags & RW_EXISTS)) {
+ if (!(entry->flags & VLF_RWEXISTS)) {
if (callBack != NULL) {
const char *messageText;
if (util_AdminErrorCodeTranslate
dest->volumeSites[i].serverPartition = source->serverPartition[i];
dest->volumeSites[i].serverFlags = 0;
- if (source->serverFlags[i] & NEW_REPSITE) {
+ if (source->serverFlags[i] & VLSF_NEWREPSITE) {
dest->volumeSites[i].serverFlags |= VOS_VLDB_NEW_REPSITE;
}
- if (source->serverFlags[i] & ITSROVOL) {
+ if (source->serverFlags[i] & VLSF_ROVOL) {
dest->volumeSites[i].serverFlags |= VOS_VLDB_READ_ONLY;
}
- if (source->serverFlags[i] & ITSRWVOL) {
+ if (source->serverFlags[i] & VLSF_RWVOL) {
dest->volumeSites[i].serverFlags |= VOS_VLDB_READ_WRITE;
}
- if (source->serverFlags[i] & ITSBACKVOL) {
+ if (source->serverFlags[i] & VLSF_BACKVOL) {
dest->volumeSites[i].serverFlags |= VOS_VLDB_BACKUP;
}
- if (source->serverFlags[i] & RO_DONTUSE) {
+ if (source->serverFlags[i] & VLSF_DONTUSE) {
dest->volumeSites[i].serverFlags |= VOS_VLDB_DONT_USE;
}
&& (!server || equal)) {
break;
}
- if (type == ITSRWVOL) {
+ if (type == VLSF_RWVOL) {
/* quit when we are looking for RW entry (there's only 1) */
return -1;
}
afs_int32 oserver, afs_int32 opart, afs_int32 nserver,
afs_int32 npart)
{
- SetAValue(cellHandle, entry, oserver, opart, nserver, npart, ITSRWVOL);
+ SetAValue(cellHandle, entry, oserver, opart, nserver, npart, VLSF_RWVOL);
}
/* Changes the RO site only */
afs_int32 oserver, afs_int32 opart, afs_int32 nserver,
afs_int32 npart)
{
- SetAValue(cellHandle, entry, oserver, opart, nserver, npart, ITSROVOL);
+ SetAValue(cellHandle, entry, oserver, opart, nserver, npart, VLSF_ROVOL);
}
/* Returns success if this server and partition matches the RW entry */
Lp_Match(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
afs_int32 server, afs_int32 part, afs_status_p st)
{
- if (FindIndex(cellHandle, entry, server, part, ITSRWVOL) == -1)
+ if (FindIndex(cellHandle, entry, server, part, VLSF_RWVOL) == -1)
return 0;
return 1;
}
Lp_ROMatch(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
afs_int32 server, afs_int32 part, afs_status_p st)
{
- return (FindIndex(cellHandle, entry, server, part, ITSROVOL) + 1);
+ return (FindIndex(cellHandle, entry, server, part, VLSF_ROVOL) + 1);
}
/* Return the index of the RW entry if it exists, else return -1 */
Lp_GetRwIndex(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
afs_status_p st)
{
- return (FindIndex(cellHandle, entry, 0, 0, ITSRWVOL));
+ return (FindIndex(cellHandle, entry, 0, 0, VLSF_RWVOL));
}
/*initialize queue pointed by <ahead>*/
if (volid == rentry->volumeId[ROVOL]) {
*voltype = ROVOL;
for (i = 0; i < rentry->nServers; i++) {
- if ((index == -1) && (rentry->serverFlags[i] & ITSROVOL)
- && !(rentry->serverFlags[i] & RO_DONTUSE))
+ if ((index == -1) && (rentry->serverFlags[i] & VLSF_ROVOL)
+ && !(rentry->serverFlags[i] & VLSF_DONTUSE))
index = i;
}
if (index == -1) {
entry.nServers = 1;
entry.serverNumber[0] = ntohl(rx_HostOf(rx_PeerOf(server)));
entry.serverPartition[0] = partition;
- entry.flags = RW_EXISTS;
- entry.serverFlags[0] = ITSRWVOL;
+ entry.flags = VLF_RWEXISTS;
+ entry.serverFlags[0] = VLSF_RWVOL;
entry.volumeId[RWVOL] = *volumeId;
entry.volumeId[ROVOL] = *volumeId + 1;
entry.volumeId[BACKVOL] = *volumeId + 2;
}
if (volumeId == entry.volumeId[BACKVOL]) {
- if (!(entry.flags & BACK_EXISTS)
+ if (!(entry.flags & VLF_BACKEXISTS)
|| !Lp_Match(cellHandle, &entry, serverAddr, partition, &tst)) {
notinvldb = 2;
goto fail_UV_DeleteVolume;
}
- entry.flags &= ~BACK_EXISTS;
+ entry.flags &= ~VLF_BACKEXISTS;
vtype = BACKVOL;
}
Lp_SetROValue(cellHandle, &entry, serverAddr, partition, 0, 0);
entry.nServers--;
if (!Lp_ROMatch(cellHandle, &entry, 0, 0, &tst)) {
- entry.flags &= ~RO_EXISTS;
+ entry.flags &= ~VLF_ROEXISTS;
}
vtype = ROVOL;
}
else if (volumeId == entry.volumeId[RWVOL]) {
- if (!(entry.flags & RW_EXISTS)
+ if (!(entry.flags & VLF_RWEXISTS)
|| !Lp_Match(cellHandle, &entry, serverAddr, partition, &tst)) {
notinvldb = 2;
goto fail_UV_DeleteVolume;
Lp_SetRWValue(cellHandle, &entry, serverAddr, partition, 0L, 0L);
entry.nServers--;
- entry.flags &= ~(BACK_EXISTS | RW_EXISTS);
+ entry.flags &= ~(VLF_BACKEXISTS | VLF_RWEXISTS);
vtype = RWVOL;
}
goto fail_UV_DeleteVolume;
}
- if ((entry.nServers <= 0) || !(entry.flags & (RO_EXISTS | RW_EXISTS))) {
+ if ((entry.nServers <= 0) || !(entry.flags & (VLF_ROEXISTS | VLF_RWEXISTS))) {
tst = ubik_VL_DeleteEntry(cellHandle->vos, 0, volumeId, vtype);
if (tst) {
goto fail_UV_DeleteVolume;
Lp_SetRWValue(cellHandle, &entry, afromserver, afrompart, atoserver,
atopart);
store_flags = entry.flags;
- entry.flags &= ~BACK_EXISTS;
+ entry.flags &= ~VLF_BACKEXISTS;
if (!VLDB_ReplaceEntry
(cellHandle, afromvol, -1, &entry,
/* These operations require the VLDB be locked since it means the VLDB
* will change or the vldb is already locked.
*/
- if (!(entry.flags & BACK_EXISTS) || /* backup volume doesnt exist */
+ if (!(entry.flags & VLF_BACKEXISTS) || /* backup volume doesnt exist */
(entry.flags & VLOP_ALLOPERS) || /* vldb lock already held */
(entry.volumeId[BACKVOL] == INVALID_BID)) {
/* no assigned backup volume id */
}
/* Mork vldb as backup exists */
- if (!(entry.flags & BACK_EXISTS)) {
- entry.flags |= BACK_EXISTS;
+ if (!(entry.flags & VLF_BACKEXISTS)) {
+ entry.flags |= VLF_BACKEXISTS;
vldbmod = 1;
}
/* Will we be completing a previously unfinished release. -force overrides */
for (fullrelease = 1, i = 0; (fullrelease && (i < entry.nServers)); i++) {
- if (entry.serverFlags[i] & NEW_REPSITE)
+ if (entry.serverFlags[i] & VLSF_NEWREPSITE)
fullrelease = 0;
}
if (forceflag && !fullrelease)
* want to "reclone" a temporary RO clone.
*/
if (roexists
- && (!roclone || (entry.serverFlags[roindex] & RO_DONTUSE))) {
+ && (!roclone || (entry.serverFlags[roindex] & VLSF_DONTUSE))) {
tst = DelVol(fromconn, cloneVolId, afrompart, ITOffline);
if (tst && (tst != VNOVOL)) {
goto fail_UV_ReleaseVolume;
* RO volume is released (temp RO clones don't count).
*/
for (i = 0; i < entry.nServers; i++) {
- entry.serverFlags[i] &= ~NEW_REPSITE;
- entry.serverFlags[i] |= RO_DONTUSE;
+ entry.serverFlags[i] &= ~VLSF_NEWREPSITE;
+ entry.serverFlags[i] |= VLSF_DONTUSE;
}
- entry.serverFlags[rwindex] |= NEW_REPSITE;
- entry.serverFlags[rwindex] &= ~RO_DONTUSE;
+ entry.serverFlags[rwindex] |= VLSF_NEWREPSITE;
+ entry.serverFlags[rwindex] &= ~VLSF_DONTUSE;
/* Begin transaction on RW and mark it busy while we clone it */
tst =
sleep(5);
/* Mark the RO clone in the VLDB as a good site (already released) */
- entry.serverFlags[roindex] |= NEW_REPSITE;
- entry.serverFlags[roindex] &= ~RO_DONTUSE;
- entry.flags |= RO_EXISTS;
+ entry.serverFlags[roindex] |= VLSF_NEWREPSITE;
+ entry.serverFlags[roindex] &= ~VLSF_DONTUSE;
+ entry.flags |= VLF_ROEXISTS;
releasecount++;
if (vldbindex == roindex)
continue; /* the clone */
- if ((entry.serverFlags[vldbindex] & NEW_REPSITE)
- && !(entry.serverFlags[vldbindex] & RO_DONTUSE))
+ if ((entry.serverFlags[vldbindex] & VLSF_NEWREPSITE)
+ && !(entry.serverFlags[vldbindex] & VLSF_DONTUSE))
continue;
- if (!(entry.serverFlags[vldbindex] & ITSROVOL))
+ if (!(entry.serverFlags[vldbindex] & VLSF_ROVOL))
continue; /* not a RO vol */
continue;
}
- entry.serverFlags[times[m].vldbEntryIndex] |= NEW_REPSITE;
- entry.serverFlags[times[m].vldbEntryIndex] &= ~RO_DONTUSE;
- entry.flags |= RO_EXISTS;
+ entry.serverFlags[times[m].vldbEntryIndex] |= VLSF_NEWREPSITE;
+ entry.serverFlags[times[m].vldbEntryIndex] &= ~VLSF_DONTUSE;
+ entry.flags |= VLF_ROEXISTS;
releasecount++;
}
}
/* Figure out if any volume were not released and say so */
for (failure = 0, i = 0; i < entry.nServers; i++) {
- if (!(entry.serverFlags[i] & NEW_REPSITE))
+ if (!(entry.serverFlags[i] & VLSF_NEWREPSITE))
failure++;
}
if (failure) {
entry.cloneId = 0;
for (i = 0; i < entry.nServers; i++)
- entry.serverFlags[i] &= ~NEW_REPSITE;
+ entry.serverFlags[i] &= ~VLSF_NEWREPSITE;
/* Update the VLDB */
if (!VLDB_ReplaceEntry
entry.nServers = 1;
entry.serverNumber[0] = toserver; /*should be indirect */
entry.serverPartition[0] = topart;
- entry.serverFlags[0] = ITSRWVOL;
- entry.flags = RW_EXISTS;
+ entry.serverFlags[0] = VLSF_RWVOL;
+ entry.flags = VLF_RWEXISTS;
if (tstatus.cloneID != 0) {
entry.volumeId[ROVOL] = tstatus.cloneID; /*this should come from status info on the volume if non zero */
} else
/* Add the rw site for the volume being restored */
entry.serverNumber[entry.nServers] = toserver;
entry.serverPartition[entry.nServers] = topart;
- entry.serverFlags[entry.nServers] = ITSRWVOL;
+ entry.serverFlags[entry.nServers] = VLSF_RWVOL;
entry.nServers++;
} else {
/* This volume should be deleted on the old site
entry.serverPartition[index] = topart;
}
- entry.flags |= RW_EXISTS;
+ entry.flags |= VLF_RWEXISTS;
if (!VLDB_ReplaceEntry
(cellHandle, pvolid, RWVOL, &entry,
LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP, &tst)) {
/* See if it's on the same server */
for (j = 0; j < entry.nServers; j++) {
- if (entry.serverFlags[j] & ITSROVOL) {
+ if (entry.serverFlags[j] & VLSF_ROVOL) {
nro++;
if (!VLDB_IsSameAddrs
(cellHandle, server, entry.serverNumber[j], &same, &tst)) {
entry.serverNumber[entry.nServers] = server;
entry.serverPartition[entry.nServers] = part;
- entry.serverFlags[entry.nServers] = (ITSROVOL | RO_DONTUSE);
+ entry.serverFlags[entry.nServers] = (VLSF_ROVOL | VLSF_DONTUSE);
entry.nServers++;
if (!VLDB_ReplaceEntry
} else { /*remove the rep site */
Lp_SetROValue(cellHandle, &entry, server, part, 0, 0);
entry.nServers--;
- if ((entry.nServers == 1) && (entry.flags & RW_EXISTS))
- entry.flags &= ~RO_EXISTS;
+ if ((entry.nServers == 1) && (entry.flags & VLF_RWEXISTS))
+ entry.flags &= ~VLF_ROEXISTS;
if (entry.nServers < 1) { /*this is the last ref */
tst = ubik_VL_DeleteEntry(cellHandle->vos, 0, volid, ROVOL);
if (tst) {
memset(&entry, 0, sizeof(entry));
strncpy(entry.name, elem.name, VOLSER_OLDMAXVOLNAME);
if (elem.isValid[RWVOL]) { /*rw exists */
- entry.flags |= RW_EXISTS;
- entry.serverFlags[entry.nServers] = ITSRWVOL;
+ entry.flags |= VLF_RWEXISTS;
+ entry.serverFlags[entry.nServers] = VLSF_RWVOL;
entry.serverNumber[entry.nServers] = aserver;
entry.serverPartition[entry.nServers] = apart;
entry.nServers += 1;
entry.volumeId[BACKVOL] = elem.ids[BACKVOL];
}
if (elem.isValid[ROVOL]) { /*ro volume exists */
- entry.flags |= RO_EXISTS;
- entry.serverFlags[entry.nServers] = ITSROVOL;
+ entry.flags |= VLF_ROEXISTS;
+ entry.serverFlags[entry.nServers] = VLSF_ROVOL;
entry.serverNumber[entry.nServers] = aserver;
entry.serverPartition[entry.nServers] = apart;
entry.nServers += 1;
}
if (elem.isValid[BACKVOL]) { /*backup volume exists */
- entry.flags |= BACK_EXISTS;
- if (!(entry.flags & RW_EXISTS)) { /*this helps to check for a stray backup if parent moves */
- entry.serverFlags[entry.nServers] = ITSRWVOL;
+ entry.flags |= VLF_BACKEXISTS;
+ if (!(entry.flags & VLF_RWEXISTS)) { /*this helps to check for a stray backup if parent moves */
+ entry.serverFlags[entry.nServers] = VLSF_RWVOL;
entry.serverNumber[entry.nServers] = aserver;
entry.serverPartition[entry.nServers] = apart;
entry.nServers += 1;
if (temp == -1) {
/* A RW index is not found in the VLDB entry - will add it */
- entry.flags |= RW_EXISTS;
+ entry.flags |= VLF_RWEXISTS;
entry.serverNumber[entry.nServers] = aserver;
entry.serverPartition[entry.nServers] = apart;
- entry.serverFlags[entry.nServers] = ITSRWVOL;
+ entry.serverFlags[entry.nServers] = VLSF_RWVOL;
entry.nServers++;
} else {
/* A RW index is found in the VLDB entry.
entry.serverPartition[temp] = apart;
}
- entry.flags |= RW_EXISTS;
+ entry.flags |= VLF_RWEXISTS;
}
if ((elem.ids[BACKVOL] != 0) && elem.isValid[BACKVOL])
entry.volumeId[BACKVOL] = elem.ids[BACKVOL];
count = entry.nServers;
rwsite = -1;
for (j = 0; j < count; j++) {
- if (entry.serverFlags[j] & ITSROVOL) {
+ if (entry.serverFlags[j] & VLSF_ROVOL) {
/*delete the site */
entry.serverNumber[j] = 0;
entry.serverPartition[j] = 0;
entry.serverFlags[j] = 0;
- } else if (entry.serverFlags[j] & ITSRWVOL)
+ } else if (entry.serverFlags[j] & VLSF_RWVOL)
rwsite = j;
}
entry.nServers = 0;
}
entry.serverNumber[entry.nServers] = aserver;
entry.serverPartition[entry.nServers] = apart;
- entry.serverFlags[entry.nServers] = ITSROVOL;
+ entry.serverFlags[entry.nServers] = VLSF_ROVOL;
entry.nServers++;
entry.volumeId[ROVOL] = elem.ids[ROVOL];
- entry.flags |= RO_EXISTS;
+ entry.flags |= VLF_ROEXISTS;
} else if (elem.ids[ROVOL] < entry.volumeId[ROVOL]) {
- if (!(entry.flags & RO_EXISTS)) {
+ if (!(entry.flags & VLF_ROEXISTS)) {
entry.volumeId[ROVOL] = elem.ids[ROVOL];
entry.serverNumber[entry.nServers] = aserver;
entry.serverPartition[entry.nServers] = apart;
- entry.serverFlags[entry.nServers] = ITSROVOL;
+ entry.serverFlags[entry.nServers] = VLSF_ROVOL;
entry.nServers++;
- entry.flags |= RO_EXISTS;
+ entry.flags |= VLF_ROEXISTS;
}
}
else if (elem.ids[ROVOL] == entry.volumeId[ROVOL]) {
entry.serverNumber[entry.nServers] = aserver;
entry.serverPartition[entry.nServers] = apart;
- entry.serverFlags[entry.nServers] = ITSROVOL;
+ entry.serverFlags[entry.nServers] = VLSF_ROVOL;
entry.nServers++;
- entry.flags |= RO_EXISTS;
+ entry.flags |= VLF_ROEXISTS;
entry.volumeId[ROVOL] = elem.ids[ROVOL];
}
}
} else {
/*tackle the backup volume */
entry.volumeId[BACKVOL] = elem.ids[BACKVOL];
- entry.flags |= BACK_EXISTS;
+ entry.flags |= VLF_BACKEXISTS;
}
if (entry.volumeId[BACKVOL] == INVALID_BID)
entry.volumeId[BACKVOL] = elem.ids[BACKVOL];
*modified = 0;
idx = Lp_GetRwIndex(cellHandle, entry, 0);
- /* Check to see if the RW volume exists and set the RW_EXISTS
+ /* Check to see if the RW volume exists and set the VLF_RWEXISTS
* flag accordingly.
*/
if (idx == -1) { /* Did not find a RW entry */
- if (entry->flags & RW_EXISTS) { /* ... yet entry says RW exists */
- entry->flags &= ~RW_EXISTS; /* ... so say RW does not exist */
+ if (entry->flags & VLF_RWEXISTS) { /* ... yet entry says RW exists */
+ entry->flags &= ~VLF_RWEXISTS; /* ... so say RW does not exist */
modentry++;
}
} else {
if (VolumeExists
(cellHandle, entry->serverNumber[idx],
entry->serverPartition[idx], entry->volumeId[RWVOL], &tst)) {
- if (!(entry->flags & RW_EXISTS)) { /* ... yet entry says RW does no
+ if (!(entry->flags & VLF_RWEXISTS)) { /* ... yet entry says RW does no
* t exist */
- entry->flags |= RW_EXISTS; /* ... so say RW does exist */
+ entry->flags |= VLF_RWEXISTS; /* ... so say RW does exist */
modentry++;
}
} else if (tst == ENODEV) { /* RW volume does not exist */
- if (entry->flags & RW_EXISTS) { /* ... yet entry says RW exists
+ if (entry->flags & VLF_RWEXISTS) { /* ... yet entry says RW exists
*/
- entry->flags &= ~RW_EXISTS; /* ... so say RW does not exist
+ entry->flags &= ~VLF_RWEXISTS; /* ... so say RW does not exist
*/
modentry++;
}
} else {
/* If VLDB says it didn't exist, then ignore error */
- if (entry->flags & RW_EXISTS) {
+ if (entry->flags & VLF_RWEXISTS) {
goto fail_CheckVldbRWBK;
}
}
}
- /* Check to see if the BK volume exists and set the BACK_EXISTS
+ /* Check to see if the BK volume exists and set the VLF_BACKEXISTS
* flag accordingly. idx already ponts to the RW entry.
*/
if (idx == -1) { /* Did not find a RW entry */
- if (entry->flags & BACK_EXISTS) { /* ... yet entry says BK exists */
- entry->flags &= ~BACK_EXISTS; /* ... so say BK does not exist */
+ if (entry->flags & VLF_BACKEXISTS) { /* ... yet entry says BK exists */
+ entry->flags &= ~VLF_BACKEXISTS; /* ... so say BK does not exist */
modentry++;
}
} else { /* Found a RW entry */
if (VolumeExists
(cellHandle, entry->serverNumber[idx],
entry->serverPartition[idx], entry->volumeId[BACKVOL], &tst)) {
- if (!(entry->flags & BACK_EXISTS)) { /* ... yet entry says BK does n
+ if (!(entry->flags & VLF_BACKEXISTS)) { /* ... yet entry says BK does n
* ot exist */
- entry->flags |= BACK_EXISTS; /* ... so say BK does exist */
+ entry->flags |= VLF_BACKEXISTS; /* ... so say BK does exist */
modentry++;
}
} else if (tst == ENODEV) { /* BK volume does not exist */
- if (entry->flags & BACK_EXISTS) { /* ... yet entry says BK exists
+ if (entry->flags & VLF_BACKEXISTS) { /* ... yet entry says BK exists
*/
- entry->flags &= ~BACK_EXISTS; /* ... so say BK does not exist
+ entry->flags &= ~VLF_BACKEXISTS; /* ... so say BK does not exist
*/
modentry++;
}
} else {
/* If VLDB says it didn't exist, then ignore error */
- if (entry->flags & BACK_EXISTS) {
+ if (entry->flags & VLF_BACKEXISTS) {
goto fail_CheckVldbRWBK;
}
}
/* If there is an idx but the BK and RW volumes no
* longer exist, then remove the RW entry.
*/
- if ((idx != -1) && !(entry->flags & RW_EXISTS)
- && !(entry->flags & BACK_EXISTS)) {
+ if ((idx != -1) && !(entry->flags & VLF_RWEXISTS)
+ && !(entry->flags & VLF_BACKEXISTS)) {
Lp_SetRWValue(cellHandle, entry, entry->serverNumber[idx],
entry->serverPartition[idx], 0L, 0L);
entry->nServers--;
if (modified)
*modified = 0;
- /* Check to see if the RO volumes exist and set the RO_EXISTS
+ /* Check to see if the RO volumes exist and set the VLF_ROEXISTS
* flag accordingly.
*/
for (idx = 0; idx < entry->nServers; idx++) {
- if (!(entry->serverFlags[idx] & ITSROVOL)) {
+ if (!(entry->serverFlags[idx] & VLSF_ROVOL)) {
continue; /* not a RO */
}
}
if (foundro) { /* A RO volume exists */
- if (!(entry->flags & RO_EXISTS)) { /* ... yet entry says RW does not e
+ if (!(entry->flags & VLF_ROEXISTS)) { /* ... yet entry says RW does not e
* xist */
- entry->flags |= RO_EXISTS; /* ... so say RW does exist */
+ entry->flags |= VLF_ROEXISTS; /* ... so say RW does exist */
modentry++;
}
} else { /* A RO volume does not exist */
- if (entry->flags & RO_EXISTS) { /* ... yet entry says RO exists */
- entry->flags &= ~RO_EXISTS; /* ... so say RO does not exist */
+ if (entry->flags & VLF_ROEXISTS) { /* ... yet entry says RO exists */
+ entry->flags &= ~VLF_ROEXISTS; /* ... so say RO does not exist */
modentry++;
}
}
if (pass == 1)
goto retry;
- if (!(entry->flags & RW_EXISTS) && !(entry->flags & BACK_EXISTS)
- && !(entry->flags & RO_EXISTS)) {
+ if (!(entry->flags & VLF_RWEXISTS) && !(entry->flags & VLF_BACKEXISTS)
+ && !(entry->flags & VLF_ROEXISTS)) {
/* The RW, BK, nor RO volumes do not exist. Delete the VLDB entry */
tst =
ubik_VL_DeleteEntry(cellHandle->vos, 0,
/*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) {
+ if (entry->flags & VLF_RWEXISTS) {
index = Lp_GetRwIndex(cellHandle, entry, 0);
if (index == -1) { /* there is a serious discrepancy */
tst = VOLSERVLDB_ERROR;
aconn = (struct rx_connection *)0;
}
/*end rw volume processing */
- if (entry->flags & BACK_EXISTS) { /*process the backup volume */
+ if (entry->flags & VLF_BACKEXISTS) { /*process the backup volume */
index = Lp_GetRwIndex(cellHandle, entry, 0);
if (index == -1) { /* there is a serious discrepancy */
tst = VOLSERVLDB_ERROR;
if (aconn)
rx_ReleaseCachedConnection(aconn);
aconn = (struct rx_connection *)0;
- if (entry->flags & RO_EXISTS) { /*process the ro volumes */
+ if (entry->flags & VLF_ROEXISTS) { /*process the ro volumes */
for (i = 0; i < entry->nServers; i++) {
- if (entry->serverFlags[i] & ITSROVOL) {
+ if (entry->serverFlags[i] & VLSF_ROVOL) {
aconn =
UV_Bind(cellHandle, entry->serverNumber[i],
AFSCONF_VOLUMEPORT);
|| VLDB_IsSameAddrs(entry->serverNumber[e], server,
&error)))
break;
- if (type == ITSRWVOL)
+ if (type == VLSF_RWVOL)
return -1; /* quit when we are looking for RW entry (there's only 1) */
}
}
Lp_SetRWValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
afs_uint32 nserver, afs_int32 npart)
{
- SetAValue(entry, oserver, opart, nserver, npart, ITSRWVOL);
+ SetAValue(entry, oserver, opart, nserver, npart, VLSF_RWVOL);
}
/* Changes the RO site only */
Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver,
afs_int32 opart, afs_uint32 nserver, afs_int32 npart)
{
- SetAValue(entry, oserver, opart, nserver, npart, ITSROVOL);
+ SetAValue(entry, oserver, opart, nserver, npart, VLSF_ROVOL);
}
/* Returns success if this server and partition matches the RW entry */
Lp_Match(afs_uint32 server, afs_int32 part,
struct nvldbentry *entry)
{
- if (FindIndex(entry, server, part, ITSRWVOL) == -1)
+ if (FindIndex(entry, server, part, VLSF_RWVOL) == -1)
return 0;
return 1;
}
int
Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entry)
{
- return (FindIndex(entry, server, part, ITSROVOL) + 1);
+ return (FindIndex(entry, server, part, VLSF_ROVOL) + 1);
}
/* Return the index of the RW entry if it exists, else return -1 */
int
Lp_GetRwIndex(struct nvldbentry *entry)
{
- return (FindIndex(entry, 0, 0, ITSRWVOL));
+ return (FindIndex(entry, 0, 0, VLSF_RWVOL));
}
/*initialize queue pointed by <ahead>*/
#define ISNAMEVALID(name) (strlen(name) < (VOLSER_OLDMAXVOLNAME - 9))
-/* values for flags in struct nvldbEntry */
-#define RW_EXISTS 0x1000
-#define RO_EXISTS 0x2000
-#define BACK_EXISTS 0x4000
-
-/* values for serverFlags in struct nvldbEntry */
-#define NEW_REPSITE 0x01
-#define ITSROVOL 0x02
-#define ITSRWVOL 0x04
-#define ITSBACKVOL 0x08
-#define ITSRWREPL 0x10
-#define RO_DONTUSE 0x20
-
#define PARTVALID 0x01
#define CLONEVALID 0x02
#define CLONEZAPPED 0x04
/* Doesn't check for non-existance of backup volume */
if ((voltype == RWVOL) || (voltype == BACKVOL)) {
- vtype = ITSRWVOL;
+ vtype = VLSF_RWVOL;
istart = 0; /* seach the entire entry */
} else {
- vtype = ITSROVOL;
+ vtype = VLSF_ROVOL;
/* Seach from beginning of entry or pick up where we left off */
istart = ((*previdx < 0) ? 0 : *previdx + 1);
}
if (code) {
error = code;
if (code == ENODEV) {
- if ((voltype == BACKVOL) && !(entry.flags & BACK_EXISTS)) {
+ if ((voltype == BACKVOL) && !(entry.flags & VLF_BACKEXISTS)) {
/* The VLDB says there is no backup volume and its not on disk */
fprintf(STDERR, "Volume %s does not exist\n",
as->parms[0].items->data);
} else
VolumeStats_int(pntr, &entry, aserver, apart, voltype);
- if ((voltype == BACKVOL) && !(entry.flags & BACK_EXISTS)) {
+ if ((voltype == BACKVOL) && !(entry.flags & VLF_BACKEXISTS)) {
/* The VLDB says there is no backup volume yet we found one on disk */
fprintf(STDERR, "Volume %s does not exist in VLDB\n",
as->parms[0].items->data);
for (i = 0; i < entry->nServers; i++) {
curserver = entry->serverNumber[i];
curpart = entry->serverPartition[i];
- if (entry->serverFlags[i] & ITSROVOL) {
+ if (entry->serverFlags[i] & VLSF_ROVOL) {
volid = entry->volumeId[ROVOL];
} else {
volid = entry->volumeId[RWVOL];
return (code);
}
- if (((volid == entry.volumeId[RWVOL]) && (entry.flags & RW_EXISTS))
+ if (((volid == entry.volumeId[RWVOL]) && (entry.flags & VLF_RWEXISTS))
|| ((volid == entry.volumeId[BACKVOL])
- && (entry.flags & BACK_EXISTS))) {
+ && (entry.flags & VLF_BACKEXISTS))) {
idx = Lp_GetRwIndex(&entry);
if ((idx == -1) || (server && (server != entry.serverNumber[idx]))
|| ((partition != -1)
return ENOENT;
}
} else if ((volid == entry.volumeId[ROVOL])
- && (entry.flags & RO_EXISTS)) {
+ && (entry.flags & VLF_ROEXISTS)) {
for (idx = -1, j = 0; j < entry.nServers; j++) {
- if (!(entry.serverFlags[j] & ITSROVOL))
+ if (!(entry.serverFlags[j] & VLSF_ROVOL))
continue;
if (((server == 0) || (server == entry.serverNumber[j]))
/* is there a backup volume already? */
- if (entry.flags & BACK_EXISTS) {
+ if (entry.flags & VLF_BACKEXISTS) {
/* yep, where is it? */
buvolid = entry.volumeId[BACKVOL];
if (volid == rentry->volumeId[ROVOL]) {
*voltype = ROVOL;
for (i = 0; i < rentry->nServers; i++) {
- if ((index == -1) && (rentry->serverFlags[i] & ITSROVOL)
- && !(rentry->serverFlags[i] & RO_DONTUSE))
+ if ((index == -1) && (rentry->serverFlags[i] & VLSF_ROVOL)
+ && !(rentry->serverFlags[i] & VLSF_DONTUSE))
index = i;
}
if (index == -1) {
pos2 = -1;
for(i = 0; i < arg1->nServers; i++)
- if(arg1->serverFlags[i] & ITSRWVOL) pos1 = i;
+ if(arg1->serverFlags[i] & VLSF_RWVOL) pos1 = i;
for(i = 0; i < arg2->nServers; i++)
- if(arg2->serverFlags[i] & ITSRWVOL) pos2 = i;
+ if(arg2->serverFlags[i] & VLSF_RWVOL) pos2 = i;
if(pos1 == -1 || pos2 == -1){
pos1 = 0;
pos2 = 0;
continue;
}
- if (!(vllist->flags & RW_EXISTS)) {
+ if (!(vllist->flags & VLF_RWEXISTS)) {
if (verbose) {
fprintf(STDOUT,
"Omitting to backup %s since RW volume does not exist \n",
MapHostToNetwork(&entry);
for (i = 0; i < entry.nServers; i++) {
- if (entry.serverFlags[i] & ITSRWVOL) {
+ if (entry.serverFlags[i] & VLSF_RWVOL) {
rwserver = entry.serverNumber[i];
rwpartition = entry.serverPartition[i];
if (roserver)
break;
- } else if ((entry.serverFlags[i] & ITSROVOL) && !roserver) {
+ } else if ((entry.serverFlags[i] & VLSF_ROVOL) && !roserver) {
same = VLDB_IsSameAddrs(server, entry.serverNumber[i], &code);
if (code) {
fprintf(STDERR,
#ifdef notdef
fprintf(STDOUT, " readWriteID %-10u ", entry->volumeId[RWVOL]);
- if (entry->flags & RW_EXISTS)
+ if (entry->flags & VLF_RWEXISTS)
fprintf(STDOUT, " valid \n");
else
fprintf(STDOUT, " invalid \n");
fprintf(STDOUT, " readOnlyID %-10u ", entry->volumeId[ROVOL]);
- if (entry->flags & RO_EXISTS)
+ if (entry->flags & VLF_ROEXISTS)
fprintf(STDOUT, " valid \n");
else
fprintf(STDOUT, " invalid \n");
fprintf(STDOUT, " backUpID %-10u ", entry->volumeId[BACKVOL]);
- if (entry->flags & BACK_EXISTS)
+ if (entry->flags & VLF_BACKEXISTS)
fprintf(STDOUT, " valid \n");
else
fprintf(STDOUT, " invalid \n");
- if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS))
+ if ((entry->cloneId != 0) && (entry->flags & VLF_ROEXISTS))
fprintf(STDOUT, " releaseClone %-10u \n", entry->cloneId);
#else
- if (entry->flags & RW_EXISTS)
+ if (entry->flags & VLF_RWEXISTS)
fprintf(STDOUT, " RWrite: %-10u", entry->volumeId[RWVOL]);
- if (entry->flags & RO_EXISTS)
+ if (entry->flags & VLF_ROEXISTS)
fprintf(STDOUT, " ROnly: %-10u", entry->volumeId[ROVOL]);
- if (entry->flags & BACK_EXISTS)
+ if (entry->flags & VLF_BACKEXISTS)
fprintf(STDOUT, " Backup: %-10u", entry->volumeId[BACKVOL]);
- if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS))
+ if ((entry->cloneId != 0) && (entry->flags & VLF_ROEXISTS))
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)
+ if (entry->serverFlags[i] & VLSF_NEWREPSITE)
isMixed = 1;
}
for (i = 0; i < entry->nServers; i++) {
fprintf(STDOUT, " server %s partition %s ",
noresolve ? afs_inet_ntoa_r(entry->serverNumber[i], hoststr) :
hostutil_GetNameByINet(entry->serverNumber[i]), pname);
- if (entry->serverFlags[i] & ITSRWVOL)
+ if (entry->serverFlags[i] & VLSF_RWVOL)
fprintf(STDOUT, "RW Site ");
else
fprintf(STDOUT, "RO Site ");
if (isMixed) {
- if (entry->serverFlags[i] & NEW_REPSITE)
+ if (entry->serverFlags[i] & VLSF_NEWREPSITE)
fprintf(STDOUT," -- New release");
else
- if (!(entry->serverFlags[i] & ITSRWVOL))
+ if (!(entry->serverFlags[i] & VLSF_RWVOL))
fprintf(STDOUT," -- Old release");
} else {
- if (entry->serverFlags[i] & RO_DONTUSE)
+ if (entry->serverFlags[i] & VLSF_DONTUSE)
fprintf(STDOUT, " -- Not released");
}
fprintf(STDOUT, "\n");
* level of indirection later */
entry.serverPartition[0] = apart; /* this should also have
* another indirection level */
- entry.flags = RW_EXISTS; /* this records that rw volume exists */
- entry.serverFlags[0] = ITSRWVOL; /*this rep site has rw vol */
+ entry.flags = VLF_RWEXISTS; /* this records that rw volume exists */
+ entry.serverFlags[0] = VLSF_RWVOL; /*this rep site has rw vol */
entry.volumeId[RWVOL] = *anewid;
entry.volumeId[ROVOL] = aroid ? *aroid : 0;
entry.volumeId[BACKVOL] = abkid ? *abkid : 0;
* level of indirection later */
entry.serverPartition[0] = apart; /* this should also have
* another indirection level */
- entry.flags = RW_EXISTS; /* this records that rw volume exists */
- entry.serverFlags[0] = ITSRWVOL; /*this rep site has rw vol */
+ entry.flags = VLF_RWEXISTS; /* this records that rw volume exists */
+ entry.serverFlags[0] = VLSF_RWVOL; /*this rep site has rw vol */
entry.volumeId[RWVOL] = aid;
#ifdef notdef
entry.volumeId[ROVOL] = anewid + 1; /* rw,ro, bk id are related in the default case */
/* 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_Match(aserver, apart, &entry)) {
+ if (!(entry.flags & VLF_BACKEXISTS) || !Lp_Match(aserver, apart, &entry)) {
notinvldb = 2; /* Not on this server and partition */
ERROR_EXIT(0);
}
VPRINT1("Marking the backup volume %u deleted in the VLDB\n", avolid);
- entry.flags &= ~BACK_EXISTS;
+ entry.flags &= ~VLF_BACKEXISTS;
vtype = BACKVOL;
}
Lp_SetROValue(&entry, aserver, apart, 0, 0); /* delete the site */
entry.nServers--;
if (!Lp_ROMatch(0, 0, &entry))
- entry.flags &= ~RO_EXISTS; /* This was the last ro volume */
+ entry.flags &= ~VLF_ROEXISTS; /* 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_Match(aserver, apart, &entry)) {
+ if (!(entry.flags & VLF_RWEXISTS) || !Lp_Match(aserver, apart, &entry)) {
notinvldb = 2; /* Not found on this server and partition */
ERROR_EXIT(0);
}
"Marking the readwrite volume %lu%s deleted in the VLDB\n",
(unsigned long)avolid,
((entry.
- flags & BACK_EXISTS) ? ", and its backup volume," :
+ flags & VLF_BACKEXISTS) ? ", and its backup volume," :
""));
Lp_SetRWValue(&entry, aserver, apart, 0L, 0L);
entry.nServers--;
- entry.flags &= ~(BACK_EXISTS | RW_EXISTS);
+ entry.flags &= ~(VLF_BACKEXISTS | VLF_RWEXISTS);
vtype = RWVOL;
- if (entry.flags & RO_EXISTS)
+ if (entry.flags & VLF_ROEXISTS)
fprintf(STDERR, "WARNING: ReadOnly copy(s) may still exist\n");
}
}
/* Either delete or replace the VLDB entry */
- if ((entry.nServers <= 0) || !(entry.flags & (RO_EXISTS | RW_EXISTS))) {
+ if ((entry.nServers <= 0) || !(entry.flags & (VLF_ROEXISTS | VLF_RWEXISTS))) {
if (verbose)
fprintf(STDOUT,
"Last reference to the VLDB entry for %lu - deleting entry\n",
/* extract information from the original entry */
for (i = 0; i < entry->nServers; i++) {
- if (entry->serverFlags[i] & ITSRWVOL) {
+ if (entry->serverFlags[i] & VLSF_RWVOL) {
rwindex = i;
rwserver = entry->serverNumber[i];
/* rwpartition = entry->serverPartition[i]; */
if (roserver)
break;
- } else if ((entry->serverFlags[i] & ITSROVOL) && !roserver) {
+ } else if ((entry->serverFlags[i] & VLSF_ROVOL) && !roserver) {
same = VLDB_IsSameAddrs(server, entry->serverNumber[i], &code);
if (code) {
fprintf(STDERR,
/* Update the VLDB to match what we did on disk as much as possible. */
/* If the converted RO was in the VLDB, make it look like the new RW. */
if (roserver) {
- entry->serverFlags[roindex] = ITSRWVOL;
+ entry->serverFlags[roindex] = VLSF_RWVOL;
} else {
/* Add a new site entry for the newly created RW. It's possible
* (but unlikely) that we are already at MAXNSERVERS and that this
(entry->nServers)++;
entry->serverNumber[newrwindex] = server;
entry->serverPartition[newrwindex] = partition;
- entry->serverFlags[newrwindex] = ITSRWVOL;
+ entry->serverFlags[newrwindex] = VLSF_RWVOL;
}
- entry->flags |= RW_EXISTS;
- entry->flags &= ~BACK_EXISTS;
+ entry->flags |= VLF_RWEXISTS;
+ entry->flags &= ~VLF_BACKEXISTS;
/* if the old RW was in the VLDB, remove it by decrementing the number */
/* of servers, replacing the RW entry with the last entry, and zeroing */
entry->serverFlags[entry->nServers] = 0;
}
}
- entry->flags &= ~RO_EXISTS;
+ entry->flags &= ~VLF_ROEXISTS;
for (i = 0; i < entry->nServers; i++) {
- if (entry->serverFlags[i] & ITSROVOL) {
- if (!(entry->serverFlags[i] & (RO_DONTUSE | NEW_REPSITE)))
- entry->flags |= RO_EXISTS;
+ if (entry->serverFlags[i] & VLSF_ROVOL) {
+ if (!(entry->serverFlags[i] & (VLSF_DONTUSE | VLSF_NEWREPSITE)))
+ entry->flags |= VLF_ROEXISTS;
}
}
MapNetworkToHost(entry, &storeEntry);
(unsigned long)afromvol);
fprintf(STDERR, "The current site is :");
for (i = 0; i < entry.nServers; i++) {
- if (entry.serverFlags[i] == ITSRWVOL) {
+ if (entry.serverFlags[i] == VLSF_RWVOL) {
char pname[10];
MapPartIdIntoName(entry.serverPartition[i], pname);
fprintf(STDERR, " server %s partition %s \n",
Lp_SetRWValue(&entry, afromserver, afrompart, atoserver, atopart);
MapNetworkToHost(&entry, &storeEntry);
- storeEntry.flags &= ~BACK_EXISTS;
+ storeEntry.flags &= ~VLF_BACKEXISTS;
if (TESTC) {
fprintf(STDOUT,
/* normal cleanup code */
- if (entry.flags & RO_EXISTS)
+ if (entry.flags & VLF_ROEXISTS)
fprintf(STDERR, "WARNING : readOnly copies still exist \n");
if (islocked) {
newentry.nServers = 1;
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.flags = (flags & RV_RDONLY) ? VLF_ROEXISTS : VLF_RWEXISTS;
+ newentry.serverFlags[0] = (flags & RV_RDONLY) ? VLSF_ROVOL : VLSF_RWVOL;
newentry.volumeId[RWVOL] = newVol;
newentry.volumeId[ROVOL] = (flags & RV_RDONLY) ? newVol : 0;
newentry.volumeId[BACKVOL] = 0;
/* These operations require the VLDB be locked since it means the VLDB
* will change or the vldb is already locked.
*/
- if (!(entry.flags & BACK_EXISTS) || /* backup volume doesnt exist */
+ if (!(entry.flags & VLF_BACKEXISTS) || /* backup volume doesnt exist */
(entry.flags & VLOP_ALLOPERS) || /* vldb lock already held */
(entry.volumeId[BACKVOL] == INVALID_BID)) { /* no assigned backup volume id */
}
/* Mark vldb as backup exists */
- if (!(entry.flags & BACK_EXISTS)) {
- entry.flags |= BACK_EXISTS;
+ if (!(entry.flags & VLF_BACKEXISTS)) {
+ entry.flags |= VLF_BACKEXISTS;
vldbmod = 1;
}
vldbEntryPtr->serverPartition[index], ITOffline,
transPtr);
- if (!code && (origflags[index] & RO_DONTUSE)) {
+ if (!code && (origflags[index] & VLSF_DONTUSE)) {
/* If RO_DONTUSE is set, this is supposed to be an entirely new
* site. Don't trust any data on it, since it is possible we
* have encountered some temporary volume from some other
* or -force-reclone flag, to force this to be a complete release.
*/
for (i = 0; i < entry.nServers; i++) {
- if (entry.serverFlags[i] & ITSROVOL) {
+ if (entry.serverFlags[i] & VLSF_ROVOL) {
sites++;
- if (entry.serverFlags[i] & NEW_REPSITE)
+ if (entry.serverFlags[i] & VLSF_NEWREPSITE)
new_sites++;
- if (entry.serverFlags[i] & RO_DONTUSE)
+ if (entry.serverFlags[i] & VLSF_DONTUSE)
notreleased++;
}
origflags[i] = entry.serverFlags[i];
error = 0;
for (e = 0; (e < entry.nServers) && !error; e++) {
- if ((entry.serverFlags[e] & ITSROVOL)) {
+ if ((entry.serverFlags[e] & VLSF_ROVOL)) {
if (!(VLDB_IsSameAddrs(entry.serverNumber[e], afromserver,
&error)))
break;
}
/* clean up any previous tmp clone before starting if staying up */
if (roexists
- && (!roclone || (entry.serverFlags[roindex] & RO_DONTUSE))) {
+ && (!roclone || (entry.serverFlags[roindex] & VLSF_DONTUSE))) {
code = DoVolDelete(fromconn,
stayUp ? entry.volumeId[ROVOL] : cloneVolId,
afrompart, "the", 0, NULL, NULL);
struct rx_connection *conn;
afs_int32 crdate;
- if (!(entry.serverFlags[vldbindex] & ITSROVOL)) {
+ if (!(entry.serverFlags[vldbindex] & VLSF_ROVOL)) {
continue;
}
- if ((entry.serverFlags[vldbindex] & RO_DONTUSE)) {
+ if ((entry.serverFlags[vldbindex] & VLSF_DONTUSE)) {
continue;
}
conn = UV_Bind(entry.serverNumber[vldbindex], AFSCONF_VOLUMEPORT);
*/
for (i = 0; i < entry.nServers; i++) {
if (justnewsites) {
- if ((entry.serverFlags[i] & RO_DONTUSE)) {
- entry.serverFlags[i] &= ~NEW_REPSITE;
+ if ((entry.serverFlags[i] & VLSF_DONTUSE)) {
+ entry.serverFlags[i] &= ~VLSF_NEWREPSITE;
} else {
- entry.serverFlags[i] |= NEW_REPSITE;
+ entry.serverFlags[i] |= VLSF_NEWREPSITE;
}
} else {
- entry.serverFlags[i] &= ~NEW_REPSITE;
- entry.serverFlags[i] |= RO_DONTUSE;
+ entry.serverFlags[i] &= ~VLSF_NEWREPSITE;
+ entry.serverFlags[i] |= VLSF_DONTUSE;
}
}
- entry.serverFlags[rwindex] |= NEW_REPSITE;
- entry.serverFlags[rwindex] &= ~RO_DONTUSE;
+ entry.serverFlags[rwindex] |= VLSF_NEWREPSITE;
+ entry.serverFlags[rwindex] &= ~VLSF_DONTUSE;
}
if (justnewsites && roexists) {
justnewsites = 0;
/* reset the serverFlags as if 'justnewsites' had never been set */
for (i = 0; i < entry.nServers; i++) {
- entry.serverFlags[i] &= ~NEW_REPSITE;
- entry.serverFlags[i] |= RO_DONTUSE;
+ entry.serverFlags[i] &= ~VLSF_NEWREPSITE;
+ entry.serverFlags[i] |= VLSF_DONTUSE;
}
- entry.serverFlags[rwindex] |= NEW_REPSITE;
- entry.serverFlags[rwindex] &= ~RO_DONTUSE;
+ entry.serverFlags[rwindex] |= VLSF_NEWREPSITE;
+ entry.serverFlags[rwindex] &= ~VLSF_DONTUSE;
}
rwcrdate = volstatus.creationDate;
sleep(5);
/* Mark the RO clone in the VLDB as a good site (already released) */
- entry.serverFlags[roindex] |= NEW_REPSITE;
- entry.serverFlags[roindex] &= ~RO_DONTUSE;
- entry.flags |= RO_EXISTS;
+ entry.serverFlags[roindex] |= VLSF_NEWREPSITE;
+ entry.serverFlags[roindex] &= ~VLSF_DONTUSE;
+ entry.flags |= VLF_ROEXISTS;
releasecount++;
/* if we have a clone, treat this as done, for now */
if (stayUp && !complete_release) {
- entry.serverFlags[roindex] |= NEW_REPSITE;
- entry.serverFlags[roindex] &= ~RO_DONTUSE;
- entry.flags |= RO_EXISTS;
+ entry.serverFlags[roindex] |= VLSF_NEWREPSITE;
+ entry.serverFlags[roindex] &= ~VLSF_DONTUSE;
+ entry.flags |= VLF_ROEXISTS;
releasecount++;
}
if (vldbindex == roindex)
continue; /* the clone */
- if ((entry.serverFlags[vldbindex] & NEW_REPSITE)
- && !(entry.serverFlags[vldbindex] & RO_DONTUSE))
+ if ((entry.serverFlags[vldbindex] & VLSF_NEWREPSITE)
+ && !(entry.serverFlags[vldbindex] & VLSF_DONTUSE))
continue;
- if (!(entry.serverFlags[vldbindex] & ITSROVOL))
+ if (!(entry.serverFlags[vldbindex] & VLSF_ROVOL))
continue; /* not a RO vol */
continue;
}
- entry.serverFlags[times[m].vldbEntryIndex] |= NEW_REPSITE;
- entry.serverFlags[times[m].vldbEntryIndex] &= ~RO_DONTUSE;
- entry.flags |= RO_EXISTS;
+ entry.serverFlags[times[m].vldbEntryIndex] |= VLSF_NEWREPSITE;
+ entry.serverFlags[times[m].vldbEntryIndex] &= ~VLSF_DONTUSE;
+ entry.flags |= VLF_ROEXISTS;
releasecount++;
}
}
}
if (code) {
EPRINT(code, "Failed: ");
- entry.serverFlags[roindex] &= ~NEW_REPSITE;
- entry.serverFlags[roindex] |= RO_DONTUSE;
+ entry.serverFlags[roindex] &= ~VLSF_NEWREPSITE;
+ entry.serverFlags[roindex] |= VLSF_DONTUSE;
} else {
- entry.serverFlags[roindex] |= NEW_REPSITE;
- entry.serverFlags[roindex] &= ~RO_DONTUSE;
- entry.flags |= RO_EXISTS;
+ entry.serverFlags[roindex] |= VLSF_NEWREPSITE;
+ entry.serverFlags[roindex] &= ~VLSF_DONTUSE;
+ entry.flags |= VLF_ROEXISTS;
VDONE;
}
if (code) {
if (!times[s].crtime) {
- entry.serverFlags[vldbindex] |= RO_DONTUSE;
+ entry.serverFlags[vldbindex] |= VLSF_DONTUSE;
}
- entry.serverFlags[vldbindex] &= ~NEW_REPSITE;
+ entry.serverFlags[vldbindex] &= ~VLSF_NEWREPSITE;
PrintError("Failed: ",
code);
} else
VDONE;
- if (entry.serverFlags[vldbindex] != RO_DONTUSE) {
+ if (entry.serverFlags[vldbindex] != VLSF_DONTUSE) {
/* bring it online (mark it InService) */
VPRINT1("Bringing readonly online on %s...",
noresolve ?
/* needed to come online for cloning */
if (code) {
/* technically it's still new, just not online */
- entry.serverFlags[s] &= ~NEW_REPSITE;
- entry.serverFlags[s] |= RO_DONTUSE;
+ entry.serverFlags[s] &= ~VLSF_NEWREPSITE;
+ entry.serverFlags[s] |= VLSF_DONTUSE;
if (code != ENOENT) {
PrintError("Failed to set correct names and ids: ",
code);
/* Figure out if any volume were not released and say so */
for (failure = 0, i = 0; i < entry.nServers; i++) {
- if (!(entry.serverFlags[i] & NEW_REPSITE))
+ if (!(entry.serverFlags[i] & VLSF_NEWREPSITE))
failure++;
}
if (failure) {
"The volume %lu could not be released to the following %d sites:\n",
(unsigned long)afromvol, failure);
for (i = 0; i < entry.nServers; i++) {
- if (!(entry.serverFlags[i] & NEW_REPSITE)) {
+ if (!(entry.serverFlags[i] & VLSF_NEWREPSITE)) {
MapPartIdIntoName(entry.serverPartition[i], pname);
fprintf(STDERR, "\t%35s %s\n",
noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) :
}
for (i = 0; i < entry.nServers; i++)
- entry.serverFlags[i] &= ~NEW_REPSITE;
+ entry.serverFlags[i] &= ~VLSF_NEWREPSITE;
/* Update the VLDB */
VPRINT("updating VLDB ...");
}
reuseID = 0;
} else if (flags & RV_RDONLY) {
- if (entry.flags & RW_EXISTS) {
+ if (entry.flags & VLF_RWEXISTS) {
fprintf(STDERR,
"Entry for ReadWrite volume %s already exists!\n",
entry.name);
entry.nServers = 1;
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;
+ entry.serverFlags[0] = (flags & RV_RDONLY) ? VLSF_ROVOL : VLSF_RWVOL;
+ entry.flags = (flags & RV_RDONLY) ? VLF_ROEXISTS : VLF_RWEXISTS;
if (flags & RV_RDONLY)
entry.volumeId[ROVOL] = pvolid;
else if (tstatus.cloneID != 0) {
entry.serverNumber[entry.nServers] = toserver;
entry.serverPartition[entry.nServers] = topart;
entry.serverFlags[entry.nServers] =
- (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL;
+ (flags & RV_RDONLY) ? VLSF_ROVOL : VLSF_RWVOL;
entry.nServers++;
} else {
/* This volume should be deleted on the old site
entry.serverPartition[index] = topart;
}
- entry.flags |= (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS;
+ entry.flags |= (flags & RV_RDONLY) ? VLF_ROEXISTS : VLF_RWEXISTS;
MapNetworkToHost(&entry, &storeEntry);
vcode =
VLDB_ReplaceEntry(pvolid, voltype, &storeEntry,
/* See if it's on the same server */
for (j = 0; j < entry.nServers; j++) {
- if (entry.serverFlags[j] & ITSROVOL) {
+ if (entry.serverFlags[j] & VLSF_ROVOL) {
nro++;
if (VLDB_IsSameAddrs(server, entry.serverNumber[j], &error)) {
if (error) {
entry.serverNumber[entry.nServers] = server;
entry.serverPartition[entry.nServers] = part;
if (!valid) {
- entry.serverFlags[entry.nServers] = (ITSROVOL | RO_DONTUSE);
+ entry.serverFlags[entry.nServers] = (VLSF_ROVOL | VLSF_DONTUSE);
} else {
- entry.serverFlags[entry.nServers] = (ITSROVOL);
+ entry.serverFlags[entry.nServers] = (VLSF_ROVOL);
}
entry.nServers++;
} else { /*remove the rep site */
Lp_SetROValue(&entry, server, part, 0, 0);
entry.nServers--;
- if ((entry.nServers == 1) && (entry.flags & RW_EXISTS))
- entry.flags &= ~RO_EXISTS;
+ if ((entry.nServers == 1) && (entry.flags & VLF_RWEXISTS))
+ entry.flags &= ~VLF_ROEXISTS;
if (entry.nServers < 1) { /*this is the last ref */
VPRINT1("Deleting the VLDB entry for %u ...", volid);
fflush(STDOUT);
if (createentry) {
fprintf(STDOUT, "\n**does not exist**\n");
} else {
- if ((entry.flags & RW_EXISTS) || (entry.flags & RO_EXISTS)
- || (entry.flags & BACK_EXISTS))
+ if ((entry.flags & VLF_RWEXISTS) || (entry.flags & VLF_ROEXISTS)
+ || (entry.flags & VLF_BACKEXISTS))
EnumerateEntry(&entry);
}
fprintf(STDOUT, "\n");
} else { /* RW index found in the VLDB entry. */
/* Verify if this volume's location matches where the VLDB says it is */
if (!Lp_Match(aserver, apart, &entry)) {
- if (entry.flags & RW_EXISTS) {
+ if (entry.flags & VLF_RWEXISTS) {
/* The RW volume exists elsewhere - report this one a duplicate */
if (pass == 1) {
MapPartIdIntoName(apart, pname);
addvolume++;
/* Check for orphaned BK volume on old partition */
- if (entry.flags & BACK_EXISTS) {
+ if (entry.flags & VLF_BACKEXISTS) {
if (pass == 1) {
MapPartIdIntoName(entry.serverPartition[idx],
pname);
}
if (addvolume) {
- entry.flags |= RW_EXISTS;
+ entry.flags |= VLF_RWEXISTS;
entry.volumeId[RWVOL] = rwvolid;
if (!entry.volumeId[BACKVOL])
entry.volumeId[BACKVOL] = volumeinfo->backupID;
if (!entry.volumeId[ROVOL])
entry.volumeId[ROVOL] = volumeinfo->cloneID;
- entry.serverFlags[idx] = ITSRWVOL;
+ entry.serverFlags[idx] = VLSF_RWVOL;
entry.serverNumber[idx] = aserver;
entry.serverPartition[idx] = apart;
strncpy(entry.name, volumeinfo->name, VOLSER_OLDMAXVOLNAME);
}
} else {
if (volumeinfo->volid != entry.volumeId[BACKVOL]) {
- if (!(entry.flags & BACK_EXISTS)) {
+ if (!(entry.flags & VLF_BACKEXISTS)) {
addvolume++;
} else if (volumeinfo->volid >
entry.volumeId[BACKVOL]) {
}
}
if (addvolume) {
- entry.flags |= BACK_EXISTS;
+ entry.flags |= VLF_BACKEXISTS;
entry.volumeId[RWVOL] = rwvolid;
entry.volumeId[BACKVOL] = volumeinfo->volid;
entry.serverNumber[idx] = aserver;
entry.serverPartition[idx] = apart;
- entry.serverFlags[idx] = ITSRWVOL;
+ entry.serverFlags[idx] = VLSF_RWVOL;
modified++;
}
entry.nServers++;
addvolume++;
} else {
- if (!(entry.flags & RO_EXISTS)) {
+ if (!(entry.flags & VLF_ROEXISTS)) {
addvolume++;
}
}
if (mod)
modified++;
- if (!(entry.flags & RO_EXISTS)) {
+ if (!(entry.flags & VLF_ROEXISTS)) {
/* No RO exists in the VLDB entry - add this one */
idx = entry.nServers;
entry.nServers++;
* all the RO volumes listed in VLDB entry and add this volume.
*/
for (j = 0; j < entry.nServers; j++) {
- if (entry.serverFlags[j] & ITSROVOL) {
+ if (entry.serverFlags[j] & VLSF_ROVOL) {
/* Verify this volume exists and print message we are orphaning it */
if (pass == 1) {
MapPartIdIntoName(apart, pname);
}
if (addvolume) {
- entry.flags |= RO_EXISTS;
+ entry.flags |= VLF_ROEXISTS;
entry.volumeId[RWVOL] = rwvolid;
entry.volumeId[ROVOL] = volumeinfo->volid;
entry.serverNumber[idx] = aserver;
entry.serverPartition[idx] = apart;
- entry.serverFlags[idx] = ITSROVOL;
+ entry.serverFlags[idx] = VLSF_ROVOL;
modified++;
}
if (vcode) {
fprintf(STDOUT, "\n**does not exist**\n");
} else {
- if ((vldbentry.flags & RW_EXISTS) || (vldbentry.flags & RO_EXISTS)
- || (vldbentry.flags & BACK_EXISTS))
+ if ((vldbentry.flags & VLF_RWEXISTS) || (vldbentry.flags & VLF_ROEXISTS)
+ || (vldbentry.flags & VLF_BACKEXISTS))
EnumerateEntry(&vldbentry);
}
fprintf(STDOUT, "\n");
*modified = 0;
idx = Lp_GetRwIndex(entry);
- /* Check to see if the RW volume exists and set the RW_EXISTS
+ /* Check to see if the RW volume exists and set the VLF_RWEXISTS
* flag accordingly.
*/
if (idx == -1) { /* Did not find a RW entry */
- if (entry->flags & RW_EXISTS) { /* ... yet entry says RW exists */
- entry->flags &= ~RW_EXISTS; /* ... so say RW does not exist */
+ if (entry->flags & VLF_RWEXISTS) { /* ... yet entry says RW exists */
+ entry->flags &= ~VLF_RWEXISTS; /* ... so say RW does not exist */
modentry++;
}
} else {
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 */
- entry->flags |= RW_EXISTS; /* ... so say RW does exist */
+ if (!(entry->flags & VLF_RWEXISTS)) { /* ... yet entry says RW does not exist */
+ entry->flags |= VLF_RWEXISTS; /* ... so say RW does exist */
modentry++;
}
} else if (code == ENODEV) { /* RW volume does not exist */
- if (entry->flags & RW_EXISTS) { /* ... yet entry says RW exists */
- entry->flags &= ~RW_EXISTS; /* ... so say RW does not exist */
+ if (entry->flags & VLF_RWEXISTS) { /* ... yet entry says RW exists */
+ entry->flags &= ~VLF_RWEXISTS; /* ... so say RW does not exist */
modentry++;
}
} else {
/* If VLDB says it didn't exist, then ignore error */
- if (entry->flags & RW_EXISTS) {
+ if (entry->flags & VLF_RWEXISTS) {
MapPartIdIntoName(entry->serverPartition[idx], pname);
fprintf(STDERR,
"Transaction call failed for RW volume %u on server %s %s\n",
}
}
- /* Check to see if the BK volume exists and set the BACK_EXISTS
+ /* Check to see if the BK volume exists and set the VLF_BACKEXISTS
* flag accordingly. idx already ponts to the RW entry.
*/
if (idx == -1) { /* Did not find a RW entry */
- if (entry->flags & BACK_EXISTS) { /* ... yet entry says BK exists */
- entry->flags &= ~BACK_EXISTS; /* ... so say BK does not exist */
+ if (entry->flags & VLF_BACKEXISTS) { /* ... yet entry says BK exists */
+ entry->flags &= ~VLF_BACKEXISTS; /* ... so say BK does not exist */
modentry++;
}
} else { /* Found a RW entry */
entry->serverPartition[idx],
entry->volumeId[BACKVOL]);
if (code == 0) { /* BK volume exists */
- if (!(entry->flags & BACK_EXISTS)) { /* ... yet entry says BK does not exist */
- entry->flags |= BACK_EXISTS; /* ... so say BK does exist */
+ if (!(entry->flags & VLF_BACKEXISTS)) { /* ... yet entry says BK does not exist */
+ entry->flags |= VLF_BACKEXISTS; /* ... so say BK does exist */
modentry++;
}
} else if (code == ENODEV) { /* BK volume does not exist */
- if (entry->flags & BACK_EXISTS) { /* ... yet entry says BK exists */
- entry->flags &= ~BACK_EXISTS; /* ... so say BK does not exist */
+ if (entry->flags & VLF_BACKEXISTS) { /* ... yet entry says BK exists */
+ entry->flags &= ~VLF_BACKEXISTS; /* ... so say BK does not exist */
modentry++;
}
} else {
/* If VLDB says it didn't exist, then ignore error */
- if (entry->flags & BACK_EXISTS) {
+ if (entry->flags & VLF_BACKEXISTS) {
MapPartIdIntoName(entry->serverPartition[idx], pname);
fprintf(STDERR,
"Transaction call failed for BK volume %u on server %s %s\n",
/* If there is an idx but the BK and RW volumes no
* longer exist, then remove the RW entry.
*/
- if ((idx != -1) && !(entry->flags & RW_EXISTS)
- && !(entry->flags & BACK_EXISTS)) {
+ if ((idx != -1) && !(entry->flags & VLF_RWEXISTS)
+ && !(entry->flags & VLF_BACKEXISTS)) {
Lp_SetRWValue(entry, entry->serverNumber[idx],
entry->serverPartition[idx], 0L, 0L);
entry->nServers--;
if (modified)
*modified = 0;
- /* Check to see if the RO volumes exist and set the RO_EXISTS
+ /* Check to see if the RO volumes exist and set the VLF_ROEXISTS
* flag accordingly.
*/
for (idx = 0; idx < entry->nServers; idx++) {
- if (!(entry->serverFlags[idx] & ITSROVOL)) {
+ if (!(entry->serverFlags[idx] & VLSF_ROVOL)) {
continue; /* not a RO */
}
}
if (foundro) { /* A RO volume exists */
- if (!(entry->flags & RO_EXISTS)) { /* ... yet entry says RW does not exist */
- entry->flags |= RO_EXISTS; /* ... so say RW does exist */
+ if (!(entry->flags & VLF_ROEXISTS)) { /* ... yet entry says RW does not exist */
+ entry->flags |= VLF_ROEXISTS; /* ... so say RW does exist */
modentry++;
}
} else { /* A RO volume does not exist */
- if (entry->flags & RO_EXISTS) { /* ... yet entry says RO exists */
- entry->flags &= ~RO_EXISTS; /* ... so say RO does not exist */
+ if (entry->flags & VLF_ROEXISTS) { /* ... yet entry says RO exists */
+ entry->flags &= ~VLF_ROEXISTS; /* ... so say RO does not exist */
modentry++;
}
}
if (verbose) {
fprintf(STDOUT, "_______________________________\n");
fprintf(STDOUT, "\n-- status before -- \n");
- if ((entry->flags & RW_EXISTS) || (entry->flags & RO_EXISTS)
- || (entry->flags & BACK_EXISTS))
+ if ((entry->flags & VLF_RWEXISTS) || (entry->flags & VLF_ROEXISTS)
+ || (entry->flags & VLF_BACKEXISTS))
EnumerateEntry(entry);
fprintf(STDOUT, "\n");
}
if (pass == 1)
goto retry;
- if (!(entry->flags & RW_EXISTS) && !(entry->flags & BACK_EXISTS)
- && !(entry->flags & RO_EXISTS) && doit) {
+ if (!(entry->flags & VLF_RWEXISTS) && !(entry->flags & VLF_BACKEXISTS)
+ && !(entry->flags & VLF_ROEXISTS) && doit) {
/* The RW, BK, nor RO volumes do not exist. Delete the VLDB entry */
code =
ubik_VL_DeleteEntry(cstruct, 0, entry->volumeId[RWVOL],
VPRINT1("Recorded the new name %s in VLDB\n", 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) {
+ if (entry->flags & VLF_RWEXISTS) {
index = Lp_GetRwIndex(entry);
if (index == -1) { /* there is a serious discrepancy */
fprintf(STDERR,
aconn = (struct rx_connection *)0;
}
/*end rw volume processing */
- if (entry->flags & BACK_EXISTS) { /*process the backup volume */
+ if (entry->flags & VLF_BACKEXISTS) { /*process the backup volume */
index = Lp_GetRwIndex(entry);
if (index == -1) { /* there is a serious discrepancy */
fprintf(STDERR,
if (aconn)
rx_DestroyConnection(aconn);
aconn = (struct rx_connection *)0;
- if (entry->flags & RO_EXISTS) { /*process the ro volumes */
+ if (entry->flags & VLF_ROEXISTS) { /*process the ro volumes */
for (i = 0; i < entry->nServers; i++) {
- if (entry->serverFlags[i] & ITSROVOL) {
+ if (entry->serverFlags[i] & VLSF_ROVOL) {
aconn = UV_Bind(entry->serverNumber[i], AFSCONF_VOLUMEPORT);
code =
AFSVolTransCreate_retry(aconn, entry->volumeId[ROVOL],