HomeFreeBSD

MFC r344238-r344241

Description

MFC r344238-r344241

r344238:
Restore loader(8)'s ability for lsdev to show partitions within a bsd slice.

I'm pretty sure this used to work at one time, perhaps long ago. It has
been failing recently because if you call disk_open() with dev->d_partition
set to -1 when d_slice refers to a bsd slice, it assumes you want it to
open the first partition within that slice. When you then pass that open
dev instance to ptable_open(), it tries to read the start of the 'a'
partition and decides there is no recognizable partition type there.

This restores the old functionality by resetting d_offset to the start
of the raw slice after disk_open() returns. For good measure, d_partition
is also set back to -1, although that doesn't currently affect anything.

I would have preferred to make disk_open() avoid such rude assumptions and
if you ask for partition -1 you get the raw slice. But the commit history
shows that someone already did that once (r239058), and had to revert it
(r239232), so I didn't even try to go down that road.

r344239:
Use a couple local variables to avoid repetitive long expressions that
cause line-wrapping.

r344240:
Make lsdev -v output line up in neat columns by using a fixed width for
the size field and a tab between the partition type and the size.

Changes this

disk devices:
      disk0 (MMC)
      disk0s1: DOS/Windows            49MB
      disk0s2: FreeBSD                14GB
      disk0s2a: FreeBSD UFS         14GB
      disk0s2b: Unknown             2048KB
      disk0s2d: FreeBSD UFS         2040KB

to this

disk devices:
      disk0 (MMC)
      disk0s1: DOS/Windows      49MB
      disk0s2: FreeBSD          14GB
      disk0s2a: FreeBSD UFS     14GB
      disk0s2b: Unknown       2048KB
      disk0s2d: FreeBSD UFS   2040KB

r344241:
Garbage collect no-longer-used constant.

Details

Provenance
ianAuthored on
Parents
rS346502: MFC r342639:
Branches
Unknown
Tags
Unknown