summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2010-08-24 12:56:45 +0000
committerrpaulo <rpaulo@FreeBSD.org>2010-08-24 12:56:45 +0000
commit78f20695ad97aec1063beb298dc82b8ffc3eeb4d (patch)
tree36731b402de12295c03637de4571e01b070b1388 /sys/boot/common
parentff10c6bff6eb6edbce7791e6a8d26a3b76194eea (diff)
downloadFreeBSD-src-78f20695ad97aec1063beb298dc82b8ffc3eeb4d.zip
FreeBSD-src-78f20695ad97aec1063beb298dc82b8ffc3eeb4d.tar.gz
Replace structure assignments with explicity memcpy calls. This allows
Clang to compile this file: it was using the builtin memcpy and we want to use the memcpy defined in gptboot.c. (Clang can't compile boot2 yet). Submitted by: Dimitry Andric <dimitry at andric.com> Reviewed by: jhb
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/ufsread.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/boot/common/ufsread.c b/sys/boot/common/ufsread.c
index cd3ba4c..5d0e8af 100644
--- a/sys/boot/common/ufsread.c
+++ b/sys/boot/common/ufsread.c
@@ -223,14 +223,19 @@ fsread(ino_t inode, void *buf, size_t nbyte)
return -1;
n = INO_TO_VBO(n, inode);
#if defined(UFS1_ONLY)
- dp1 = ((struct ufs1_dinode *)blkbuf)[n];
+ memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
+ sizeof(struct ufs1_dinode));
#elif defined(UFS2_ONLY)
- dp2 = ((struct ufs2_dinode *)blkbuf)[n];
+ memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
+ sizeof(struct ufs2_dinode));
#else
if (fs->fs_magic == FS_UFS1_MAGIC)
- dp1 = ((struct ufs1_dinode *)blkbuf)[n];
+ memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
+ sizeof(struct ufs1_dinode));
else
- dp2 = ((struct ufs2_dinode *)blkbuf)[n];
+ memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
+ sizeof(struct ufs2_dinode));
+
#endif
inomap = inode;
fs_off = 0;
OpenPOWER on IntegriCloud