65 lines
1.9 KiB
Diff
65 lines
1.9 KiB
Diff
commit 0098e7bdb80fb7ffe55b8bc9086a16d0a65898e5
|
|
Author: Joel Granados Moreno <jgranado@redhat.com>
|
|
Date: Mon Jun 22 11:37:26 2009 +0200
|
|
|
|
Add mechanism to avoid cylinder alignments.
|
|
|
|
diff --git a/include/parted/disk.h b/include/parted/disk.h
|
|
index 172fbee..664c388 100644
|
|
--- a/include/parted/disk.h
|
|
+++ b/include/parted/disk.h
|
|
@@ -263,7 +263,8 @@ extern int ped_disk_get_last_partition_num (const PedDisk* disk);
|
|
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 int ped_disk_align_to_cylinders_on();
|
|
+extern int ped_disk_align_to_cylinders_toggle();
|
|
/** @} */
|
|
|
|
/**
|
|
diff --git a/libparted/disk.c b/libparted/disk.c
|
|
index 6884c83..44a2f2f 100644
|
|
--- a/libparted/disk.c
|
|
+++ b/libparted/disk.c
|
|
@@ -65,6 +65,23 @@ static int _disk_raw_add (PedDisk* disk, PedPartition* part);
|
|
|
|
static PedDiskType* disk_types = NULL;
|
|
|
|
+int ped_disk_align_to_cylinders = 1;
|
|
+
|
|
+int
|
|
+ped_disk_align_to_cylinders_toggle ()
|
|
+{
|
|
+ if (ped_disk_align_to_cylinders == 1)
|
|
+ return ped_disk_align_to_cylinders = 0;
|
|
+ else
|
|
+ return ped_disk_align_to_cylinders = 1;
|
|
+}
|
|
+
|
|
+int
|
|
+ped_disk_align_to_cylinders_on ()
|
|
+{
|
|
+ return ped_disk_align_to_cylinders;
|
|
+}
|
|
+
|
|
void
|
|
ped_disk_type_register (PedDiskType* disk_type)
|
|
{
|
|
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
|
|
index fc54339..e7d416d 100644
|
|
--- a/libparted/labels/dos.c
|
|
+++ b/libparted/labels/dos.c
|
|
@@ -2005,8 +2005,9 @@ msdos_partition_align (PedPartition* part, const PedConstraint* constraint)
|
|
|
|
partition_probe_bios_geometry (part, &bios_geom);
|
|
|
|
- if (_align (part, &bios_geom, constraint))
|
|
- return 1;
|
|
+ if (ped_disk_align_to_cylinders_on())
|
|
+ if (_align (part, &bios_geom, constraint))
|
|
+ return 1;
|
|
if (_align_no_geom (part, constraint))
|
|
return 1;
|
|
|