[PATCH v6 09/11] erofs-utils: lib: add erofs_inode_is_whiteout() helper
Jingbo Xu
jefflexu at linux.alibaba.com
Tue Sep 5 20:02:25 AEST 2023
Add erofs_inode_is_whiteout() helper checking if given inode is a
whiteout.
Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
include/erofs/internal.h | 7 +++++++
lib/tar.c | 2 --
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/erofs/internal.h b/include/erofs/internal.h
index fcc0710..5df689c 100644
--- a/include/erofs/internal.h
+++ b/include/erofs/internal.h
@@ -20,6 +20,7 @@ typedef unsigned short umode_t;
#include "erofs_fs.h"
#include <fcntl.h>
#include <sys/types.h> /* for off_t definition */
+#include <sys/stat.h> /* for S_ISCHR definition */
#include <stdio.h>
#ifndef PATH_MAX
@@ -427,6 +428,12 @@ static inline u32 erofs_crc32c(u32 crc, const u8 *in, size_t len)
return crc;
}
+#define EROFS_WHITEOUT_DEV 0
+static inline bool erofs_inode_is_whiteout(struct erofs_inode *inode)
+{
+ return S_ISCHR(inode->i_mode) && inode->u.i_rdev == EROFS_WHITEOUT_DEV;
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/tar.c b/lib/tar.c
index e0fe2a2..8cb392c 100644
--- a/lib/tar.c
+++ b/lib/tar.c
@@ -13,8 +13,6 @@
#include "erofs/blobchunk.h"
#include "erofs/rebuild.h"
-#define EROFS_WHITEOUT_DEV 0
-
static char erofs_libbuf[16384];
struct tar_header {
--
2.19.1.6.gb485710b
More information about the Linux-erofs
mailing list