]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: Add interface to let user can get private data from comp
authorHaomai Wang <haomaiwang@gmail.com>
Tue, 4 Aug 2015 09:31:43 +0000 (17:31 +0800)
committerHaomai Wang <haomai@xsky.com>
Tue, 1 Dec 2015 02:02:47 +0000 (10:02 +0800)
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/include/rbd/librbd.h
src/include/rbd/librbd.hpp
src/librbd/AioCompletion.h
src/librbd/librbd.cc

index 2f665916566ce40181f8d11ea2e5e900ea426ec3..41d671e4bca5890c7e92ff94d8b3d0a75a24d771 100644 (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);
 /**
index 49a6f783bf00e37c954ef83e72dad2ad421d105f..70fcf13e0760490347935ff53cd394c7ee92d118 100644 (file)
@@ -70,6 +70,7 @@ public:
     bool is_complete();
     int wait_for_complete();
     ssize_t get_return_value();
+    void *get_arg();
     void release();
   };
 
index 1ef37a1309846ac5c0f8233e4037af175d935076..44c93b284c58ac867530f8afccade3931b0e4105 100644 (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 {
index 20209ede5a387bc484b52f7d18bfb2f421d17646..88380960f4efefc7a93d9b762ac3276d78e93ccf 100644 (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;