From: Christoph Hellwig Date: Fri, 28 Nov 2025 06:29:48 +0000 (+0100) Subject: logprint: move xfs_inode_item_format_convert up X-Git-Tag: v6.18.0~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17da769c68e2857a68f45de68dad2214cdcdff9b;p=thirdparty%2Fxfsprogs-dev.git logprint: move xfs_inode_item_format_convert up Toward the caller. And reindent it while we're at it. Signed-off-by: Christoph Hellwig [aalbersh: add one tab column to arguments to make it align with in_f32] Signed-off-by: Andrey Albershteyn Reviewed-by: Andrey Albershteyn --- diff --git a/logprint/log_misc.c b/logprint/log_misc.c index a3aa4a32..25090de2 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; -}