diff -Nru parted-3.2/debian/changelog parted-3.2/debian/changelog --- parted-3.2/debian/changelog 2016-02-10 14:26:23.000000000 +0000 +++ parted-3.2/debian/changelog 2018-01-12 23:21:42.000000000 +0000 @@ -1,3 +1,9 @@ +parted (3.2-15ubuntu0.1) xenial; urgency=medium + + * Cherry-pick upstream patch to add support NVMe devices (LP: #1742787). + + -- dann frazier Fri, 12 Jan 2018 16:21:42 -0700 + parted (3.2-15) unstable; urgency=medium * Cherry-pick upstream patch to check DASD geometry more carefully to diff -Nru parted-3.2/debian/patches/Add-support-for-NVMe-devices.patch parted-3.2/debian/patches/Add-support-for-NVMe-devices.patch --- parted-3.2/debian/patches/Add-support-for-NVMe-devices.patch 1970-01-01 00:00:00.000000000 +0000 +++ parted-3.2/debian/patches/Add-support-for-NVMe-devices.patch 2018-01-12 23:21:24.000000000 +0000 @@ -0,0 +1,116 @@ +From e4ae4330f3e33201aeeed3b7ca88e15d98d03e13 Mon Sep 17 00:00:00 2001 +From: Petr Uzel +Date: Tue, 14 Jun 2016 13:17:00 +0200 +Subject: [PATCH] Add support for NVMe devices + +Recognize NVMe Devices, so "parted -s /dev/nvme0n1" now prints +"NVMe Device (nvme)" instead of "Model: Unknown (unknown)". + +In order for a device to be recognized as NVMe, it has to +have a 'blkext' major number. But since this major can be +used also by other device types, we also check the device +path contains 'nvme' as a substring. + +* NEWS: Mention the change +* include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_NVME +* libparted/arch/linux.c(BLKEXT_MAJOR): New define. +* libparted/arch/linux.c(_is_blkext_major): New function. +* libparted/arch/linux.c(_device_probe_type): Recognize NVMe devices. +* libparted/arch/linux.c(linux_new): Handle NVMe devices. +* parted/parted.c(do_print): Add "nvme" to list of transports. + +Signed-off-by: Brian C. Lane +--- + NEWS | 2 ++ + include/parted/device.in.h | 3 ++- + libparted/arch/linux.c | 14 ++++++++++++++ + parted/parted.c | 2 +- + 4 files changed, 19 insertions(+), 2 deletions(-) + +Index: parted-3.2/include/parted/device.in.h +=================================================================== +--- parted-3.2.orig/include/parted/device.in.h ++++ parted-3.2/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; +Index: parted-3.2/libparted/arch/linux.c +=================================================================== +--- parted-3.2.orig/libparted/arch/linux.c ++++ parted-3.2/libparted/arch/linux.c +@@ -279,6 +279,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 \ +@@ -440,6 +441,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) +@@ -691,6 +698,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; + } +@@ -1454,6 +1463,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; +Index: parted-3.2/parted/parted.c +=================================================================== +--- parted-3.2.orig/parted/parted.c ++++ parted-3.2/parted/parted.c +@@ -972,7 +972,7 @@ _print_disk_info (const PedDevice *dev, + "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 (); +Index: parted-3.2/include/parted/device.h +=================================================================== +--- parted-3.2.orig/include/parted/device.h ++++ parted-3.2/include/parted/device.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 -Nru parted-3.2/debian/patches/series parted-3.2/debian/patches/series --- parted-3.2/debian/patches/series 2016-02-10 14:25:07.000000000 +0000 +++ parted-3.2/debian/patches/series 2018-01-12 23:21:42.000000000 +0000 @@ -18,3 +18,4 @@ dasd-enhance-probing.patch dm-512b-sectors.patch fdasd-check-geometry.patch +Add-support-for-NVMe-devices.patch