int ceph_getxattr(ceph_mount_info *cmount, const char *path, const char *name,
void *value, size_t size)
int ceph_removexattr(ceph_mount_info *cmount, const char *path, const char *name)
+ int ceph_listxattr(ceph_mount_info *cmount, const char *path, char *list, size_t size)
int ceph_write(ceph_mount_info *cmount, int fd, const char *buf, int64_t size, int64_t offset)
int ceph_read(ceph_mount_info *cmount, int fd, char *buf, int64_t size, int64_t offset)
int ceph_flock(ceph_mount_info *cmount, int fd, int operation, uint64_t owner)
if ret < 0:
raise make_ex(ret, "error in removexattr")
+ def listxattr(self, path, size=65536):
+ """
+ List the extended attribute keys set on a file.
+
+ :param path: path of the file.
+ :param size: the size of list buffer to be filled with extended attribute keys.
+ """
+ self.require_state("mounted")
+
+ path = cstr(path, 'path')
+
+ cdef:
+ char *_path = path
+ char *ret_buf = NULL
+ size_t ret_length = size
+
+ try:
+ ret_buf = <char *>realloc_chk(ret_buf, ret_length)
+ with nogil:
+ ret = ceph_listxattr(self.cluster, _path, ret_buf, ret_length)
+
+ if ret < 0:
+ raise make_ex(ret, "error in listxattr")
+
+ return ret, ret_buf[:ret]
+ finally:
+ free(ret_buf)
+
def stat(self, path, follow_symlink=True):
"""
Get a file's extended statistics and attributes.