mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-23 01:59:54 +00:00
libf2fs: fix build error on Windows
Windows doesn't support S_ISREG, so let's avoid depedency. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
e65d9c7adf
commit
a60cd1a3f9
@ -1178,6 +1178,10 @@ enum FILE_TYPE {
|
||||
F2FS_FT_LAST_FILE_TYPE = F2FS_FT_XATTR,
|
||||
};
|
||||
|
||||
#define LINUX_S_IFMT 00170000
|
||||
#define LINUX_S_IFREG 0100000
|
||||
#define LINUX_S_ISREG(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFREG)
|
||||
|
||||
/* from f2fs/segment.h */
|
||||
enum {
|
||||
LFS = 0,
|
||||
|
@ -504,7 +504,7 @@ unsigned int addrs_per_inode(struct f2fs_inode *i)
|
||||
{
|
||||
unsigned int addrs = CUR_ADDRS_PER_INODE(i) - get_inline_xattr_addrs(i);
|
||||
|
||||
if (!S_ISREG(le16_to_cpu(i->i_mode)) ||
|
||||
if (!LINUX_S_ISREG(le16_to_cpu(i->i_mode)) ||
|
||||
!(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL))
|
||||
return addrs;
|
||||
return ALIGN_DOWN(addrs, 1 << i->i_log_cluster_size);
|
||||
@ -512,7 +512,7 @@ unsigned int addrs_per_inode(struct f2fs_inode *i)
|
||||
|
||||
unsigned int addrs_per_block(struct f2fs_inode *i)
|
||||
{
|
||||
if (!S_ISREG(le16_to_cpu(i->i_mode)) ||
|
||||
if (!LINUX_S_ISREG(le16_to_cpu(i->i_mode)) ||
|
||||
!(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL))
|
||||
return DEF_ADDRS_PER_BLOCK;
|
||||
return ALIGN_DOWN(DEF_ADDRS_PER_BLOCK, 1 << i->i_log_cluster_size);
|
||||
|
Loading…
Reference in New Issue
Block a user