Project

General

Profile

Actions

Bug #13346

closed

diskinfo should identify lofi(7D) devices

Added by Joshua M. Clulow 8 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

At least when using the labelled mode of lofi(7D) devices, i.e., with the -l option, devices show up with other disk devices in the output of diskinfo(1M); e.g.,

$ lofiadm
Block Device             File                           Options
/dev/dsk/c3t1d0p0        /var/tmp/lofi.raw              Labeled

$ pfexec diskinfo
TYPE    DISK                    VID      PID              SIZE          RMV SSD
SCSI    c2t0d0                  Seagate  Expansion        3726.02 GiB   no  no
-       c5t0d0                  -        -                   0.00 GiB   yes yes
NVME    c6t00343847C1B3A2BBd0   Samsung  SSD 990 EVO 500GB  465.76 GiB   no  yes
NVME    c9t0027395891B2833Ad0   Samsung  SSD 990 EVO 500GB  465.76 GiB   no  yes
UNKNOWN c3t1d0                  -        -                   3.91 GiB   no  no

Rather than UNKNOWN, the type should probably display LOFI.

Actions #1

Updated by Robert Mustacchi 6 months ago

  • Assignee set to Robert Mustacchi

What's happening here is somewhat interesting. When libdevinfo goes through and tries to discover disks, it attempts to find a controller for it by looking at its parent device. In the case of a lofi node, which is going to show up in /devices as /pseudo/lofi@1:a,raw, it'll find a parent of /psuedo. This will actually go through and create a controller represented by /psuedo which the unfortunately named ctype() function will not known, leaving it to show up as UKNOWN. In this case, we should make it so when we discover the lofi0 control node lofi0:ctl that we explicitly create a controller and then when we discover lofi nodes we map them over.

Actions #2

Updated by Robert Mustacchi 6 months ago

We now correctly identify a labeled lofi device though an unlabeled device does not show up. For example if lofiadm has the following:

$ pfexec lofiadm
Block Device             File                           Options
/dev/dsk/c7t1d0p0        /var/tmp/blahdisk              Labeled
/dev/lofi/2              /var/tmp/blahdisk-nl           -

We actually find in diskinfo:

#  diskinfo
TYPE    DISK                    VID      PID              SIZE          RMV SSD
NVME    c1t1d0                  INTEL    SSDPEKNW512G8     476.94 GiB   no  yes
SATA    c6t0d0                  Samsung  SSD 860 EVO 1TB   931.51 GiB   no  yes
LOFI    c7t1d0                  -        -                   0.10 GiB   no  no 
Actions #3

Updated by Electric Monk 6 months ago

  • Gerrit CR set to 1168
Actions #4

Updated by Electric Monk 6 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit f85f43ed9f8f93958ca75033d5f390666baa0b6c

commit  f85f43ed9f8f93958ca75033d5f390666baa0b6c
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2021-01-22T16:19:42.000Z

    13346 diskinfo should identify lofi(7D) devices
    Reviewed by: C Fraire <cfraire@me.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

Actions

Also available in: Atom PDF