diff options
author | Robert Mustacchi <rm@fingolfin.org> | 2021-01-16 11:17:49 -0800 |
---|---|---|
committer | Robert Mustacchi <rm@fingolfin.org> | 2021-01-22 08:19:42 -0800 |
commit | f85f43ed9f8f93958ca75033d5f390666baa0b6c (patch) | |
tree | ba0cc0c34b4fc379c4c478b3e2811c9d851e076c /usr/src/lib | |
parent | 4efb20e81cede837b887da28bb6284155a828dab (diff) | |
download | illumos-joyent-f85f43ed9f8f93958ca75033d5f390666baa0b6c.tar.gz |
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>
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/libdiskmgt/common/findevs.c | 33 | ||||
-rw-r--r-- | usr/src/lib/libdiskmgt/common/libdiskmgt.h | 1 |
2 files changed, 33 insertions, 1 deletions
diff --git a/usr/src/lib/libdiskmgt/common/findevs.c b/usr/src/lib/libdiskmgt/common/findevs.c index 440d8585db..d5de1af440 100644 --- a/usr/src/lib/libdiskmgt/common/findevs.c +++ b/usr/src/lib/libdiskmgt/common/findevs.c @@ -27,7 +27,7 @@ /* * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. - * Copyright 2020 Oxide Computer Company + * Copyright 2021 Oxide Computer Company */ #include <fcntl.h> @@ -627,6 +627,28 @@ add_disk2controller(disk_t *diskp, struct search_args *args) return (0); } + /* + * Certain pseudo-device nodes do not all immediately have a valid + * parent-node. In particular, lofi (and zfs) would point to the generic + * /pseudo node. As a result, if we find a lofi disk, redirect it to the + * actual path. If we don't find it in this, then just fall back to the + * traditional path. + */ + if (libdiskmgt_str_eq(di_node_name(pnode), "pseudo") && + libdiskmgt_str_eq(di_node_name(node), "lofi")) { + di_node_t n; + + n = di_drv_first_node("lofi", pnode); + while (n != DI_NODE_NIL) { + if (di_instance(n) == 0) { + pnode = n; + break; + } + + n = di_drv_next_node(n); + } + } + minor = di_minor_next(pnode, NULL); if (minor == NULL) { return (0); @@ -1059,6 +1081,10 @@ ctype(di_node_t node, di_minor_t minor) libdiskmgt_str_eq(name, "xpvd")) return (DM_CTYPE_XEN); + if (libdiskmgt_str_eq(type, DDI_PSEUDO) && + libdiskmgt_str_eq(name, "lofi")) + return (DM_CTYPE_LOFI); + if (dm_debug) { (void) fprintf(stderr, "INFO: unknown controller type=%s name=%s\n", type, name); @@ -1437,6 +1463,11 @@ is_ctrl(di_node_t node, di_minor_t minor) libdiskmgt_str_eq(name, "xpvd"))) return (1); + if (libdiskmgt_str_eq(type, DDI_PSEUDO) && + libdiskmgt_str_eq(name, "lofi") && + libdiskmgt_str_eq(di_minor_name(minor), "ctl")) + return (1); + return (0); } diff --git a/usr/src/lib/libdiskmgt/common/libdiskmgt.h b/usr/src/lib/libdiskmgt/common/libdiskmgt.h index 7391350962..6c3a0d4325 100644 --- a/usr/src/lib/libdiskmgt/common/libdiskmgt.h +++ b/usr/src/lib/libdiskmgt/common/libdiskmgt.h @@ -354,6 +354,7 @@ typedef enum { #define DM_CTYPE_ATA "ata" #define DM_CTYPE_FIBRE "fibre" +#define DM_CTYPE_LOFI "lofi" #define DM_CTYPE_NVME "nvme" #define DM_CTYPE_SATA "sata" #define DM_CTYPE_SCSI "scsi" |