mirror of
https://github.com/ceph/go-ceph
synced 2024-12-24 23:22:33 +00:00
863d71caa5
These apis are now stable as per the stability plan. Signed-off-by: John Mulligan <jmulligan@redhat.com>
31 lines
626 B
Go
31 lines
626 B
Go
package rados
|
|
|
|
// #cgo LDFLAGS: -lrados
|
|
// #include <rados/librados.h>
|
|
// #include <stdlib.h>
|
|
//
|
|
import "C"
|
|
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
// SetXattr sets an xattr.
|
|
//
|
|
// Implements:
|
|
// void rados_write_op_setxattr(rados_write_op_t write_op,
|
|
// const char * name,
|
|
// const char * value,
|
|
// size_t value_len)
|
|
func (w *WriteOp) SetXattr(name string, value []byte) {
|
|
cName := C.CString(name)
|
|
defer C.free(unsafe.Pointer(cName))
|
|
|
|
C.rados_write_op_setxattr(
|
|
w.op,
|
|
cName,
|
|
(*C.char)(unsafe.Pointer(&value[0])),
|
|
C.size_t(len(value)),
|
|
)
|
|
}
|