From c092b4fcc4ca1b8d66f93ca326f3abeba85619b0 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Fri, 31 Jul 2015 17:20:14 +0800 Subject: [PATCH] os/chain_xattr: set CHAIN_XATTR_MAX_NAME_LEN according to max length of xattr name Signed-off-by: Yan, Zheng --- src/os/chain_xattr.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/os/chain_xattr.h b/src/os/chain_xattr.h index 2d77568012ce0..65460b2aa6e4b 100644 --- a/src/os/chain_xattr.h +++ b/src/os/chain_xattr.h @@ -8,7 +8,16 @@ #include +#if defined(__linux__) +#include +#define CHAIN_XATTR_MAX_NAME_LEN ((XATTR_NAME_MAX + 1) / 2) +#elif defined(__APPLE__) || defined(__FreeBSD__) +#include +#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 /* -- 2.39.5