Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/lfs Add byteswapping to the inode block-pointer acce...



details:   https://anonhg.NetBSD.org/src/rev/801cca1f5d39
branches:  trunk
changeset: 340919:801cca1f5d39
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Oct 10 22:33:44 2015 +0000

description:
Add byteswapping to the inode block-pointer accessors.

diffstat:

 sys/ufs/lfs/lfs_accessors.h |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (59 lines):

diff -r 88609b1c27d2 -r 801cca1f5d39 sys/ufs/lfs/lfs_accessors.h
--- a/sys/ufs/lfs/lfs_accessors.h       Sat Oct 10 22:33:31 2015 +0000
+++ b/sys/ufs/lfs/lfs_accessors.h       Sat Oct 10 22:33:44 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_accessors.h,v 1.36 2015/10/03 08:29:48 dholland Exp $      */
+/*     $NetBSD: lfs_accessors.h,v 1.37 2015/10/10 22:33:44 dholland Exp $      */
 
 /*  from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp  */
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
@@ -499,10 +499,10 @@
 {
        KASSERT(ix < ULFS_NDADDR);
        if (fs->lfs_is64) {
-               return dip->u_64.di_db[ix];
+               return LFS_SWAP_uint64_t(fs, dip->u_64.di_db[ix]);
        } else {
                /* note: this must sign-extend or UNWRITTEN gets trashed */
-               return dip->u_32.di_db[ix];
+               return (int32_t)LFS_SWAP_uint32_t(fs, dip->u_32.di_db[ix]);
        }
 }
 
@@ -511,10 +511,10 @@
 {
        KASSERT(ix < ULFS_NIADDR);
        if (fs->lfs_is64) {
-               return dip->u_64.di_ib[ix];
+               return LFS_SWAP_uint64_t(fs, dip->u_64.di_ib[ix]);
        } else {
                /* note: this must sign-extend or UNWRITTEN gets trashed */
-               return dip->u_32.di_ib[ix];
+               return (int32_t)LFS_SWAP_uint32_t(fs, dip->u_32.di_ib[ix]);
        }
 }
 
@@ -523,9 +523,9 @@
 {
        KASSERT(ix < ULFS_NDADDR);
        if (fs->lfs_is64) {
-               dip->u_64.di_db[ix] = val;
+               dip->u_64.di_db[ix] = LFS_SWAP_uint64_t(fs, val);
        } else {
-               dip->u_32.di_db[ix] = val;
+               dip->u_32.di_db[ix] = LFS_SWAP_uint32_t(fs, val);
        }
 }
 
@@ -534,9 +534,9 @@
 {
        KASSERT(ix < ULFS_NIADDR);
        if (fs->lfs_is64) {
-               dip->u_64.di_ib[ix] = val;
+               dip->u_64.di_ib[ix] = LFS_SWAP_uint64_t(fs, val);
        } else {
-               dip->u_32.di_ib[ix] = val;
+               dip->u_32.di_ib[ix] = LFS_SWAP_uint32_t(fs, val);
        }
 }
 



Home | Main Index | Thread Index | Old Index