output superblock in xml format

This commit is contained in:
Joe Thornber 2011-10-10 16:14:36 +01:00
parent 8389ca31a8
commit 64f4c341bd
2 changed files with 22 additions and 10 deletions

View File

@ -123,6 +123,8 @@ namespace {
void void
metadata::dump(emitter::ptr e) metadata::dump(emitter::ptr e)
{ {
e->begin_superblock("", sb_.time_, sb_.trans_id_, sb_.data_block_size_);
details_extractor::ptr de(new details_extractor); details_extractor::ptr de(new details_extractor);
details_.visit(de); details_.visit(de);
@ -144,6 +146,8 @@ metadata::dump(emitter::ptr e)
e->end_device(); e->end_device();
} }
e->end_superblock();
} }
//---------------------------------------------------------------- //----------------------------------------------------------------

View File

@ -22,15 +22,19 @@ namespace {
uint64_t time, uint64_t time,
uint64_t trans_id, uint64_t trans_id,
uint32_t data_block_size) { uint32_t data_block_size) {
out_ << "begin superblock: " << uuid indent();
<< ", " << time out_ << "<superblock uuid=\"" << uuid << "\""
<< ", " << trans_id << " time=\"" << time << "\""
<< ", " << data_block_size << " transaction=\"" << trans_id << "\""
<< " data_block_size=\"" << data_block_size << "\">"
<< endl; << endl;
inc();
} }
void end_superblock() { void end_superblock() {
out_ << "end superblock" << endl; dec();
indent();
out_ << "</superblock>" << endl;
} }
void begin_device(uint32_t dev_id, void begin_device(uint32_t dev_id,
@ -49,21 +53,25 @@ namespace {
void end_device() { void end_device() {
dec(); dec();
indent();
out_ << "</device>" << endl; out_ << "</device>" << endl;
} }
void begin_named_mapping(string const &name) { void begin_named_mapping(string const &name) {
out_ << "begin named mapping" indent();
<< endl; out_ << "<named_mapping>" << endl;
inc();
} }
void end_named_mapping() { void end_named_mapping() {
out_ << "end named mapping" dec();
<< endl; indent();
out_ << "</named_mapping>" << endl;
} }
void identifier(string const &name) { void identifier(string const &name) {
out_ << "identifier: " << name << endl; indent();
out_ << "<identifier name=\"" << name << "\"/>" << endl;
} }
void range_map(uint64_t origin_begin, uint64_t data_begin, uint64_t len) { void range_map(uint64_t origin_begin, uint64_t data_begin, uint64_t len) {