Skip to content

Commit

Permalink
libcephfs: add ceph_fsetattr()
Browse files Browse the repository at this point in the history
Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
  • Loading branch information
renhwztetecs committed Oct 18, 2016
1 parent c4d88d4 commit b399d65
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/include/cephfs/libcephfs.h
Expand Up @@ -655,6 +655,17 @@ int ceph_lstat(struct ceph_mount_info *cmount, const char *path, struct stat *st
*/
int ceph_setattr(struct ceph_mount_info *cmount, const char *relpath, struct stat *attr, int mask);

/**
* Set a file's attributes.
*
* @param cmount the ceph mount handle to use for performing the setattr.
* @param fd the fd of the open file/directory to set the attributes of.
* @param attr the stat struct that must include attribute values to set on the file.
* @param mask a mask of all the stat values that have been set on the stat struct.
* @returns 0 on success or negative error code on failure.
*/
int ceph_fsetattr(struct ceph_mount_info *cmount, int fd, struct stat *attr, int mask);

/**
* Set a file's attributes (extended version).
*
Expand Down
8 changes: 8 additions & 0 deletions src/libcephfs.cc
Expand Up @@ -634,6 +634,14 @@ extern "C" int ceph_setattr(struct ceph_mount_info *cmount, const char *relpath,
return cmount->get_client()->setattr(relpath, attr, mask);
}

extern "C" int ceph_fsetattr(struct ceph_mount_info *cmount, int fd,
struct stat *attr, int mask)
{
if (!cmount->is_mounted())
return -ENOTCONN;
return cmount->get_client()->fsetattr(fd, attr, mask, cmount->default_perms);
}

extern "C" int ceph_setattrx(struct ceph_mount_info *cmount, const char *relpath,
struct ceph_statx *stx, int mask, int flags)
{
Expand Down

0 comments on commit b399d65

Please sign in to comment.