Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Nov 2011 20:31:48 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r227454 - head/sbin/newfs_msdos
Message-ID:  <201111112031.pABKVmas007553@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Fri Nov 11 20:31:48 2011
New Revision: 227454
URL: http://svn.freebsd.org/changeset/base/227454

Log:
  Use __packed to prevent alignment from taking place, which otherwise may
  change the on-disk format in an incompatible way.  Without this change,
  msdosfs created on FreeBSD/arm would not be mountable.
  
  PR:		bin/162486
  Submitted by:	Ian Lepore <freebsd damnhippie dyndns org>
  Reported by:	Mattia Rossi <mrossi at swin.edu.au>
  MFC after:	3 days

Modified:
  head/sbin/newfs_msdos/newfs_msdos.c

Modified: head/sbin/newfs_msdos/newfs_msdos.c
==============================================================================
--- head/sbin/newfs_msdos/newfs_msdos.c	Fri Nov 11 20:13:24 2011	(r227453)
+++ head/sbin/newfs_msdos/newfs_msdos.c	Fri Nov 11 20:31:48 2011	(r227454)
@@ -99,7 +99,7 @@ static const char rcsid[] =
 struct bs {
     u_int8_t bsJump[3];		/* bootstrap entry point */
     u_int8_t bsOemName[8];		/* OEM name and version */
-};
+} __packed;
 
 struct bsbpb {
     u_int8_t bpbBytesPerSec[2];		/* bytes per sector */
@@ -114,7 +114,7 @@ struct bsbpb {
     u_int8_t bpbHeads[2];		/* drive heads */
     u_int8_t bpbHiddenSecs[4];		/* hidden sectors */
     u_int8_t bpbHugeSectors[4];		/* big total sectors */
-};
+} __packed;
 
 struct bsxbpb {
     u_int8_t bpbBigFATsecs[4];		/* big sectors per FAT */
@@ -124,7 +124,7 @@ struct bsxbpb {
     u_int8_t bpbFSInfo[2];		/* file system info sector */
     u_int8_t bpbBackup[2];		/* backup boot sector */
     u_int8_t bpbReserved[12];			/* reserved */
-};
+} __packed;
 
 struct bsx {
     u_int8_t exDriveNumber;		/* drive number */
@@ -133,7 +133,7 @@ struct bsx {
     u_int8_t exVolumeID[4];		/* volume ID number */
     u_int8_t exVolumeLabel[11]; 	/* volume label */
     u_int8_t exFileSysType[8];		/* file system type */
-};
+} __packed;
 
 struct de {
     u_int8_t deName[11];	/* name and extension */
@@ -143,7 +143,7 @@ struct de {
     u_int8_t deMDate[2];	/* creation date */
     u_int8_t deStartCluster[2];	/* starting cluster */
     u_int8_t deFileSize[4];	/* size */
-};
+} __packed;
 
 struct bpb {
     u_int bpbBytesPerSec;		/* bytes per sector */



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