typedef void *rbd_snap_t;
typedef void *rbd_image_t;
-typedef int (*librbd_copy_progress_fn_t)(uint64_t offset, uint64_t src_size,
- void *data);
+typedef int (*librbd_progress_fn_t)(uint64_t offset, uint64_t total, void *ptr);
typedef struct {
uint64_t id;
int rbd_stat(rbd_image_t image, rbd_image_info_t *info, size_t infosize);
int rbd_copy(rbd_image_t image, rados_ioctx_t dest_io_ctx, const char *destname);
int rbd_copy_with_progress(rbd_image_t image, rados_ioctx_t dest_p,
- const char *destname, librbd_copy_progress_fn_t fn, void *data);
+ const char *destname, librbd_progress_fn_t fn, void *data);
/* snapshots */
int rbd_snap_list(rbd_image_t image, rbd_snap_info_t *snaps, int *max_snaps);
typedef rbd_image_info_t image_info_t;
-class ProgressContext
-{
-public:
- virtual ~ProgressContext();
- virtual int update_progress(uint64_t offset, uint64_t src_size) = 0;
-};
+ class ProgressContext
+ {
+ public:
+ virtual ~ProgressContext();
+ virtual int update_progress(uint64_t offset, uint64_t total) = 0;
+ };
class RBD
{
class CProgressContext : public librbd::ProgressContext
{
public:
- CProgressContext(librbd_copy_progress_fn_t fn, void *data)
+ CProgressContext(librbd_progress_fn_t fn, void *data)
: m_fn(fn), m_data(data)
{
}
return m_fn(offset, src_size, m_data);
}
private:
- librbd_copy_progress_fn_t m_fn;
+ librbd_progress_fn_t m_fn;
void *m_data;
};
}
extern "C" int rbd_copy_with_progress(rbd_image_t image, rados_ioctx_t dest_p,
- const char *destname, librbd_copy_progress_fn_t fn, void *data)
+ const char *destname, librbd_progress_fn_t fn, void *data)
{
librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
librados::IoCtx dest_io_ctx;