public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Andrey Albershteyn <aalbersh@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 11/25] logprint: move xfs_inode_item_format_convert up
Date: Fri, 28 Nov 2025 07:29:48 +0100	[thread overview]
Message-ID: <20251128063007.1495036-12-hch@lst.de> (raw)
In-Reply-To: <20251128063007.1495036-1-hch@lst.de>

Toward the caller.  And reindent it while we're at it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 logprint/log_misc.c | 80 +++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 39 deletions(-)

diff --git a/logprint/log_misc.c b/logprint/log_misc.c
index a3aa4a323193..274d25e94bbd 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -527,6 +527,39 @@ xlog_print_trans_qoff(
 	return 0;
 }
 
+/*
+ * if necessary, convert an xfs_inode_log_format struct from the old 32bit version
+ * (which can have different field alignments) to the native 64 bit version
+ */
+struct xfs_inode_log_format *
+xfs_inode_item_format_convert(
+	char			*src_buf,
+	uint			len,
+	struct xfs_inode_log_format *in_f)
+{
+	struct xfs_inode_log_format_32	*in_f32;
+
+	/* if we have native format then just return buf without copying data */
+	if (len == sizeof(struct xfs_inode_log_format))
+		return (struct xfs_inode_log_format *)src_buf;
+
+	in_f32 = (struct xfs_inode_log_format_32 *)src_buf;
+	in_f->ilf_type = in_f32->ilf_type;
+	in_f->ilf_size = in_f32->ilf_size;
+	in_f->ilf_fields = in_f32->ilf_fields;
+	in_f->ilf_asize = in_f32->ilf_asize;
+	in_f->ilf_dsize = in_f32->ilf_dsize;
+	in_f->ilf_ino = in_f32->ilf_ino;
+	/* copy biggest field of ilf_u */
+	memcpy(&in_f->ilf_u.__pad, &in_f32->ilf_u.__pad,
+					sizeof(in_f->ilf_u.__pad));
+	in_f->ilf_blkno = in_f32->ilf_blkno;
+	in_f->ilf_len = in_f32->ilf_len;
+	in_f->ilf_boffset = in_f32->ilf_boffset;
+
+	return in_f;
+}
+
 static void
 xlog_print_trans_inode_core(
 	struct xfs_log_dinode	*ip)
@@ -588,14 +621,14 @@ xlog_print_trans_inode(
 	int			num_ops,
 	int			continued)
 {
-    struct xfs_log_dinode	dino;
-    struct xlog_op_header	*op_head;
-    struct xfs_inode_log_format	dst_lbuf;
-    struct xfs_inode_log_format	src_lbuf;
-    struct xfs_inode_log_format *f;
-    int				mode;
-    int				size;
-    int				skip_count;
+	struct xfs_log_dinode	dino;
+	struct xlog_op_header	*op_head;
+	struct xfs_inode_log_format dst_lbuf;
+	struct xfs_inode_log_format src_lbuf;
+	struct xfs_inode_log_format *f;
+	int				mode;
+	int				size;
+	int				skip_count;
 
     /*
      * print inode type header region
@@ -1582,34 +1615,3 @@ end:
     printf(_("%s: logical end of log\n"), progname);
     print_xlog_record_line();
 }
-
-/*
- * if necessary, convert an xfs_inode_log_format struct from the old 32bit version
- * (which can have different field alignments) to the native 64 bit version
- */
-struct xfs_inode_log_format *
-xfs_inode_item_format_convert(char *src_buf, uint len, struct xfs_inode_log_format *in_f)
-{
-	struct xfs_inode_log_format_32	*in_f32;
-
-	/* if we have native format then just return buf without copying data */
-	if (len == sizeof(struct xfs_inode_log_format)) {
-		return (struct xfs_inode_log_format *)src_buf;
-	}
-
-	in_f32 = (struct xfs_inode_log_format_32 *)src_buf;
-	in_f->ilf_type = in_f32->ilf_type;
-	in_f->ilf_size = in_f32->ilf_size;
-	in_f->ilf_fields = in_f32->ilf_fields;
-	in_f->ilf_asize = in_f32->ilf_asize;
-	in_f->ilf_dsize = in_f32->ilf_dsize;
-	in_f->ilf_ino = in_f32->ilf_ino;
-	/* copy biggest field of ilf_u */
-	memcpy(&in_f->ilf_u.__pad, &in_f32->ilf_u.__pad,
-					sizeof(in_f->ilf_u.__pad));
-	in_f->ilf_blkno = in_f32->ilf_blkno;
-	in_f->ilf_len = in_f32->ilf_len;
-	in_f->ilf_boffset = in_f32->ilf_boffset;
-
-	return in_f;
-}
-- 
2.47.3


  parent reply	other threads:[~2025-11-28  6:31 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28  6:29 logprint cleanups, part1 Christoph Hellwig
2025-11-28  6:29 ` [PATCH 01/25] include: remove struct xfs_qoff_logitem Christoph Hellwig
2025-11-28  6:29 ` [PATCH 02/25] logprint: remove xlog_print_dir2_sf Christoph Hellwig
2025-11-28  6:29 ` [PATCH 03/25] logprint: re-indent printing helpers Christoph Hellwig
2025-11-28  6:29 ` [PATCH 04/25] logprint: cleanup xlog_print_op_header Christoph Hellwig
2025-11-28  6:29 ` [PATCH 05/25] logprint: cleanup struct xlog_split_item handling Christoph Hellwig
2025-11-28  6:29 ` [PATCH 06/25] logprint: cleanup xlog_print_trans_header Christoph Hellwig
2025-11-28  6:29 ` [PATCH 07/25] logprint: split per-type helpers out of xlog_print_trans_buffer Christoph Hellwig
2025-11-28  6:29 ` [PATCH 08/25] logprint: cleanup xlog_print_trans_buffer Christoph Hellwig
2025-11-28  6:29 ` [PATCH 09/25] logprint: cleanup xlog_print_trans_qoff Christoph Hellwig
2025-11-28  6:29 ` [PATCH 10/25] logprint: cleanup xlog_print_trans_inode_core Christoph Hellwig
2025-12-01 18:23   ` Andrey Albershteyn
2025-12-02  7:27     ` Christoph Hellwig
2025-11-28  6:29 ` Christoph Hellwig [this message]
2025-12-01 18:32   ` [PATCH 11/25] logprint: move xfs_inode_item_format_convert up Andrey Albershteyn
2025-12-02  7:28     ` Christoph Hellwig
2025-11-28  6:29 ` [PATCH 12/25] logprint: cleanup xlog_print_trans_inode Christoph Hellwig
2025-11-28  6:29 ` [PATCH 13/25] logprint: cleanup xlog_print_trans_dquot Christoph Hellwig
2025-11-28  6:29 ` [PATCH 14/25] logprint: re-indent print_lseek / print_lsn Christoph Hellwig
2025-11-28  6:29 ` [PATCH 15/25] logprint: factor out a xlog_print_process_region helper Christoph Hellwig
2025-11-28  6:29 ` [PATCH 16/25] logprint: factor out a xlog_print_op helper Christoph Hellwig
2025-12-01 18:44   ` Andrey Albershteyn
2025-12-02  7:29     ` Christoph Hellwig
2025-11-28  6:29 ` [PATCH 17/25] logprint: factor out a xlog_unpack_rec_header Christoph Hellwig
2025-11-28  6:29 ` [PATCH 18/25] logprint: cleanup xlog_print_record Christoph Hellwig
2025-11-28  6:29 ` [PATCH 19/25] logprint: cleanup xlog_print_rec_head Christoph Hellwig
2025-11-28  6:29 ` [PATCH 20/25] logprint: cleanup xlog_print_rec_xhead Christoph Hellwig
2025-11-28  6:29 ` [PATCH 21/25] logprint: re-indent print_xlog_bad_* Christoph Hellwig
2025-11-28  6:29 ` [PATCH 22/25] logprint: cleanup xlog_reallocate_xhdrs Christoph Hellwig
2025-11-28  6:30 ` [PATCH 23/25] logprint: factor out a xlog_print_ext_header helper Christoph Hellwig
2025-11-28  6:30 ` [PATCH 24/25] logprint: cleanup xlog_print_extended_headers Christoph Hellwig
2025-11-28  6:30 ` [PATCH 25/25] logprint: cleanup xfs_log_print Christoph Hellwig
2025-12-01 19:03 ` logprint cleanups, part1 Andrey Albershteyn
2025-12-02  7:29   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251128063007.1495036-12-hch@lst.de \
    --to=hch@lst.de \
    --cc=aalbersh@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox