From: Samuel Just Date: Thu, 21 Feb 2013 21:26:40 +0000 (-0800) Subject: FileStore: add _fsetattrs X-Git-Tag: v0.59~152^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c33c51f01f79c6e180d1ef8157fb908ac44995e8;p=ceph.git FileStore: add _fsetattrs Signed-off-by: Samuel Just --- diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index deab9ede875..a8f23ba97e8 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -3720,6 +3720,27 @@ int FileStore::_fgetattrs(int fd, map& aset, bool user_only) return 0; } +int FileStore::_fsetattrs(int fd, map &aset) +{ + for (map::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 diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 3336e59378e..e739447afc0 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -386,6 +386,7 @@ public: int _fgetattr(int fd, const char *name, bufferptr& bp); int _fgetattrs(int fd, map& aset, bool user_only); + int _fsetattrs(int fd, map &aset); void _start_sync();