diff -u parted-2.2/debian/changelog parted-2.2/debian/changelog --- parted-2.2/debian/changelog +++ parted-2.2/debian/changelog @@ -1,3 +1,14 @@ +parted (2.2-1ubuntu4) karmic; urgency=low + + * put-back-BLKPG.patch: Upstream removed the code using the new + BLKPG ioctls instead of the old BLKRRPART ioctl to update the + in-kernel partition table. This patch reverses that change. + * error-check-BLKPG.patch: Add error checking to the NLKPG code to + fix up the old BLKPG code to satisfy upstream. (LP: #540940) + * Refresh quilt patches. + + -- Phillip Susi Thu, 18 Mar 2010 16:00:57 -0400 + parted (2.2-1ubuntu3) lucid; urgency=low * gptsync.patch (update): Set OSType 0xee (same as EFI System Partitions) diff -u parted-2.2/debian/patches/dmraid.patch parted-2.2/debian/patches/dmraid.patch --- parted-2.2/debian/patches/dmraid.patch +++ parted-2.2/debian/patches/dmraid.patch @@ -5,10 +5,10 @@ nodes created needlessly, and make sure that partition nodes for DM-RAID devices are not probed. -Index: b/libparted/arch/linux.c +Index: parted-2.2/libparted/arch/linux.c =================================================================== ---- a/libparted/arch/linux.c -+++ b/libparted/arch/linux.c +--- parted-2.2.orig/libparted/arch/linux.c 2010-03-25 12:39:16.000000000 -0400 ++++ parted-2.2/libparted/arch/linux.c 2010-03-25 12:39:27.000000000 -0400 @@ -266,6 +266,10 @@ static char* _device_get_part_path (PedDevice* dev, int num); @@ -50,7 +50,7 @@ } else if (dev->type == PED_DEVICE_DAC960 || dev->type == PED_DEVICE_CPQARRAY || dev->type == PED_DEVICE_ATARAID -@@ -2434,6 +2450,8 @@ +@@ -2627,6 +2643,8 @@ char* vol_name = NULL; const char* dev_name = NULL; char* params = NULL; @@ -59,7 +59,7 @@ LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev); if (!_has_partitions(disk)) -@@ -2472,6 +2490,12 @@ +@@ -2665,6 +2683,12 @@ dm_task_set_name (task, vol_name); dm_task_add_target (task, 0, part->geom.length, "linear", params); @@ -72,7 +72,7 @@ rc = dm_task_run (task); if (rc >= 0) { //printf("0 %ld linear %s\n", part->geom.length, params); -@@ -2479,6 +2503,7 @@ +@@ -2672,6 +2696,7 @@ dm_task_destroy(task); free(params); free(vol_name); @@ -80,7 +80,7 @@ return 1; } else { _dm_remove_map_name(vol_name); -@@ -2519,6 +2544,85 @@ +@@ -2712,6 +2737,85 @@ } return rc; } diff -u parted-2.2/debian/patches/update-abi-symbols.patch parted-2.2/debian/patches/update-abi-symbols.patch --- parted-2.2/debian/patches/update-abi-symbols.patch +++ parted-2.2/debian/patches/update-abi-symbols.patch @@ -4,17 +4,17 @@ Update ABI symbols -diff --git a/scripts/data/abi/baseline_symbols.txt b/scripts/data/abi/baseline_symbols.txt -index 010a55e..2af5a34 100644 ---- a/scripts/data/abi/baseline_symbols.txt -+++ b/scripts/data/abi/baseline_symbols.txt +Index: parted-2.2/scripts/data/abi/baseline_symbols.txt +=================================================================== +--- parted-2.2.orig/scripts/data/abi/baseline_symbols.txt 2010-03-23 11:11:47.000000000 -0400 ++++ parted-2.2/scripts/data/abi/baseline_symbols.txt 2010-03-23 11:23:46.000000000 -0400 @@ -1,4 +1,5 @@ FUNC:__efi_crc32 +FUNC:__xargmatch_internal FUNC:_amiga_add_id FUNC:_amiga_free_ids FUNC:_amiga_id_in_list -@@ -12,8 +13,21 @@ FUNC:_ped_partition_alloc +@@ -12,8 +13,21 @@ FUNC:_ped_partition_attempt_align FUNC:_ped_partition_free FUNC:_update_stats @@ -37,7 +37,7 @@ FUNC:ext2_bcache_deinit FUNC:ext2_bcache_dump FUNC:ext2_bcache_flush -@@ -28,6 +42,7 @@ FUNC:ext2_close +@@ -28,6 +42,7 @@ FUNC:ext2_commit_metadata FUNC:ext2_copy_block FUNC:ext2_destroy_dev_handle @@ -45,7 +45,7 @@ FUNC:ext2_do_inode FUNC:ext2_find_free_block FUNC:ext2_find_free_inode -@@ -51,7 +66,6 @@ FUNC:ext2_write_blocks +@@ -51,7 +66,6 @@ FUNC:ext2_write_inode FUNC:ext2_zero_blocks FUNC:ext2_zero_inode @@ -53,7 +53,7 @@ FUNC:fat_alloc FUNC:fat_alloc_buffers FUNC:fat_boot_sector_analyse -@@ -164,9 +178,12 @@ FUNC:fat_write_sync_clusters +@@ -164,9 +178,12 @@ FUNC:fat_write_sync_fragment FUNC:fat_write_sync_fragments FUNC:findit @@ -66,7 +66,7 @@ FUNC:hfs_and_wrapper_probe FUNC:hfs_btree_search FUNC:hfs_file_close -@@ -205,7 +222,11 @@ FUNC:hfsplus_probe +@@ -205,7 +222,11 @@ FUNC:hfsplus_read_bad_blocks FUNC:hfsplus_update_vh FUNC:hfsx_probe @@ -79,7 +79,7 @@ FUNC:ped_alignment_align_down FUNC:ped_alignment_align_nearest FUNC:ped_alignment_align_up -@@ -234,6 +255,7 @@ FUNC:ped_constraint_solve_nearest +@@ -234,6 +255,7 @@ FUNC:ped_debug FUNC:ped_debug_set_handler FUNC:ped_device_begin_external_access @@ -87,7 +87,7 @@ FUNC:ped_device_check FUNC:ped_device_close FUNC:ped_device_destroy -@@ -241,7 +263,11 @@ FUNC:ped_device_end_external_access +@@ -241,7 +263,11 @@ FUNC:ped_device_free_all FUNC:ped_device_get FUNC:ped_device_get_constraint @@ -99,7 +99,7 @@ FUNC:ped_device_is_busy FUNC:ped_device_open FUNC:ped_device_probe_all -@@ -250,6 +276,8 @@ FUNC:ped_device_sync +@@ -250,6 +276,8 @@ FUNC:ped_device_sync_fast FUNC:ped_device_write FUNC:ped_disk_add_partition @@ -108,7 +108,7 @@ FUNC:ped_disk_amiga_done FUNC:ped_disk_amiga_init FUNC:ped_disk_bsd_done -@@ -266,18 +294,27 @@ FUNC:ped_disk_duplicate +@@ -266,18 +294,27 @@ FUNC:ped_disk_dvh_done FUNC:ped_disk_dvh_init FUNC:ped_disk_extended_partition @@ -136,7 +136,7 @@ FUNC:ped_disk_maximize_partition FUNC:ped_disk_minimize_extended_partition FUNC:ped_disk_msdos_done -@@ -290,6 +327,7 @@ FUNC:ped_disk_pc98_init +@@ -290,6 +327,7 @@ FUNC:ped_disk_print FUNC:ped_disk_probe FUNC:ped_disk_remove_partition @@ -144,7 +144,7 @@ FUNC:ped_disk_set_partition_geom FUNC:ped_disk_sun_done FUNC:ped_disk_sun_init -@@ -298,16 +336,18 @@ FUNC:ped_disk_type_get +@@ -298,16 +336,18 @@ FUNC:ped_disk_type_get_next FUNC:ped_disk_type_register FUNC:ped_disk_type_unregister @@ -165,7 +165,7 @@ FUNC:ped_file_system_amiga_done FUNC:ped_file_system_amiga_init FUNC:ped_file_system_check -@@ -352,6 +392,7 @@ FUNC:ped_geometry_intersect +@@ -352,6 +392,7 @@ FUNC:ped_geometry_map FUNC:ped_geometry_new FUNC:ped_geometry_read @@ -173,7 +173,7 @@ FUNC:ped_geometry_set FUNC:ped_geometry_set_end FUNC:ped_geometry_set_start -@@ -376,13 +417,11 @@ FUNC:ped_partition_is_active +@@ -376,13 +417,11 @@ FUNC:ped_partition_is_busy FUNC:ped_partition_is_flag_available FUNC:ped_partition_new @@ -187,7 +187,7 @@ FUNC:ped_round_down_to FUNC:ped_round_to_nearest FUNC:ped_round_up_to -@@ -406,45 +445,112 @@ FUNC:ped_unit_get_size +@@ -406,45 +445,112 @@ FUNC:ped_unit_parse FUNC:ped_unit_parse_custom FUNC:ped_unit_set_default diff -u parted-2.2/debian/patches/series parted-2.2/debian/patches/series --- parted-2.2/debian/patches/series +++ parted-2.2/debian/patches/series @@ -2,6 +2,8 @@ doc-package.patch # For upstream merging +put-back-BLKPG.patch +error-check-BLKPG.patch preserve-hidden-parts.patch update-ext4-code.patch #unblacklist-md.patch diff -u parted-2.2/debian/patches/linux-exports.patch parted-2.2/debian/patches/linux-exports.patch --- parted-2.2/debian/patches/linux-exports.patch +++ parted-2.2/debian/patches/linux-exports.patch @@ -3,11 +3,11 @@ Last-Update: 2010-02-26 Description: Don't export functions only used via linux_dev_ops. -Index: b/libparted/arch/linux.c +Index: parted-2.2/libparted/arch/linux.c =================================================================== ---- a/libparted/arch/linux.c -+++ b/libparted/arch/linux.c -@@ -2563,7 +2563,7 @@ +--- parted-2.2.orig/libparted/arch/linux.c 2010-03-25 12:39:36.000000000 -0400 ++++ parted-2.2/libparted/arch/linux.c 2010-03-25 12:39:47.000000000 -0400 +@@ -2779,7 +2779,7 @@ } #if USE_BLKID @@ -16,7 +16,7 @@ linux_get_minimum_alignment(const PedDevice *dev) { blkid_topology tp = LINUX_SPECIFIC(dev)->topology; -@@ -2581,7 +2581,7 @@ +@@ -2797,7 +2797,7 @@ blkid_topology_get_minimum_io_size(tp) / dev->sector_size); } diff -u parted-2.2/debian/patches/udevadm-settle.patch parted-2.2/debian/patches/udevadm-settle.patch --- parted-2.2/debian/patches/udevadm-settle.patch +++ parted-2.2/debian/patches/udevadm-settle.patch @@ -7,10 +7,10 @@ This should be replaced by a proper completion-notification mechanism between the kernel and udev. -Index: b/libparted/arch/linux.c +Index: parted-2.2/libparted/arch/linux.c =================================================================== ---- a/libparted/arch/linux.c -+++ b/libparted/arch/linux.c +--- parted-2.2.orig/libparted/arch/linux.c 2010-03-25 12:38:51.000000000 -0400 ++++ parted-2.2/libparted/arch/linux.c 2010-03-25 12:39:16.000000000 -0400 @@ -26,6 +26,7 @@ #include #endif @@ -19,53 +19,61 @@ #include #include #include -@@ -2551,18 +2552,45 @@ +@@ -2757,9 +2758,25 @@ static int linux_disk_commit (PedDisk* disk) { + int ret = 1; + - if (!_has_partitions (disk)) - return 1; - -+ /* Modern versions of udev may notice the write activity on -+ * partition devices caused by _flush_cache, and may decide to -+ * synthesise some change events as a result. These may in turn run -+ * programs that open partition devices, which will race with us -+ * trying to remove those devices. To avoid this, we need to wait -+ * until udevd has finished processing its event queue. -+ * TODO: for upstream submission, this should check whether udevadm -+ * exists on $PATH. -+ */ -+ if (system ("udevadm settle") != 0) { -+ /* ignore failures */ -+ } -+ ++ /* Modern versions of udev may notice the write activity on ++ * partition devices caused by _flush_cache, and may decide to ++ * synthesise some change events as a result. These may in turn run ++ * programs that open partition devices, which will race with us ++ * trying to remove those devices. To avoid this, we need to wait ++ * until udevd has finished processing its event queue. ++ * TODO: for upstream submission, this should check whether udevadm ++ * exists on $PATH. ++ */ ++ if (system ("udevadm settle") != 0) { ++ /* ignore failures */ ++ } #ifdef ENABLE_DEVICE_MAPPER - if (disk->dev->type == PED_DEVICE_DM) - return _dm_reread_part_table (disk); + if (disk->dev->type == PED_DEVICE_DM) { -+ ret = _dm_reread_part_table (disk); -+ goto out; -+ } ++ ret = _dm_reread_part_table (disk); ++ goto out; ++ } #endif if (disk->dev->type != PED_DEVICE_FILE) { + /* The ioctl() command BLKPG_ADD_PARTITION does not notify +@@ -2772,13 +2789,26 @@ + if (disk->dev->type != PED_DEVICE_DASD && + _have_blkpg () ) { + if (_disk_sync_part_table (disk)) +- return 1; ++ { ++ ret = 1; ++ goto out; ++ } + } + - return _kernel_reread_part_table (disk->dev); + ret = _kernel_reread_part_table (disk->dev); ++ goto out; } ++ out: ++ /* Now we wait for udevd to finish creating device nodes based on ++ * the above activity, so that callers can reliably use them. ++ * TODO: for upstream submission, this should check whether udevadm ++ * exists on $PATH. ++ */ ++ if (system ("udevadm settle") != 0) { ++ /* ignore failures */ ++ } - return 1; -+out: -+ /* Now we wait for udevd to finish creating device nodes based on -+ * the above activity, so that callers can reliably use them. -+ * TODO: for upstream submission, this should check whether udevadm -+ * exists on $PATH. -+ */ -+ if (system ("udevadm settle") != 0) { -+ /* ignore failures */ -+ } -+ -+ return ret; ++ return ret; } #if USE_BLKID only in patch2: unchanged: --- parted-2.2.orig/debian/patches/put-back-BLKPG.patch +++ parted-2.2/debian/patches/put-back-BLKPG.patch @@ -0,0 +1,243 @@ +From: Phillip Susi +Description: Upstream removed the code using the new BLKPG + ioctls instead of the old BLKRRPART ioctl to update the + in-kernel partition table. This patch reverses that change. + The reason for this is because BLKRRPART fails if any + partition on the disk is in use, but the BLKPG ioctls allow + you to manipulate the other partitions on the disk without + requiring a reboot. Also BLKRRPART requires that the kernel + understand the partition table on the disk, which may not + always be the case. +Index: parted-2.2/libparted/arch/linux.c +=================================================================== +--- parted-2.2.orig/libparted/arch/linux.c 2010-03-23 11:36:28.000000000 -0400 ++++ parted-2.2/libparted/arch/linux.c 2010-03-23 11:42:58.000000000 -0400 +@@ -19,7 +19,7 @@ + + #include + #include +- ++#include + #include + #include + #if defined __s390__ || defined __s390x__ +@@ -2299,6 +2299,176 @@ + return 0; + } + ++static int ++_blkpg_part_command (PedDevice* dev, struct blkpg_partition* part, int op) ++{ ++ LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); ++ struct blkpg_ioctl_arg ioctl_arg; ++ ++ ioctl_arg.op = op; ++ ioctl_arg.flags = 0; ++ ioctl_arg.datalen = sizeof (struct blkpg_partition); ++ ioctl_arg.data = (void*) part; ++ ++ return ioctl (arch_specific->fd, BLKPG, &ioctl_arg) == 0; ++} ++ ++static int ++_blkpg_add_partition (PedDisk* disk, const PedPartition *part) ++{ ++ struct blkpg_partition linux_part; ++ const char* vol_name; ++ char* dev_name; ++ ++ PED_ASSERT(disk != NULL, return 0); ++ PED_ASSERT(disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, ++ return 0); ++ ++ if (ped_disk_type_check_feature (disk->type, ++ PED_DISK_TYPE_PARTITION_NAME)) ++ vol_name = ped_partition_get_name (part); ++ else ++ vol_name = NULL; ++ ++ dev_name = _device_get_part_path (disk->dev, part->num); ++ if (!dev_name) ++ return 0; ++ ++ memset (&linux_part, 0, sizeof (linux_part)); ++ linux_part.start = part->geom.start * disk->dev->sector_size; ++ /* see fs/partitions/msdos.c:msdos_partition(): "leave room for LILO" */ ++ if (part->type & PED_PARTITION_EXTENDED) ++ linux_part.length = part->geom.length == 1 ? 512 : 1024; ++ else ++ linux_part.length = part->geom.length * disk->dev->sector_size; ++ linux_part.pno = part->num; ++ strncpy (linux_part.devname, dev_name, BLKPG_DEVNAMELTH); ++ if (vol_name) ++ strncpy (linux_part.volname, vol_name, BLKPG_VOLNAMELTH); ++ ++ free (dev_name); ++ ++ if (!_blkpg_part_command (disk->dev, &linux_part, ++ BLKPG_ADD_PARTITION)) { ++ return ped_exception_throw ( ++ PED_EXCEPTION_ERROR, ++ PED_EXCEPTION_IGNORE_CANCEL, ++ _("Error informing the kernel about modifications to " ++ "partition %s -- %s. This means Linux won't know " ++ "about any changes you made to %s until you reboot " ++ "-- so you shouldn't mount it or use it in any way " ++ "before rebooting."), ++ linux_part.devname, ++ strerror (errno), ++ linux_part.devname) ++ == PED_EXCEPTION_IGNORE; ++ } ++ ++ return 1; ++} ++ ++static int ++_blkpg_remove_partition (PedDisk* disk, int n) ++{ ++ struct blkpg_partition linux_part; ++ ++ memset (&linux_part, 0, sizeof (linux_part)); ++ linux_part.pno = n; ++ return _blkpg_part_command (disk->dev, &linux_part, ++ BLKPG_DEL_PARTITION); ++} ++ ++/* ++ * 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. ++ * 2. Add all the partitions that we hold in disk. ++ * ++ * To achieve this two step process we must calculate the minimum number of ++ * maximum possible partitions between what linux supports and what the label ++ * type supports. EX: ++ * ++ * number=MIN(max_parts_supported_in_linux,max_parts_supported_in_msdos_tables) ++ */ ++static int ++_disk_sync_part_table (PedDisk* disk) ++{ ++ PED_ASSERT(disk != NULL, return 0); ++ PED_ASSERT(disk->dev != NULL, return 0); ++ 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); ++ ++ /* Its not possible to support largest_partnum < 0. ++ * largest_partnum == 0 would mean does not support partitions. ++ * */ ++ if(lpn < 0) ++ return 0; ++ ++ int *rets = ped_malloc(sizeof(int) * lpn); ++ int *errnums = ped_malloc(sizeof(int) * lpn); ++ int ret = 1; ++ int i; ++ ++ for (i = 1; i <= lpn; i++) { ++ rets[i - 1] = _blkpg_remove_partition (disk, i); ++ errnums[i - 1] = errno; ++ } ++ ++ for (i = 1; i <= lpn; i++) { ++ const PedPartition *part = ped_disk_get_partition (disk, i); ++ if (part) { ++ /* busy... so we won't (can't!) disturb ;) Prolly ++ * doesn't matter anyway, because users shouldn't be ++ * changing mounted partitions anyway... ++ */ ++ if (!rets[i - 1] && errnums[i - 1] == EBUSY) ++ continue; ++ ++ /* add the (possibly modified or new) partition */ ++ if (!_blkpg_add_partition (disk, part)) ++ ret = 0; ++ } ++ } ++ ++ free (rets); ++ free (errnums); ++ return ret; ++} ++ + #ifdef ENABLE_DEVICE_MAPPER + static int + _dm_remove_map_name(char *name) +@@ -2546,16 +2716,39 @@ + } + + static int +-linux_disk_commit (PedDisk* disk) ++_have_blkpg () + { +- if (!_has_partitions (disk)) +- return 1; ++ static int have_blkpg = -1; ++ int kver; ++ ++ if (have_blkpg != -1) ++ return have_blkpg; ++ ++ kver = _get_linux_version(); ++ return have_blkpg = kver >= KERNEL_VERSION (2,4,0) ? 1 : 0; ++} + ++static int ++linux_disk_commit (PedDisk* disk) ++{ + #ifdef ENABLE_DEVICE_MAPPER + if (disk->dev->type == PED_DEVICE_DM) + return _dm_reread_part_table (disk); + #endif + if (disk->dev->type != PED_DEVICE_FILE) { ++ /* The ioctl() command BLKPG_ADD_PARTITION does not notify ++ * the devfs system; consequently, /proc/partitions will not ++ * be up to date, and the proper links in /dev are not ++ * created. Therefore, if using DevFS, we must get the kernel ++ * to re-read and grok the partition table. ++ */ ++ /* Work around kernel dasd problem so we really do BLKRRPART */ ++ if (disk->dev->type != PED_DEVICE_DASD && ++ _have_blkpg () ) { ++ if (_disk_sync_part_table (disk)) ++ return 1; ++ } ++ + return _kernel_reread_part_table (disk->dev); + } + only in patch2: unchanged: --- parted-2.2.orig/debian/patches/error-check-BLKPG.patch +++ parted-2.2/debian/patches/error-check-BLKPG.patch @@ -0,0 +1,60 @@ +From: Phillip Susi +Description: In the event that some partitions are in use, + they can not be modified in the running kernel usign BLKPG. + Warn the user that this is the case and advise them to reboot, + just like we do when BLKRRPART fails for the same reason, unless + the partition in question is unchanged. +Index: parted-2.2/libparted/arch/linux.c +=================================================================== +--- parted-2.2.orig/libparted/arch/linux.c 2010-03-25 12:16:46.000000000 -0400 ++++ parted-2.2/libparted/arch/linux.c 2010-03-25 12:38:37.000000000 -0400 +@@ -2411,7 +2411,9 @@ + * 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. +- * 2. Add all the partitions that we hold in disk. ++ * 2. Add all the partitions that we hold in disk, throwing a warning ++ * if we can not beacuse step 1 failed to remove it and it is not being ++ * added back with the same start and length. + * + * To achieve this two step process we must calculate the minimum number of + * maximum possible partitions between what linux supports and what the label +@@ -2451,12 +2453,33 @@ + for (i = 1; i <= lpn; i++) { + const PedPartition *part = ped_disk_get_partition (disk, i); + if (part) { +- /* busy... so we won't (can't!) disturb ;) Prolly +- * doesn't matter anyway, because users shouldn't be +- * changing mounted partitions anyway... +- */ + if (!rets[i - 1] && errnums[i - 1] == EBUSY) +- continue; ++ { ++ struct hd_geometry geom; ++ unsigned long long length; ++ int fd; ++ char *dev_name; ++ ++ memset( &geom, 0, sizeof( geom ) ); ++ length = 0; ++ /* get start and length of existing partition */ ++ dev_name = _device_get_part_path (disk->dev, i); ++ fd = open( dev_name, O_RDONLY ); ++ ioctl( fd, HDIO_GETGEO, &geom ); ++ ioctl( fd, BLKGETSIZE64, &length ); ++ close( fd ); ++ if( geom.start != part->geom.start || ++ length != part->geom.length ) ++ ped_exception_throw( ++ PED_EXCEPTION_WARNING, ++ PED_EXCEPTION_IGNORE, ++ _("WARNING: partition %d on %s could not be modified, probably " ++ "because it is in use. As a result, the old partition " ++ "will remain in use until after reboot. You should reboot " ++ "now before making further changes."), ++ i, disk->dev->path); ++ continue; ++ } + + /* add the (possibly modified or new) partition */ + if (!_blkpg_add_partition (disk, part))