]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/chain_xattr: set CHAIN_XATTR_MAX_NAME_LEN according to max length of xattr name
authorYan, Zheng <zyan@redhat.com>
Fri, 31 Jul 2015 09:20:14 +0000 (17:20 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 31 Aug 2015 08:00:27 +0000 (16:00 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/os/chain_xattr.h

index 2d77568012ce01eb3987b147343f9e8f4847693d..65460b2aa6e4b5c547f02a1f2cf2659ba1bfb2b9 100644 (file)
@@ -8,7 +8,16 @@
 
 #include <errno.h>
 
+#if defined(__linux__)
+#include <limits.h>
+#define CHAIN_XATTR_MAX_NAME_LEN ((XATTR_NAME_MAX + 1) / 2)
+#elif defined(__APPLE__) || defined(__FreeBSD__)
+#include <sys/xattr.h>
+#define CHAIN_XATTR_MAX_NAME_LEN ((XATTR_MAXNAMELEN + 1) / 2)
+#else
 #define CHAIN_XATTR_MAX_NAME_LEN  128
+#endif
+
 #define CHAIN_XATTR_MAX_BLOCK_LEN 2048
 
 /*