]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
loader: disk_open() should honor D_PARTNONE
authortsoome <tsoome@FreeBSD.org>
Thu, 6 Jun 2019 16:27:05 +0000 (16:27 +0000)
committertsoome <tsoome@FreeBSD.org>
Thu, 6 Jun 2019 16:27:05 +0000 (16:27 +0000)
commit278c316e05793f369bf562878b51019d46949009
tree2a98b4d48335d912202c4b9a23fb69fc57a3bca8
parentec3cf4f0330b9038d65b8a8a3d7bc13bed1f2a1e
loader: disk_open() should honor D_PARTNONE

The D_PARTNONE is documented to make it possible to open raw MBR
partition, but the current disk_open() does not really implement this
statement.

The current code is checking partition against -1 (D_PARTNONE) but does
attempt to open partition table in case we do have FreeBSD MBR partition type.
Instead, we should check -2 (D_PARTWILD).

In case we do have MBR + BSD label, this code is only working because
by default, the first BSD partiton is created starting with relative sector
0, and we can still access the BSD table from that MBR slice.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20501
stand/common/disk.c