From b2e8130d3696948d317d249124258555ef63b61b5d024f085cf478b40ea40fc2 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Tue, 14 Jun 2016 11:11:50 +0000 Subject: [PATCH 1/2] - Detect NVMe devices and fix the nvme partition naming scheme (bsc#982169) - libparted-Add-support-for-NVMe-devices.patch - libparted-fix-nvme-partition-naming.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=121 --- libparted-Add-support-for-NVMe-devices.patch | 99 ++++++++++++++++++++ libparted-fix-nvme-partition-naming.patch | 16 ++++ parted.changes | 8 ++ parted.spec | 6 ++ 4 files changed, 129 insertions(+) create mode 100644 libparted-Add-support-for-NVMe-devices.patch create mode 100644 libparted-fix-nvme-partition-naming.patch diff --git a/libparted-Add-support-for-NVMe-devices.patch b/libparted-Add-support-for-NVMe-devices.patch new file mode 100644 index 0000000..9529a55 --- /dev/null +++ b/libparted-Add-support-for-NVMe-devices.patch @@ -0,0 +1,99 @@ +From 02bb5fe15b89b0a0ffd4019c9d04f16c0af29d46 Mon Sep 17 00:00:00 2001 +From: Petr Uzel +Date: Tue, 14 Jun 2016 10:41:18 +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. +--- + include/parted/device.in.h | 3 ++- + libparted/arch/linux.c | 14 ++++++++++++++ + parted/parted.c | 2 +- + 3 files changed, 17 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 \ +@@ -463,6 +464,12 @@ _ensure_read_write (PedDevice *dev) + _flush_cache (dev); + } + ++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) +@@ -714,6 +721,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; + } +@@ -1473,6 +1482,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 +@@ -1035,7 +1035,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 (); diff --git a/libparted-fix-nvme-partition-naming.patch b/libparted-fix-nvme-partition-naming.patch new file mode 100644 index 0000000..31bd9d4 --- /dev/null +++ b/libparted-fix-nvme-partition-naming.patch @@ -0,0 +1,16 @@ +--- + libparted/arch/linux.c | 1 + + 1 file changed, 1 insertion(+) + +Index: parted-3.2/libparted/arch/linux.c +=================================================================== +--- parted-3.2.orig/libparted/arch/linux.c ++++ parted-3.2/libparted/arch/linux.c +@@ -2411,6 +2411,7 @@ _device_get_part_path (PedDevice const * + } else { + const char *p; + if (dev->type == PED_DEVICE_CPQARRAY || ++ dev->type == PED_DEVICE_NVME || + dev->type == PED_DEVICE_SDMMC) + p = "p"; + else if (dev->type == PED_DEVICE_DM) diff --git a/parted.changes b/parted.changes index 47865dd..f99c61d 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Jun 14 11:09:20 UTC 2016 - puzel@suse.com + +- Detect NVMe devices and fix the nvme partition naming scheme + (bsc#982169) + - libparted-Add-support-for-NVMe-devices.patch + - libparted-fix-nvme-partition-naming.patch + ------------------------------------------------------------------- Thu May 26 10:46:38 UTC 2016 - puzel@suse.com diff --git a/parted.spec b/parted.spec index df35c71..cd06241 100644 --- a/parted.spec +++ b/parted.spec @@ -59,6 +59,10 @@ Patch31: parted-do-not-warn-when-shrinking-in-script-mode.patch Patch32: libparted-Use-read-only-when-probing-devices-on-linu.patch Patch33: libparted-open-the-device-RO-and-lazily-switch-to-RW.patch Patch34: parted-implement-wipesignatures-option.patch + +# bsc#982169 +Patch35: libparted-Add-support-for-NVMe-devices.patch +Patch36: libparted-fix-nvme-partition-naming.patch Patch100: parted-fatresize-autoconf.patch BuildRequires: check-devel BuildRequires: device-mapper-devel >= 1.02.33 @@ -136,6 +140,8 @@ to develop applications that require these. %patch32 -p1 %patch33 -p1 %patch34 -p1 +%patch35 -p1 +%patch36 -p1 %patch100 -p1 %build From c3afce22ecd035ee2637c3cf968dc92fa6c3b89b19753c0b50df7acc5ec8a7fb Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Fri, 24 Jun 2016 07:49:52 +0000 Subject: [PATCH 2/2] Accepting request 403569 from home:jengelh:branches:Base:System - install_info should run in %preun; otherwise the files to operate are gone already. - Drop with-pic: only useful for static libs (which are not built) Drop redundant %clean and switch from LDFLAGS to LIBS because that's the proper variable name OBS-URL: https://build.opensuse.org/request/show/403569 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=122 --- parted.changes | 7 +++++++ parted.spec | 19 ++++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/parted.changes b/parted.changes index f99c61d..69d7f50 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Jun 18 07:08:01 UTC 2016 - jengelh@inai.de + +- install_info should run in %preun; otherwise the files to operate + are gone already. +- Drop with-pic: only useful for static libs (which are not built) + ------------------------------------------------------------------- Tue Jun 14 11:09:20 UTC 2016 - puzel@suse.com diff --git a/parted.spec b/parted.spec index cd06241..527cafd 100644 --- a/parted.spec +++ b/parted.spec @@ -89,7 +89,7 @@ and copying partitions, and the file systems on them. %package -n libparted0 Summary: Library for manipulating partitions -Group: System/Filesystems +Group: System/Libraries %description -n libparted0 Libparted is a library for creating, destroying, resizing, checking @@ -146,10 +146,9 @@ to develop applications that require these. %build export CFLAGS="%{optflags} `ncursesw6-config --cflags`" -export LDFLAGS="`ncursesw6-config --libs`" +export LIBS="`ncursesw6-config --libs`" AUTOPOINT=true autoreconf --force --install %configure --disable-static \ - --with-pic \ --enable-device-mapper=yes \ --enable-dynamic-loading=no \ --enable-selinux \ @@ -158,24 +157,18 @@ AUTOPOINT=true autoreconf --force --install make %{?_smp_mflags} %install -%makeinstall +%make_install rm %{buildroot}%{_libdir}/*.la %find_lang %{name} -%clean -rm -rf %{buildroot} - %post %install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz -%postun +%preun %install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz -%post -n libparted0 -/sbin/ldconfig - -%postun -n libparted0 -/sbin/ldconfig +%post -n libparted0 -p /sbin/ldconfig +%postun -n libparted0 -p /sbin/ldconfig %files %defattr(-,root,root)