xattr: add helper that detect special purpose xattrs

This commit is contained in:
Lennart Poettering
2025-08-21 13:36:12 +02:00
parent fec0f699a2
commit b2fa6d0945
2 changed files with 14 additions and 0 deletions

View 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");
}

View 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);