]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: convert XATTR_{CREATE,REPLACE} to CEPH_XATTR_{CREATE,REPLACE}
authorYan, Zheng <zyan@redhat.com>
Mon, 27 Jul 2015 11:08:48 +0000 (19:08 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 31 Aug 2015 08:00:25 +0000 (16:00 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/client/Client.cc

index 4259c6ecdf605cd244f776c26fc1a67f18a7739e..9fbf72ddc5e4490e4e769e3994def5f0c0a9f94c 100644 (file)
@@ -23,6 +23,7 @@
 #include <fcntl.h>
 #include <sys/utsname.h>
 #include <sys/uio.h>
+#include <sys/xattr.h>
 
 #if defined(__linux__)
 #include <linux/falloc.h>
@@ -8962,8 +8963,13 @@ int Client::_setxattr(Inode *in, const char *name, const void *value,
   if (vxattr && vxattr->readonly)
     return -EOPNOTSUPP;
 
+  int xattr_flags = 0;
   if (!value)
-    flags |= CEPH_XATTR_REMOVE;
+    xattr_flags |= CEPH_XATTR_REMOVE;
+  if (flags & XATTR_CREATE)
+    xattr_flags |= CEPH_XATTR_CREATE;
+  if (flags & XATTR_REPLACE)
+    xattr_flags |= CEPH_XATTR_REPLACE;
 
   MetaRequest *req = new MetaRequest(CEPH_MDS_OP_SETXATTR);
   filepath path;
@@ -8971,7 +8977,7 @@ int Client::_setxattr(Inode *in, const char *name, const void *value,
   req->set_filepath(path);
   req->set_string2(name);
   req->set_inode(in);
-  req->head.args.setxattr.flags = flags;
+  req->head.args.setxattr.flags = xattr_flags;
 
   bufferlist bl;
   bl.append((const char*)value, size);