bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Handle syncing partition changes when using blkext majors (#6349


From: Brian C. Lane
Subject: [PATCH] Handle syncing partition changes when using blkext majors (#634980)
Date: Thu, 23 Sep 2010 16:36:41 -0700

Remove unused _device_get_partition_range function

* libparted/arch/linux.c (_device_get_partition_range): Remove unused function
* libparted/arch/linux.c (_disk_sync_part_table): Set lpn=256 for blkext majors
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]