diff mbox

[01/39] xfs: convert RUI log formats to use variable length arrays

Message ID 147743662427.11035.5343374767358259727.stgit@birch.djwong.org (mailing list archive)
State Accepted
Headers show

Commit Message

Darrick J. Wong Oct. 25, 2016, 11:03 p.m. UTC
Use variable length array declarations for RUI log items,
and replace the open coded sizeof formulae with a single function.

[Fix up the logprint code to reflect the new RUI format.]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 logprint/log_redo.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Christoph Hellwig Oct. 26, 2016, 10:21 a.m. UTC | #1
On Tue, Oct 25, 2016 at 04:03:44PM -0700, Darrick J. Wong wrote:
> Use variable length array declarations for RUI log items,
> and replace the open coded sizeof formulae with a single function.
> 
> [Fix up the logprint code to reflect the new RUI format.]

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/logprint/log_redo.c b/logprint/log_redo.c
index add0764..40e0727 100644
--- a/logprint/log_redo.c
+++ b/logprint/log_redo.c
@@ -240,8 +240,7 @@  xfs_rui_copy_format(
 	int			  continued)
 {
 	uint nextents = ((struct xfs_rui_log_format *)buf)->rui_nextents;
-	uint dst_len = sizeof(struct xfs_rui_log_format) +
-			(nextents - 1) * sizeof(struct xfs_map_extent);
+	uint dst_len = xfs_rui_log_format_sizeof(nextents);
 
 	if (len == dst_len || continued) {
 		memcpy((char *)dst_fmt, buf, len);
@@ -283,8 +282,7 @@  xlog_print_trans_rui(
 
 	/* convert to native format */
 	nextents = src_f->rui_nextents;
-	dst_len = sizeof(struct xfs_rui_log_format) +
-			(nextents - 1) * sizeof(struct xfs_map_extent);
+	dst_len = xfs_rui_log_format_sizeof(nextents);
 
 	if (continued && src_len < core_size) {
 		printf(_("RUI: Not enough data to decode further\n"));