afs_int32 code, error = 0;
struct nvldbentry entry, storeEntry;
char pname[10];
- int pass = 0, islocked = 0, createentry, addvolume, modified, mod;
+ int pass = 0, islocked = 0, createentry, addvolume, modified, mod, doit = 1;
afs_int32 rwvolid;
- if (modentry)
+ if (modentry) {
+ if (*modentry == 1)
+ doit = 0;
*modentry = 0;
+ }
rwvolid =
((volumeinfo->type ==
RWVOL) ? volumeinfo->volid : volumeinfo->parentID);
if (entry.volumeId[RWVOL] > *maxvolid)
*maxvolid = entry.volumeId[RWVOL];
- if (modified) {
+ if (modified && doit) {
MapNetworkToHost(&entry, &storeEntry);
if (createentry) {
}
}
- if (verbose) {
+ if (verbose && doit) {
fprintf(STDOUT, "-- status after --\n");
if (modified)
EnumerateEntry(&entry);
volumeInfo.volEntries_val = (volintInfo *) 0;
volumeInfo.volEntries_len = 0;
- if (!aserver && flags) {
+ if (!aserver && (flags & 1)) {
/* fprintf(STDERR,"Partition option requires a server option\n"); */
ERROR_EXIT(EINVAL);
}
/* Turn verbose logging off and do our own verbose logging */
tverbose = verbose;
+ if (flags & 2)
+ tverbose = 1;
verbose = 0;
/* Read the VLDB entry */
* Equivalent to a syncserv.
*/
if (!vcode) {
+ /* Tell CheckVldb not to update if appropriate */
+ if (flags & 2)
+ mod = 1;
+ else
+ mod = 0;
code = CheckVldb(&vldbentry, &mod);
if (code) {
fprintf(STDERR, "Could not process VLDB entry for volume %s\n",
/* If aserver is given, we will search for the desired volume on it */
if (aserver) {
/* Generate array of partitions on the server that we will check */
- if (!flags) {
+ if (!(flags & 1)) {
code = UV_ListPartitions(aserver, &PartList, &pcnt);
if (code) {
fprintf(STDERR,
ERROR_EXIT(code);
}
} else {
+ if (flags & 2)
+ mod = 1;
+ else
+ mod = 0;
/* Found one, sync it with VLDB entry */
code =
CheckVolume(volumeInfo.volEntries_val, aserver,
ERROR_EXIT(code);
}
} else {
+ if (flags & 2)
+ mod = 1;
+ else
+ mod = 0;
/* Found one, sync it with VLDB entry */
code =
CheckVolume(volumeInfo.volEntries_val, aserver,
/* if (aserver) */
/* If verbose output, print a summary of what changed */
- if (tverbose) {
+ if (tverbose && !(flags & 2)) {
fprintf(STDOUT, "-- status after --\n");
code = VLDB_GetEntryByName(avolname, &vldbentry);
if (code && (code != VL_NOENT)) {
aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
/* Generate array of partitions to check */
- if (!flags) {
+ if (!(flags & 1)) {
code = UV_ListPartitions(aserver, &PartList, &pcnt);
if (code) {
fprintf(STDERR,
fflush(STDOUT);
}
+ if (flags & 2)
+ modified = 1;
+ else
+ modified = 0;
code = CheckVolume(vi, aserver, apart, &modified, &maxvolid);
if (code) {
PrintError("", code);
} /* thru all partitions */
- VPRINT3("Total entries: %u, Failed to process %d, Changed %d\n", tentries,
- failures, modifications);
+ if (flags & 2) {
+ VPRINT3("Total entries: %u, Failed to process %d, Would change %d\n",
+ tentries, failures, modifications);
+ } else {
+ VPRINT3("Total entries: %u, Failed to process %d, Changed %d\n",
+ tentries, failures, modifications);
+ }
error_exit:
/* Now check if the maxvolid is larger than that stored in the VLDB */
afs_int32 code, error = 0;
struct nvldbentry storeEntry;
int islocked = 0, mod, modentry, delentry = 0;
- int pass = 0;
+ int pass = 0, doit=1;
- if (modified)
+ if (modified) {
+ if (*modified == 1)
+ doit = 0;
*modified = 0;
+ }
if (verbose) {
fprintf(STDOUT, "_______________________________\n");
fprintf(STDOUT, "\n-- status before -- \n");
code = CheckVldbRWBK(entry, &mod);
if (code)
ERROR_EXIT(code);
- if (mod && (pass == 1))
+ if (mod && (pass == 1) && doit)
goto retry;
if (mod)
modentry++;
code = CheckVldbRO(entry, &mod);
if (code)
ERROR_EXIT(code);
- if (mod && (pass == 1))
+ if (mod && (pass == 1) && doit)
goto retry;
if (mod)
modentry++;
/* The VLDB entry has been updated. If it as been modified, then
* write the entry back out the the VLDB.
*/
- if (modentry) {
+ if (modentry && doit) {
if (pass == 1)
goto retry;
if (!(entry->flags & RW_EXISTS) && !(entry->flags & BACK_EXISTS)
- && !(entry->flags & RO_EXISTS)) {
+ && !(entry->flags & RO_EXISTS) && doit) {
/* The RW, BK, nor RO volumes do not exist. Delete the VLDB entry */
code =
ubik_VL_DeleteEntry(cstruct, 0, entry->volumeId[RWVOL],
islocked = 0;
}
- if (verbose) {
+ if (verbose && doit) {
fprintf(STDOUT, "-- status after --\n");
if (delentry)
fprintf(STDOUT, "\n**entry deleted**\n");
struct nvldbentry *vlentry;
afs_int32 si, nsi, j;
+ if (flags & 2)
+ verbose = 1;
+
aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
/* Set up attributes to search VLDB */
attributes.server = ntohl(aserver);
attributes.Mask = VLLIST_SERVER;
- if (flags) {
+ if ((flags & 1)) {
attributes.partition = apart;
attributes.Mask |= VLLIST_PARTITION;
}
VPRINT1("Processing VLDB entry %d ...\n", j + 1);
+ /* Tell CheckVldb not to update if appropriate */
+ if (flags & 2)
+ modified = 1;
+ else
+ modified = 0;
code = CheckVldb(vlentry, &modified);
if (code) {
PrintError("", code);
}
}
- VPRINT3("Total entries: %u, Failed to process %d, Changed %d\n", tentries,
- failures, modifications);
+ if (flags & 2) {
+ VPRINT3("Total entries: %u, Failed to process %d, Would change %d\n",
+ tentries, failures, modifications);
+ } else {
+ VPRINT3("Total entries: %u, Failed to process %d, Changed %d\n",
+ tentries, failures, modifications);
+ }
error_exit:
if (aconn)