]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Restore the ability to open a raw disk or partition in loader(8).
authorian <ian@FreeBSD.org>
Thu, 25 Apr 2019 15:09:21 +0000 (15:09 +0000)
committerian <ian@FreeBSD.org>
Thu, 25 Apr 2019 15:09:21 +0000 (15:09 +0000)
commit9fa301b5e86ec7c2e1a353524120334e90e91073
tree64387acc90d3829985b2cca150d7334834b7e40f
parent43aa0eb3b2a547f35d942be07fc56bd2584c4766
Restore the ability to open a raw disk or partition in loader(8).

The disk_open() function searches for "the best partition" when slice and
partition information is not provided as part of the device name.  As of
r345477 the slice and partition fields of a disk_devdesc are initialized to
D_SLICEWILD and D_PARTWILD; in the past they were initialized to -1, which
was sometimes interpreted as meaning 'wildcard' and sometimes as 'open the
raw partition' depending on the context.  So as an unintended side effect of
r345477 it became basically impossible to ever open a disk or partition
without doing the 'best partition' search.  One visible effect of that was
the inability to open the raw disk to read the partition table correctly in
zfs_probe_dev(), leading to failures to find the zfs pool unless it was on
the first partition.

Now instead of always initializing slice and partition to wildcards, the
disk_parsedev() function initializes them based on the presence of a
path/file name following the device.  If there is any path or filename
following the ':' that ends the device name, then slice and partition are
initialized to D_SLICEWILD and D_PARTWILD.  If there is nothing after the
':' then it is considered to be a request to open the raw device or
partition itself (not a file stored within it), and the fields are
initialized to D_SLICENONE and D_PARTNONE.

With this change in place, all the tests in src/tools/boot are succesful
again, including the recently-added cases of booting from a zfs pool on
a partition other than slice 1 of the device.

PR: 236981
stand/common/disk.c