]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
logprint: move xfs_inode_item_format_convert up
authorChristoph Hellwig <hch@lst.de>
Fri, 28 Nov 2025 06:29:48 +0000 (07:29 +0100)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 3 Dec 2025 10:48:04 +0000 (11:48 +0100)
Toward the caller.  And reindent it while we're at it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[aalbersh: add one tab column to arguments to make it align with in_f32]
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
logprint/log_misc.c

index a3aa4a32319397a51d353b0dc8f8bc4b58224835..25090de2fe05dcadb1329fedc9fac9f189122ffa 100644 (file)
@@ -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;
-}