[thinp tools] move find_metadata_snap to superblock.cc

This commit is contained in:
Joe Thornber 2015-07-27 14:30:09 +01:00
parent 642ae6e7c2
commit 93fb540bd4
4 changed files with 19 additions and 14 deletions

View File

@ -1 +1 @@
0.5.2
0.5.3

View File

@ -1,6 +1,7 @@
#include "persistent-data/checksum.h"
#include "persistent-data/errors.h"
#include "thin-provisioning/superblock.h"
#include "persistent-data/file_utils.h"
using namespace thin_provisioning;
using namespace superblock_detail;
@ -180,6 +181,20 @@ namespace thin_provisioning {
visitor.visit(superblock_corruption(e.what()));
}
}
block_address find_metadata_snap(string const &path)
{
superblock_detail::superblock sb =
read_superblock(open_bm(path, block_manager<>::READ_ONLY, false), 0);
uint64_t ms = sb.metadata_snap_;
if (!ms) {
cerr << "no metadata snapshot found!" << endl;
exit(1);
}
return ms;
}
}
//----------------------------------------------------------------

View File

@ -137,6 +137,9 @@ namespace thin_provisioning {
void check_superblock(persistent_data::block_manager<>::ptr bm,
superblock_detail::damage_visitor &visitor);
persistent_data::block_address find_metadata_snap(string const &path);
}
//----------------------------------------------------------------

View File

@ -39,19 +39,6 @@ struct flags {
};
namespace {
block_address find_metadata_snap(string const &path)
{
superblock_detail::superblock sb = read_superblock(open_bm(path, block_manager<>::READ_ONLY, false), 0);
uint64_t ms = sb.metadata_snap_;
if (!ms) {
cerr << "no metadata snapshot found!" << endl;
exit(1);
}
return ms;
}
int dump_(string const &path, ostream &out, string const &format, struct flags &flags,
block_address metadata_snap) {
try {