From owner-svn-src-all@FreeBSD.ORG Thu Jul 28 02:40:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E54A106566B; Thu, 28 Jul 2011 02:40:17 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 271AF8FC16; Thu, 28 Jul 2011 02:40:16 +0000 (UTC) Received: by iyb11 with SMTP id 11so3219695iyb.13 for ; Wed, 27 Jul 2011 19:40:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; bh=p24sltxxJBcYDmMrJriF27NJE4b3KhbfS1pOpLVaI58=; b=dCTBbLibMCNTPcJ2AGAMluki8Z4liQwyHTHBYDZY0CAJ2cHXN928RkK2s4F632bcMT 88tNq9PE8OmWZisbYbDJGIwB9y9UWHIUu69FaJpsGsDDeqrRXJPsFwEkSz0OaJWq1ISe TfF1GEV6IjiYVvYNwwqHPyrc3q8RHDeiIrEBY= Received: by 10.42.134.2 with SMTP id j2mr365821ict.308.1311820815172; Wed, 27 Jul 2011 19:40:15 -0700 (PDT) Received: from DataIX.net (adsl-99-181-132-76.dsl.klmzmi.sbcglobal.net [99.181.132.76]) by mx.google.com with ESMTPS id e2sm339800ibb.23.2011.07.27.19.40.12 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jul 2011 19:40:13 -0700 (PDT) Sender: "J. Hellenthal" Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id p6S2e7Rq092373 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Jul 2011 22:40:08 -0400 (EDT) (envelope-from jhell@DataIX.net) Received: (from jhell@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id p6S2e77n092372; Wed, 27 Jul 2011 22:40:07 -0400 (EDT) (envelope-from jhell@DataIX.net) Date: Wed, 27 Jul 2011 22:40:07 -0400 From: Jason Hellenthal To: "Andrey V. Elsukov" Message-ID: <20110728024007.GB55550@DataIX.net> References: <201107270410.p6R4AXc3040342@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jho1yZJdad60DJr+" Content-Disposition: inline In-Reply-To: <201107270410.p6R4AXc3040342@svn.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 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 02:40:17 -0000 --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 > =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+--