namespace rbd {
namespace action {
-namespace export_diff {
-
-namespace at = argument_types;
-namespace po = boost::program_options;
struct ExportDiffContext {
librbd::Image *image;
}
};
-static int do_export_diff(librbd::Image& image, const char *fromsnapname,
- const char *endsnapname, bool whole_object,
- const char *path, bool no_progress)
+int do_export_diff(librbd::Image& image, const char *fromsnapname,
+ const char *endsnapname, bool whole_object,
+ const char *path, bool no_progress)
{
int r;
librbd::image_info_t info;
if (fd < 0)
return -errno;
- BOOST_SCOPE_EXIT((&r) (&fd) (&path)) {
- close(fd);
- if (r < 0 && fd != 1) {
- remove(path);
- }
- } BOOST_SCOPE_EXIT_END
-
{
// header
bufferlist bl;
r = bl.write_fd(fd);
if (r < 0) {
+ close(fd);
+ if (fd != 1) {
+ remove(path);
+ }
return r;
}
}
r = bl.write_fd(fd);
}
- out:
+out:
if (r < 0)
edc.pc.fail();
else
edc.pc.finish();
+
+ close(fd);
+ if (r < 0 && fd != 1) {
+ remove(path);
+ }
+
return r;
}
+
+namespace export_diff {
+
+namespace at = argument_types;
+namespace po = boost::program_options;
+
void get_arguments(po::options_description *positional,
po::options_description *options) {
at::add_image_or_snap_spec_options(positional, options,