[thin_show_duplicates] add --block-sectors switch
This commit is contained in:
parent
519cbfd855
commit
929a824184
@ -34,6 +34,7 @@
|
|||||||
#include "thin-provisioning/superblock.h"
|
#include "thin-provisioning/superblock.h"
|
||||||
|
|
||||||
#include <boost/uuid/sha1.hpp>
|
#include <boost/uuid/sha1.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace base;
|
using namespace base;
|
||||||
@ -58,6 +59,19 @@ namespace {
|
|||||||
return tm;
|
return tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t parse_int(string const &str, string const &desc) {
|
||||||
|
try {
|
||||||
|
return boost::lexical_cast<uint64_t>(str);
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
ostringstream out;
|
||||||
|
out << "Couldn't parse " << desc << ": '" << str << "'";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0; // never get here
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
|
|
||||||
struct flags {
|
struct flags {
|
||||||
@ -197,6 +211,7 @@ int thin_show_dups_main(int argc, char **argv)
|
|||||||
|
|
||||||
char const shortopts[] = "qhV";
|
char const shortopts[] = "qhV";
|
||||||
option const longopts[] = {
|
option const longopts[] = {
|
||||||
|
{ "block-sectors", required_argument, NULL, 1},
|
||||||
{ "help", no_argument, NULL, 'h'},
|
{ "help", no_argument, NULL, 'h'},
|
||||||
{ "version", no_argument, NULL, 'V'},
|
{ "version", no_argument, NULL, 'V'},
|
||||||
{ NULL, no_argument, NULL, 0 }
|
{ NULL, no_argument, NULL, 0 }
|
||||||
@ -212,6 +227,10 @@ int thin_show_dups_main(int argc, char **argv)
|
|||||||
cout << THIN_PROVISIONING_TOOLS_VERSION << endl;
|
cout << THIN_PROVISIONING_TOOLS_VERSION << endl;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
fs.block_size = 512 * parse_int(optarg, "block sectors");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage(cerr, basename(argv[0]));
|
usage(cerr, basename(argv[0]));
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user