diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h --- a/usr.sbin/makefs/makefs.h +++ b/usr.sbin/makefs/makefs.h @@ -43,7 +43,9 @@ #if HAVE_NBTOOL_CONFIG_H #include "nbtool_config.h" #else +#define HAVE_STRUCT_STAT_BIRTHTIME 1 #define HAVE_STRUCT_STAT_ST_FLAGS 1 +#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1 #endif #include diff --git a/usr.sbin/makefs/makefs.c b/usr.sbin/makefs/makefs.c --- a/usr.sbin/makefs/makefs.c +++ b/usr.sbin/makefs/makefs.c @@ -442,15 +442,17 @@ cur->inode->st.st_atime = stampst.st_atime; cur->inode->st.st_mtime = stampst.st_mtime; cur->inode->st.st_ctime = stampst.st_ctime; +#if HAVE_STRUCT_STAT_BIRTHTIME + cur->inode->st.st_birthtime = stampst.st_birthtime; +#endif #if HAVE_STRUCT_STAT_ST_MTIMENSEC cur->inode->st.st_atimensec = stampst.st_atimensec; cur->inode->st.st_mtimensec = stampst.st_mtimensec; cur->inode->st.st_ctimensec = stampst.st_ctimensec; -#endif #if HAVE_STRUCT_STAT_BIRTHTIME - cur->inode->st.st_birthtime = stampst.st_birthtime; cur->inode->st.st_birthtimensec = stampst.st_birthtimensec; #endif +#endif } static fstype_t * diff --git a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh --- a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh +++ b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh @@ -347,6 +347,8 @@ atf_check_equal $st_atime $timestamp atf_check_equal $st_mtime $timestamp atf_check_equal $st_ctime $timestamp + # CD9660 does not have birth time + atf_check_equal $st_birthtime -1 } T_flag_dir_cleanup() @@ -371,7 +373,9 @@ eval $(stat -s $TEST_MOUNT_DIR/dir1) atf_check_equal $st_atime $timestamp_F atf_check_equal $st_mtime $timestamp_F - # atf_check_equal $st_ctime $timestamp_F + # XXX atf_check_equal $st_ctime $timestamp_F + # CD9660 does not have birth time + atf_check_equal $st_birthtime -1 } T_flag_F_flag_cleanup() @@ -394,6 +398,8 @@ atf_check_equal $st_atime $timestamp atf_check_equal $st_mtime $timestamp atf_check_equal $st_ctime $timestamp + # CD9660 does not have birth time + atf_check_equal $st_birthtime -1 } T_flag_mtree_cleanup() diff --git a/usr.sbin/makefs/tests/makefs_ffs_tests.sh b/usr.sbin/makefs/tests/makefs_ffs_tests.sh --- a/usr.sbin/makefs/tests/makefs_ffs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_ffs_tests.sh @@ -245,6 +245,8 @@ atf_check_equal $st_atime $timestamp atf_check_equal $st_mtime $timestamp atf_check_equal $st_ctime $timestamp + # FFS version 1 does not have birth time + atf_check_equal $st_birthtime -1 } T_flag_dir_cleanup() @@ -269,7 +271,9 @@ eval $(stat -s $TEST_MOUNT_DIR/dir1) atf_check_equal $st_atime $timestamp_F atf_check_equal $st_mtime $timestamp_F - # atf_check_equal $st_ctime $timestamp_F + # XXX atf_check_equal $st_ctime $timestamp_F + # FFS version 1 does not have birth time + atf_check_equal $st_birthtime -1 } T_flag_F_flag_cleanup() @@ -293,6 +297,8 @@ atf_check_equal $st_atime $timestamp atf_check_equal $st_mtime $timestamp atf_check_equal $st_ctime $timestamp + # FFS version 1 does not have birth time + atf_check_equal $st_birthtime -1 } T_flag_mtree_cleanup() diff --git a/usr.sbin/makefs/tests/makefs_msdos_tests.sh b/usr.sbin/makefs/tests/makefs_msdos_tests.sh --- a/usr.sbin/makefs/tests/makefs_msdos_tests.sh +++ b/usr.sbin/makefs/tests/makefs_msdos_tests.sh @@ -61,6 +61,7 @@ atf_check_equal $st_atime $timestamp_atime atf_check_equal $st_mtime $timestamp atf_check_equal $st_ctime $timestamp + atf_check_equal $st_birthtime $timestamp } T_flag_dir_cleanup() @@ -89,6 +90,7 @@ atf_check_equal $st_atime $timestamp_F_atime atf_check_equal $st_mtime $timestamp_F atf_check_equal $st_ctime $timestamp_F + atf_check_equal $st_birthtime $timestamp_T # XXX should be $timestamp_F } T_flag_F_flag_cleanup() @@ -114,6 +116,7 @@ atf_check_equal $st_atime $timestamp_atime atf_check_equal $st_mtime $timestamp atf_check_equal $st_ctime $timestamp + atf_check_equal $st_birthtime $timestamp } T_flag_mtree_cleanup() diff --git a/usr.sbin/makefs/tests/makefs_zfs_tests.sh b/usr.sbin/makefs/tests/makefs_zfs_tests.sh --- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh @@ -969,6 +969,7 @@ atf_check_equal $st_atime $timestamp atf_check_equal $st_mtime $timestamp atf_check_equal $st_ctime $timestamp + atf_check_equal $st_birthtime $timestamp } T_flag_dir_cleanup() @@ -994,7 +995,8 @@ eval $(stat -s $TEST_MOUNT_DIR/dir1) atf_check_equal $st_atime $timestamp_F atf_check_equal $st_mtime $timestamp_F - # atf_check_equal $st_ctime $timestamp_F + # XXX atf_check_equal $st_ctime $timestamp_F + atf_check_equal $st_birthtime $timestamp_T # XXX should be $timestamp_F } T_flag_F_flag_cleanup() @@ -1018,6 +1020,7 @@ atf_check_equal $st_atime $timestamp atf_check_equal $st_mtime $timestamp atf_check_equal $st_ctime $timestamp + atf_check_equal $st_birthtime $timestamp } T_flag_mtree_cleanup()