librbd: Add interface to let user can get private data from comp

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
This commit is contained in:
Haomai Wang 2015-08-04 17:31:43 +08:00 committed by Haomai Wang
parent e7a1506b30
commit 1ab727d194
4 changed files with 18 additions and 0 deletions

View File

@ -479,6 +479,7 @@ CEPH_RBD_API int rbd_aio_create_completion(void *cb_arg,
CEPH_RBD_API int rbd_aio_is_complete(rbd_completion_t c);
CEPH_RBD_API int rbd_aio_wait_for_complete(rbd_completion_t c);
CEPH_RBD_API ssize_t rbd_aio_get_return_value(rbd_completion_t c);
CEPH_RBD_API void *rbd_aio_get_arg(rbd_completion_t c);
CEPH_RBD_API void rbd_aio_release(rbd_completion_t c);
CEPH_RBD_API int rbd_flush(rbd_image_t image);
/**

View File

@ -70,6 +70,7 @@ public:
bool is_complete();
int wait_for_complete();
ssize_t get_return_value();
void *get_arg();
void release();
};

View File

@ -157,6 +157,10 @@ namespace librbd {
Mutex::Locker l(lock);
event_notify = true;
}
void *get_arg() {
return complete_arg;
}
};
class C_AioRequest : public Context {

View File

@ -304,6 +304,12 @@ namespace librbd {
return c->get_return_value();
}
void *RBD::AioCompletion::get_arg()
{
librbd::AioCompletion *c = (librbd::AioCompletion *)pc;
return c->get_arg();
}
void RBD::AioCompletion::release()
{
librbd::AioCompletion *c = (librbd::AioCompletion *)pc;
@ -2252,6 +2258,12 @@ extern "C" ssize_t rbd_aio_get_return_value(rbd_completion_t c)
return comp->get_return_value();
}
extern "C" void *rbd_aio_get_arg(rbd_completion_t c)
{
librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;
return comp->get_arg();
}
extern "C" void rbd_aio_release(rbd_completion_t c)
{
librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;