// GetFSID returns the fsid of the cluster as a hexadecimal string. The fsid // is a unique identifier of an entire Ceph cluster. func (c *Conn) GetFSID() (fsid string, err error) { buf := make([]byte, 37) ret := int(C.rados_cluster_fsid(c.cluster, (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)))) // FIXME: the success case isn't documented correctly in librados.h if ret == 36 { fsid = C.GoString((*C.char)(unsafe.Pointer(&buf[0]))) return fsid, nil } else { return "", RadosError(int(ret)) } }
// FSID returns the FSID of the cluster. func (cluster *Cluster) FSID() string { bufLen := 37 for { bufAddr := bufferAddress(bufLen) ret := C.rados_cluster_fsid(cluster.handle, bufAddr, C.size_t(bufLen)) if int(ret) == -int(syscall.ERANGE) { bufLen *= 2 continue } fsid := C.GoStringN(bufAddr, ret) return fsid } }