func (r *RadosIoCtx) GetPoolName() (string, error) { var buf [MAX_NAME_LEN]C.char cerr := C.rados_ioctx_get_pool_name(*r.ctx, &buf[0], MAX_NAME_LEN-1) if cerr < 0 { return "", errors.New("get pool name failed") } return C.GoString(&buf[0]), nil }
// Name returns the name of the pool. func (pool *Pool) Name() string { bufLen := 64 for { bufAddr := bufferAddress(bufLen) ret := C.rados_ioctx_get_pool_name(pool.context, bufAddr, C.unsigned(bufLen)) if int(ret) == -int(syscall.ERANGE) { bufLen *= 2 continue } return C.GoStringN(bufAddr, ret) } }
// GetPoolName returns the name of the pool associated with the I/O context. func (ioctx *IOContext) GetPoolName() (name string, err error) { buf := make([]byte, 128) for { ret := C.rados_ioctx_get_pool_name(ioctx.ioctx, (*C.char)(unsafe.Pointer(&buf[0])), C.unsigned(len(buf))) if ret == -34 { // FIXME buf = make([]byte, len(buf)*2) continue } else if ret < 0 { return "", RadosError(ret) } name = C.GoStringN((*C.char)(unsafe.Pointer(&buf[0])), ret) return name, nil } }