mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 23:52:17 +00:00
btrfs-progs: convert: handle rename of inode_includes() from e2fsprogs 1.47.1
There is a new release candidate for e2fsprogs https://github.com/tytso/e2fsprogs/releases/tag/v1.47.1-rc2 Linking btrfs-progs v6.8 against this version of e2fsprogs leads to the following compile error: convert/source-ext2.c: In function 'ext4_copy_inode_timespec_extra': convert/source-ext2.c:733:13: warning: implicit declaration of function 'inode_includes' [-Wimplicit-function-declaration] 733 | if (inode_includes(inode_size, i_ ## xtime ## _extra)) { \ | ^~~~~~~~~~~~~~ convert/source-ext2.c:769:9: note: in expansion of macro 'EXT4_COPY_XTIME' 769 | EXT4_COPY_XTIME(atime, dst, tv_sec, tv_nsec); | ^~~~~~~~~~~~~~~ convert/source-ext2.c:733:40: error: 'i_atime_extra' undeclared (first use in this function) 733 | if (inode_includes(inode_size, i_ ## xtime ## _extra)) { \ | ^~ convert/source-ext2.c:769:9: note: in expansion of macro 'EXT4_COPY_XTIME' 769 | EXT4_COPY_XTIME(atime, dst, tv_sec, tv_nsec); | ^~~~~~~~~~~~~~~ convert/source-ext2.c:733:40: note: each undeclared identifier is reported only once for each function it appears in 733 | if (inode_includes(inode_size, i_ ## xtime ## _extra)) { \ | ^~ convert/source-ext2.c:769:9: note: in expansion of macro 'EXT4_COPY_XTIME' 769 | EXT4_COPY_XTIME(atime, dst, tv_sec, tv_nsec); | ^~~~~~~~~~~~~~~ convert/source-ext2.c:733:40: error: 'i_mtime_extra' undeclared (first use in this function) 733 | if (inode_includes(inode_size, i_ ## xtime ## _extra)) { \ | ^~ convert/source-ext2.c:770:9: note: in expansion of macro 'EXT4_COPY_XTIME' 770 | EXT4_COPY_XTIME(mtime, dst, tv_sec, tv_nsec); | ^~~~~~~~~~~~~~~ convert/source-ext2.c:733:40: error: 'i_ctime_extra' undeclared (first use in this function) 733 | if (inode_includes(inode_size, i_ ## xtime ## _extra)) { \ | ^~ convert/source-ext2.c:771:9: note: in expansion of macro 'EXT4_COPY_XTIME' 771 | EXT4_COPY_XTIME(ctime, dst, tv_sec, tv_nsec); | ^~~~~~~~~~~~~~~ convert/source-ext2.c:774:40: error: 'i_crtime_extra' undeclared (first use in this function) 774 | if (inode_includes(inode_size, i_crtime_extra)) { | ^~~~~~~~~~~~~~ from tytso/e2fsprogs@ca8bc92 Fix inode_includes() macro to properly wrap "inode" parameter, and rename to ext2fs_inode_includes() to avoid potential name clashes. Use this to check inode field inclusion in debugfs instead of bare constants for inode field offsets. To fix that use the new prefixed macro and add backward compatibility that would still use inode_includes(). Issue: #785 Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3b899063bd
commit
bcb887a4de
@ -312,7 +312,8 @@ AS_IF([test "x$have_ext4_epoch_mask_define" = xno], [
|
||||
AC_DEFINE([EXT4_EPOCH_BITS], [2],[for encode and decode tv_nsec in ext2 inode])
|
||||
AC_DEFINE([EXT4_EPOCH_MASK], [((1U << EXT4_EPOCH_BITS) - 1)], [For encode and decode tv_nsec info in ext2 inode])
|
||||
AC_DEFINE([EXT4_NSEC_MASK], [(~0UL << EXT4_EPOCH_BITS)], [For encode and decode tv_nsec info in ext2 inode])
|
||||
AC_DEFINE([inode_includes(size, field)],[m4_normalize[(size >= (sizeof(((struct ext2_inode_large *)0)->field) + offsetof(struct ext2_inode_large, field)))]],
|
||||
# Use name from 1.47.1, backward compatibility is handled in convert/source-ext2.c
|
||||
AC_DEFINE([ext2fs_inode_includes(size, field)],[m4_normalize[(size >= (sizeof(((struct ext2_inode_large *)0)->field) + offsetof(struct ext2_inode_large, field)))]],
|
||||
[For encode and decode tv_nsec info in ext2 inode])
|
||||
],
|
||||
[AC_MSG_WARN([It seems that ext2_inode_large don't includes tv_nsec related info, probably old e2fsprogs, no 64bit time precision of converted images])],
|
||||
|
@ -727,10 +727,17 @@ static inline void ext4_decode_extra_time(__le32 * tv_sec, __le32 * tv_nsec,
|
||||
*tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
|
||||
}
|
||||
|
||||
/*
|
||||
* In e2fsprogs < 1.47.1 it's inode_includes, from >= on it's with ext2fs_ prefix.
|
||||
*/
|
||||
#ifndef ext2fs_inode_includes
|
||||
#define ext2fs_inode_includes(size, field) inode_includes(size, field)
|
||||
#endif
|
||||
|
||||
#define EXT4_COPY_XTIME(xtime, dst, tv_sec, tv_nsec) \
|
||||
do { \
|
||||
tv_sec = src->i_ ## xtime ; \
|
||||
if (inode_includes(inode_size, i_ ## xtime ## _extra)) { \
|
||||
if (ext2fs_inode_includes(inode_size, i_ ## xtime ## _extra)) { \
|
||||
tv_sec = src->i_ ## xtime ; \
|
||||
ext4_decode_extra_time(&tv_sec, &tv_nsec, src->i_ ## xtime ## _extra); \
|
||||
btrfs_set_stack_timespec_sec(&dst->xtime , tv_sec); \
|
||||
@ -771,7 +778,7 @@ static int ext4_copy_inode_timespec_extra(struct btrfs_inode_item *dst,
|
||||
EXT4_COPY_XTIME(ctime, dst, tv_sec, tv_nsec);
|
||||
|
||||
tv_sec = src->i_crtime;
|
||||
if (inode_includes(inode_size, i_crtime_extra)) {
|
||||
if (ext2fs_inode_includes(inode_size, i_crtime_extra)) {
|
||||
tv_sec = src->i_crtime;
|
||||
ext4_decode_extra_time(&tv_sec, &tv_nsec, src->i_crtime_extra);
|
||||
btrfs_set_stack_timespec_sec(&dst->otime, tv_sec);
|
||||
|
Loading…
Reference in New Issue
Block a user