Get tools building with g++ 4.8.1

This commit is contained in:
Joe Thornber
2013-06-25 13:48:02 +01:00
parent 7b603183df
commit eb8d4c6f0b
11 changed files with 45 additions and 51 deletions

View File

@@ -189,9 +189,9 @@ namespace {
void
thin_provisioning::metadata_dump(metadata::ptr md, emitter::ptr e, bool repair)
{
optional<uint64_t> md_snap = md->sb_.metadata_snap_ ?
optional<uint64_t>(md->sb_.metadata_snap_) :
optional<uint64_t>();
boost::optional<uint64_t> md_snap = md->sb_.metadata_snap_ ?
boost::optional<uint64_t>(md->sb_.metadata_snap_) :
boost::optional<uint64_t>();
e->begin_superblock("", md->sb_.time_,
md->sb_.trans_id_,

View File

@@ -19,7 +19,6 @@
#include "thin-provisioning/restore_emitter.h"
#include "thin-provisioning/superblock.h"
using namespace boost;
using namespace std;
using namespace thin_provisioning;
@@ -46,11 +45,11 @@ namespace {
uint64_t trans_id,
uint32_t data_block_size,
uint64_t nr_data_blocks,
optional<uint64_t> metadata_snap) {
boost::optional<uint64_t> metadata_snap) {
in_superblock_ = true;
nr_data_blocks_ = nr_data_blocks;
superblock &sb = md_->sb_;
memcpy(&sb.uuid_, &uuid, sizeof(&sb.uuid_));
memcpy(&sb.uuid_, &uuid, sizeof(sb.uuid_));
sb.time_ = time;
sb.trans_id_ = trans_id;
sb.data_block_size_ = data_block_size;
@@ -83,7 +82,7 @@ namespace {
md_->details_->insert(key, details);
current_mapping_ = empty_mapping_->clone();
current_device_ = optional<uint32_t>(dev);
current_device_ = boost::optional<uint32_t>(dev);
}
virtual void end_device() {
@@ -92,7 +91,7 @@ namespace {
md_->mappings_top_level_->insert(key, current_mapping_->get_root());
md_->mappings_->set_root(md_->mappings_top_level_->get_root()); // FIXME: ugly
current_device_ = optional<uint32_t>();
current_device_ = boost::optional<uint32_t>();
}
virtual void begin_named_mapping(std::string const &name) {
@@ -147,7 +146,7 @@ namespace {
metadata::ptr md_;
bool in_superblock_;
block_address nr_data_blocks_;
optional<uint32_t> current_device_;
boost::optional<uint32_t> current_device_;
single_mapping_tree::ptr current_mapping_;
single_mapping_tree::ptr empty_mapping_;
};

View File

@@ -73,7 +73,7 @@ void
thin::set_snapshot_time(uint32_t time)
{
uint64_t key[1] = { dev_ };
optional<device_tree_detail::device_details> mdetail = pool_->md_->details_->lookup(key);
boost::optional<device_tree_detail::device_details> mdetail = pool_->md_->details_->lookup(key);
if (!mdetail)
throw runtime_error("no such device");
@@ -85,7 +85,7 @@ block_address
thin::get_mapped_blocks() const
{
uint64_t key[1] = { dev_ };
optional<device_tree_detail::device_details> mdetail = pool_->md_->details_->lookup(key);
boost::optional<device_tree_detail::device_details> mdetail = pool_->md_->details_->lookup(key);
if (!mdetail)
throw runtime_error("no such device");
@@ -96,7 +96,7 @@ void
thin::set_mapped_blocks(block_address count)
{
uint64_t key[1] = { dev_ };
optional<device_tree_detail::device_details> mdetail = pool_->md_->details_->lookup(key);
boost::optional<device_tree_detail::device_details> mdetail = pool_->md_->details_->lookup(key);
if (!mdetail)
throw runtime_error("no such device");
@@ -138,7 +138,7 @@ thin_pool::create_snap(thin_dev_t dev, thin_dev_t origin)
uint64_t snap_key[1] = {dev};
uint64_t origin_key[1] = {origin};
optional<uint64_t> mtree_root = md_->mappings_top_level_->lookup(origin_key);
boost::optional<uint64_t> mtree_root = md_->mappings_top_level_->lookup(origin_key);
if (!mtree_root)
throw std::runtime_error("unknown origin");
@@ -186,7 +186,7 @@ thin_pool::get_metadata_snap() const
block_address
thin_pool::alloc_data_block()
{
optional<block_address> mb = md_->data_sm_->new_block();
boost::optional<block_address> mb = md_->data_sm_->new_block();
if (!mb)
throw runtime_error("couldn't allocate new block");
@@ -221,7 +221,7 @@ thin::ptr
thin_pool::open_thin(thin_dev_t dev)
{
uint64_t key[1] = {dev};
optional<device_tree_detail::device_details> mdetails = md_->details_->lookup(key);
boost::optional<device_tree_detail::device_details> mdetails = md_->details_->lookup(key);
if (!mdetails)
throw runtime_error("no such device");

View File

@@ -27,7 +27,6 @@
#include <stdexcept>
#include <string.h>
using namespace boost;
using namespace std;
using namespace thin_provisioning;
@@ -51,7 +50,7 @@ namespace {
uint64_t trans_id,
uint32_t data_block_size,
uint64_t nr_data_blocks,
optional<uint64_t> metadata_snap) {
boost::optional<uint64_t> metadata_snap) {
indent();
out_ << "<superblock uuid=\"" << uuid << "\""
<< " time=\"" << time << "\""
@@ -178,17 +177,17 @@ namespace {
throw runtime_error(out.str());
}
return lexical_cast<T>(it->second);
return boost::lexical_cast<T>(it->second);
}
template <typename T>
optional<T> get_opt_attr(attributes const &attr, string const &key) {
typedef optional<T> rtype;
boost::optional<T> get_opt_attr(attributes const &attr, string const &key) {
typedef boost::optional<T> rtype;
attributes::const_iterator it = attr.find(key);
if (it == attr.end())
return rtype();
return rtype(lexical_cast<T>(it->second));
return rtype(boost::lexical_cast<T>(it->second));
}
void parse_superblock(emitter *e, attributes const &attr) {