summaryrefslogtreecommitdiffstats
path: root/lib/libdisk/write_disk.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1998-09-30 21:40:51 +0000
committerjkh <jkh@FreeBSD.org>1998-09-30 21:40:51 +0000
commite2bde560d54e66f5d48e1c30fe503b90598389a6 (patch)
tree7f29e85c2ae84aa75810ff23268eb0fa8e6b377c /lib/libdisk/write_disk.c
parent0e9aa6252248eafcd5f8e457f96039dd49733388 (diff)
downloadFreeBSD-src-e2bde560d54e66f5d48e1c30fe503b90598389a6.zip
FreeBSD-src-e2bde560d54e66f5d48e1c30fe503b90598389a6.tar.gz
Eliminate unaligned access on Alpha and also neaten up this code a little.
Submitted by: dfr
Diffstat (limited to 'lib/libdisk/write_disk.c')
-rw-r--r--lib/libdisk/write_disk.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/libdisk/write_disk.c b/lib/libdisk/write_disk.c
index 799c97d..cf7e87a 100644
--- a/lib/libdisk/write_disk.c
+++ b/lib/libdisk/write_disk.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: write_disk.c,v 1.20 1997/02/22 15:06:40 peter Exp $
+ * $Id: write_disk.c,v 1.21 1998/06/27 02:01:25 jdp Exp $
*
*/
@@ -113,6 +113,16 @@ Write_Extended(int fd, struct disk *new, struct disk *old, struct chunk *c1)
return 0;
}
+static void
+Write_Int32(u_int32_t *p, u_int32_t v)
+{
+ u_int8_t *bp = (u_int8_t *)p;
+ bp[0] = (v >> 0) & 0xff;
+ bp[1] = (v >> 8) & 0xff;
+ bp[2] = (v >> 16) & 0xff;
+ bp[3] = (v >> 24) & 0xff;
+}
+
int
Write_Disk(struct disk *d1)
{
@@ -154,8 +164,8 @@ Write_Disk(struct disk *d1)
if (c1->type == freebsd)
ret += Write_FreeBSD(fd, d1,old,c1);
- dp[j].dp_start = c1->offset;
- dp[j].dp_size = c1->size;
+ Write_Int32(&dp[j].dp_start, c1->offset);
+ Write_Int32(&dp[j].dp_size, c1->size);
i = c1->offset;
if (i >= 1024*d1->bios_sect*d1->bios_hd) {
OpenPOWER on IntegriCloud