tree-wide: add ERRNO_IS_XATTR_ABSENT() helper

We check the same list of error codes on various xattr operations, and
we should on some more. Add a common helper for this purpose.
This commit is contained in:
Lennart Poettering
2022-10-10 16:00:15 +02:00
parent dcf1bf3b6d
commit 00675c363f
15 changed files with 29 additions and 23 deletions
+7
View File
@@ -153,3 +153,10 @@ static inline bool ERRNO_IS_DEVICE_ABSENT(int r) {
ENXIO,
ENOENT);
}
/* Quite often we want to handle cases where the backing FS doesn't support extended attributes at all and
* where it simply doesn't have the requested xattr the same way */
static inline bool ERRNO_IS_XATTR_ABSENT(int r) {
return abs(r) == ENODATA ||
ERRNO_IS_NOT_SUPPORTED(r);
}