]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs: add ceph_fsetattr()
authorhuanwen ren <ren.huanwen@zte.com.cn>
Thu, 22 Sep 2016 11:24:46 +0000 (19:24 +0800)
committerhuanwen ren <ren.huanwen@zte.com.cn>
Tue, 18 Oct 2016 08:28:56 +0000 (16:28 +0800)
Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
src/include/cephfs/libcephfs.h
src/libcephfs.cc

index bf38b2b8f22038321f435a6926f8fda632b9766b..09e9801ea35bd61abf8f31354587be012353be98 100644 (file)
@@ -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).
  *
index 9e65bff95d298757c979c09c821f878eac66dbc7..8611c81e4ffc85c2d93983d26731834692cd841a 100644 (file)
@@ -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)
 {