diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-10-21 18:10:05 +0200 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-10-31 16:58:20 +0100 |
commit | 3c5aaaced99912c9fb3352fc5af5b104df67d4aa (patch) | |
tree | bd152f47835b2c0b4c502ce4079395ae6f360326 /fs/xfs/xfs_extfree_item.h | |
parent | xfs: fix memcpy fortify errors in EFI log format copying (diff) | |
download | linux-3c5aaaced99912c9fb3352fc5af5b104df67d4aa.tar.xz linux-3c5aaaced99912c9fb3352fc5af5b104df67d4aa.zip |
xfs: refactor all the EFI/EFD log item sizeof logic
Refactor all the open-coded sizeof logic for EFI/EFD log item and log
format structures into common helper functions whose names reflect the
struct names.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_extfree_item.h')
-rw-r--r-- | fs/xfs/xfs_extfree_item.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/xfs_extfree_item.h b/fs/xfs/xfs_extfree_item.h index 186d0f2137f1..da6a5afa607c 100644 --- a/fs/xfs/xfs_extfree_item.h +++ b/fs/xfs/xfs_extfree_item.h @@ -52,6 +52,14 @@ struct xfs_efi_log_item { xfs_efi_log_format_t efi_format; }; +static inline size_t +xfs_efi_log_item_sizeof( + unsigned int nr) +{ + return offsetof(struct xfs_efi_log_item, efi_format) + + xfs_efi_log_format_sizeof(nr); +} + /* * This is the "extent free done" log item. It is used to log * the fact that some extents earlier mentioned in an efi item @@ -64,6 +72,14 @@ struct xfs_efd_log_item { xfs_efd_log_format_t efd_format; }; +static inline size_t +xfs_efd_log_item_sizeof( + unsigned int nr) +{ + return offsetof(struct xfs_efd_log_item, efd_format) + + xfs_efd_log_format_sizeof(nr); +} + /* * Max number of extents in fast allocation path. */ |