New version.

This commit is contained in:
Joel Andres Granados Moreno 2009-07-10 13:16:25 +00:00
parent 6d2787e7d9
commit 15289757e3
16 changed files with 1061 additions and 39 deletions

View File

@ -1 +1 @@
parted-1.8.8.tar.bz2
parted-1.9.0.tar.gz

View File

@ -0,0 +1,198 @@
From fc419e55f358fae46ca24f15f5ce2bc7ff1b9e4a Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Thu, 11 Jun 2009 16:06:43 +0200
Subject: [PATCH] Add support for appletv partitions.
---
include/parted/disk.h | 5 ++-
libparted/disk.c | 2 +
libparted/labels/gpt.c | 50 ++++++++++++++++++++++++++++++++++++++---------
3 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/include/parted/disk.h b/include/parted/disk.h
index 691f413..5207e0b 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -53,10 +53,11 @@ enum _PedPartitionFlag {
PED_PARTITION_PALO=9,
PED_PARTITION_PREP=10,
PED_PARTITION_MSFT_RESERVED=11,
- PED_PARTITION_BIOS_GRUB=12
+ PED_PARTITION_BIOS_GRUB=12,
+ PED_PARTITION_APPLE_TV_RECOVERY=13
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_BIOS_GRUB
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_APPLE_TV_RECOVERY
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index 5fb8060..3269b9d 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2246,6 +2246,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("prep");
case PED_PARTITION_MSFT_RESERVED:
return N_("msftres");
+ case PED_PARTITION_APPLE_TV_RECOVERY:
+ return N_("atvrecv");
default:
ped_exception_throw (
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 536e06a..73bdbb2 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -127,6 +127,10 @@ typedef struct {
((efi_guid_t) { PED_CPU_TO_LE32 (0x48465300), PED_CPU_TO_LE16 (0x0000), \
PED_CPU_TO_LE16 (0x11AA), 0xaa, 0x11, \
{ 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC }})
+#define PARTITION_APPLE_TV_RECOVERY_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0x5265636F), PED_CPU_TO_LE16 (0x7665), \
+ PED_CPU_TO_LE16 (0x11AA), 0xaa, 0x11, \
+ { 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC }})
struct __attribute__ ((packed)) _GuidPartitionTableHeader_t {
uint64_t Signature;
@@ -254,6 +258,7 @@ typedef struct _GPTPartitionData {
int hp_service;
int hidden;
int msftres;
+ int atvrecv;
} GPTPartitionData;
static PedDiskType gpt_disk_type;
@@ -768,7 +773,7 @@ _parse_part_entry (PedDisk* disk, GuidPartitionEntry_t* pte)
gpt_part_data->lvm = gpt_part_data->raid
= gpt_part_data->boot = gpt_part_data->hp_service
= gpt_part_data->hidden = gpt_part_data->msftres
- = gpt_part_data->bios_grub = 0;
+ = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
if (pte->Attributes.RequiredToFunction & 0x1)
gpt_part_data->hidden = 1;
@@ -783,9 +788,11 @@ _parse_part_entry (PedDisk* disk, GuidPartitionEntry_t* pte)
gpt_part_data->lvm = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_HPSERVICE_GUID))
gpt_part_data->hp_service = 1;
- else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID))
- gpt_part_data->msftres = 1;
-
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID))
+ gpt_part_data->msftres = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID))
+ gpt_part_data->atvrecv = 1;
+
return part;
}
@@ -1182,6 +1189,7 @@ gpt_partition_new (const PedDisk* disk,
gpt_part_data->hp_service = 0;
gpt_part_data->hidden = 0;
gpt_part_data->msftres = 0;
+ gpt_part_data->atvrecv = 0;
uuid_generate ((unsigned char*) &gpt_part_data->uuid);
swap_uuid_and_efi_guid((unsigned char*)(&gpt_part_data->uuid));
memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
@@ -1269,6 +1277,11 @@ gpt_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID;
return 1;
}
+ if (gpt_part_data->atvrecv) {
+ gpt_part_data->type = PARTITION_APPLE_TV_RECOVERY_GUID;
+ return 1;
+ }
+
if (fs_type) {
if (strncmp (fs_type->name, "fat", 3) == 0
@@ -1361,7 +1374,8 @@ gpt_partition_set_flag(PedPartition *part,
= gpt_part_data->lvm
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
- = gpt_part_data->msftres = 0;
+ = gpt_part_data->msftres
+ = gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_BIOS_GRUB:
gpt_part_data->bios_grub = state;
@@ -1370,7 +1384,8 @@ gpt_partition_set_flag(PedPartition *part,
= gpt_part_data->lvm
= gpt_part_data->boot
= gpt_part_data->hp_service
- = gpt_part_data->msftres = 0;
+ = gpt_part_data->msftres
+ = gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_RAID:
gpt_part_data->raid = state;
@@ -1379,7 +1394,8 @@ gpt_partition_set_flag(PedPartition *part,
= gpt_part_data->lvm
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
- = gpt_part_data->msftres = 0;
+ = gpt_part_data->msftres
+ = gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_LVM:
gpt_part_data->lvm = state;
@@ -1388,7 +1404,8 @@ gpt_partition_set_flag(PedPartition *part,
= gpt_part_data->raid
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
- = gpt_part_data->msftres = 0;
+ = gpt_part_data->msftres
+ = gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HPSERVICE:
gpt_part_data->hp_service = state;
@@ -1397,7 +1414,8 @@ gpt_partition_set_flag(PedPartition *part,
= gpt_part_data->raid
= gpt_part_data->lvm
= gpt_part_data->bios_grub
- = gpt_part_data->msftres = 0;
+ = gpt_part_data->msftres
+ = gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_RESERVED:
gpt_part_data->msftres = state;
@@ -1406,8 +1424,17 @@ gpt_partition_set_flag(PedPartition *part,
= gpt_part_data->raid
= gpt_part_data->lvm
= gpt_part_data->bios_grub
- = gpt_part_data->hp_service = 0;
+ = gpt_part_data->hp_service
+ = gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_APPLE_TV_RECOVERY:
+ gpt_part_data->atvrecv = state;
+ if (state)
+ gpt_part_data->boot
+ = gpt_part_data->raid
+ = gpt_part_data->lvm
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres = 0;
case PED_PARTITION_HIDDEN:
gpt_part_data->hidden = state;
return 1;
@@ -1440,6 +1467,8 @@ gpt_partition_get_flag(const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->hp_service;
case PED_PARTITION_MSFT_RESERVED:
return gpt_part_data->msftres;
+ case PED_PARTITION_APPLE_TV_RECOVERY:
+ return gpt_part_data->atvrecv;
case PED_PARTITION_HIDDEN:
return gpt_part_data->hidden;
case PED_PARTITION_SWAP:
@@ -1462,6 +1491,7 @@ gpt_partition_is_flag_available(const PedPartition * part,
case PED_PARTITION_BIOS_GRUB:
case PED_PARTITION_HPSERVICE:
case PED_PARTITION_MSFT_RESERVED:
+ case PED_PARTITION_APPLE_TV_RECOVERY:
case PED_PARTITION_HIDDEN:
return 1;
case PED_PARTITION_SWAP:
--
1.6.0.6

View File

@ -0,0 +1,27 @@
From 4d7e16d3a36ce3875b9f34a04f4078cc5b935417 Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Tue, 30 Jun 2009 17:07:06 +0200
Subject: [PATCH] Identify the device by path.
* libparted/labels/dasd.c (dasd_probe): The element name is not defined
in the dev structure.
---
libparted/labels/dasd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index e3e5d1b..40c0546 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -166,7 +166,7 @@ dasd_probe (const PedDevice *dev)
error_cleanup:
fdasd_cleanup(&anchor);
ped_exception_throw(PED_EXCEPTION_ERROR,PED_EXCEPTION_IGNORE_CANCEL,
- "Error while probing device %s.", dev->name);
+ "Error while probing device %s.", dev->path);
return 0;
}
--
1.6.0.6

View File

@ -0,0 +1,41 @@
From f515b5a54a929896c9ad1482f05c060f4a1b9893 Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@suse.cz>
Date: Fri, 5 Jun 2009 14:14:11 +0200
Subject: [PATCH] do not discard bootcode from extended partition
* libparted/labels/dos.c (write_ext_table): Do not discard
bootcode from extended partition on msdos label when some of
the logical partitions are changed.
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
libparted/labels/dos.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index b4cd23a..fc54339 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1060,7 +1060,8 @@ write_ext_table (const PedDisk* disk,
lba_offset = ped_disk_extended_partition (disk)->geom.start;
- memset (&table, 0, sizeof (DosRawTable));
+ ped_device_read (disk->dev, &table, sector, 1);
+ memset (&(table.partitions), 0, 4 * sizeof(DosRawPartition));
table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
if (!fill_raw_part (&table.partitions[0], logical, sector))
@@ -1094,7 +1095,8 @@ write_empty_table (const PedDisk* disk, PedSector sector)
PED_ASSERT (disk != NULL, return 0);
- memset (&table, 0, sizeof (DosRawTable));
+ ped_device_read (disk->dev, &table, sector, 1);
+ memset (&(table.partitions), 0, 4 * sizeof(DosRawPartition));
table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
return ped_device_write (disk->dev, (void*) &table, sector, 1);
--
1.6.0.6

View File

@ -0,0 +1,26 @@
From c3bd7f40c18197d8092b80f0975d1e0486b686c7 Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Wed, 10 Jun 2009 17:33:42 +0200
Subject: [PATCH] Remove unnecessary variable.
* libparted/labels/fdasd.c (fdasd_get_geometry): The variable "s" is not
used in the function.
---
libparted/labels/fdasd.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index 40ba8c9..4cf4eb0 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -773,7 +773,6 @@ fdasd_get_geometry (fdasd_anchor_t *anc, int f)
PDEBUG
int blksize = 0;
dasd_information_t dasd_info;
- char s[LINE_LENGTH];
if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
fdasd_error(anc, unable_to_ioctl,
--
1.6.0.6

View File

@ -0,0 +1,166 @@
From cd5dd183b4810de2160c433544541c852ca1877d Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Mon, 29 Jun 2009 13:44:10 +0200
Subject: [PATCH] Put the dasd function definitions at the end of the file.
All label types define the label functions at the end of the file. Be
consistent with this characteristic. The function declarations are no
longer needed.
* libparted/labels/dasd.c (dasd_disk_ops, dasd_disk_type)
(ped_disk_dasd_init, ped_disk_dasd_done): Move the specifications of the
functions the end of the file. Remove function declarations.
---
libparted/labels/dasd.c | 125 ++++++++++++++++++-----------------------------
1 files changed, 48 insertions(+), 77 deletions(-)
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index 3a0bb32..e3e5d1b 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -76,70 +76,7 @@ typedef struct {
struct fdasd_anchor *anchor;
} DasdDiskSpecific;
-static int dasd_probe (const PedDevice *dev);
-static int dasd_clobber (PedDevice* dev);
-static int dasd_read (PedDisk* disk);
-static int dasd_write (const PedDisk* disk);
-
-static PedPartition* dasd_partition_new (const PedDisk* disk,
- PedPartitionType part_type,
- const PedFileSystemType* fs_type,
- PedSector start,
- PedSector end);
-static void dasd_partition_destroy (PedPartition* part);
-static int dasd_partition_set_flag (PedPartition* part,
- PedPartitionFlag flag,
- int state);
-static int dasd_partition_get_flag (const PedPartition* part,
- PedPartitionFlag flag);
-static int dasd_partition_is_flag_available (const PedPartition* part,
- PedPartitionFlag flag);
-static int dasd_partition_align (PedPartition* part,
- const PedConstraint* constraint);
-static int dasd_partition_enumerate (PedPartition* part);
-static int dasd_get_max_primary_partition_count (const PedDisk* disk);
-
-static PedDisk* dasd_alloc (const PedDevice* dev);
-static PedDisk* dasd_duplicate (const PedDisk* disk);
-static void dasd_free (PedDisk* disk);
-static int dasd_partition_set_system (PedPartition* part,
- const PedFileSystemType* fs_type);
-static int dasd_alloc_metadata (PedDisk* disk);
-
-static PedDiskOps dasd_disk_ops = {
- probe: dasd_probe,
- clobber: dasd_clobber,
- read: dasd_read,
- write: dasd_write,
-
- alloc: dasd_alloc,
- duplicate: dasd_duplicate,
- free: dasd_free,
- partition_set_system: dasd_partition_set_system,
-
- partition_new: dasd_partition_new,
- partition_destroy: dasd_partition_destroy,
- partition_set_flag: dasd_partition_set_flag,
- partition_get_flag: dasd_partition_get_flag,
- partition_is_flag_available: dasd_partition_is_flag_available,
- partition_set_name: NULL,
- partition_get_name: NULL,
- partition_align: dasd_partition_align,
- partition_enumerate: dasd_partition_enumerate,
-
- alloc_metadata: dasd_alloc_metadata,
- get_max_primary_partition_count: dasd_get_max_primary_partition_count,
- get_max_supported_partition_count: dasd_get_max_supported_partition_count,
-
- partition_duplicate: NULL
-};
-
-static PedDiskType dasd_disk_type = {
- next: NULL,
- name: "dasd",
- ops: &dasd_disk_ops,
- features: 0
-};
+static PedDiskType dasd_disk_type;
static PedDisk*
dasd_alloc (const PedDevice* dev)
@@ -199,19 +136,6 @@ dasd_free (PedDisk* disk)
_ped_disk_free(disk);
}
-
-void
-ped_disk_dasd_init ()
-{
- ped_disk_type_register(&dasd_disk_type);
-}
-
-void
-ped_disk_dasd_done ()
-{
- ped_disk_type_unregister(&dasd_disk_type);
-}
-
static int
dasd_probe (const PedDevice *dev)
{
@@ -881,3 +805,50 @@ error:
ped_constraint_destroy (constraint_any);
return 0;
}
+
+static PedDiskOps dasd_disk_ops = {
+ probe: dasd_probe,
+ clobber: dasd_clobber,
+ read: dasd_read,
+ write: dasd_write,
+
+ alloc: dasd_alloc,
+ duplicate: dasd_duplicate,
+ free: dasd_free,
+ partition_set_system: dasd_partition_set_system,
+
+ partition_new: dasd_partition_new,
+ partition_destroy: dasd_partition_destroy,
+ partition_set_flag: dasd_partition_set_flag,
+ partition_get_flag: dasd_partition_get_flag,
+ partition_is_flag_available: dasd_partition_is_flag_available,
+ partition_set_name: NULL,
+ partition_get_name: NULL,
+ partition_align: dasd_partition_align,
+ partition_enumerate: dasd_partition_enumerate,
+
+ alloc_metadata: dasd_alloc_metadata,
+ get_max_primary_partition_count: dasd_get_max_primary_partition_count,
+ get_max_supported_partition_count: dasd_get_max_supported_partition_count,
+
+ partition_duplicate: NULL
+};
+
+static PedDiskType dasd_disk_type = {
+ next: NULL,
+ name: "dasd",
+ ops: &dasd_disk_ops,
+ features: 0
+};
+
+void
+ped_disk_dasd_init ()
+{
+ ped_disk_type_register(&dasd_disk_type);
+}
+
+void
+ped_disk_dasd_done ()
+{
+ ped_disk_type_unregister(&dasd_disk_type);
+}
--
1.6.0.6

View File

@ -0,0 +1,64 @@
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;

View File

@ -0,0 +1,30 @@
From 1dd152a33813406e91261db1f59a9a9dacf4bff6 Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Thu, 11 Jun 2009 16:20:45 +0200
Subject: [PATCH] No include headers.
---
include/parted/Makefile.am | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/parted/Makefile.am b/include/parted/Makefile.am
index a1ba960..022373f 100644
--- a/include/parted/Makefile.am
+++ b/include/parted/Makefile.am
@@ -16,10 +16,10 @@ partedinclude_HEADERS = constraint.h \
natmath.h \
timer.h \
unit.h \
- parted.h \
- $(S390_HDRS)
+ parted.h
noinst_HEADERS = crc32.h \
- endian.h
+ endian.h \
+ $(S390_HDRS)
MAINTAINERCLEANFILES = Makefile.in
--
1.6.0.6

View File

@ -0,0 +1,280 @@
From fd2df92bbaaa5926b0c67916a5947af102cac20c Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Thu, 11 Jun 2009 17:05:39 +0200
Subject: [PATCH] return errro on push or pop update mode.
---
libparted/disk.c | 85 +++++++++++++++++++++++++++++++++++------------------
1 files changed, 56 insertions(+), 29 deletions(-)
diff --git a/libparted/disk.c b/libparted/disk.c
index 3269b9d..6884c83 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -54,8 +54,8 @@
#ifdef DEBUG
static int _disk_check_sanity (PedDisk* disk);
#endif
-static void _disk_push_update_mode (PedDisk* disk);
-static void _disk_pop_update_mode (PedDisk* disk);
+static int _disk_push_update_mode (PedDisk* disk);
+static int _disk_pop_update_mode (PedDisk* disk);
static int _disk_raw_insert_before (PedDisk* disk, PedPartition* loc,
PedPartition* part);
static int _disk_raw_insert_after (PedDisk* disk, PedPartition* loc,
@@ -215,9 +215,11 @@ _add_duplicate_part (PedDisk* disk, PedPartition* old_part)
goto error;
new_part->disk = disk;
- _disk_push_update_mode (disk);
+ if (!_disk_push_update_mode (disk))
+ goto error_destroy_new_part;
ret = _disk_raw_add (disk, new_part);
- _disk_pop_update_mode (disk);
+ if (_disk_pop_update_mode (disk))
+ goto error_destroy_new_part;
if (!ret)
goto error_destroy_new_part;
#ifdef DEBUG
@@ -253,7 +255,8 @@ ped_disk_duplicate (const PedDisk* old_disk)
if (!new_disk)
goto error;
- _disk_push_update_mode (new_disk);
+ if (!_disk_push_update_mode (new_disk))
+ goto error_destroy_new_disk;
for (old_part = ped_disk_next_partition (old_disk, NULL); old_part;
old_part = ped_disk_next_partition (old_disk, old_part)) {
if (ped_partition_is_active (old_part)) {
@@ -261,7 +264,8 @@ ped_disk_duplicate (const PedDisk* old_disk)
goto error_destroy_new_disk;
}
}
- _disk_pop_update_mode (new_disk);
+ if (!_disk_pop_update_mode (new_disk))
+ goto error_destroy_new_disk;
return new_disk;
error_destroy_new_disk:
@@ -349,7 +353,8 @@ ped_disk_new_fresh (PedDevice* dev, const PedDiskType* type)
disk = type->ops->alloc (dev);
if (!disk)
goto error;
- _disk_pop_update_mode (disk);
+ if (!_disk_pop_update_mode (disk))
+ goto error_destroy_disk;
PED_ASSERT (disk->update_mode == 0, goto error_destroy_disk);
disk->needs_clobber = 1;
@@ -914,12 +919,13 @@ _disk_alloc_freespace (PedDisk* disk)
* partitions are removed, making it much easier for various manipulation
* routines...
*/
-static void
+static int
_disk_push_update_mode (PedDisk* disk)
{
if (!disk->update_mode) {
#ifdef DEBUG
- _disk_check_sanity (disk);
+ if (!_disk_check_sanity (disk))
+ return 0;
#endif
_disk_remove_freespace (disk);
@@ -927,24 +933,27 @@ _disk_push_update_mode (PedDisk* disk)
_disk_remove_metadata (disk);
#ifdef DEBUG
- _disk_check_sanity (disk);
+ if (!_disk_check_sanity (disk))
+ return 0;
#endif
} else {
disk->update_mode++;
}
+ return 1;
}
-static void
+static int
_disk_pop_update_mode (PedDisk* disk)
{
- PED_ASSERT (disk->update_mode, return);
+ PED_ASSERT (disk->update_mode, return 0);
if (disk->update_mode == 1) {
/* re-allocate metadata BEFORE leaving update mode, to prevent infinite
* recursion (metadata allocation requires update mode)
*/
#ifdef DEBUG
- _disk_check_sanity (disk);
+ if (!_disk_check_sanity (disk))
+ return 0;
#endif
_disk_alloc_metadata (disk);
@@ -952,11 +961,13 @@ _disk_pop_update_mode (PedDisk* disk)
_disk_alloc_freespace (disk);
#ifdef DEBUG
- _disk_check_sanity (disk);
+ if (!_disk_check_sanity (disk))
+ return 0;
#endif
} else {
disk->update_mode--;
}
+ return 1;
}
/** @} */
@@ -1826,7 +1837,8 @@ ped_disk_add_partition (PedDisk* disk, PedPartition* part,
if (!_partition_check_basic_sanity (disk, part))
return 0;
- _disk_push_update_mode (disk);
+ if (!_disk_push_update_mode (disk))
+ return 0;
if (ped_partition_is_active (part)) {
overlap_constraint
@@ -1854,7 +1866,8 @@ ped_disk_add_partition (PedDisk* disk, PedPartition* part,
ped_constraint_destroy (overlap_constraint);
ped_constraint_destroy (constraints);
- _disk_pop_update_mode (disk);
+ if (!_disk_pop_update_mode (disk))
+ return 0;
#ifdef DEBUG
if (!_disk_check_sanity (disk))
return 0;
@@ -1883,10 +1896,12 @@ ped_disk_remove_partition (PedDisk* disk, PedPartition* part)
PED_ASSERT (disk != NULL, return 0);
PED_ASSERT (part != NULL, return 0);
- _disk_push_update_mode (disk);
+ if (!_disk_push_update_mode (disk))
+ return 0;
PED_ASSERT (part->part_list == NULL, goto error);
_disk_raw_remove (disk, part);
- _disk_pop_update_mode (disk);
+ if (!_disk_pop_update_mode (disk))
+ return 0;
ped_disk_enumerate_partitions (disk);
return 1;
@@ -1909,12 +1924,14 @@ ped_disk_delete_partition (PedDisk* disk, PedPartition* part)
PED_ASSERT (disk != NULL, return 0);
PED_ASSERT (part != NULL, return 0);
- _disk_push_update_mode (disk);
+ if (!_disk_push_update_mode (disk))
+ return 0;
if (part->type == PED_PARTITION_EXTENDED)
ped_disk_delete_all_logical (disk);
ped_disk_remove_partition (disk, part);
ped_partition_destroy (part);
- _disk_pop_update_mode (disk);
+ if (!_disk_pop_update_mode (disk))
+ return 0;
return 1;
}
@@ -1952,7 +1969,8 @@ ped_disk_delete_all (PedDisk* disk)
PED_ASSERT (disk != NULL, return 0);
- _disk_push_update_mode (disk);
+ if (!_disk_push_update_mode (disk))
+ return 0;
for (walk = disk->part_list; walk; walk = next) {
next = walk->next;
@@ -1961,7 +1979,8 @@ ped_disk_delete_all (PedDisk* disk)
return 0;
}
- _disk_pop_update_mode (disk);
+ if (!_disk_pop_update_mode (disk))
+ return 0;
return 1;
}
@@ -1995,7 +2014,8 @@ ped_disk_set_partition_geom (PedDisk* disk, PedPartition* part,
old_geom = part->geom;
ped_geometry_init (&new_geom, part->geom.dev, start, end - start + 1);
- _disk_push_update_mode (disk);
+ if (!_disk_push_update_mode (disk))
+ return 0;
overlap_constraint
= _partition_get_overlap_constraint (part, &new_geom);
@@ -2018,7 +2038,8 @@ ped_disk_set_partition_geom (PedDisk* disk, PedPartition* part,
_disk_raw_remove (disk, part);
_disk_raw_add (disk, part);
- _disk_pop_update_mode (disk);
+ if (!_disk_pop_update_mode (disk))
+ goto error;
ped_constraint_destroy (overlap_constraint);
ped_constraint_destroy (constraints);
@@ -2026,6 +2047,7 @@ ped_disk_set_partition_geom (PedDisk* disk, PedPartition* part,
error_pop_update_mode:
_disk_pop_update_mode (disk);
+error:
ped_constraint_destroy (overlap_constraint);
ped_constraint_destroy (constraints);
part->geom = old_geom;
@@ -2064,7 +2086,8 @@ ped_disk_maximize_partition (PedDisk* disk, PedPartition* part,
old_geom = part->geom;
- _disk_push_update_mode (disk);
+ if (!_disk_push_update_mode (disk))
+ return 0;
if (part->prev)
new_start = part->prev->geom.end + 1;
@@ -2080,7 +2103,8 @@ ped_disk_maximize_partition (PedDisk* disk, PedPartition* part,
new_end))
goto error;
- _disk_pop_update_mode (disk);
+ if (!_disk_pop_update_mode (disk))
+ return 0;
return 1;
error:
@@ -2152,11 +2176,13 @@ ped_disk_minimize_extended_partition (PedDisk* disk)
if (!ext_part)
return 1;
- _disk_push_update_mode (disk);
+ if (!_disk_push_update_mode (disk))
+ return 0;
first_logical = ext_part->part_list;
if (!first_logical) {
- _disk_pop_update_mode (disk);
+ if (!_disk_pop_update_mode (disk))
+ return 0;
return ped_disk_delete_partition (disk, ext_part);
}
@@ -2169,7 +2195,8 @@ ped_disk_minimize_extended_partition (PedDisk* disk)
last_logical->geom.end);
ped_constraint_destroy (constraint);
- _disk_pop_update_mode (disk);
+ if (!_disk_pop_update_mode (disk))
+ return 0;
return status;
}
--
1.6.0.6

View File

@ -0,0 +1,38 @@
From 456b8c4d2424e52f7861e14d667ba7c26ca1cce3 Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Fri, 5 Jun 2009 14:14:08 +0200
Subject: [PATCH] Preserve first 446 bytes of the pmbr in gpt.
* libparted/label/gpt.c (_write_pmbr) : Make sure we read the first 446
bytes of the device when we are creating the pmbr.
---
libparted/labels/gpt.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 73bdbb2..f1c4f69 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -982,7 +982,18 @@ _write_pmbr (PedDevice * dev)
{
LegacyMBR_t pmbr;
- memset(&pmbr, 0, sizeof(pmbr));
+ /* The UEFI spec is not clear about what to do with the following
+ * elements of the Protective MBR (pmbr): BootCode (0-440B),
+ * UniqueMBRSignature (440B-444B) and Unknown (444B-446B).
+ * With this in mind, we try not to modify these elements.
+ */
+ if(ped_device_read(dev, &pmbr, 0, GPT_PMBR_SECTORS) < GPT_PMBR_SECTORS)
+ memset(&pmbr, 0, sizeof(pmbr));
+
+ /* Make sure we zero out all the legacy partitions.
+ * There are 4 PartitionRecords. */
+ memset(&(pmbr.PartitionRecord), 0, sizeof(PartitionRecord_t) * 4);
+
pmbr.Signature = PED_CPU_TO_LE16(MSDOS_MBR_SIGNATURE);
pmbr.PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI;
pmbr.PartitionRecord[0].StartSector = 1;
--
1.6.0.6

View File

@ -0,0 +1,19 @@
commit 9a4166aa0420ca16c73ba11e0cb7bce4d326cbdf
Author: Joel Granados Moreno <jgranado@redhat.com>
Date: Fri Jun 12 14:41:53 2009 +0200
Remove unneeded struct element.
diff --git a/include/parted/disk.h b/include/parted/disk.h
index 5207e0b..172fbee 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -157,7 +157,7 @@ struct _PedDisk {
PedDevice* dev; /**< the device where the
partition table lies */
const PedDiskType* type; /**< type of disk label */
- const int* block_sizes; /**< block sizes supported
+ /*const int* block_sizes; **< block sizes supported
by this label */
PedPartition* part_list; /**< list of partitions. Access with
ped_disk_next_partition() */

View File

@ -0,0 +1,30 @@
From ae78428ae1bc521a11be60b6acdb511a6e7aee21 Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Wed, 10 Jun 2009 18:34:46 +0200
Subject: [PATCH] Use the swap flag.
* libparted/labels/dos.c (msdos_partition_set_flag): Set the partition
type if the user sets the swap flag.
---
libparted/labels/dos.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index f219e7d..b4cd23a 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1413,6 +1413,11 @@ msdos_partition_set_flag (PedPartition* part,
dos_data->prep = state;
return ped_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_SWAP:
+ if (state) {
+ return ped_partition_set_system (part, ped_file_system_type_get("linux-swap"));
+ }
+
default:
return 0;
}
--
1.6.0.6

View File

@ -0,0 +1,107 @@
From 2f0d94d200fb8822a9f8699e93b65c2d5476b087 Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Tue, 30 Jun 2009 16:21:02 +0200
Subject: [PATCH] The file include/parted/linux.h is needed by dasd.c
* include/parted/linux.h (PED_LINUX_H_INCLUDED, LINUX_SPECIFIC)
(LinuxSpecific, _LinuxSpecific, fd, dmtype, real_sector_size, anchor):
New file.
* libparted/arch/linux.c (PROC_DEVICES_BUFSIZ, LINUX_SPECIFIC)
(LinuxSpecific, RW_MODE, _LinuxSpecific, anchor, dmtype, fd)
(real_sector_size): User new header file.
---
include/parted/linux.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
libparted/arch/linux.c | 19 +------------------
2 files changed, 45 insertions(+), 18 deletions(-)
create mode 100644 include/parted/linux.h
diff --git a/include/parted/linux.h b/include/parted/linux.h
new file mode 100644
index 0000000..1a4171d
--- /dev/null
+++ b/include/parted/linux.h
@@ -0,0 +1,44 @@
+/*
+ libparted - a library for manipulating disk partitions
+ Copyright (C) 2001, 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef PED_LINUX_H_INCLUDED
+#define PED_LINUX_H_INCLUDED
+
+#include <parted/parted.h>
+#include <parted/device.h>
+
+#if defined(__s390__) || defined(__s390x__)
+# include <parted/fdasd.h>
+#endif
+
+#define LINUX_SPECIFIC(dev) ((LinuxSpecific*) (dev)->arch_specific)
+
+typedef struct _LinuxSpecific LinuxSpecific;
+
+struct _LinuxSpecific {
+ int fd;
+ char* dmtype; /**< device map target type */
+#if defined(__s390__) || defined(__s390x__)
+ unsigned int real_sector_size;
+ /* IBM internal dasd structure (i guess ;), required. */
+ struct fdasd_anchor *anchor;
+#endif
+};
+
+#endif /* PED_LINUX_H_INCLUDED */
+
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 66fdd37..92c8f31 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -21,6 +21,7 @@
#include <parted/parted.h>
#include <parted/debug.h>
+#include <parted/linux.h>
#include <ctype.h>
#include <errno.h>
@@ -75,24 +76,6 @@
#define RW_MODE (O_RDWR)
#endif
-#if defined(__s390__) || defined(__s390x__)
-# include <parted/fdasd.h>
-#endif
-
-#define LINUX_SPECIFIC(dev) ((LinuxSpecific*) (dev)->arch_specific)
-
-typedef struct _LinuxSpecific LinuxSpecific;
-
-struct _LinuxSpecific {
- int fd;
- char* dmtype; /**< device map target type */
-#if defined(__s390__) || defined(__s390x__)
- unsigned int real_sector_size;
- /* IBM internal dasd structure (i guess ;), required. */
- struct fdasd_anchor *anchor;
-#endif
-};
-
struct hd_geometry {
unsigned char heads;
unsigned char sectors;
--
1.6.0.6

BIN
parted-1.9.0.tar.gz Normal file

Binary file not shown.

View File

@ -3,29 +3,24 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 1.8.8
Release: 16%{?dist}
Version: 1.9.0
Release: 1%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
Source: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.bz2
Patch0: %{name}-1.8.8-xvd.patch
Patch1: %{name}-1.8.8-devmapper-header.patch
Patch2: %{name}-1.8.8-noinst-headers.patch
Patch3: %{name}-1.8.8-manpage.patch
Patch4: %{name}-1.8.8-gcc-4.3.patch
Patch5: %{name}-1.8.8-nofixgpt.patch
Patch6: %{name}-1.8.8-alpha.patch
Patch7: %{name}-1.8.8-dospartrec.patch
Patch8: %{name}-1.8.8-appletv.patch
Patch9: %{name}-1.8.8-s390-compile.patch
Patch10: %{name}-1.8.8-sparc-enableraid.patch
Patch11: %{name}-1.8.8-avoid-none-stat.patch
Patch12: %{name}-1.8.8-newgcc4.4.patch
Patch13: %{name}-1.8.8-return-error-update-mode.patch
Patch14: %{name}-1.8.8-virtio.patch
Patch15: %{name}-1.8.8-dos-label-swap.patch
Source: %{name}/%{name}-%{version}.tar.gz
Patch1: %{name}-1.9.0-appletv-support.patch
Patch2: %{name}-1.9.0-extended-mbr.patch
Patch3: %{name}-1.9.0-extra-var.patch
Patch4: %{name}-1.9.0-noheaders.patch
Patch5: %{name}-1.9.0-pop-push-error.patch
Patch6: %{name}-1.9.0-no-cylinder-align.patch
Patch7: %{name}-1.9.0-swap-flag.patch
Patch8: %{name}-1.9.0-remove-struct-elem.patch
Patch9: %{name}-1.9.0-move-function-declarations.patch
Patch10: %{name}-1.9.0-use-linuxh.patch
Patch11: %{name}-1.9.0-device-path.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@ -36,6 +31,9 @@ BuildRequires: gettext-devel
BuildRequires: texinfo
BuildRequires: device-mapper-devel
BuildRequires: libselinux-devel
%ifnarch s390 s390x
BuildRequires: libuuid-devel
%endif
Requires(post): /sbin/ldconfig
Requires(post): /sbin/install-info
@ -61,26 +59,21 @@ partitions and filesystems using the routines provided by the GNU
Parted library, you need to install this package.
%prep
%setup -q
%patch0 -p1 -b .xvd
%patch1 -p1 -b .devmapper
%patch2 -p1 -b .noinst
%patch3 -p1 -b .manpage
%patch4 -p1 -b .gcc43
%patch5 -p1 -b .nofixgpt
%patch6 -p1 -b .alpha
%patch7 -p1 -b .dospartrec
%patch8 -p1 -b .appletv
%patch9 -p1 -b .s390-compile
%patch10 -p1 -b .sparc-raid
%patch11 -p1 -b .avoid-none-stat
%patch12 -p1 -b .newgcc4.4
%patch13 -p1 -b .return-error-update-mode
%patch14 -p1 -b .virtio
%patch15 -p1 -b .dos-label-swap
%setup -q -n %{name}-%{version}
%patch1 -p1 -b .appletv
%patch2 -p1 -b .extended-mbr
%patch3 -p1 -b .extra-var
%patch4 -p1 -b .noheaders
%patch5 -p1 -b .pop-push-error
%patch6 -p1 -b .no-cylinder-align
%patch7 -p1 -b .swap-flag
%patch8 -p1 -b .remove-struct-elem
%patch9 -p1 -b .move-function-declarations
%patch10 -p1 -b .use-linuxh
%patch11 -p1 -b .device-path
%build
%configure --enable-device-mapper --enable-selinux --disable-static
%configure --enable-selinux --disable-static
%{__make} %{?_smp_mflags}
%install
@ -135,6 +128,9 @@ fi
%{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc
%changelog
* Wed Jun 10 2009 Joel Granados <jgranado@redhat.com> - 1.9.0-1
- New version.
* Thu Mar 26 2009 Joel Granados <jgranado@redhat.com> - 1.8.8-15
- Begin to identify virtio devices.
- Actually change the partition type in msdos lables (dcantrell).

View File

@ -1 +1 @@
607ab4c3cfd8455af6588b97d99ad0ba parted-1.8.8.tar.bz2
ba0122a5ab71cb3b040d6193532f1aed parted-1.9.0.tar.gz