]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
FileStore: add _fsetattrs
authorSamuel Just <sam.just@inktank.com>
Thu, 21 Feb 2013 21:26:40 +0000 (13:26 -0800)
committerSamuel Just <sam.just@inktank.com>
Thu, 21 Feb 2013 21:26:40 +0000 (13:26 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/os/FileStore.cc
src/os/FileStore.h

index deab9ede8759bd5bc230203a02a543a149c742e3..a8f23ba97e8700f17db5956a88f340416c2e0311 100644 (file)
@@ -3720,6 +3720,27 @@ int FileStore::_fgetattrs(int fd, map<string,bufferptr>& aset, bool user_only)
   return 0;
 }
 
+int FileStore::_fsetattrs(int fd, map<string, bufferptr> &aset)
+{
+  for (map<string, bufferptr>::iterator p = aset.begin();
+       p != aset.end();
+       ++p) {
+    char n[CHAIN_XATTR_MAX_NAME_LEN];
+    get_attrname(p->first.c_str(), n, CHAIN_XATTR_MAX_NAME_LEN);
+    const char *val;
+    if (p->second.length())
+      val = p->second.c_str();
+    else
+      val = "";
+    // ??? Why do we skip setting all the other attrs if one fails?
+    int r = chain_fsetxattr(fd, n, val, p->second.length());
+    if (r < 0) {
+      derr << "FileStore::_setattrs: chain_setxattr returned " << r << dendl;
+      return r;
+    }
+  }
+  return 0;
+}
 
 // objects
 
index 3336e59378ee96ff9367ed25cd8e6416269ab064..e739447afc0bfa06224037433ea323e42157107c 100644 (file)
@@ -386,6 +386,7 @@ public:
 
   int _fgetattr(int fd, const char *name, bufferptr& bp);
   int _fgetattrs(int fd, map<string,bufferptr>& aset, bool user_only);
+  int _fsetattrs(int fd, map<string, bufferptr> &aset);
 
   void _start_sync();