Compare commits

..

1 Commits

Author SHA1 Message Date
Tom Marshall 47e4bf222c Implement cbd tune plus some cleanup and rearranging
Still need to implement cbd tune --repack.
2019-11-18 00:43:51 +01:00
1 changed files with 11 additions and 5 deletions

View File

@ -193,8 +193,8 @@ usage(void)
"\n"
" tune [opts] <name> Change compression and/or repack\n"
" -r --repack Repack data blocks\n"
" -z --zero-detect Detect and free zeroed blocks\n"
" -Z --compress-level Compression level\n"
" --detect-zeros Detect and free zeroed blocks\n"
"\n");
exit(1);
}
@ -531,8 +531,8 @@ do_tune(int argc, char** argv)
static const char short_opts[] = "rzZ:";
static const struct option long_opts[] = {
{ "repack", no_argument, NULL, 'r' },
{ "zero-detect", no_argument, NULL, 'z' },
{ "compress-level", required_argument, NULL, 'Z' },
{ "detect-zeros", optional_argument, NULL, 0x1 },
{ NULL, no_argument, NULL, 0 }
};
char opt;
@ -548,9 +548,6 @@ do_tune(int argc, char** argv)
case 'r':
repack = true;
break;
case 'z':
zero_detect = true;
break;
case 'Z':
if (!parse_numeric_arg(optarg, &optval)) {
error("Failed to parse \"%s\"\n", optarg);
@ -560,6 +557,15 @@ do_tune(int argc, char** argv)
}
level = optval;
break;
case 0x1:
optval = 1;
if (optarg) {
if (!parse_boolean_arg(optarg, &optval)) {
error("Failed to parse \"%s\"\n", optarg);
}
}
zero_detect = (optval != 0);
break;
default:
usage();
}