rebase: update go-ceph to v0.7.0

updating go-ceph to latest 0.7.0
release.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2020-12-09 11:16:45 +05:30
committed by mergify[bot]
parent 97acd47ae9
commit eeec1213cb
17 changed files with 401 additions and 218 deletions

View File

@ -8,15 +8,19 @@ package rbd
#cgo LDFLAGS: -lrbd
#include <rbd/librbd.h>
extern void imageWatchCallback(void *);
extern void imageWatchCallback(uintptr_t);
// inline wrapper to cast uintptr_t to void*
static inline int wrap_rbd_update_watch(rbd_image_t image, uint64_t *handle,
uintptr_t arg) {
return rbd_update_watch(image, handle, (void*)imageWatchCallback, (void*)arg);
};
*/
import "C"
import (
"unsafe"
"github.com/ceph/go-ceph/internal/callbacks"
"github.com/ceph/go-ceph/internal/cutil"
"github.com/ceph/go-ceph/internal/retry"
)
@ -107,11 +111,10 @@ func (image *Image) UpdateWatch(cb WatchCallback, data interface{}) (*Watch, err
cbIndex: watchCallbacks.Add(wcc),
}
ret := C.rbd_update_watch(
ret := C.wrap_rbd_update_watch(
image.image,
&w.handle,
C.rbd_update_callback_t(C.imageWatchCallback),
cutil.VoidPtr(w.cbIndex))
C.uintptr_t(w.cbIndex))
if ret != 0 {
return nil, getError(ret)
}
@ -135,8 +138,8 @@ func (w *Watch) Unwatch() error {
}
//export imageWatchCallback
func imageWatchCallback(index unsafe.Pointer) {
v := watchCallbacks.Lookup(uintptr(index))
func imageWatchCallback(index uintptr) {
v := watchCallbacks.Lookup(index)
wcc := v.(watchCallbackCtx)
wcc.callback(wcc.data)
}