From: Dongsheng Yang Date: Wed, 2 Nov 2016 08:37:32 +0000 (-0400) Subject: rbd: combine the namespaces of export_diff and export_full, import_diff and import. X-Git-Tag: v12.0.1~342^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8d2a6139fbf3d965b8d1af87c9001040bdc74598;p=ceph.git rbd: combine the namespaces of export_diff and export_full, import_diff and import. Signed-off-by: Dongsheng Yang --- diff --git a/src/tools/rbd/action/Export.cc b/src/tools/rbd/action/Export.cc index b09cca65dfdc..f938590d3a28 100644 --- a/src/tools/rbd/action/Export.cc +++ b/src/tools/rbd/action/Export.cc @@ -17,6 +17,7 @@ namespace rbd { namespace action { +namespace export_full { struct ExportDiffContext { librbd::Image *image; @@ -231,12 +232,10 @@ int do_export_diff(librbd::Image& image, const char *fromsnapname, } -namespace export_diff { - namespace at = argument_types; namespace po = boost::program_options; -void get_arguments(po::options_description *positional, +void get_arguments_diff(po::options_description *positional, po::options_description *options) { at::add_image_or_snap_spec_options(positional, options, at::ARGUMENT_MODIFIER_SOURCE); @@ -249,7 +248,7 @@ void get_arguments(po::options_description *positional, at::add_no_progress_option(options); } -int execute(const po::variables_map &vm) { +int execute_diff(const po::variables_map &vm) { size_t arg_index = 0; std::string pool_name; std::string image_name; @@ -295,17 +294,9 @@ int execute(const po::variables_map &vm) { } Shell::SwitchArguments switched_arguments({at::WHOLE_OBJECT}); -Shell::Action action( +Shell::Action action_diff( {"export-diff"}, {}, "Export incremental diff to file.", "", - &get_arguments, &execute); - -} // namespace export_diff - - -namespace export_full { - -namespace at = argument_types; -namespace po = boost::program_options; + &get_arguments_diff, &execute_diff); class C_Export : public Context { diff --git a/src/tools/rbd/action/Import.cc b/src/tools/rbd/action/Import.cc index 4d7106812899..0fa76f2f5c53 100644 --- a/src/tools/rbd/action/Import.cc +++ b/src/tools/rbd/action/Import.cc @@ -19,6 +19,7 @@ namespace rbd { namespace action { +namespace import { int do_import_diff_fd(librbd::Image &image, int fd, bool no_progress, int format) @@ -205,12 +206,10 @@ int do_import_diff(librbd::Image &image, const char *path, return r; } -namespace import_diff { - namespace at = argument_types; namespace po = boost::program_options; -void get_arguments(po::options_description *positional, +void get_arguments_diff(po::options_description *positional, po::options_description *options) { at::add_path_options(positional, options, "import file (or '-' for stdin)"); @@ -218,7 +217,7 @@ void get_arguments(po::options_description *positional, at::add_no_progress_option(options); } -int execute(const po::variables_map &vm) { +int execute_diff(const po::variables_map &vm) { std::string path; int r = utils::get_path(vm, utils::get_positional_argument(vm, 0), &path); if (r < 0) { @@ -253,16 +252,9 @@ int execute(const po::variables_map &vm) { return 0; } -Shell::Action action( - {"import-diff"}, {}, "Import an incremental diff.", "", &get_arguments, - &execute); - -} // namespace import_diff - -namespace import { - -namespace at = argument_types; -namespace po = boost::program_options; +Shell::Action action_diff( + {"import-diff"}, {}, "Import an incremental diff.", "", &get_arguments_diff, + &execute_diff); class C_Import : public Context { public: