From: Lennart Poettering Date: Thu, 21 Aug 2025 11:36:12 +0000 (+0200) Subject: xattr: add helper that detect special purpose xattrs X-Git-Tag: v259-rc1~324^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2fa6d0945aa2c84c67bbc1ca6afee0992650dc9;p=thirdparty%2Fsystemd.git xattr: add helper that detect special purpose xattrs --- diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c index 1bde725d1a7..cf53418ceb1 100644 --- a/src/basic/xattr-util.c +++ b/src/basic/xattr-util.c @@ -477,3 +477,14 @@ int fd_setcrtime(int fd, usec_t usec) { "user.crtime_usec", (const char*) &le, sizeof(le), /* xattr_flags = */ 0); } + +bool xattr_is_acl(const char *name) { + return STR_IN_SET( + ASSERT_PTR(name), + "system.posix_acl_access", + "system.posix_acl_default"); +} + +bool xattr_is_selinux(const char *name) { + return streq(ASSERT_PTR(name), "security.selinux"); +} diff --git a/src/basic/xattr-util.h b/src/basic/xattr-util.h index cf68933bfe3..f38ecf491dc 100644 --- a/src/basic/xattr-util.h +++ b/src/basic/xattr-util.h @@ -54,3 +54,6 @@ int getcrtime_at(int fd, const char *path, int at_flags, usec_t *ret); static inline int fd_getcrtime(int fd, usec_t *ret) { return getcrtime_at(fd, NULL, 0, ret); } + +bool xattr_is_acl(const char *name); +bool xattr_is_selinux(const char *name);