@@ -856,9 +856,11 @@ struct xfs_agfl {
* Inode timestamps consist of signed 32-bit counters for seconds and
* nanoseconds; time zero is the Unix epoch, Jan 1 00:00:00 UTC 1970.
*/
-struct xfs_timestamp {
- __be32 t_sec; /* timestamp seconds */
- __be32 t_nsec; /* timestamp nanoseconds */
+union xfs_timestamp {
+ struct {
+ __be32 t_sec; /* timestamp seconds */
+ __be32 t_nsec; /* timestamp nanoseconds */
+ };
};
/*
@@ -904,9 +906,9 @@ typedef struct xfs_dinode {
__be16 di_projid_hi; /* higher part owner's project id */
__u8 di_pad[6]; /* unused, zeroed space */
__be16 di_flushiter; /* incremented on flush */
- struct xfs_timestamp di_atime; /* time last accessed */
- struct xfs_timestamp di_mtime; /* time last modified */
- struct xfs_timestamp di_ctime; /* time created/inode modified */
+ union xfs_timestamp di_atime; /* time last accessed */
+ union xfs_timestamp di_mtime; /* time last modified */
+ union xfs_timestamp di_ctime; /* time created/inode modified */
__be64 di_size; /* number of bytes in file */
__be64 di_nblocks; /* # of direct & btree blocks used */
__be32 di_extsize; /* basic/minimum extent size for file */
@@ -931,7 +933,7 @@ typedef struct xfs_dinode {
__u8 di_pad2[12]; /* more padding for future expansion */
/* fields only written to during inode creation */
- struct xfs_timestamp di_crtime; /* time created */
+ union xfs_timestamp di_crtime; /* time created */
__be64 di_ino; /* inode number */
uuid_t di_uuid; /* UUID of the filesystem */
@@ -160,7 +160,7 @@ xfs_imap_to_bp(
void
xfs_inode_from_disk_timestamp(
struct timespec64 *tv,
- const struct xfs_timestamp *ts)
+ const union xfs_timestamp *ts)
{
tv->tv_sec = (int)be32_to_cpu(ts->t_sec);
tv->tv_nsec = (int)be32_to_cpu(ts->t_nsec);
@@ -259,7 +259,7 @@ xfs_inode_from_disk(
void
xfs_inode_to_disk_timestamp(
- struct xfs_timestamp *ts,
+ union xfs_timestamp *ts,
const struct timespec64 *tv)
{
ts->t_sec = cpu_to_be32(tv->tv_sec);
@@ -59,8 +59,8 @@ xfs_failaddr_t xfs_inode_validate_cowextsize(struct xfs_mount *mp,
uint64_t flags2);
void xfs_inode_from_disk_timestamp(struct timespec64 *tv,
- const struct xfs_timestamp *ts);
-void xfs_inode_to_disk_timestamp(struct xfs_timestamp *ts,
+ const union xfs_timestamp *ts);
+void xfs_inode_to_disk_timestamp(union xfs_timestamp *ts,
const struct timespec64 *tv);
#endif /* __XFS_INODE_BUF_H__ */
@@ -368,9 +368,11 @@ static inline int xfs_ilog_fdata(int w)
* directly mirrors the xfs_dinode structure as it must contain all the same
* information.
*/
-struct xfs_ictimestamp {
- int32_t t_sec; /* timestamp seconds */
- int32_t t_nsec; /* timestamp nanoseconds */
+union xfs_ictimestamp {
+ struct {
+ int32_t t_sec; /* timestamp seconds */
+ int32_t t_nsec; /* timestamp nanoseconds */
+ };
};
/*
@@ -390,9 +392,9 @@ struct xfs_log_dinode {
uint16_t di_projid_hi; /* higher part of owner's project id */
uint8_t di_pad[6]; /* unused, zeroed space */
uint16_t di_flushiter; /* incremented on flush */
- struct xfs_ictimestamp di_atime; /* time last accessed */
- struct xfs_ictimestamp di_mtime; /* time last modified */
- struct xfs_ictimestamp di_ctime; /* time created/inode modified */
+ union xfs_ictimestamp di_atime; /* time last accessed */
+ union xfs_ictimestamp di_mtime; /* time last modified */
+ union xfs_ictimestamp di_ctime; /* time created/inode modified */
xfs_fsize_t di_size; /* number of bytes in file */
xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
@@ -417,7 +419,7 @@ struct xfs_log_dinode {
uint8_t di_pad2[12]; /* more padding for future expansion */
/* fields only written to during inode creation */
- struct xfs_ictimestamp di_crtime; /* time created */
+ union xfs_ictimestamp di_crtime; /* time created */
xfs_ino_t di_ino; /* inode number */
uuid_t di_uuid; /* UUID of the filesystem */
@@ -199,7 +199,7 @@ static inline void
xchk_dinode_nsec(
struct xfs_scrub *sc,
xfs_ino_t ino,
- const struct xfs_timestamp *ts)
+ const union xfs_timestamp *ts)
{
struct timespec64 tv;
@@ -298,8 +298,8 @@ xfs_inode_item_format_attr_fork(
/* Write a log_dinode timestamp into an ondisk inode timestamp. */
static inline void
xfs_log_dinode_to_disk_ts(
- struct xfs_timestamp *ts,
- const struct xfs_ictimestamp *its)
+ union xfs_timestamp *ts,
+ const union xfs_ictimestamp *its)
{
ts->t_sec = cpu_to_be32(its->t_sec);
ts->t_nsec = cpu_to_be32(its->t_nsec);
@@ -356,7 +356,7 @@ xfs_log_dinode_to_disk(
/* Write an incore inode timestamp into a log_dinode timestamp. */
static inline void
xfs_inode_to_log_dinode_ts(
- struct xfs_ictimestamp *its,
+ union xfs_ictimestamp *its,
const struct timespec64 *ts)
{
its->t_sec = ts->tv_sec;
@@ -57,7 +57,7 @@ xfs_check_ondisk_structs(void)
XFS_CHECK_STRUCT_SIZE(struct xfs_refcount_rec, 12);
XFS_CHECK_STRUCT_SIZE(struct xfs_rmap_key, 20);
XFS_CHECK_STRUCT_SIZE(struct xfs_rmap_rec, 24);
- XFS_CHECK_STRUCT_SIZE(struct xfs_timestamp, 8);
+ XFS_CHECK_STRUCT_SIZE(union xfs_timestamp, 8);
XFS_CHECK_STRUCT_SIZE(xfs_alloc_key_t, 8);
XFS_CHECK_STRUCT_SIZE(xfs_alloc_ptr_t, 4);
XFS_CHECK_STRUCT_SIZE(xfs_alloc_rec_t, 8);
@@ -137,7 +137,7 @@ xfs_check_ondisk_structs(void)
XFS_CHECK_STRUCT_SIZE(struct xfs_extent_64, 16);
XFS_CHECK_STRUCT_SIZE(struct xfs_log_dinode, 176);
XFS_CHECK_STRUCT_SIZE(struct xfs_icreate_log, 28);
- XFS_CHECK_STRUCT_SIZE(struct xfs_ictimestamp, 8);
+ XFS_CHECK_STRUCT_SIZE(union xfs_ictimestamp, 8);
XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format_32, 52);
XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format, 56);
XFS_CHECK_STRUCT_SIZE(struct xfs_qoff_logformat, 20);