mirror of https://github.com/ceph/go-ceph
rados: return an unsafe.Pointer from ioctx Pointer call
This improves the code in two ways: first, it makes the function name and the return type match. Second, it avoids issues found by go vet converting from uintptr to unsafe.Pointer without any obvious pointer math. (See: https://pkg.go.dev/unsafe) Technically, this is an API breaking change but this function is only public to exchange the internal ceph structure between the rados and rbd modules. This had the smallest delta and doesn't feel any more hacky than what already existed in the code. If someone was using this function externally then too bad. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
944510bd8c
commit
754d744ac8
|
@ -90,9 +90,10 @@ type IOContext struct {
|
||||||
ioctx C.rados_ioctx_t
|
ioctx C.rados_ioctx_t
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pointer returns a uintptr representation of the IOContext.
|
// Pointer returns a pointer reference to an internal structure.
|
||||||
func (ioctx *IOContext) Pointer() uintptr {
|
// This function should NOT be used outside of go-ceph itself.
|
||||||
return uintptr(ioctx.ioctx)
|
func (ioctx *IOContext) Pointer() unsafe.Pointer {
|
||||||
|
return unsafe.Pointer(ioctx.ioctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNamespace sets the namespace for objects within this IO context (pool).
|
// SetNamespace sets the namespace for objects within this IO context (pool).
|
||||||
|
|
Loading…
Reference in New Issue