summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--include/parted/device.in.h3
-rw-r--r--libparted/arch/linux.c14
-rw-r--r--parted/parted.c2
4 files changed, 19 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index cf7b39c..a92825c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
GNU parted NEWS -*- outline -*-
+ Parted now recognizes NVMe devices
+
* Noteworthy changes in release ?.? (????-??-??) [?]
** Bug Fixes
diff --git a/include/parted/device.in.h b/include/parted/device.in.h
index 82d4104..d38db44 100644
--- a/include/parted/device.in.h
+++ b/include/parted/device.in.h
@@ -49,7 +49,8 @@ typedef enum {
PED_DEVICE_VIRTBLK = 15,
PED_DEVICE_AOE = 16,
PED_DEVICE_MD = 17,
- PED_DEVICE_LOOP = 18
+ PED_DEVICE_LOOP = 18,
+ PED_DEVICE_NVME = 19
} PedDeviceType;
typedef struct _PedDevice PedDevice;
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 326b956..a22b1d7 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -278,6 +278,7 @@ struct blkdev_ioctl_param {
#define SDMMC_MAJOR 179
#define LOOP_MAJOR 7
#define MD_MAJOR 9
+#define BLKEXT_MAJOR 259
#define SCSI_BLK_MAJOR(M) ( \
(M) == SCSI_DISK0_MAJOR \
@@ -441,6 +442,12 @@ _is_virtblk_major (int major)
return _major_type_in_devices (major, "virtblk");
}
+static int
+_is_blkext_major (int major)
+{
+ return _major_type_in_devices (major, "blkext");
+}
+
#ifdef ENABLE_DEVICE_MAPPER
static int
_dm_task_run_wait (struct dm_task *task, uint32_t cookie)
@@ -692,6 +699,8 @@ _device_probe_type (PedDevice* dev)
dev->type = PED_DEVICE_LOOP;
} else if (dev_major == MD_MAJOR) {
dev->type = PED_DEVICE_MD;
+ } else if (_is_blkext_major(dev_major) && dev->path && strstr(dev->path, "nvme")) {
+ dev->type = PED_DEVICE_NVME;
} else {
dev->type = PED_DEVICE_UNKNOWN;
}
@@ -1465,6 +1474,11 @@ linux_new (const char* path)
goto error_free_arch_specific;
break;
+ case PED_DEVICE_NVME:
+ if (!init_generic (dev, _("NVMe Device")))
+ goto error_free_arch_specific;
+ break;
+
case PED_DEVICE_ATARAID:
if (!init_generic (dev, _("ATARAID Controller")))
goto error_free_arch_specific;
diff --git a/parted/parted.c b/parted/parted.c
index e6e4ac9..7e6c266 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -979,7 +979,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp)
"cpqarray", "file", "ataraid", "i2o",
"ubd", "dasd", "viodasd", "sx8", "dm",
"xvd", "sd/mmc", "virtblk", "aoe",
- "md", "loopback"};
+ "md", "loopback", "nvme"};
char* start = ped_unit_format (dev, 0);
PedUnit default_unit = ped_unit_get_default ();