]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
xattr: add helper that detect special purpose xattrs
authorLennart Poettering <lennart@poettering.net>
Thu, 21 Aug 2025 11:36:12 +0000 (13:36 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 14 Oct 2025 09:21:46 +0000 (11:21 +0200)
src/basic/xattr-util.c
src/basic/xattr-util.h

index 1bde725d1a7f40160524d90731c589a55bed7f04..cf53418ceb195a0934b3f4eab9f2e749cb255d6f 100644 (file)
@@ -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");
+}
index cf68933bfe394a1f7072d4d2abd9a3e13337d4df..f38ecf491dce5f180b79198db7883554429b7163 100644 (file)
@@ -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);