kern/157819: commit references a PR

dfilter service dfilter at FreeBSD.ORG
Mon Jun 27 10:50:12 UTC 2011


The following reply was made to PR kern/157819; it has been noted by GNATS.

From: dfilter at FreeBSD.ORG (dfilter service)
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: kern/157819: commit references a PR
Date: Mon, 27 Jun 2011 10:42:20 +0000 (UTC)

 Author: ae
 Date: Mon Jun 27 10:42:06 2011
 New Revision: 223587
 URL: http://svn.freebsd.org/changeset/base/223587
 
 Log:
   MS Windows NT+ uses 4 bytes at offset 0x1b8 in the MBR to identify
   disk drive. The boot0cfg(8) utility preserves these 4 bytes when is
   writing bootcode to keep a multiboot ability.
   Change gpart's bootcode method to keep DSN if it is not zero. Also
   do not allow writing bootcode with size not equal to MBRSIZE.
   
   PR:		kern/157819
   Tested by:	Eir Nym
   MFC after:	1 month
 
 Modified:
   head/sys/geom/part/g_part_mbr.c
   head/sys/sys/diskmbr.h
 
 Modified: head/sys/geom/part/g_part_mbr.c
 ==============================================================================
 --- head/sys/geom/part/g_part_mbr.c	Mon Jun 27 09:15:41 2011	(r223586)
 +++ head/sys/geom/part/g_part_mbr.c	Mon Jun 27 10:42:06 2011	(r223587)
 @@ -237,14 +237,16 @@ static int
  g_part_mbr_bootcode(struct g_part_table *basetable, struct g_part_parms *gpp)
  {
  	struct g_part_mbr_table *table;
 -	size_t codesz;
 +	uint32_t dsn;
 +
 +	if (gpp->gpp_codesize != MBRSIZE)
 +		return (ENODEV);
  
 -	codesz = DOSPARTOFF;
  	table = (struct g_part_mbr_table *)basetable;
 -	bzero(table->mbr, codesz);
 -	codesz = MIN(codesz,  gpp->gpp_codesize);
 -	if (codesz > 0)
 -		bcopy(gpp->gpp_codeptr, table->mbr, codesz);
 +	dsn = *(uint32_t *)(table->mbr + DOSDSNOFF);
 +	bcopy(gpp->gpp_codeptr, table->mbr, DOSPARTOFF);
 +	if (dsn != 0)
 +		*(uint32_t *)(table->mbr + DOSDSNOFF) = dsn;
  	return (0);
  }
  
 
 Modified: head/sys/sys/diskmbr.h
 ==============================================================================
 --- head/sys/sys/diskmbr.h	Mon Jun 27 09:15:41 2011	(r223586)
 +++ head/sys/sys/diskmbr.h	Mon Jun 27 10:42:06 2011	(r223587)
 @@ -36,6 +36,7 @@
  #include <sys/ioccom.h>
  
  #define	DOSBBSECTOR	0	/* DOS boot block relative sector number */
 +#define	DOSDSNOFF	440	/* WinNT/2K/XP Drive Serial Number offset */
  #define	DOSPARTOFF	446
  #define	DOSPARTSIZE	16
  #define	NDOSPART	4
 _______________________________________________
 svn-src-all at freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe at freebsd.org"
 


More information about the freebsd-geom mailing list