Replace inline version of similar, but less complete, functionality
with the lib/blkdev.c function. The function will inform if a type is
unknown, which appears as hex string value.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
lsblk_SOURCES = \
lsblk.c \
$(top_srcdir)/lib/at.c \
+ $(top_srcdir)/lib/blkdev.c \
$(top_srcdir)/lib/canonicalize.c \
- $(top_srcdir)/lib/mbsalign.c \
+ $(top_srcdir)/lib/linux_version.c \
$(top_srcdir)/lib/mangle.c \
+ $(top_srcdir)/lib/mbsalign.c \
$(top_srcdir)/lib/strutils.c \
$(top_srcdir)/lib/sysfs.c \
$(top_srcdir)/lib/tt.c
} else {
const char *type = cxt->partition ? "part" : "disk";
int x = 0;
-
sysfs_read_int(&cxt->sysfs, "device/type", &x);
-
- switch (x) {
- case 0x0c: /* TYPE_RAID */
- type = "raid"; break;
- case 0x01: /* TYPE_TAPE */
- type = "raid"; break;
- case 0x04: /* TYPE_WORM */
- case 0x05: /* TYPE_ROM */
- type = "rom"; break;
- case 0x07: /* TYPE_MOD */
- type = "mo-disk"; break;
- case 0x0e: /* TYPE_RBC */
- type = "rbc"; break;
- }
-
- res = xstrdup(type);
+ res = blkdev_scsi_type_to_name(x);
}
for (p = res; p && *p; p++)