From 93cc230195607f7a34cb8cbf7ba0075f52c6d02f Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Mon, 15 Oct 2001 10:34:04 +0000 Subject: [PATCH] fix pointer alignment issues on IA64 in handling block map structures. --- db/bmap.c | 6 ++++-- include/libxfs.h | 2 +- libxfs/xfs_bmap_btree.c | 9 +-------- repair/dinode.c | 5 ++++- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/db/bmap.c b/db/bmap.c index 69e2d3dd9..634e16c07 100644 --- a/db/bmap.c +++ b/db/bmap.c @@ -289,15 +289,17 @@ bmap_one_extent( void convert_extent( - xfs_bmbt_rec_64_t *rp, + xfs_bmbt_rec_64_t *rp, xfs_dfiloff_t *op, xfs_dfsbno_t *sp, xfs_dfilblks_t *cp, int *fp) { xfs_bmbt_irec_t irec, *s = &irec; + xfs_bmbt_rec_t rpcopy, *p = &rpcopy; - libxfs_bmbt_get_all((xfs_bmbt_rec_t *)rp, s); + memmove(&rpcopy, rp, sizeof(rpcopy)); + libxfs_bmbt_get_all(p, s); if (s->br_state == XFS_EXT_UNWRITTEN) { *fp = 1; diff --git a/include/libxfs.h b/include/libxfs.h index 93ba22293..a01b3b19f 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -425,7 +425,7 @@ extern int libxfs_attr_leaf_newentsize (xfs_da_args_t *, int, int *); extern xfs_filblks_t libxfs_bmbt_get_blockcount (xfs_bmbt_rec_t *); extern xfs_fileoff_t libxfs_bmbt_get_startoff (xfs_bmbt_rec_t *); -extern void libxfs_bmbt_get_all (xfs_bmbt_rec_32_t *, xfs_bmbt_irec_t *); +extern void libxfs_bmbt_get_all (xfs_bmbt_rec_t *, xfs_bmbt_irec_t *); extern int libxfs_free_extent (xfs_trans_t *, xfs_fsblock_t, xfs_extlen_t); extern int libxfs_rtfree_extent (xfs_trans_t *, xfs_rtblock_t, diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c index 5948c4af3..4335ef061 100644 --- a/libxfs/xfs_bmap_btree.c +++ b/libxfs/xfs_bmap_btree.c @@ -1552,21 +1552,14 @@ xfs_bmbt_delete( * Convert a compressed bmap extent record to an uncompressed form. * This code must be in sync with the routines xfs_bmbt_get_startoff, * xfs_bmbt_get_startblock, xfs_bmbt_get_blockcount and xfs_bmbt_get_state. - * - * In the kernel this function is called with xfs_bmbt_rec_t, the caller has - * already ensured that the data is suitably aligned. In commands, the data is - * aligned to 32 bit until it gets here so this routine has to convert to the - * machine alignment. This is a divergence between kernel and commands. KAO. */ void xfs_bmbt_get_all( - xfs_bmbt_rec_32_t *rp, + xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s) { int ext_flag; xfs_exntst_t st; - xfs_bmbt_rec_t rpcopy, *r = &rpcopy; - memcpy(&rpcopy, rp, sizeof(rpcopy)); #if BMBT_USE_64 ext_flag = (int)((INT_GET(r->l0, ARCH_CONVERT)) >> (64 - BMBT_EXNTFLAG_BITLEN)); diff --git a/repair/dinode.c b/repair/dinode.c index 520d579b5..807c33503 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -443,8 +443,11 @@ convert_extent( int *fp) /* extent flag */ { xfs_bmbt_irec_t irec, *s = &irec; + xfs_bmbt_rec_t rpcopy, *p = &rpcopy; + + memcpy(&rpcopy, rp, sizeof(rpcopy)); /* Just use the extent parsing routine from the kernel */ - libxfs_bmbt_get_all(rp, s); + libxfs_bmbt_get_all(p, s); if (fs_has_extflgbit) { if (s->br_state == XFS_EXT_UNWRITTEN) { -- 2.47.2