Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jul 2011 22:40:07 -0400
From:      Jason Hellenthal <jhell@DataIX.net>
To:        "Andrey V. Elsukov" <ae@freebsd.org>
Cc:        svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   Re: svn commit: r224464 - in stable/8/sys: geom/part sys
Message-ID:  <20110728024007.GB55550@DataIX.net>
In-Reply-To: <201107270410.p6R4AXc3040342@svn.freebsd.org>
References:  <201107270410.p6R4AXc3040342@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--jho1yZJdad60DJr+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable



On Wed, Jul 27, 2011 at 04:10:33AM +0000, Andrey V. Elsukov wrote:
> Author: ae
> Date: Wed Jul 27 04:10:32 2011
> New Revision: 224464
> URL: http://svn.freebsd.org/changeset/base/224464
>=20
> Log:
>   MFC r223587:
>     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 it 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.
>  =20
>     PR:		kern/157819
>=20
> Modified:
>   stable/8/sys/geom/part/g_part_mbr.c
>   stable/8/sys/sys/diskmbr.h
> Directory Properties:
>   stable/8/sys/   (props changed)
>   stable/8/sys/amd64/include/xen/   (props changed)
>   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
>   stable/8/sys/contrib/dev/acpica/   (props changed)
>   stable/8/sys/contrib/pf/   (props changed)
>   stable/8/sys/geom/label/   (props changed)
>=20
> Modified: stable/8/sys/geom/part/g_part_mbr.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- stable/8/sys/geom/part/g_part_mbr.c	Wed Jul 27 01:57:24 2011	(r224463)
> +++ stable/8/sys/geom/part/g_part_mbr.c	Wed Jul 27 04:10:32 2011	(r224464)
> @@ -234,14 +234,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 !=3D MBRSIZE)
> +		return (ENODEV);

Is it known for an absolute fact that the size being written is always
going to be the size of MBRSIZE ? never less ? wouldnt ">=3D" greater-than
or equal make sense here ? though I would seriously doubt it needs to
return on equal too as that could be written.

> =20
> -	codesz =3D DOSPARTOFF;
>  	table =3D (struct g_part_mbr_table *)basetable;
> -	bzero(table->mbr, codesz);
> -	codesz =3D MIN(codesz,  gpp->gpp_codesize);
> -	if (codesz > 0)
> -		bcopy(gpp->gpp_codeptr, table->mbr, codesz);
> +	dsn =3D *(uint32_t *)(table->mbr + DOSDSNOFF);
> +	bcopy(gpp->gpp_codeptr, table->mbr, DOSPARTOFF);
> +	if (dsn !=3D 0)

Shit happens... any case that the product might return less than 0
causing this to still fall through and process... ? ">" ?

> +		*(uint32_t *)(table->mbr + DOSDSNOFF) =3D dsn;
>  	return (0);
>  }
> =20
>=20
> Modified: stable/8/sys/sys/diskmbr.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- stable/8/sys/sys/diskmbr.h	Wed Jul 27 01:57:24 2011	(r224463)
> +++ stable/8/sys/sys/diskmbr.h	Wed Jul 27 04:10:32 2011	(r224464)
> @@ -36,6 +36,7 @@
>  #include <sys/ioccom.h>
> =20
>  #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-stable-8@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8
> To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.or=
g"

--jho1yZJdad60DJr+
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (FreeBSD)
Comment: http://bit.ly/0x89D8547E

iQEcBAEBAgAGBQJOMMwHAAoJEJBXh4mJ2FR+mCEH/11OPJqBMX9ueQRnMdHVvcM1
4gCv10qaHzKNaXhBqOzLAmg/kXQOs28kNXkhViBDnRr7NLGF7euFZCd7PyiK10Dy
sB1+Ti2p9WEAk9JWBNKI34ttv5yKrOd67Cc3YojUs4Qt7vISYwMJ6PkvINM67YnY
MDDFmQ45N7ry03jZQYl2mTW34Qdo1nBp4gT/VQ44M6mJSFECt+0QYXKtoG+DVi5y
N0ZoFcg+b4g4zDwTlyCNDnpW0B3aRoCfhvoM87UZ6LBcuFS4xBF4j7jojaFCJsR2
hWnRMpUs+nnk5G8XlTaQ7K7rZlVKfPvi2zVRWU5QY5P4YMINsnBIitUv0ZhSZEM=
=NqxT
-----END PGP SIGNATURE-----

--jho1yZJdad60DJr+--



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