- Fix crash when partitioning loopback devices (#546622)

- Drop no-cylinder-align patch:
- its functionality is superseeded by the per disk flags
- its only user (pyparted) has been updated to use those
- this is not upstream so we don't want other programs to start using it
This commit is contained in:
Hans de Goede 2009-12-20 10:19:49 +00:00
parent ce6563fae4
commit c11ab73298
5 changed files with 41 additions and 18 deletions

View File

@ -287,17 +287,20 @@ diff -up parted-1.9.0/libparted/labels/dos.c.diskflags parted-1.9.0/libparted/la
}
#ifndef DISCOVER_ONLY
@@ -2029,7 +2083,9 @@ msdos_partition_align (PedPartition* par
@@ -2029,8 +2082,11 @@ msdos_partition_align (PedPartition* par
partition_probe_bios_geometry (part, &bios_geom);
- if (ped_disk_align_to_cylinders_on())
- if (_align (part, &bios_geom, constraint))
- return 1;
+ DosDiskData *disk_specific = part->disk->disk_specific;
+ if (ped_disk_align_to_cylinders_on() &&
+ disk_specific->cylinder_alignment)
if (_align (part, &bios_geom, constraint))
return 1;
+ if (disk_specific->cylinder_alignment)
+ if (_align (part, &bios_geom, constraint))
+ return 1;
+
if (_align_no_geom (part, constraint))
return 1;
@@ -2324,6 +2380,10 @@ static PedDiskOps msdos_disk_ops = {
write: NULL,
#endif

View File

@ -68,15 +68,14 @@ diff -up parted-1.9.0/include/parted/disk.h.export-align parted-1.9.0/include/pa
};
struct _PedDiskType {
@@ -263,6 +264,8 @@ extern int ped_disk_get_last_partition_n
@@ -263,6 +264,7 @@ extern int ped_disk_get_last_partition_n
extern int ped_disk_get_max_primary_partition_count (const PedDisk* disk);
extern bool ped_disk_get_max_supported_partition_count(const PedDisk* disk,
int* supported);
+extern PedAlignment *ped_disk_get_partition_alignment(const PedDisk *disk);
+
extern int ped_disk_align_to_cylinders_on();
extern int ped_disk_align_to_cylinders_toggle();
/** @} */
diff -up parted-1.9.0/include/parted/natmath.h.export-align parted-1.9.0/include/parted/natmath.h
--- parted-1.9.0/include/parted/natmath.h.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/include/parted/natmath.h 2009-11-03 11:30:46.000000000 +0100

View File

@ -18,3 +18,19 @@ diff -up parted-1.9.0/libparted/arch/linux.c.orig parted-1.9.0/libparted/arch/li
} else {
dev->type = PED_DEVICE_UNKNOWN;
}
@@ -1048,6 +1048,15 @@ init_file (PedDevice* dev)
if (!ped_device_open (dev))
goto error;
+ dev->sector_size = PED_SECTOR_SIZE_DEFAULT;
+ char *p = getenv ("PARTED_SECTOR_SIZE");
+ if (p) {
+ int s = atoi (p);
+ if (0 < s && s % 512 == 0)
+ dev->sector_size = s;
+ }
+ dev->phys_sector_size = dev->sector_size;
+
if (S_ISBLK(dev_stat.st_mode))
dev->length = _device_get_length (dev);
else

View File

@ -1,15 +1,14 @@
--- parted-1.9.0.orig/include/parted/disk.h 2009-12-15 10:32:24.000000000 +0100
+++ parted-1.9.0/include/parted/disk.h 2009-12-15 10:59:26.000000000 +0100
@@ -266,6 +266,9 @@
@@ -265,6 +265,8 @@ extern int ped_disk_get_max_primary_part
extern bool ped_disk_get_max_supported_partition_count(const PedDisk* disk,
int* supported);
extern PedAlignment *ped_disk_get_partition_alignment(const PedDisk *disk);
+extern PedSector ped_disk_max_partition_length (const PedDisk *disk);
+extern PedSector ped_disk_max_partition_start_sector (const PedDisk *disk);
+
extern int ped_disk_align_to_cylinders_on();
extern int ped_disk_align_to_cylinders_toggle();
/** @} */
--- parted-1.9.0.orig/libparted/disk.c 2009-12-15 10:32:24.000000000 +0100
+++ parted-1.9.0/libparted/disk.c 2009-12-15 10:55:16.000000000 +0100
@@ -738,6 +738,40 @@

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 1.9.0
Release: 24%{?dist}
Release: 25%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -14,7 +14,6 @@ Patch1: %{name}-1.9.0-appletv-support.patch
Patch2: %{name}-1.9.0-extended-mbr.patch
Patch3: %{name}-1.9.0-noheaders.patch
Patch4: %{name}-1.9.0-pop-push-error.patch
Patch5: %{name}-1.9.0-no-cylinder-align.patch
Patch6: %{name}-1.9.0-remove-struct-elem.patch
Patch7: %{name}-1.9.0-move-function-declarations.patch
Patch10: %{name}-1.9.0-handle-dup-error.patch
@ -78,7 +77,6 @@ Parted library, you need to install this package.
%patch2 -p1 -b .extended-mbr
%patch3 -p1 -b .noheaders
%patch4 -p1 -b .pop-push-error
%patch5 -p1 -b .no-cylinder-align
%patch6 -p1 -b .remove-struct-elem
%patch7 -p1 -b .move-function-declarations
%patch10 -p1 -b .handle-dup-error
@ -164,7 +162,15 @@ fi
%{_exec_prefix}/%{_lib}/libparted.so
%{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc
%changelog
* Sun Dec 20 2009 Hans de Goede <hdegoede@redhat.com> 1.9.0-25
- Fix crash when partitioning loopback devices (#546622)
- Drop no-cylinder-align patch:
- its functionality is superseeded by the per disk flags
- its only user (pyparted) has been updated to use those
- this is not upstream so we don't want other programs to start using it
* Fri Dec 18 2009 Hans de Goede <hdegoede@redhat.com> 1.9.0-24
- Allow partitioning of loopback devices (#546622)
- Add libparted function to query maximum partition length and start