rebase: use the go-ceph master branch

The main change that is useful, is the new rbd.ErrExist error.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos
2024-10-03 16:14:26 +02:00
committed by mergify[bot]
parent 10076ca11f
commit 9267210da4
8 changed files with 17 additions and 17 deletions

View File

@ -2,12 +2,10 @@ package dlsym
// #cgo LDFLAGS: -ldl
//
// #define _GNU_SOURCE
//
// #include <stdlib.h>
// #include <dlfcn.h>
//
// #ifndef RTLD_DEFAULT /* from dlfcn.h */
// #define RTLD_DEFAULT ((void *) 0)
// #endif
import "C"
import (

View File

@ -85,8 +85,8 @@ func (ioctx *IOContext) GetSnapName(snapID SnapID) (string, error) {
err error
)
// range from 1k to 64KiB
retry.WithSizes(1024, 1<<16, func(len int) retry.Hint {
cLen := C.int(len)
retry.WithSizes(1024, 1<<16, func(length int) retry.Hint {
cLen := C.int(length)
buf = make([]byte, cLen)
ret := C.rados_ioctx_snap_get_name(
ioctx.ioctx,

View File

@ -298,11 +298,11 @@ func (c *Conn) WatcherFlush() error {
//
// NOTE: starting with pacific this is implemented as a C function and this can
// be replaced later
func decodeNotifyResponse(response *C.char, len C.size_t) ([]NotifyAck, []NotifyTimeout) {
if len == 0 || response == nil {
func decodeNotifyResponse(response *C.char, length C.size_t) ([]NotifyAck, []NotifyTimeout) {
if length == 0 || response == nil {
return nil, nil
}
b := (*[math.MaxInt32]byte)(unsafe.Pointer(response))[:len:len]
b := (*[math.MaxInt32]byte)(unsafe.Pointer(response))[:length:length]
pos := 0
num := binary.LittleEndian.Uint32(b[pos:])

View File

@ -73,6 +73,8 @@ var (
// Public general error
const (
// ErrExist indicates a non-specific already existing resource.
ErrExist = rbdError(-C.EEXIST)
// ErrNotExist indicates a non-specific missing resource.
ErrNotExist = rbdError(-C.ENOENT)
// ErrNotImplemented indicates a function is not implemented in by librbd.

View File

@ -50,8 +50,8 @@ func (image *Image) GetSnapByID(snapID uint64) (string, error) {
err error
)
// range from 1k to 64KiB
retry.WithSizes(1024, 1<<16, func(len int) retry.Hint {
cLen := C.size_t(len)
retry.WithSizes(1024, 1<<16, func(length int) retry.Hint {
cLen := C.size_t(length)
buf = make([]byte, cLen)
ret := C.rbd_snap_get_name(
image.image,