8f615e462d
- Fix warnings from GCC 7's -Wimplicit-fallthrough (dann.frazier) - ped_unit_get_name: Resolve conflicting attributes 'const' and 'pure' (dann.frazier) - Add udf to t1700-probe-fs and to the manpage (bcl) - libparted: Add support for MBR id, GPT GUID and detection of UDF filesystem (pali.rohar) - Fix potential command line buffer overflow (xu.simon) - t6100-mdraid-partitions: Use v0.90 metadata for the test (bcl) - parted.c: Make sure dev_name is freed (bcl) - parted.c: Always free peek_word (bcl) - Fix the length of several strncpy calls (bcl)
60 lines
1.6 KiB
Diff
60 lines
1.6 KiB
Diff
From 279bd5540a59e3bdc4e3702ff062f87fd842c0e9 Mon Sep 17 00:00:00 2001
|
|
From: dann frazier <dann.frazier@canonical.com>
|
|
Date: Fri, 7 Sep 2018 13:31:15 -0600
|
|
Subject: [PATCH 103/103] Read NVMe model names from sysfs
|
|
|
|
parted currently shows the same generic model name for all NVMe devices:
|
|
|
|
# parted /dev/nvme0n1 -s print | grep Model
|
|
Model: NVMe Device (nvme)
|
|
|
|
If the model information is available in sysfs, display that instead:
|
|
|
|
# parted /dev/nvme0n1 -s print | grep Model
|
|
Model: THNSN5512GPU7 NVMe TOSHIBA 512GB (nvme)
|
|
|
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
---
|
|
libparted/arch/linux.c | 18 +++++++++++++++++-
|
|
1 file changed, 17 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
index 02d7a52..7d83dfb 100644
|
|
--- a/libparted/arch/linux.c
|
|
+++ b/libparted/arch/linux.c
|
|
@@ -1405,6 +1405,22 @@ init_sdmmc (PedDevice* dev)
|
|
return init_generic(dev, id);
|
|
}
|
|
|
|
+static int
|
|
+init_nvme (PedDevice* dev)
|
|
+{
|
|
+ int ret;
|
|
+ char *model = read_device_sysfs_file (dev, "model");
|
|
+
|
|
+ if (!model)
|
|
+ ret = init_generic (dev, _("NVMe Device"));
|
|
+ else {
|
|
+ ret = init_generic (dev, model);
|
|
+ free (model);
|
|
+ }
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
static PedDevice*
|
|
linux_new (const char* path)
|
|
{
|
|
@@ -1489,7 +1505,7 @@ linux_new (const char* path)
|
|
break;
|
|
|
|
case PED_DEVICE_NVME:
|
|
- if (!init_generic (dev, _("NVMe Device")))
|
|
+ if (!init_nvme (dev))
|
|
goto error_free_arch_specific;
|
|
break;
|
|
|
|
--
|
|
2.17.2
|
|
|