2019-06-04 15:08:58 +05:30
|
|
|
// Copyright (C) 2019 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/>.
|
|
|
|
|
|
|
|
#ifndef NOOP_MAP_H
|
|
|
|
#define NOOP_MAP_H
|
|
|
|
|
|
|
|
#include "persistent-data/space_map.h"
|
|
|
|
|
|
|
|
//----------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace persistent_data {
|
|
|
|
class noop_map : public checked_space_map {
|
|
|
|
public:
|
2020-04-30 19:32:43 +05:30
|
|
|
typedef std::shared_ptr<noop_map> ptr;
|
2019-06-04 15:08:58 +05:30
|
|
|
|
|
|
|
block_address get_nr_blocks() const {
|
|
|
|
fail();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
block_address get_nr_free() const {
|
|
|
|
fail();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ref_t get_count(block_address b) const {
|
|
|
|
fail();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_count(block_address b, ref_t c) {
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
|
|
|
|
void commit() {
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
|
|
|
|
void inc(block_address b) {
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
|
|
|
|
void dec(block_address b) {
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
|
|
|
|
maybe_block find_free(span_iterator &it) {
|
|
|
|
fail();
|
2019-06-05 15:37:28 +05:30
|
|
|
return boost::optional<block_address>(0);
|
2019-06-04 15:08:58 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
bool count_possibly_greater_than_one(block_address b) const {
|
|
|
|
fail();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void extend(block_address extra_blocks) {
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
|
|
|
|
void count_metadata(block_counter &bc) const {
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t root_size() const {
|
|
|
|
fail();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void copy_root(void *dest, size_t len) const {
|
|
|
|
fail();
|
|
|
|
}
|
|
|
|
|
|
|
|
checked_space_map::ptr clone() const {
|
|
|
|
return ptr(new noop_map());
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void fail() const {
|
|
|
|
throw std::runtime_error("noop space map used");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|