#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/xattr.h>
+#ifdef HAVE_LINUX_SELINUX_IS_ENABLED
#include <linux/selinux.h>
+#endif
#define DEBUG_SUBSYSTEM S_LLITE
}
#endif
+#ifdef HAVE_LINUX_SELINUX_IS_ENABLED
+# define test_xattr_is_selinux_disabled(handler, name) \
+ ((handler)->flags == XATTR_SECURITY_T && \
+ !selinux_is_enabled() && \
+ strcmp((name), "selinux") == 0)
+#else
+# define test_xattr_is_selinux_disabled(handler, name) \
+ ((handler)->flags == XATTR_SECURITY_T && \
+ strcmp((name), "selinux") == 0)
+#endif
+
const struct xattr_handler *get_xattr_type(const char *name)
{
int i;
RETURN(0);
/* LU-549: Disable security.selinux when selinux is disabled */
- if (handler->flags == XATTR_SECURITY_T && !selinux_is_enabled() &&
- strcmp(name, "selinux") == 0)
+ if (test_xattr_is_selinux_disabled(handler, name))
RETURN(-EOPNOTSUPP);
/*
RETURN(rc);
/* LU-549: Disable security.selinux when selinux is disabled */
- if (handler->flags == XATTR_SECURITY_T && !selinux_is_enabled() &&
- !strcmp(name, "selinux"))
+ if (test_xattr_is_selinux_disabled(handler, name))
RETURN(-EOPNOTSUPP);
#ifdef CONFIG_FS_POSIX_ACL