thin-provisioning-tools/caching/commands.h

72 lines
1.7 KiB
C
Raw Normal View History

2014-08-27 18:31:31 +05:30
#ifndef CACHING_COMMANDS_H
#define CACHING_COMMANDS_H
#include "base/application.h"
#include "boost/optional.hpp"
2014-08-27 18:31:31 +05:30
//----------------------------------------------------------------
namespace caching {
class cache_check_cmd : public base::command {
public:
cache_check_cmd();
virtual void usage(std::ostream &out) const;
virtual int run(int argc, char **argv);
};
class cache_dump_cmd : public base::command {
public:
cache_dump_cmd();
virtual void usage(std::ostream &out) const;
virtual int run(int argc, char **argv);
};
class cache_metadata_size_cmd : public base::command {
public:
cache_metadata_size_cmd();
virtual void usage(std::ostream &out) const;
virtual int run(int argc, char **argv);
private:
struct flags {
flags();
boost::optional<uint64_t> device_size;
boost::optional<uint32_t> block_size;
boost::optional<uint64_t> nr_blocks;
uint32_t max_hint_width;
};
enum parse_result {
FINISH,
CONTINUE
};
parse_result parse_command_line(std::string const &prog_name, int argc, char **argv, flags &fs);
uint64_t get_nr_blocks(flags &fs);
uint64_t meg(uint64_t n);
uint64_t calc_size(uint64_t nr_blocks, uint32_t max_hint_width);
};
class cache_repair_cmd : public base::command {
public:
cache_repair_cmd();
virtual void usage(std::ostream &out) const;
virtual int run(int argc, char **argv);
};
class cache_restore_cmd : public base::command {
public:
cache_restore_cmd();
virtual void usage(std::ostream &out) const;
virtual int run(int argc, char **argv);
};
void register_cache_commands(base::application &app);
2014-08-27 18:31:31 +05:30
}
//----------------------------------------------------------------
#endif