2012-02-27 19:37:16 +05:30
|
|
|
// Copyright (C) 2011 Red Hat, Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// This file is part of the thin-provisioning-tools source.
|
|
|
|
//
|
|
|
|
// thin-provisioning-tools is free software: you can redistribute it
|
|
|
|
// and/or modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation, either version 3 of
|
|
|
|
// the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// thin-provisioning-tools is distributed in the hope that it will be
|
|
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
|
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with thin-provisioning-tools. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <getopt.h>
|
|
|
|
#include <libgen.h>
|
|
|
|
|
2017-10-04 16:13:13 +05:30
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
#include <boost/optional.hpp>
|
|
|
|
|
2012-02-27 19:37:16 +05:30
|
|
|
#include "version.h"
|
|
|
|
|
2014-08-27 18:31:31 +05:30
|
|
|
#include "base/application.h"
|
2013-08-16 18:37:04 +05:30
|
|
|
#include "base/error_state.h"
|
2017-09-15 19:52:04 +05:30
|
|
|
#include "base/file_utils.h"
|
2013-08-16 18:18:25 +05:30
|
|
|
#include "base/nested_output.h"
|
2014-02-19 21:38:05 +05:30
|
|
|
#include "persistent-data/data-structures/btree_counter.h"
|
2013-05-21 20:19:20 +05:30
|
|
|
#include "persistent-data/space-maps/core.h"
|
2014-02-19 21:38:05 +05:30
|
|
|
#include "persistent-data/space-maps/disk.h"
|
2013-09-11 16:10:46 +05:30
|
|
|
#include "persistent-data/file_utils.h"
|
2017-10-05 16:23:40 +05:30
|
|
|
#include "thin-provisioning/metadata.h"
|
2013-05-21 19:08:33 +05:30
|
|
|
#include "thin-provisioning/device_tree.h"
|
|
|
|
#include "thin-provisioning/mapping_tree.h"
|
2016-04-02 20:54:24 +05:30
|
|
|
#include "thin-provisioning/metadata_counter.h"
|
2013-05-21 19:08:33 +05:30
|
|
|
#include "thin-provisioning/superblock.h"
|
2014-08-27 18:31:31 +05:30
|
|
|
#include "thin-provisioning/commands.h"
|
2013-05-21 19:08:33 +05:30
|
|
|
|
2013-08-16 18:37:04 +05:30
|
|
|
using namespace base;
|
2012-02-27 19:37:16 +05:30
|
|
|
using namespace std;
|
|
|
|
using namespace thin_provisioning;
|
|
|
|
|
2013-05-21 19:08:33 +05:30
|
|
|
//----------------------------------------------------------------
|
|
|
|
|
2012-02-27 19:37:16 +05:30
|
|
|
namespace {
|
2013-05-21 19:08:33 +05:30
|
|
|
class superblock_reporter : public superblock_detail::damage_visitor {
|
|
|
|
public:
|
2013-05-21 19:35:25 +05:30
|
|
|
superblock_reporter(nested_output &out)
|
2013-05-21 19:08:33 +05:30
|
|
|
: out_(out),
|
|
|
|
err_(NO_ERROR) {
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void visit(superblock_detail::superblock_corruption const &d) {
|
2013-05-21 19:35:25 +05:30
|
|
|
out_ << "superblock is corrupt" << end_message();
|
2013-05-21 20:19:20 +05:30
|
|
|
{
|
2013-08-08 15:19:59 +05:30
|
|
|
nested_output::nest _ = out_.push();
|
2013-05-21 20:19:20 +05:30
|
|
|
out_ << d.desc_ << end_message();
|
|
|
|
}
|
2015-04-08 18:37:38 +05:30
|
|
|
err_ << FATAL;
|
2013-05-21 19:08:33 +05:30
|
|
|
}
|
|
|
|
|
2013-08-16 18:37:04 +05:30
|
|
|
base::error_state get_error() const {
|
2013-05-21 19:08:33 +05:30
|
|
|
return err_;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2013-05-21 19:35:25 +05:30
|
|
|
nested_output &out_;
|
2013-05-21 19:08:33 +05:30
|
|
|
error_state err_;
|
|
|
|
};
|
|
|
|
|
2013-05-21 20:19:20 +05:30
|
|
|
//--------------------------------
|
|
|
|
|
|
|
|
class devices_reporter : public device_tree_detail::damage_visitor {
|
|
|
|
public:
|
|
|
|
devices_reporter(nested_output &out)
|
|
|
|
: out_(out),
|
|
|
|
err_(NO_ERROR) {
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void visit(device_tree_detail::missing_devices const &d) {
|
|
|
|
out_ << "missing devices: " << d.keys_ << end_message();
|
|
|
|
{
|
2013-08-08 15:19:59 +05:30
|
|
|
nested_output::nest _ = out_.push();
|
2013-05-21 20:19:20 +05:30
|
|
|
out_ << d.desc_ << end_message();
|
|
|
|
}
|
|
|
|
|
2015-04-08 18:37:38 +05:30
|
|
|
err_ << FATAL;
|
2013-05-21 20:19:20 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
error_state get_error() const {
|
|
|
|
return err_;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nested_output &out_;
|
|
|
|
error_state err_;
|
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
2013-05-22 19:25:28 +05:30
|
|
|
class mapping_reporter : public mapping_tree_detail::damage_visitor {
|
|
|
|
public:
|
|
|
|
mapping_reporter(nested_output &out)
|
2013-08-15 20:56:17 +05:30
|
|
|
: out_(out),
|
|
|
|
err_(NO_ERROR) {
|
2013-05-22 19:25:28 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
virtual void visit(mapping_tree_detail::missing_devices const &d) {
|
|
|
|
out_ << "missing all mappings for devices: " << d.keys_ << end_message();
|
|
|
|
{
|
2013-08-08 15:19:59 +05:30
|
|
|
nested_output::nest _ = out_.push();
|
2013-05-22 19:25:28 +05:30
|
|
|
out_ << d.desc_ << end_message();
|
|
|
|
}
|
2015-04-08 18:37:38 +05:30
|
|
|
err_ << FATAL;
|
2013-05-22 19:25:28 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
virtual void visit(mapping_tree_detail::missing_mappings const &d) {
|
|
|
|
out_ << "thin device " << d.thin_dev_ << " is missing mappings " << d.keys_ << end_message();
|
|
|
|
{
|
2013-08-08 15:19:59 +05:30
|
|
|
nested_output::nest _ = out_.push();
|
2013-05-22 19:25:28 +05:30
|
|
|
out_ << d.desc_ << end_message();
|
|
|
|
}
|
2015-04-08 18:37:38 +05:30
|
|
|
err_ << FATAL;
|
2013-05-22 19:25:28 +05:30
|
|
|
}
|
|
|
|
|
2013-10-15 15:10:26 +05:30
|
|
|
error_state get_error() const {
|
|
|
|
return err_;
|
|
|
|
}
|
|
|
|
|
2013-05-22 19:25:28 +05:30
|
|
|
private:
|
|
|
|
nested_output &out_;
|
|
|
|
error_state err_;
|
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
2013-05-23 15:55:54 +05:30
|
|
|
struct flags {
|
2014-03-27 17:30:17 +05:30
|
|
|
flags()
|
|
|
|
: check_device_tree(true),
|
|
|
|
check_mapping_tree_level1(true),
|
|
|
|
check_mapping_tree_level2(true),
|
|
|
|
ignore_non_fatal_errors(false),
|
|
|
|
quiet(false),
|
|
|
|
clear_needs_check_flag_on_success(false) {
|
|
|
|
}
|
|
|
|
|
2013-05-23 15:55:54 +05:30
|
|
|
bool check_device_tree;
|
|
|
|
bool check_mapping_tree_level1;
|
|
|
|
bool check_mapping_tree_level2;
|
2013-05-23 16:27:02 +05:30
|
|
|
|
|
|
|
bool ignore_non_fatal_errors;
|
2013-06-19 17:08:14 +05:30
|
|
|
|
|
|
|
bool quiet;
|
2017-10-04 16:13:13 +05:30
|
|
|
boost::optional<block_address> override_mapping_root;
|
2014-03-27 17:30:17 +05:30
|
|
|
bool clear_needs_check_flag_on_success;
|
2013-05-23 15:55:54 +05:30
|
|
|
};
|
|
|
|
|
2015-08-04 19:44:02 +05:30
|
|
|
error_state check_space_map_counts(flags const &fs, nested_output &out,
|
|
|
|
superblock_detail::superblock &sb,
|
|
|
|
block_manager<>::ptr bm,
|
|
|
|
transaction_manager::ptr tm) {
|
|
|
|
block_counter bc;
|
|
|
|
|
2016-04-02 20:54:24 +05:30
|
|
|
count_metadata(tm, sb, bc);
|
2015-04-08 18:37:38 +05:30
|
|
|
|
|
|
|
// Finally we need to check the metadata space map agrees
|
|
|
|
// with the counts we've just calculated.
|
|
|
|
error_state err = NO_ERROR;
|
|
|
|
nested_output::nest _ = out.push();
|
|
|
|
persistent_space_map::ptr metadata_sm =
|
|
|
|
open_metadata_sm(*tm, static_cast<void *>(&sb.metadata_space_map_root_));
|
|
|
|
for (unsigned b = 0; b < metadata_sm->get_nr_blocks(); b++) {
|
|
|
|
ref_t c_actual = metadata_sm->get_count(b);
|
|
|
|
ref_t c_expected = bc.get_count(b);
|
|
|
|
|
|
|
|
if (c_actual != c_expected) {
|
|
|
|
out << "metadata reference counts differ for block " << b
|
|
|
|
<< ", expected " << c_expected
|
|
|
|
<< ", but got " << c_actual
|
|
|
|
<< end_message();
|
|
|
|
|
|
|
|
err << (c_actual > c_expected ? NON_FATAL : FATAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2017-10-04 16:13:13 +05:30
|
|
|
block_address mapping_root(superblock_detail::superblock const &sb, flags const &fs)
|
|
|
|
{
|
|
|
|
return fs.override_mapping_root ? *fs.override_mapping_root : sb.data_mapping_root_;
|
|
|
|
}
|
|
|
|
|
2018-11-09 18:13:21 +05:30
|
|
|
void print_info(superblock_detail::superblock const &sb,
|
|
|
|
transaction_manager::ptr tm)
|
|
|
|
{
|
|
|
|
cout << "TRANSACTION_ID=" << sb.trans_id_ << "\n";
|
|
|
|
cout << "METADATA_FREE_BLOCKS=" << tm->get_sm()->get_nr_free() << "\n";
|
|
|
|
}
|
|
|
|
|
2017-09-15 19:52:04 +05:30
|
|
|
error_state metadata_check(string const &path, flags fs) {
|
2013-05-21 19:35:25 +05:30
|
|
|
nested_output out(cerr, 2);
|
2013-06-19 17:42:44 +05:30
|
|
|
if (fs.quiet)
|
|
|
|
out.disable();
|
|
|
|
|
2017-09-15 19:52:04 +05:30
|
|
|
if (file_utils::get_file_length(path) < persistent_data::MD_BLOCK_SIZE) {
|
|
|
|
out << "Metadata device/file too small. Is this binary metadata?"
|
|
|
|
<< end_message();
|
|
|
|
return FATAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
block_manager<>::ptr bm = open_bm(path);
|
|
|
|
|
2013-05-21 20:19:20 +05:30
|
|
|
superblock_reporter sb_rep(out);
|
|
|
|
devices_reporter dev_rep(out);
|
2013-05-22 19:25:28 +05:30
|
|
|
mapping_reporter mapping_rep(out);
|
2013-05-21 20:19:20 +05:30
|
|
|
|
2013-05-21 19:35:25 +05:30
|
|
|
out << "examining superblock" << end_message();
|
|
|
|
{
|
2013-08-08 15:19:59 +05:30
|
|
|
nested_output::nest _ = out.push();
|
2013-05-21 19:35:25 +05:30
|
|
|
check_superblock(bm, sb_rep);
|
2013-05-21 20:19:20 +05:30
|
|
|
}
|
2013-05-21 19:35:25 +05:30
|
|
|
|
2017-09-15 19:52:04 +05:30
|
|
|
if (sb_rep.get_error() == FATAL) {
|
2017-10-05 18:17:10 +05:30
|
|
|
if (check_for_xml(bm))
|
|
|
|
out << "This looks like XML. thin_check only checks the binary metadata format." << end_message();
|
2013-05-21 20:19:20 +05:30
|
|
|
return FATAL;
|
2017-09-15 19:52:04 +05:30
|
|
|
}
|
2013-05-21 20:19:20 +05:30
|
|
|
|
2013-05-22 19:25:28 +05:30
|
|
|
superblock_detail::superblock sb = read_superblock(bm);
|
2017-10-05 16:23:40 +05:30
|
|
|
transaction_manager::ptr tm =
|
|
|
|
open_tm(bm, superblock_detail::SUPERBLOCK_LOCATION);
|
2013-05-22 19:25:28 +05:30
|
|
|
|
2018-11-09 18:13:21 +05:30
|
|
|
if (!fs.quiet)
|
|
|
|
print_info(sb, tm);
|
|
|
|
|
2013-05-23 15:55:54 +05:30
|
|
|
if (fs.check_device_tree) {
|
|
|
|
out << "examining devices tree" << end_message();
|
|
|
|
{
|
2013-08-08 15:19:59 +05:30
|
|
|
nested_output::nest _ = out.push();
|
2014-08-26 15:44:49 +05:30
|
|
|
device_tree dtree(*tm, sb.device_details_root_,
|
2013-05-23 15:55:54 +05:30
|
|
|
device_tree_detail::device_details_traits::ref_counter());
|
|
|
|
check_device_tree(dtree, dev_rep);
|
|
|
|
}
|
2013-05-21 19:35:25 +05:30
|
|
|
}
|
2013-05-21 20:19:20 +05:30
|
|
|
|
2013-05-23 15:55:54 +05:30
|
|
|
if (fs.check_mapping_tree_level1 && !fs.check_mapping_tree_level2) {
|
|
|
|
out << "examining top level of mapping tree" << end_message();
|
|
|
|
{
|
2013-08-08 15:19:59 +05:30
|
|
|
nested_output::nest _ = out.push();
|
2017-10-04 16:13:13 +05:30
|
|
|
dev_tree dtree(*tm, mapping_root(sb, fs),
|
2019-04-04 19:08:46 +05:30
|
|
|
mapping_tree_detail::mtree_traits::ref_counter(*tm));
|
2013-05-23 15:55:54 +05:30
|
|
|
check_mapping_tree(dtree, mapping_rep);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (fs.check_mapping_tree_level2) {
|
|
|
|
out << "examining mapping tree" << end_message();
|
|
|
|
{
|
2013-08-08 15:19:59 +05:30
|
|
|
nested_output::nest _ = out.push();
|
2017-10-04 16:13:13 +05:30
|
|
|
mapping_tree mtree(*tm, mapping_root(sb, fs),
|
2013-05-23 15:55:54 +05:30
|
|
|
mapping_tree_detail::block_traits::ref_counter(tm->get_sm()));
|
|
|
|
check_mapping_tree(mtree, mapping_rep);
|
|
|
|
}
|
2013-05-22 19:25:28 +05:30
|
|
|
}
|
|
|
|
|
2015-04-08 18:37:38 +05:30
|
|
|
error_state err = NO_ERROR;
|
|
|
|
err << sb_rep.get_error() << mapping_rep.get_error() << dev_rep.get_error();
|
2014-02-19 21:38:05 +05:30
|
|
|
|
|
|
|
// if we're checking everything, and there were no errors,
|
|
|
|
// then we should check the space maps too.
|
2015-04-08 18:37:38 +05:30
|
|
|
if (fs.check_device_tree && fs.check_mapping_tree_level2 && err != FATAL) {
|
2014-02-19 21:38:05 +05:30
|
|
|
out << "checking space map counts" << end_message();
|
2015-04-08 18:37:38 +05:30
|
|
|
err << check_space_map_counts(fs, out, sb, bm, tm);
|
2014-02-19 21:38:05 +05:30
|
|
|
}
|
|
|
|
|
2015-04-08 18:37:38 +05:30
|
|
|
return err;
|
2013-05-21 19:08:33 +05:30
|
|
|
}
|
|
|
|
|
2014-03-27 17:30:17 +05:30
|
|
|
void clear_needs_check(string const &path) {
|
2014-07-22 21:11:39 +05:30
|
|
|
block_manager<>::ptr bm = open_bm(path, block_manager<>::READ_WRITE);
|
2014-03-27 17:30:17 +05:30
|
|
|
|
|
|
|
superblock_detail::superblock sb = read_superblock(bm);
|
|
|
|
sb.set_needs_check_flag(false);
|
|
|
|
write_superblock(bm, sb);
|
|
|
|
}
|
|
|
|
|
2014-04-02 18:13:16 +05:30
|
|
|
// Returns 0 on success, 1 on failure (this gets returned directly
|
|
|
|
// by main).
|
2013-05-23 15:55:54 +05:30
|
|
|
int check(string const &path, flags fs) {
|
2013-05-21 19:08:33 +05:30
|
|
|
error_state err;
|
2014-03-27 17:30:17 +05:30
|
|
|
bool success = false;
|
2013-05-21 19:08:33 +05:30
|
|
|
|
2012-03-02 15:30:31 +05:30
|
|
|
try {
|
2013-05-23 15:55:54 +05:30
|
|
|
err = metadata_check(path, fs);
|
2013-05-21 19:08:33 +05:30
|
|
|
|
2014-03-27 17:30:17 +05:30
|
|
|
if (fs.ignore_non_fatal_errors)
|
2015-06-22 15:43:19 +05:30
|
|
|
success = (err == FATAL) ? false : true;
|
2014-03-27 17:30:17 +05:30
|
|
|
else
|
2015-06-22 15:43:19 +05:30
|
|
|
success = (err == NO_ERROR) ? true : false;
|
2014-03-27 17:30:17 +05:30
|
|
|
|
2015-06-22 15:43:19 +05:30
|
|
|
if (success && fs.clear_needs_check_flag_on_success)
|
2014-03-27 17:30:17 +05:30
|
|
|
clear_needs_check(path);
|
|
|
|
|
2012-03-02 15:30:31 +05:30
|
|
|
} catch (std::exception &e) {
|
2013-06-19 17:08:14 +05:30
|
|
|
if (!fs.quiet)
|
|
|
|
cerr << e.what() << endl;
|
|
|
|
|
2012-02-27 19:37:16 +05:30
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-22 15:43:19 +05:30
|
|
|
return !success;
|
2012-02-27 19:37:16 +05:30
|
|
|
}
|
2016-01-08 18:21:52 +05:30
|
|
|
}
|
2012-02-27 19:37:16 +05:30
|
|
|
|
2016-01-08 18:21:52 +05:30
|
|
|
//----------------------------------------------------------------
|
|
|
|
|
|
|
|
thin_check_cmd::thin_check_cmd()
|
|
|
|
: command("thin_check")
|
|
|
|
{
|
2012-02-27 19:37:16 +05:30
|
|
|
}
|
|
|
|
|
2016-01-08 18:21:52 +05:30
|
|
|
void
|
|
|
|
thin_check_cmd::usage(std::ostream &out) const
|
|
|
|
{
|
|
|
|
out << "Usage: " << get_name() << " [options] {device|file}" << endl
|
|
|
|
<< "Options:" << endl
|
|
|
|
<< " {-q|--quiet}" << endl
|
|
|
|
<< " {-h|--help}" << endl
|
|
|
|
<< " {-V|--version}" << endl
|
2017-10-04 16:13:13 +05:30
|
|
|
<< " {--override-mapping-root}" << endl
|
2016-01-08 18:21:52 +05:30
|
|
|
<< " {--clear-needs-check-flag}" << endl
|
|
|
|
<< " {--ignore-non-fatal-errors}" << endl
|
|
|
|
<< " {--skip-mappings}" << endl
|
|
|
|
<< " {--super-block-only}" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
thin_check_cmd::run(int argc, char **argv)
|
2012-02-27 19:37:16 +05:30
|
|
|
{
|
|
|
|
int c;
|
2013-08-15 15:05:07 +05:30
|
|
|
flags fs;
|
2013-07-29 15:59:05 +05:30
|
|
|
|
2013-05-23 18:27:15 +05:30
|
|
|
char const shortopts[] = "qhV";
|
|
|
|
option const longopts[] = {
|
2012-03-02 18:29:59 +05:30
|
|
|
{ "quiet", no_argument, NULL, 'q'},
|
2012-02-27 19:37:16 +05:30
|
|
|
{ "help", no_argument, NULL, 'h'},
|
|
|
|
{ "version", no_argument, NULL, 'V'},
|
2013-04-23 19:51:44 +05:30
|
|
|
{ "super-block-only", no_argument, NULL, 1},
|
2013-05-23 15:55:54 +05:30
|
|
|
{ "skip-mappings", no_argument, NULL, 2},
|
2013-05-23 16:27:02 +05:30
|
|
|
{ "ignore-non-fatal-errors", no_argument, NULL, 3},
|
2014-03-27 17:30:17 +05:30
|
|
|
{ "clear-needs-check-flag", no_argument, NULL, 4 },
|
2017-10-04 16:13:13 +05:30
|
|
|
{ "override-mapping-root", required_argument, NULL, 5},
|
2012-02-27 19:37:16 +05:30
|
|
|
{ NULL, no_argument, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
|
|
|
switch(c) {
|
|
|
|
case 'h':
|
2016-01-08 18:21:52 +05:30
|
|
|
usage(cout);
|
2012-02-27 19:37:16 +05:30
|
|
|
return 0;
|
2012-03-02 18:29:59 +05:30
|
|
|
|
|
|
|
case 'q':
|
2013-06-19 17:08:14 +05:30
|
|
|
fs.quiet = true;
|
2012-03-02 18:29:59 +05:30
|
|
|
break;
|
|
|
|
|
2012-02-27 19:37:16 +05:30
|
|
|
case 'V':
|
2012-03-13 18:02:30 +05:30
|
|
|
cout << THIN_PROVISIONING_TOOLS_VERSION << endl;
|
2012-02-27 19:37:16 +05:30
|
|
|
return 0;
|
2012-03-13 18:02:30 +05:30
|
|
|
|
2013-04-23 19:51:44 +05:30
|
|
|
case 1:
|
2013-05-23 15:55:54 +05:30
|
|
|
// super-block-only
|
|
|
|
fs.check_device_tree = false;
|
|
|
|
fs.check_mapping_tree_level1 = false;
|
|
|
|
fs.check_mapping_tree_level2 = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
// skip-mappings
|
|
|
|
fs.check_mapping_tree_level2 = false;
|
2013-04-23 19:51:44 +05:30
|
|
|
break;
|
|
|
|
|
2013-05-23 16:27:02 +05:30
|
|
|
case 3:
|
|
|
|
// ignore-non-fatal-errors
|
|
|
|
fs.ignore_non_fatal_errors = true;
|
|
|
|
break;
|
|
|
|
|
2014-03-27 17:30:17 +05:30
|
|
|
case 4:
|
|
|
|
// clear needs-check flag
|
|
|
|
fs.clear_needs_check_flag_on_success = true;
|
|
|
|
break;
|
|
|
|
|
2017-10-04 16:13:13 +05:30
|
|
|
case 5:
|
|
|
|
// override-mapping-root
|
|
|
|
fs.override_mapping_root = boost::lexical_cast<uint64_t>(optarg);
|
|
|
|
break;
|
|
|
|
|
2012-03-06 00:04:05 +05:30
|
|
|
default:
|
2016-01-08 18:21:52 +05:30
|
|
|
usage(cerr);
|
2012-03-06 00:04:05 +05:30
|
|
|
return 1;
|
2012-02-27 19:37:16 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-06 00:04:05 +05:30
|
|
|
if (argc == optind) {
|
2013-06-19 17:08:14 +05:30
|
|
|
if (!fs.quiet) {
|
|
|
|
cerr << "No input file provided." << endl;
|
2016-01-08 18:21:52 +05:30
|
|
|
usage(cerr);
|
2013-06-19 17:08:14 +05:30
|
|
|
}
|
|
|
|
|
2012-02-27 19:37:16 +05:30
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2013-05-23 15:55:54 +05:30
|
|
|
return check(argv[optind], fs);
|
2012-02-27 19:37:16 +05:30
|
|
|
}
|
2014-08-27 18:31:31 +05:30
|
|
|
|
|
|
|
//----------------------------------------------------------------
|