[parted] Add patch to handle syncing partition using blkext majors (#634980)
Brian C. Lane
bcl at fedoraproject.org
Fri Sep 17 22:25:59 UTC 2010
commit dfb1e1bc531f4e40233012735fc38520f6359de2
Author: Brian C. Lane <bcl at redhat.com>
Date: Fri Sep 17 09:05:38 2010 -0700
Add patch to handle syncing partition using blkext majors (#634980)
Removed unused _device_get_partition_range function
change back to gnupg for verifying the signature
Resolves: rhbz#634980
Related: rhbz#629719
parted-2.3-lpn.patch | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
parted.spec | 12 +++++++-
2 files changed, 78 insertions(+), 2 deletions(-)
---
diff --git a/parted-2.3-lpn.patch b/parted-2.3-lpn.patch
new file mode 100644
index 0000000..da9c3c2
--- /dev/null
+++ b/parted-2.3-lpn.patch
@@ -0,0 +1,68 @@
+From 763d9aca0fd5c79c46243774c17b562013a93418 Mon Sep 17 00:00:00 2001
+From: Brian C. Lane <bcl at redhat.com>
+Date: Fri, 17 Sep 2010 09:21:24 -0700
+Subject: [PATCH] Handle syncing partition changes when using blkext majors (#634980)
+
+Also remove unused _device_get_partition_range function
+---
+ libparted/arch/linux.c | 37 ++++---------------------------------
+ 1 files changed, 4 insertions(+), 33 deletions(-)
+
+diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
+index 38f4e31..225d06b 100644
+--- a/libparted/arch/linux.c
++++ b/libparted/arch/linux.c
+@@ -2391,35 +2391,6 @@ _blkpg_remove_partition (PedDisk* disk, int n)
+ }
+
+ /*
+- * The number of partitions that a device can have depends on the kernel.
+- * If we don't find this value in /sys/block/DEV/range, we will use our own
+- * value.
+- */
+-static unsigned int
+-_device_get_partition_range(PedDevice* dev)
+-{
+- int range, r;
+- char path[128];
+- FILE* fp;
+- bool ok;
+-
+- r = snprintf(path, sizeof(path), "/sys/block/%s/range",
+- last_component(dev->path));
+- if (r < 0 || r >= sizeof(path))
+- return MAX_NUM_PARTS;
+-
+- fp = fopen(path, "r");
+- if (!fp)
+- return MAX_NUM_PARTS;
+-
+- ok = fscanf(fp, "%d", &range) == 1;
+- fclose(fp);
+-
+- /* (range <= 0) is none sense.*/
+- return ok && range > 0 ? range : MAX_NUM_PARTS;
+-}
+-
+-/*
+ * Sync the partition table in two step process:
+ * 1. Remove all of the partitions from the kernel's tables, but do not attempt
+ * removal of any partition for which the corresponding ioctl call fails.
+@@ -2441,10 +2412,10 @@ _disk_sync_part_table (PedDisk* disk)
+ int lpn;
+
+ /* lpn = largest partition number. */
+- if (ped_disk_get_max_supported_partition_count(disk, &lpn))
+- lpn = PED_MIN(lpn, _device_get_partition_range(disk->dev));
+- else
+- lpn = _device_get_partition_range(disk->dev);
++ if (!ped_disk_get_max_supported_partition_count(disk, &lpn))
++ lpn = 256; /* HDG: not pretty but there is no other way
++ as we must make sure any removed partitions
++ actually get removed from the kernels view */
+
+ /* Its not possible to support largest_partnum < 0.
+ * largest_partnum == 0 would mean does not support partitions.
+--
+1.7.2.2
+
diff --git a/parted.spec b/parted.spec
index 5ef5a84..d5e6ec4 100644
--- a/parted.spec
+++ b/parted.spec
@@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 2.3
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@@ -16,6 +16,8 @@ Source2: pubkey.jim.meyering
# Recognize scsi disks with a high major as such
Patch0: parted-2.2-hi-major-sd-rh611691.patch
+# Report partitions changes when using blkext major numbers
+Patch1: parted-2.3-lpn.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@@ -27,7 +29,7 @@ BuildRequires: device-mapper-devel
BuildRequires: libselinux-devel
BuildRequires: libuuid-devel
BuildRequires: libblkid-devel >= 2.17
-BuildRequires: gnupg2
+BuildRequires: gnupg
Requires(post): /sbin/ldconfig
Requires(post): /sbin/install-info
@@ -59,6 +61,7 @@ Parted library, you need to install this package.
gpg --import %{SOURCE2}
gpg --verify %{SOURCE1} %{SOURCE0}
%patch0 -p1
+%patch1 -p1
iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS
@@ -134,6 +137,11 @@ fi
%changelog
+* Fri Sep 17 2010 Brian C. Lane <bcl at redhat.com> 2.3-2
+- Add patch to handle syncing partition changes when using blkext majors
+- Resolves rhbz#634980
+- Related rhbz#629719
+
* Tue Jul 20 2010 Hans de Goede <hdegoede at redhat.com> 2.3-1
- Rebase to new upstream 2.3 release
- Drop all patches (all upstreamed)
More information about the scm-commits
mailing list