Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Aug 2010 12:56:46 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r211747 - head/sys/boot/common
Message-ID:  <201008241256.o7OCukie076575@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Tue Aug 24 12:56:45 2010
New Revision: 211747
URL: http://svn.freebsd.org/changeset/base/211747

Log:
  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

Modified:
  head/sys/boot/common/ufsread.c

Modified: head/sys/boot/common/ufsread.c
==============================================================================
--- head/sys/boot/common/ufsread.c	Tue Aug 24 12:18:39 2010	(r211746)
+++ head/sys/boot/common/ufsread.c	Tue Aug 24 12:56:45 2010	(r211747)
@@ -223,14 +223,19 @@ fsread(ino_t inode, void *buf, size_t nb
 			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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008241256.o7OCukie076575>