mirror of
https://github.com/ceph/go-ceph
synced 2025-01-11 08:39:50 +00:00
rbd: prevent a go vet error by doing type-casting in C
The void * is (ab)used in C for passing arbitrary data to the callback, which in our case is a integer index. However, Go tools can not tell this is OK and throws an error running go vet. Change the wrapper function to take a uintptr_t and cast that to void* only in the (unchecked) C layer. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
754d744ac8
commit
1abd1423c1
@ -17,8 +17,8 @@ static inline int wrap_rbd_diff_iterate2(
|
||||
uint64_t ofs, uint64_t len,
|
||||
uint8_t include_parent, uint8_t whole_object,
|
||||
void *cb,
|
||||
void *arg) {
|
||||
return rbd_diff_iterate2(image, fromsnapname, ofs, len, include_parent, whole_object, cb, arg);
|
||||
uintptr_t arg) {
|
||||
return rbd_diff_iterate2(image, fromsnapname, ofs, len, include_parent, whole_object, cb, (void*)arg);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
@ -120,7 +120,7 @@ func (image *Image) DiffIterate(config DiffIterateConfig) error {
|
||||
C.uint8_t(config.IncludeParent),
|
||||
C.uint8_t(config.WholeObject),
|
||||
C.callDiffIterateCallback,
|
||||
unsafe.Pointer(uintptr(cbIndex)))
|
||||
C.uintptr_t(cbIndex))
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user