afs_int32
IdHash(afs_uint32 volid)
{
- return ((abs(volid)) % HASHSIZE);
+ return (volid % HASHSIZE);
}
#define LEGALCHARS ".ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
if (verbose) {
quiet_println("Writing back MH block % at addr %u\n", block, addr);
}
+ mhblockP->ex_hdrflags = htonl(mhblockP->ex_hdrflags);
if (block == 0) {
+ /*
+ * These header fields are only used in the first mh block, so were
+ * converted to host byte order only when the first mh block was read.
+ */
mhblockP->ex_count = htonl(mhblockP->ex_count);
- mhblockP->ex_hdrflags = htonl(mhblockP->ex_hdrflags);
for (i = 0; i < VL_MAX_ADDREXTBLKS; i++) {
mhblockP->ex_contaddrs[i] = htonl(mhblockP->ex_contaddrs[i]);
}
if (fix) {
/*
- * If we are fixing we will rebuild all the hash lists from the ground up
+ * If we are fixing we will rebuild the free and hash lists from the ground up.
*/
+ header.vital_header.freePtr = 0;
memcpy(oldnamehash, header.VolnameHash, sizeof(oldnamehash));
memset(header.VolnameHash, 0, sizeof(header.VolnameHash));
}
writeMH(record[i].addr, block, MHblock);
}
+ } else if (record[i].type & FR) {
+ if (fix) {
+ readentry(record[i].addr, &vlentry, &type);
+ vlentry.nextIdHash[0] = header.vital_header.freePtr;
+ header.vital_header.freePtr = record[i].addr;
+ if ((record[i].type & FRC) == 0) {
+ quiet_println
+ ("FIX: Putting free entry on the free chain: addr=%lu (offset 0x%0x)\n",
+ record[i].addr, OFFSET(record[i].addr));
+ }
+ writeentry(record[i].addr, &vlentry);
+ }
}
}
if (fix) {
setlinebuf(stdout);
- ts = cmd_CreateSyntax(NULL, WorkerBee, NULL, "vldb check");
+ ts = cmd_CreateSyntax(NULL, WorkerBee, NULL, 0, "vldb check");
cmd_AddParm(ts, "-database", CMD_SINGLE, CMD_REQUIRED, "vldb_file");
cmd_AddParm(ts, "-uheader", CMD_FLAG, CMD_OPTIONAL,
"Display UBIK header");