.B s_mmp_block
field in the superblock to locate and use the existing MMP block.
.TP
-.BI dx_hash " [-h hash_alg] [-s hash_seed] filename"
+.BI dx_hash " [-cv] [-h hash_alg] [-s hash_seed] filename"
Calculate the directory hash of
.IR filename .
+The
+.I -c
+option will casefold the filename before calculating the hash. The
+.I -v
+option will make the
+.B dx_hash
+command more verbose and print the hash algorithm and hash seed to
+calculate the hash.
+If a file system is open, use the hash_seed and
+default hash_algorithm used by the file system, although these can be
+overridden by the
+.I -h
+and
+.I -s
+options.
The hash algorithm specified with
.I -h
may be
{
ext2_dirhash_t hash, minor_hash;
errcode_t err;
- int c;
+ int c, verbose = 0;
int hash_version = 0;
__u32 hash_seed[4] = { 0, };
int hash_flags = 0;
}
reset_getopt();
- while ((c = getopt(argc, argv, "h:s:ce:")) != EOF) {
+ while ((c = getopt(argc, argv, "h:s:ce:v")) != EOF) {
switch (c) {
case 'h':
hash_version = e2p_string2hash(optarg);
return;
}
break;
+ case 'v':
+ verbose = 1;
+ break;
default:
goto print_usage;
}
}
if (optind != argc-1) {
print_usage:
- com_err(argv[0], 0, "usage: dx_hash [-h hash_alg] "
- "[-s hash_seed] [-c] [-e encoding] filename");
+ com_err(argv[0], 0, "usage: dx_hash [-cv] [-h hash_alg] "
+ "[-s hash_seed] [-e encoding] filename");
return;
}
err = ext2fs_dirhash2(hash_version, argv[optind],
}
printf("Hash of %s is 0x%0x (minor 0x%0x)\n", argv[optind],
hash, minor_hash);
+ if (verbose) {
+ char uuid_str[37];
+
+ uuid_unparse((__u8 *) hash_seed, uuid_str);
+ printf(" using hash algorithm %d and hash_seed %s\n",
+ hash_version, uuid_str);
+ }
}
/*