diff options
| author | Marius Strobl <marius@FreeBSD.org> | 2012-03-14 13:08:16 +0000 |
|---|---|---|
| committer | Marius Strobl <marius@FreeBSD.org> | 2012-03-14 13:08:16 +0000 |
| commit | f57b9fbbd3558dfad6fee7ffea61726dfc19dd79 (patch) | |
| tree | 4ed20db7568fc2560c0fa828ea09a991bce06a1d | |
| parent | 16dc3d4688494efbd1be4d702cc96560779d4f3b (diff) | |
Notes
| -rw-r--r-- | sys/boot/common/ufsread.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/boot/common/ufsread.c b/sys/boot/common/ufsread.c index b7677329b196..d87853fd227a 100644 --- a/sys/boot/common/ufsread.c +++ b/sys/boot/common/ufsread.c @@ -46,6 +46,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <sys/endian.h> + #include <ufs/ufs/dinode.h> #include <ufs/ufs/dir.h> #include <ufs/ffs/fs.h> @@ -262,15 +264,28 @@ fsread(ino_t inode, void *buf, size_t nbyte) } n = (lbn - NDADDR) & (n - 1); #if defined(UFS1_ONLY) +#if BYTE_ORDER == BIG_ENDIAN + memcpy((char *)&addr + sizeof(addr) - + sizeof(ufs1_daddr_t), (ufs1_daddr_t *)indbuf + n, + sizeof(ufs1_daddr_t)); +#else memcpy(&addr, (ufs1_daddr_t *)indbuf + n, sizeof(ufs1_daddr_t)); +#endif #elif defined(UFS2_ONLY) memcpy(&addr, (ufs2_daddr_t *)indbuf + n, sizeof(ufs2_daddr_t)); #else if (fs.fs_magic == FS_UFS1_MAGIC) +#if BYTE_ORDER == BIG_ENDIAN + memcpy((char *)&addr + sizeof(addr) - + sizeof(ufs1_daddr_t), + (ufs1_daddr_t *)indbuf + n, + sizeof(ufs1_daddr_t)); +#else memcpy(&addr, (ufs1_daddr_t *)indbuf + n, sizeof(ufs1_daddr_t)); +#endif else memcpy(&addr, (ufs2_daddr_t *)indbuf + n, sizeof(ufs2_daddr_t)); |
