- Fix error when creating a fresh dasd disk (#532425)

- Rewrite dasd disk duplication patches, as the old old ones conflicted
    with fixing creating a fresh dasd disk
This commit is contained in:
Hans de Goede 2009-11-03 12:07:15 +00:00
parent b8f160a800
commit 7061b8af36
5 changed files with 526 additions and 552 deletions

View File

@ -1,316 +0,0 @@
From bc854d48563ff30ba4c55914baa8db0a271790e5 Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Thu, 16 Jul 2009 20:16:43 +0200
Subject: [PATCH] Add duplicate functionality to dasd type lables.
* libparted/labels/dasd.c (dasd_alloc): Add the errno to the exception
message to ease debugging.
(dasd_partition_duplicate): New function.
(dasd_duplicate): Include all the dasd specific structures in the
duplicate disk.
(dasd_partition_new): Handle the case when malloc fails because of lack
of memory.
(dasd_disk_ops): Add the new dasd_partition_duplicate hook.
---
libparted/labels/dasd.c | 234 ++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 222 insertions(+), 12 deletions(-)
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index ec73d09..e87daba 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -23,6 +23,7 @@
#include <config.h>
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <time.h>
@@ -58,6 +59,9 @@
extern void ped_disk_dasd_init ();
extern void ped_disk_dasd_done ();
+static PedPartition* dasd_partition_new (const PedDisk*, PedPartitionType,
+ const PedFileSystemType*,
+ PedSector, PedSector);
#define DASD_NAME "dasd"
@@ -104,7 +108,8 @@ dasd_alloc (const PedDevice* dev)
&disk_specific->real_sector_size) == -1) {
ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Unable to determine the block "
- "size of this dasd"));
+ "size of this dasd - %s"),
+ strerror(errno));
free(disk_specific);
free(disk);
return NULL;
@@ -113,19 +118,216 @@ dasd_alloc (const PedDevice* dev)
return disk;
}
+static PedPartition*
+dasd_partition_duplicate (const PedPartition* part, PedDisk* disk)
+{
+ PedPartition* walk;
+ PedPartition* new_part;
+ format1_label_t* new_format1;
+ partition_info_t* new_part_info;
+ partition_info_t* old_part_info;
+ DasdPartitionData* old_dasd_data;
+ DasdPartitionData* temp_dasd_data;
+ DasdDiskSpecific* old_disk_specific;
+ partition_info_t* old_anchor_first;
+ partition_info_t* old_anchor_last;
+ char* error_message;
+
+ /* Initialize old_* variables. */
+ old_dasd_data = (DasdPartitionData*) part->disk_specific;
+ old_part_info = (partition_info_t*) old_dasd_data->part_info;
+ old_disk_specific = (DasdDiskSpecific*) part->disk->disk_specific;
+ old_anchor_first = (partition_info_t*) old_disk_specific->anchor->first;
+ old_anchor_last = (partition_info_t*) old_disk_specific->anchor->last;
+ /* The default error message. */
+ error_message = "Could not allocate memory for dasd specific structure.";
+
+ /* Handle the DasdPartitionData->partition_info_t->format1_label_t pointer. */
+ new_format1 = (format1_label_t*) ped_malloc (sizeof (format1_label_t));
+ if (!new_format1)
+ goto error;
+ memcpy (new_format1, old_part_info->f1, sizeof (format1_label_t));
+
+ /* Handle the DasdPartitionData->partition_info_t pointer. */
+ new_part_info = (partition_info_t*) ped_malloc (sizeof (partition_info_t));
+ if (!new_part_info)
+ goto error_free_format1;
+ memcpy (new_part_info, old_part_info, sizeof (partition_info_t));
+ new_part_info->f1 = new_format1;
+ new_part_info->next = NULL;
+ new_part_info->prev = NULL;
+
+ /* Try to set new_part_info->next, new_part_info->prev,
+ * disk->disk_specific->anchor->first & disk->disk_specific->anchor->last
+ * when disk is not NULL.
+ */
+ if (disk)
+ {
+ /* Handle the next and prev pointers. */
+ /* Look for the prev. */
+ if (old_part_info->prev == NULL || part->prev == NULL)
+ new_part_info->prev = NULL;
+ else
+ {
+ for (walk = disk->part_list ; walk ; walk = walk->next)
+ {
+ /* Identify the partition by start and length sectors. */
+ if (walk->geom.start == part->prev->geom.start
+ && walk->geom.length == part->prev->geom.length)
+ {
+ /* Verify the new_part_info->prev and the walk->next. */
+ temp_dasd_data = (DasdPartitionData*) walk->disk_specific;
+ new_part_info->prev = (partition_info_t*) temp_dasd_data->part_info;
+ ((partition_info_t*)temp_dasd_data->part_info)->next = new_part_info;
+ break;
+ }
+ }
+ }
+
+ /* Look for the next. */
+ if (old_part_info->next == NULL || part->next == NULL)
+ new_part_info->next = NULL;
+ else
+ {
+ for (walk = disk->part_list ; walk ; walk = walk->next)
+ {
+ /* Identify the partition by start and length sectors. */
+ if (walk->geom.start == part->next->geom.start
+ && walk->geom.length == part->next->geom.length)
+ {
+ /* Verify the new_part_info->next and the walk->prev. */
+ temp_dasd_data = (DasdPartitionData*) walk->disk_specific;
+ new_part_info->next = (partition_info_t*) temp_dasd_data->part_info;
+ ((partition_info_t*)temp_dasd_data->part_info)->prev = new_part_info;
+ break;
+ }
+ }
+ }
+
+ /* Handle the DasdDiskSpecific->fdasd_anchor->last &&
+ * Handle the DasdDiskSpecific->fdasd_anchor->first. */
+ if ( old_anchor_first->start_trk == new_part_info->start_trk
+ && old_anchor_first->len_trk == new_part_info->len_trk)
+ ((DasdDiskSpecific*) disk->disk_specific)->anchor->first = new_part_info;
+ else if ( old_anchor_last->start_trk == new_part_info->start_trk
+ && old_anchor_last->len_trk == new_part_info->len_trk)
+ ((DasdDiskSpecific*) disk->disk_specific)->anchor->last = new_part_info;
+ }
+
+ /* Create new partition. Allocates memory for DasdPartitionData. */
+ new_part = dasd_partition_new (part->disk, part->type, part->fs_type,
+ part->geom.start, part->geom.end);
+ if (!new_part)
+ goto error_free_part_info;
+ new_part->num = part->num;
+
+ /* Handle the DasdPartitionData pointer. */
+ memcpy (new_part->disk_specific, old_dasd_data, sizeof (DasdPartitionData));
+ ((DasdPartitionData*)new_part->disk_specific)->part_info = new_part_info;
+
+ return new_part;
+
+error_free_part_info:
+ free(new_part_info);
+error_free_format1:
+ free(new_format1);
+error:
+ ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _(error_message));
+ return NULL;
+}
+
static PedDisk*
dasd_duplicate (const PedDisk* disk)
{
- PedDisk* new_disk;
-
- new_disk = ped_disk_new_fresh(disk->dev, &dasd_disk_type);
-
- if (!new_disk)
- return NULL;
-
- new_disk->disk_specific = NULL;
-
- return new_disk;
+ PedDisk* new_disk;
+ DasdDiskSpecific* old_disk_specific;
+ fdasd_anchor_t* new_anchor;
+ fdasd_anchor_t* old_anchor;
+ format4_label_t* new_format4;
+ format5_label_t* new_format5;
+ format7_label_t* new_format7;
+ volume_label_t* new_volume;
+ char* error_message;
+
+ /* Initialize old_* variables. */
+ old_disk_specific = disk->disk_specific;
+ old_anchor = old_disk_specific->anchor;
+ /* The default error message. */
+ error_message = "Could not allocate memory for dasd specific structure.";
+
+ /* Handle DasdDiskSpecific->fdasd_anchor->format4_label_t. */
+ new_format4 = (format4_label_t*) ped_malloc (sizeof (format4_label_t));
+ if (!new_format4)
+ goto error;
+ memcpy (new_format4, old_disk_specific->anchor->f4, sizeof (format4_label_t));
+
+ /* Handle DasdDiskSpecific->fdasd_anchor->format5_label_t. */
+ new_format5 = (format5_label_t*) ped_malloc (sizeof (format5_label_t));
+ if (!new_format5)
+ goto error_free_format4;
+ memcpy (new_format5, old_disk_specific->anchor->f5, sizeof (format5_label_t));
+
+ /* Handle DasdDiskSpecific->fdasd_anchor->format7_label_t. */
+ new_format7 = (format7_label_t*) ped_malloc (sizeof (format7_label_t));
+ if (!new_format7)
+ goto error_free_format5;
+ memcpy (new_format7, old_disk_specific->anchor->f7, sizeof (format7_label_t));
+
+ /* Handle DasdDiskSpecific->fdasd_anchor->volume_label_t. */
+ new_volume = (volume_label_t*) ped_malloc (sizeof (volume_label_t));
+ if (!new_volume)
+ goto error_free_format7;
+ memcpy (new_volume, old_disk_specific->anchor->vlabel,
+ sizeof (volume_label_t));
+
+ /* Handle DasdDiskSpecific->fdasd_anchor. */
+ if (! (new_anchor = (fdasd_anchor_t*) ped_malloc (sizeof (fdasd_anchor_t))))
+ goto error_free_volume;
+ memcpy (new_anchor, old_anchor, sizeof (fdasd_anchor_t));
+ new_anchor->f4 = new_format4;
+ new_anchor->f5 = new_format5;
+ new_anchor->f7 = new_format7;
+ new_anchor->vlabel = new_volume;
+ /* We dont have last and first info yet. */
+ new_anchor->last = NULL;
+ new_anchor->first = NULL;
+
+ /* Handle new disk creation. ped_disk_new_fresh allocates memory for
+ * new_disk->disk_specific. */
+ /* We need to make sure that the device is open for reading. */
+ if (!ped_device_open(disk->dev))
+ {
+ error_message = "Could not open device for dasd disk duplication";
+ goto error_free_anchor;
+ }
+ new_disk = ped_disk_new_fresh (disk->dev, &dasd_disk_type);
+ if (!ped_device_close(disk->dev))
+ {
+ error_message = "Could not close device for dasd disk duplication";
+ goto error_free_anchor;
+ }
+ if (!new_disk)
+ goto error_free_anchor;
+ memcpy (new_disk->disk_specific, old_disk_specific, sizeof(DasdDiskSpecific));
+ ((DasdDiskSpecific*)new_disk->disk_specific)->anchor = new_anchor;
+
+ return new_disk;
+
+error_free_anchor:
+ free(new_anchor);
+error_free_volume:
+ free(new_volume);
+error_free_format7:
+ free(new_format7);
+error_free_format5:
+ free(new_format5);
+error_free_format4:
+ free(new_format4);
+error:
+ ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _(error_message));
+ return NULL;
}
static void
@@ -551,12 +753,20 @@ dasd_partition_new (const PedDisk* disk, PedPartitionType part_type,
goto error;
part->disk_specific = ped_malloc (sizeof (DasdPartitionData));
+ if (!part->disk_specific)
+ goto error_free_part;
return part;
+error_free_part:
+ free(part);
error:
return 0;
}
+/*
+ * Frees the memory of an active partition. Active here is whatever
+ * ped_partition_is_active returns.
+ */
static void
dasd_partition_destroy (PedPartition* part)
{
@@ -818,6 +1028,7 @@ static PedDiskOps dasd_disk_ops = {
partition_set_system: dasd_partition_set_system,
partition_new: dasd_partition_new,
+ partition_duplicate: dasd_partition_duplicate,
partition_destroy: dasd_partition_destroy,
partition_set_flag: dasd_partition_set_flag,
partition_get_flag: dasd_partition_get_flag,
@@ -831,7 +1042,6 @@ static PedDiskOps dasd_disk_ops = {
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 = {
--
1.6.0.6

View File

@ -0,0 +1,485 @@
diff -ur parted-1.9.0.orig/libparted/arch/linux.c parted-1.9.0/libparted/arch/linux.c
--- parted-1.9.0.orig/libparted/arch/linux.c 2009-11-03 11:35:00.000000000 +0100
+++ parted-1.9.0/libparted/arch/linux.c 2009-11-03 11:45:48.000000000 +0100
@@ -646,10 +646,14 @@
#if USE_BLKID
get_blkid_topology(arch_specific);
#endif
+
+#if defined __s390__ || defined __s390x__
/* Return PED_SECTOR_SIZE_DEFAULT for DASDs. */
if (dev->type == PED_DEVICE_DASD) {
+ arch_specific->real_sector_size = dev->sector_size;
dev->sector_size = PED_SECTOR_SIZE_DEFAULT;
}
+#endif
if (dev->sector_size != PED_SECTOR_SIZE_DEFAULT) {
ped_exception_throw (
@@ -1069,6 +1073,7 @@
return 0;
}
+#if defined __s390__ || defined __s390x__
static int
init_dasd (PedDevice* dev, const char* model_name)
{
@@ -1124,6 +1129,7 @@
error:
return 0;
}
+#endif
static int
init_generic (PedDevice* dev, const char* model_name)
@@ -1270,10 +1276,12 @@
goto error_free_arch_specific;
break;
+#if defined __s390__ || defined __s390x__
case PED_DEVICE_DASD:
if (!init_dasd (dev, _("IBM S390 DASD drive")))
goto error_free_arch_specific;
break;
+#endif
case PED_DEVICE_VIODASD:
if (!init_generic (dev, _("IBM iSeries Virtual DASD")))
Only in parted-1.9.0/libparted/arch: linux.c.orig
Only in parted-1.9.0/libparted/arch: linux.c.rej
Only in parted-1.9.0/libparted/arch: linux.c~
diff -ur parted-1.9.0.orig/libparted/arch/linux.h parted-1.9.0/libparted/arch/linux.h
--- parted-1.9.0.orig/libparted/arch/linux.h 2009-11-03 11:35:00.000000000 +0100
+++ parted-1.9.0/libparted/arch/linux.h 2009-11-03 11:44:40.000000000 +0100
@@ -18,10 +18,6 @@
#ifndef PED_ARCH_LINUX_H_INCLUDED
#define PED_ARCH_LINUX_H_INCLUDED
-#if defined(__s390__) || defined(__s390x__)
-# include <parted/fdasd.h>
-#endif
-
#if HAVE_BLKID_BLKID_H
# include <blkid/blkid.h>
#endif
@@ -35,8 +31,6 @@
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
#if HAVE_BLKID_BLKID_H
blkid_probe probe;
Only in parted-1.9.0/libparted/arch: linux.h.orig
Only in parted-1.9.0/libparted/arch: linux.h.rej
Only in parted-1.9.0/libparted/arch: linux.h~
diff -ur parted-1.9.0.orig/libparted/labels/dasd.c parted-1.9.0/libparted/labels/dasd.c
--- parted-1.9.0.orig/libparted/labels/dasd.c 2009-11-03 11:35:00.000000000 +0100
+++ parted-1.9.0/libparted/labels/dasd.c 2009-11-03 11:48:17.000000000 +0100
@@ -66,14 +66,10 @@
int system;
int raid;
int lvm;
- void *part_info;
} DasdPartitionData;
typedef struct {
- unsigned int real_sector_size;
unsigned int format_type;
- /* IBM internal dasd structure (i guess ;), required. */
- struct fdasd_anchor *anchor;
} DasdDiskSpecific;
static PedDiskType dasd_disk_type;
@@ -98,17 +94,8 @@
return NULL;
}
- /* because we lie to parted we have to compensate with the
- real sector size. Record that now. */
- if (ioctl(arch_specific->fd, BLKSSZGET,
- &disk_specific->real_sector_size) == -1) {
- ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
- _("Unable to determine the block "
- "size of this dasd"));
- free(disk_specific);
- free(disk);
- return NULL;
- }
+ /* CDL format, newer */
+ disk_specific->format_type = 2;
return disk;
}
@@ -123,7 +110,8 @@
if (!new_disk)
return NULL;
- new_disk->disk_specific = NULL;
+ memcpy(new_disk->disk_specific, disk->disk_specific,
+ sizeof(DasdDiskSpecific));
return new_disk;
}
@@ -187,6 +175,8 @@
fdasd_recreate_vtoc(&anchor);
fdasd_write_labels(&anchor, arch_specific->fd);
+ fdasd_cleanup(&anchor);
+
return 1;
}
@@ -203,6 +193,7 @@
partition_info_t *p;
LinuxSpecific* arch_specific;
DasdDiskSpecific* disk_specific;
+ struct fdasd_anchor anchor;
PDEBUG;
@@ -216,35 +207,32 @@
arch_specific = LINUX_SPECIFIC(dev);
disk_specific = disk->disk_specific;
- disk_specific->anchor = ped_malloc(sizeof(fdasd_anchor_t));
-
PDEBUG;
- fdasd_initialize_anchor(disk_specific->anchor);
+ fdasd_initialize_anchor(&anchor);
- fdasd_get_geometry(disk_specific->anchor, arch_specific->fd);
+ fdasd_get_geometry(&anchor, arch_specific->fd);
/* check dasd for labels and vtoc */
- if (fdasd_check_volume(disk_specific->anchor, arch_specific->fd))
+ if (fdasd_check_volume(&anchor, arch_specific->fd))
goto error_close_dev;
- if ((disk_specific->anchor->geo.cylinders
- * disk_specific->anchor->geo.heads) > BIG_DISK_SIZE)
- disk_specific->anchor->big_disk++;
+ if ((anchor.geo.cylinders * anchor.geo.heads) > BIG_DISK_SIZE)
+ anchor.big_disk++;
ped_disk_delete_all (disk);
- if (strncmp(disk_specific->anchor->vlabel->volkey,
+ if (strncmp(anchor.vlabel->volkey,
vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0) {
DasdPartitionData* dasd_data;
/* LDL format, old one */
disk_specific->format_type = 1;
start = 24;
- end = (long long)(long long) disk_specific->anchor->geo.cylinders
- * (long long)disk_specific->anchor->geo.heads
+ end = (long long)(long long) anchor.geo.cylinders
+ * (long long)anchor.geo.heads
* (long long)disk->dev->hw_geom.sectors
- * (long long)disk_specific->real_sector_size
+ * (long long)arch_specific->real_sector_size
/ (long long)disk->dev->sector_size - 1;
part = ped_partition_new (disk, PED_PARTITION_PROTECTED, NULL, start, end);
if (!part)
@@ -260,13 +248,15 @@
if (!ped_disk_add_partition (disk, part, NULL))
goto error_close_dev;
+ fdasd_cleanup(&anchor);
+
return 1;
}
/* CDL format, newer */
disk_specific->format_type = 2;
- p = disk_specific->anchor->first;
+ p = anchor.first;
PDEBUG;
for (i = 1 ; i <= USABLE_PARTITIONS; i++) {
@@ -281,11 +271,11 @@
start = (long long)(long long) p->start_trk
* (long long) disk->dev->hw_geom.sectors
- * (long long) disk_specific->real_sector_size
+ * (long long) arch_specific->real_sector_size
/ (long long) disk->dev->sector_size;
end = (long long)((long long) p->end_trk + 1)
* (long long) disk->dev->hw_geom.sectors
- * (long long) disk_specific->real_sector_size
+ * (long long) arch_specific->real_sector_size
/ (long long) disk->dev->sector_size - 1;
part = ped_partition_new(disk, PED_PARTITION_NORMAL, NULL,
start, end);
@@ -331,24 +321,25 @@
vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44);
- dasd_data->part_info = (void *) p;
dasd_data->type = 0;
constraint_exact = ped_constraint_exact (&part->geom);
if (!constraint_exact)
goto error_close_dev;
- if (!ped_disk_add_partition(disk, part, constraint_exact))
+ if (!ped_disk_add_partition(disk, part, constraint_exact)) {
+ ped_constraint_destroy(constraint_exact);
goto error_close_dev;
+ }
ped_constraint_destroy(constraint_exact);
if (p->fspace_trk > 0) {
start = (long long)((long long) p->end_trk + 1)
* (long long) disk->dev->hw_geom.sectors
- * (long long) disk_specific->real_sector_size
+ * (long long) arch_specific->real_sector_size
/ (long long) disk->dev->sector_size;
end = (long long)((long long) p->end_trk + 1 + p->fspace_trk)
* (long long) disk->dev->hw_geom.sectors
- * (long long) disk_specific->real_sector_size
+ * (long long) arch_specific->real_sector_size
/ (long long) disk->dev->sector_size - 1;
part = ped_partition_new (disk, PED_PARTITION_NORMAL,
NULL, start, end);
@@ -361,8 +352,10 @@
if (!constraint_exact)
goto error_close_dev;
- if (!ped_disk_add_partition(disk, part, constraint_exact))
+ if (!ped_disk_add_partition(disk, part, constraint_exact)) {
+ ped_constraint_destroy(constraint_exact);
goto error_close_dev;
+ }
ped_constraint_destroy (constraint_exact);
}
@@ -371,16 +364,20 @@
}
PDEBUG;
+ fdasd_cleanup(&anchor);
return 1;
error_close_dev:
PDEBUG;
+ fdasd_cleanup(&anchor);
return 0;
}
static int
-dasd_update_type (const PedDisk* disk)
+dasd_update_type (const PedDisk* disk, struct fdasd_anchor *anchor,
+ partition_info_t *part_info[USABLE_PARTITIONS])
{
+ int i;
PedPartition* part;
LinuxSpecific* arch_specific;
DasdDiskSpecific* disk_specific;
@@ -390,22 +387,21 @@
PDEBUG;
- for (part = ped_disk_next_partition(disk, NULL); part;
- part = ped_disk_next_partition(disk, part)) {
+ for (i = 1; i <= USABLE_PARTITIONS; i++) {
partition_info_t *p;
char *ch = NULL;
DasdPartitionData* dasd_data;
PDEBUG;
- if (part->type & PED_PARTITION_FREESPACE
- || part->type & PED_PARTITION_METADATA)
+ part = ped_disk_get_partition(disk, i);
+ if (!part)
continue;
PDEBUG;
dasd_data = part->disk_specific;
- p = dasd_data->part_info;
+ p = part_info[i - 1];
if (!p ) {
PDEBUG;
@@ -447,7 +443,7 @@
break;
}
- disk_specific->anchor->vtoc_changed++;
+ anchor->vtoc_changed++;
vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44);
}
@@ -463,6 +459,9 @@
partition_info_t *p;
LinuxSpecific* arch_specific;
DasdDiskSpecific* disk_specific;
+ struct fdasd_anchor anchor;
+ partition_info_t *part_info[USABLE_PARTITIONS];
+
PED_ASSERT(disk != NULL, return 0);
PED_ASSERT(disk->dev != NULL, return 0);
@@ -475,23 +474,21 @@
if (disk_specific->format_type == 1)
return 1;
- /* XXX re-initialize anchor? */
- fdasd_initialize_anchor(disk_specific->anchor);
- fdasd_get_geometry(disk_specific->anchor, arch_specific->fd);
+ /* initialize the anchor */
+ fdasd_initialize_anchor(&anchor);
+ fdasd_get_geometry(&anchor, arch_specific->fd);
/* check dasd for labels and vtoc */
- if (fdasd_check_volume(disk_specific->anchor, arch_specific->fd))
+ if (fdasd_check_volume(&anchor, arch_specific->fd))
goto error;
- if ((disk_specific->anchor->geo.cylinders
- * disk_specific->anchor->geo.heads) > BIG_DISK_SIZE)
- disk_specific->anchor->big_disk++;
+ if ((anchor.geo.cylinders * anchor.geo.heads) > BIG_DISK_SIZE)
+ anchor.big_disk++;
- fdasd_recreate_vtoc(disk_specific->anchor);
+ fdasd_recreate_vtoc(&anchor);
for (i = 1; i <= USABLE_PARTITIONS; i++) {
unsigned int start, stop;
- int type;
PDEBUG;
part = ped_disk_get_partition(disk, i);
@@ -501,41 +498,40 @@
PDEBUG;
start = part->geom.start * disk->dev->sector_size
- / disk_specific->real_sector_size / disk->dev->hw_geom.sectors;
+ / arch_specific->real_sector_size / disk->dev->hw_geom.sectors;
stop = (part->geom.end + 1)
- * disk->dev->sector_size / disk_specific->real_sector_size
+ * disk->dev->sector_size / arch_specific->real_sector_size
/ disk->dev->hw_geom.sectors - 1;
PDEBUG;
dasd_data = part->disk_specific;
- type = dasd_data->type;
- PDEBUG;
-
- p = fdasd_add_partition(disk_specific->anchor, start, stop);
+ p = fdasd_add_partition(&anchor, start, stop);
if (!p) {
PDEBUG;
- return 0;
+ goto error;
}
- dasd_data->part_info = (void *) p;
+ part_info[i - 1] = p;
p->type = dasd_data->system;
}
PDEBUG;
- if (!fdasd_prepare_labels(disk_specific->anchor, arch_specific->fd))
- return 0;
+ if (!fdasd_prepare_labels(&anchor, arch_specific->fd))
+ goto error;
- dasd_update_type(disk);
+ dasd_update_type(disk, &anchor, part_info);
PDEBUG;
- if (!fdasd_write_labels(disk_specific->anchor, arch_specific->fd))
- return 0;
+ if (!fdasd_write_labels(&anchor, arch_specific->fd))
+ goto error;
+ fdasd_cleanup(&anchor);
return 1;
error:
PDEBUG;
+ fdasd_cleanup(&anchor);
return 0;
}
@@ -557,6 +553,23 @@
return 0;
}
+static PedPartition*
+dasd_partition_duplicate (const PedPartition *part)
+{
+ PedPartition *new_part;
+
+ new_part = ped_partition_new (part->disk, part->type, part->fs_type,
+ part->geom.start, part->geom.end);
+ if (!new_part)
+ return NULL;
+ new_part->num = part->num;
+
+ memcpy(new_part->disk_specific, part->disk_specific,
+ sizeof(DasdPartitionData));
+
+ return new_part;
+}
+
static void
dasd_partition_destroy (PedPartition* part)
{
@@ -650,8 +662,9 @@
dasd_get_partition_alignment(const PedDisk *disk)
{
DasdDiskSpecific* disk_specific = disk->disk_specific;
+ LinuxSpecific *arch_specific = LINUX_SPECIFIC(disk->dev);
PedSector sector_size =
- disk_specific->real_sector_size / disk->dev->sector_size;
+ arch_specific->real_sector_size / disk->dev->sector_size;
return ped_alignment_new(0, disk->dev->hw_geom.sectors * sector_size);
}
@@ -670,7 +683,7 @@
arch_specific = LINUX_SPECIFIC (disk->dev);
disk_specific = disk->disk_specific;
- sector_size = disk_specific->real_sector_size / disk->dev->sector_size;
+ sector_size = arch_specific->real_sector_size / disk->dev->sector_size;
if (!ped_alignment_init (&start_align, 0,
disk->dev->hw_geom.sectors * sector_size))
@@ -796,7 +809,7 @@
else
/* Mark the start of the disk as metadata. */
vtoc_end = (FIRST_USABLE_TRK * (long long) disk->dev->hw_geom.sectors
- * (long long) disk_specific->real_sector_size
+ * (long long) arch_specific->real_sector_size
/ (long long) disk->dev->sector_size) - 1;
new_part = ped_partition_new (disk,PED_PARTITION_METADATA,NULL,0,vtoc_end);
@@ -828,6 +841,7 @@
partition_set_system: dasd_partition_set_system,
partition_new: dasd_partition_new,
+ partition_duplicate: dasd_partition_duplicate,
partition_destroy: dasd_partition_destroy,
partition_set_flag: dasd_partition_set_flag,
partition_get_flag: dasd_partition_get_flag,
@@ -841,8 +855,6 @@
get_max_primary_partition_count: dasd_get_max_primary_partition_count,
get_max_supported_partition_count: dasd_get_max_supported_partition_count,
get_partition_alignment: dasd_get_partition_alignment,
-
- partition_duplicate: NULL
};
static PedDiskType dasd_disk_type = {
Only in parted-1.9.0/libparted/labels: dasd.c.orig
Only in parted-1.9.0/libparted/labels: dasd.c.rej
Only in parted-1.9.0/libparted/labels: dasd.c~

View File

@ -1,6 +1,6 @@
diff -up parted-1.9.0/configure.ac.export-align parted-1.9.0/configure.ac diff -up parted-1.9.0/configure.ac.export-align parted-1.9.0/configure.ac
--- parted-1.9.0/configure.ac.export-align 2009-07-23 19:52:08.000000000 +0200 --- parted-1.9.0/configure.ac.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/configure.ac 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/configure.ac 2009-11-03 11:30:46.000000000 +0100
@@ -519,6 +519,18 @@ HOST=$(hostname) @@ -519,6 +519,18 @@ HOST=$(hostname)
BUILDINFO="$USER@$HOST, $DATE" BUILDINFO="$USER@$HOST, $DATE"
AC_SUBST([BUILDINFO]) AC_SUBST([BUILDINFO])
@ -22,7 +22,7 @@ diff -up parted-1.9.0/configure.ac.export-align parted-1.9.0/configure.ac
lib/Makefile lib/Makefile
diff -up parted-1.9.0/include/parted/device.h.export-align parted-1.9.0/include/parted/device.h diff -up parted-1.9.0/include/parted/device.h.export-align parted-1.9.0/include/parted/device.h
--- parted-1.9.0/include/parted/device.h.export-align 2009-07-23 19:52:08.000000000 +0200 --- parted-1.9.0/include/parted/device.h.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/include/parted/device.h 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/include/parted/device.h 2009-11-03 11:30:46.000000000 +0100
@@ -92,6 +92,8 @@ struct _PedDevice { @@ -92,6 +92,8 @@ struct _PedDevice {
void* arch_specific; void* arch_specific;
}; };
@ -58,9 +58,9 @@ diff -up parted-1.9.0/include/parted/device.h.export-align parted-1.9.0/include/
extern void _ped_device_probe (const char* path); extern void _ped_device_probe (const char* path);
diff -up parted-1.9.0/include/parted/disk.h.export-align parted-1.9.0/include/parted/disk.h diff -up parted-1.9.0/include/parted/disk.h.export-align parted-1.9.0/include/parted/disk.h
--- parted-1.9.0/include/parted/disk.h.export-align 2009-10-29 15:19:31.000000000 +0100 --- parted-1.9.0/include/parted/disk.h.export-align 2009-11-03 11:30:46.000000000 +0100
+++ parted-1.9.0/include/parted/disk.h 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/include/parted/disk.h 2009-11-03 11:30:46.000000000 +0100
@@ -216,6 +216,7 @@ struct _PedDiskOps { @@ -214,6 +214,7 @@ struct _PedDiskOps {
int (*get_max_primary_partition_count) (const PedDisk* disk); int (*get_max_primary_partition_count) (const PedDisk* disk);
bool (*get_max_supported_partition_count) (const PedDisk* disk, bool (*get_max_supported_partition_count) (const PedDisk* disk,
int* supported); int* supported);
@ -68,7 +68,7 @@ diff -up parted-1.9.0/include/parted/disk.h.export-align parted-1.9.0/include/pa
}; };
struct _PedDiskType { struct _PedDiskType {
@@ -265,6 +266,8 @@ extern int ped_disk_get_last_partition_n @@ -263,6 +264,8 @@ extern int ped_disk_get_last_partition_n
extern int ped_disk_get_max_primary_partition_count (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, extern bool ped_disk_get_max_supported_partition_count(const PedDisk* disk,
int* supported); int* supported);
@ -79,7 +79,7 @@ diff -up parted-1.9.0/include/parted/disk.h.export-align parted-1.9.0/include/pa
/** @} */ /** @} */
diff -up parted-1.9.0/include/parted/natmath.h.export-align parted-1.9.0/include/parted/natmath.h 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.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/include/parted/natmath.h 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/include/parted/natmath.h 2009-11-03 11:30:46.000000000 +0100
@@ -31,6 +31,7 @@ typedef struct _PedAlignment PedAlignmen @@ -31,6 +31,7 @@ typedef struct _PedAlignment PedAlignmen
#include <parted/disk.h> #include <parted/disk.h>
@ -90,7 +90,7 @@ diff -up parted-1.9.0/include/parted/natmath.h.export-align parted-1.9.0/include
#define PED_MAX(a, b) ( ((a)>(b)) ? (a) : (b) ) #define PED_MAX(a, b) ( ((a)>(b)) ? (a) : (b) )
diff -up parted-1.9.0/libparted/Makefile.am.export-align parted-1.9.0/libparted/Makefile.am diff -up parted-1.9.0/libparted/Makefile.am.export-align parted-1.9.0/libparted/Makefile.am
--- parted-1.9.0/libparted/Makefile.am.export-align 2009-07-23 19:52:08.000000000 +0200 --- parted-1.9.0/libparted/Makefile.am.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/libparted/Makefile.am 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/Makefile.am 2009-11-03 11:30:46.000000000 +0100
@@ -50,6 +50,7 @@ libparted_la_LIBADD = \ @@ -50,6 +50,7 @@ libparted_la_LIBADD = \
$(DL_LIBS) \ $(DL_LIBS) \
$(DM_LIBS) \ $(DM_LIBS) \
@ -100,8 +100,8 @@ diff -up parted-1.9.0/libparted/Makefile.am.export-align parted-1.9.0/libparted/
EXTRA_DIST = mbr.s EXTRA_DIST = mbr.s
diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted/arch/linux.c diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted/arch/linux.c
--- parted-1.9.0/libparted/arch/linux.c.export-align 2009-10-29 15:19:31.000000000 +0100 --- parted-1.9.0/libparted/arch/linux.c.export-align 2009-11-03 11:30:46.000000000 +0100
+++ parted-1.9.0/libparted/arch/linux.c 2009-10-29 15:22:59.000000000 +0100 +++ parted-1.9.0/libparted/arch/linux.c 2009-11-03 11:30:46.000000000 +0100
@@ -598,7 +598,24 @@ _have_kern26 () @@ -598,7 +598,24 @@ _have_kern26 ()
kver = _get_linux_version(); kver = _get_linux_version();
return have_kern26 = kver >= KERNEL_VERSION (2,6,0) ? 1 : 0; return have_kern26 = kver >= KERNEL_VERSION (2,6,0) ? 1 : 0;
@ -128,7 +128,7 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted
static void static void
_device_set_sector_size (PedDevice* dev) _device_set_sector_size (PedDevice* dev)
{ {
@@ -626,6 +645,9 @@ _device_set_sector_size (PedDevice* dev) @@ -626,6 +643,9 @@ _device_set_sector_size (PedDevice* dev)
dev->sector_size = (long long)sector_size; dev->sector_size = (long long)sector_size;
} }
@ -138,7 +138,7 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted
/* Return PED_SECTOR_SIZE_DEFAULT for DASDs. */ /* Return PED_SECTOR_SIZE_DEFAULT for DASDs. */
if (dev->type == PED_DEVICE_DASD) { if (dev->type == PED_DEVICE_DASD) {
dev->sector_size = PED_SECTOR_SIZE_DEFAULT; dev->sector_size = PED_SECTOR_SIZE_DEFAULT;
@@ -1237,6 +1235,10 @@ linux_new (const char* path) @@ -1215,6 +1235,10 @@ linux_new (const char* path)
goto error_free_path; goto error_free_path;
arch_specific = LINUX_SPECIFIC (dev); arch_specific = LINUX_SPECIFIC (dev);
arch_specific->dmtype = NULL; arch_specific->dmtype = NULL;
@ -149,7 +149,7 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted
dev->open_count = 0; dev->open_count = 0;
dev->read_only = 0; dev->read_only = 0;
@@ -1335,7 +1357,12 @@ error: @@ -1335,7 +1359,12 @@ error:
static void static void
linux_destroy (PedDevice* dev) linux_destroy (PedDevice* dev)
{ {
@ -163,7 +163,7 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted
free (dev->arch_specific); free (dev->arch_specific);
free (dev->path); free (dev->path);
free (dev->model); free (dev->model);
@@ -2446,6 +2473,34 @@ linux_disk_commit (PedDisk* disk) @@ -2446,6 +2475,34 @@ linux_disk_commit (PedDisk* disk)
return 1; return 1;
} }
@ -198,7 +198,7 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted
static PedDeviceArchOps linux_dev_ops = { static PedDeviceArchOps linux_dev_ops = {
_new: linux_new, _new: linux_new,
destroy: linux_destroy, destroy: linux_destroy,
@@ -2459,7 +2514,11 @@ static PedDeviceArchOps linux_dev_ops = @@ -2459,7 +2516,11 @@ static PedDeviceArchOps linux_dev_ops =
check: linux_check, check: linux_check,
sync: linux_sync, sync: linux_sync,
sync_fast: linux_sync_fast, sync_fast: linux_sync_fast,
@ -213,7 +213,7 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted
PedDiskArchOps linux_disk_ops = { PedDiskArchOps linux_disk_ops = {
diff -up parted-1.9.0/libparted/arch/linux.h.export-align parted-1.9.0/libparted/arch/linux.h diff -up parted-1.9.0/libparted/arch/linux.h.export-align parted-1.9.0/libparted/arch/linux.h
--- parted-1.9.0/libparted/arch/linux.h.export-align 2009-07-23 19:52:08.000000000 +0200 --- parted-1.9.0/libparted/arch/linux.h.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/libparted/arch/linux.h 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/arch/linux.h 2009-11-03 11:30:46.000000000 +0100
@@ -22,6 +22,10 @@ @@ -22,6 +22,10 @@
# include <parted/fdasd.h> # include <parted/fdasd.h>
#endif #endif
@ -238,7 +238,7 @@ diff -up parted-1.9.0/libparted/arch/linux.h.export-align parted-1.9.0/libparted
#endif /* PED_ARCH_LINUX_H_INCLUDED */ #endif /* PED_ARCH_LINUX_H_INCLUDED */
diff -up parted-1.9.0/libparted/device.c.export-align parted-1.9.0/libparted/device.c diff -up parted-1.9.0/libparted/device.c.export-align parted-1.9.0/libparted/device.c
--- parted-1.9.0/libparted/device.c.export-align 2009-07-23 19:52:08.000000000 +0200 --- parted-1.9.0/libparted/device.c.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/libparted/device.c 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/device.c 2009-11-03 11:30:46.000000000 +0100
@@ -416,33 +416,146 @@ ped_device_sync_fast (PedDevice* dev) @@ -416,33 +416,146 @@ ped_device_sync_fast (PedDevice* dev)
} }
@ -398,8 +398,8 @@ diff -up parted-1.9.0/libparted/device.c.export-align parted-1.9.0/libparted/dev
/** @} */ /** @} */
diff -up parted-1.9.0/libparted/disk.c.export-align parted-1.9.0/libparted/disk.c diff -up parted-1.9.0/libparted/disk.c.export-align parted-1.9.0/libparted/disk.c
--- parted-1.9.0/libparted/disk.c.export-align 2009-10-29 15:19:31.000000000 +0100 --- parted-1.9.0/libparted/disk.c.export-align 2009-11-03 11:30:46.000000000 +0100
+++ parted-1.9.0/libparted/disk.c 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/disk.c 2009-11-03 11:30:46.000000000 +0100
@@ -703,6 +703,26 @@ ped_disk_get_max_supported_partition_cou @@ -703,6 +703,26 @@ ped_disk_get_max_supported_partition_cou
} }
@ -428,9 +428,9 @@ diff -up parted-1.9.0/libparted/disk.c.export-align parted-1.9.0/libparted/disk.
* *
* For example, MacIntosh partition maps can have different sizes, * For example, MacIntosh partition maps can have different sizes,
diff -up parted-1.9.0/libparted/labels/dasd.c.export-align parted-1.9.0/libparted/labels/dasd.c diff -up parted-1.9.0/libparted/labels/dasd.c.export-align parted-1.9.0/libparted/labels/dasd.c
--- parted-1.9.0/libparted/labels/dasd.c.export-align 2009-10-29 15:19:31.000000000 +0100 --- parted-1.9.0/libparted/labels/dasd.c.export-align 2009-11-03 11:30:46.000000000 +0100
+++ parted-1.9.0/libparted/labels/dasd.c 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/labels/dasd.c 2009-11-03 11:32:19.000000000 +0100
@@ -856,6 +856,16 @@ dasd_get_max_supported_partition_count ( @@ -646,6 +646,16 @@ dasd_get_max_supported_partition_count (
return true; return true;
} }
@ -447,17 +447,17 @@ diff -up parted-1.9.0/libparted/labels/dasd.c.export-align parted-1.9.0/libparte
static PedConstraint* static PedConstraint*
_primary_constraint (PedDisk* disk) _primary_constraint (PedDisk* disk)
{ {
@@ -1041,6 +1051,7 @@ static PedDiskOps dasd_disk_ops = { @@ -830,6 +840,7 @@ static PedDiskOps dasd_disk_ops = {
alloc_metadata: dasd_alloc_metadata, alloc_metadata: dasd_alloc_metadata,
get_max_primary_partition_count: dasd_get_max_primary_partition_count, get_max_primary_partition_count: dasd_get_max_primary_partition_count,
get_max_supported_partition_count: dasd_get_max_supported_partition_count, get_max_supported_partition_count: dasd_get_max_supported_partition_count,
+ get_partition_alignment: dasd_get_partition_alignment, + get_partition_alignment: dasd_get_partition_alignment,
partition_duplicate: NULL
}; };
diff -up parted-1.9.0/libparted/labels/mac.c.export-align parted-1.9.0/libparted/labels/mac.c diff -up parted-1.9.0/libparted/labels/mac.c.export-align parted-1.9.0/libparted/labels/mac.c
--- parted-1.9.0/libparted/labels/mac.c.export-align 2009-10-29 15:19:31.000000000 +0100 --- parted-1.9.0/libparted/labels/mac.c.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/libparted/labels/mac.c 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/labels/mac.c 2009-11-03 11:30:46.000000000 +0100
@@ -1375,6 +1375,14 @@ mac_partition_get_name (const PedPartiti @@ -1375,6 +1375,14 @@ mac_partition_get_name (const PedPartiti
return mac_data->volume_name; return mac_data->volume_name;
} }
@ -484,8 +484,8 @@ diff -up parted-1.9.0/libparted/labels/mac.c.export-align parted-1.9.0/libparted
static PedDiskType mac_disk_type = { static PedDiskType mac_disk_type = {
diff -up parted-1.9.0/libparted/labels/pc98.c.export-align parted-1.9.0/libparted/labels/pc98.c diff -up parted-1.9.0/libparted/labels/pc98.c.export-align parted-1.9.0/libparted/labels/pc98.c
--- parted-1.9.0/libparted/labels/pc98.c.export-align 2009-10-29 15:19:31.000000000 +0100 --- parted-1.9.0/libparted/labels/pc98.c.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/libparted/labels/pc98.c 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/labels/pc98.c 2009-11-03 11:30:46.000000000 +0100
@@ -720,6 +720,15 @@ pc98_partition_get_name (const PedPartit @@ -720,6 +720,15 @@ pc98_partition_get_name (const PedPartit
return pc98_data->name; return pc98_data->name;
} }
@ -513,8 +513,8 @@ diff -up parted-1.9.0/libparted/labels/pc98.c.export-align parted-1.9.0/libparte
static PedDiskType pc98_disk_type = { static PedDiskType pc98_disk_type = {
diff -up parted-1.9.0/libparted/labels/rdb.c.export-align parted-1.9.0/libparted/labels/rdb.c diff -up parted-1.9.0/libparted/labels/rdb.c.export-align parted-1.9.0/libparted/labels/rdb.c
--- parted-1.9.0/libparted/labels/rdb.c.export-align 2009-10-29 15:19:31.000000000 +0100 --- parted-1.9.0/libparted/labels/rdb.c.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/libparted/labels/rdb.c 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/labels/rdb.c 2009-11-03 11:30:46.000000000 +0100
@@ -1024,6 +1024,15 @@ amiga_partition_get_name (const PedParti @@ -1024,6 +1024,15 @@ amiga_partition_get_name (const PedParti
return _amiga_get_bstr(partition->pb_DriveName); return _amiga_get_bstr(partition->pb_DriveName);
} }
@ -542,8 +542,8 @@ diff -up parted-1.9.0/libparted/labels/rdb.c.export-align parted-1.9.0/libparted
static PedDiskType amiga_disk_type = { static PedDiskType amiga_disk_type = {
diff -up parted-1.9.0/libparted/labels/sun.c.export-align parted-1.9.0/libparted/labels/sun.c diff -up parted-1.9.0/libparted/labels/sun.c.export-align parted-1.9.0/libparted/labels/sun.c
--- parted-1.9.0/libparted/labels/sun.c.export-align 2009-10-29 15:19:31.000000000 +0100 --- parted-1.9.0/libparted/labels/sun.c.export-align 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/libparted/labels/sun.c 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/labels/sun.c 2009-11-03 11:30:46.000000000 +0100
@@ -677,6 +677,15 @@ sun_get_max_primary_partition_count (con @@ -677,6 +677,15 @@ sun_get_max_primary_partition_count (con
return SUN_DISK_MAXPARTITIONS; return SUN_DISK_MAXPARTITIONS;
} }

View File

@ -1,199 +0,0 @@
From 3b3113cff84f89ae6a64e195acb3423125f6d681 Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@redhat.com>
Date: Thu, 16 Jul 2009 18:35:30 +0200
Subject: [PATCH] Add disk as an argument to partition_duplicate.
The disk is needed to provide some context when creating the duplicate
partition. The disk is needed by the dasd type labels.
* include/parted/disk.h (partition_duplicate): Add the disk to the
function definition
* libparted/disk.c (_add_duplicate_part): Pass the "new disk" to the
partition_duplicate function.
* libparted/labels/aix.c (aix_partition_duplicate): Comply with the new
partition_duplicate function definition.
* libparted/labels/bsd.c (bsd_partition_duplicate): Likewise
* libparted/labels/dos.c (msdos_partition_duplicate): Likewise
* libparted/labels/dvh.c (dvh_partition_duplicate): Likewise
* libparted/labels/gpt.c (gpt_partition_duplicate): Likewise
* libparted/labels/loop.c (loop_partition_duplicate): Likewise
* libparted/labels/mac.c (mac_partition_duplicate): Likewise
* libparted/labels/pc98.c (pc98_partition_duplicate): Likewise
* libparted/labels/rdb.c (amiga_partition_duplicate): Likewise
* libparted/labels/sun.c (sun_partition_duplicate): Likewise
---
include/parted/disk.h | 4 +++-
libparted/disk.c | 2 +-
libparted/labels/aix.c | 2 +-
libparted/labels/bsd.c | 2 +-
libparted/labels/dos.c | 2 +-
libparted/labels/dvh.c | 2 +-
libparted/labels/gpt.c | 2 +-
libparted/labels/loop.c | 2 +-
libparted/labels/mac.c | 2 +-
libparted/labels/pc98.c | 2 +-
libparted/labels/rdb.c | 2 +-
libparted/labels/sun.c | 2 +-
12 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/include/parted/disk.h b/include/parted/disk.h
index 664c388..7548be8 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -189,7 +189,9 @@ struct _PedDiskOps {
const PedFileSystemType* fs_type,
PedSector start,
PedSector end);
- PedPartition* (*partition_duplicate) (const PedPartition* part);
+ /* disk is the result of duplicate (the new disk). Can be NULL */
+ PedPartition* (*partition_duplicate) (const PedPartition* part,
+ PedDisk* disk);
void (*partition_destroy) (PedPartition* part);
int (*partition_set_system) (PedPartition* part,
const PedFileSystemType* fs_type);
diff --git a/libparted/disk.c b/libparted/disk.c
index 44a2f2f..99cb563 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -227,7 +227,7 @@ _add_duplicate_part (PedDisk* disk, PedPartition* old_part)
PedPartition* new_part;
int ret;
- new_part = disk->type->ops->partition_duplicate (old_part);
+ new_part = disk->type->ops->partition_duplicate (old_part, disk);
if (!new_part)
goto error;
new_part->disk = disk;
diff --git a/libparted/labels/aix.c b/libparted/labels/aix.c
index de81270..a544cbb 100644
--- a/libparted/labels/aix.c
+++ b/libparted/labels/aix.c
@@ -165,7 +165,7 @@ aix_partition_new (const PedDisk* disk, PedPartitionType part_type,
}
static PedPartition*
-aix_partition_duplicate (const PedPartition* part)
+aix_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
PED_EXCEPTION_CANCEL,
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
index 3d6b5ab..62634a6 100644
--- a/libparted/labels/bsd.c
+++ b/libparted/labels/bsd.c
@@ -417,7 +417,7 @@ error:
}
static PedPartition*
-bsd_partition_duplicate (const PedPartition* part)
+bsd_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
PedPartition* new_part;
BSDPartitionData* new_bsd_data;
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index e7d416d..0987c70 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1215,7 +1215,7 @@ error:
}
static PedPartition*
-msdos_partition_duplicate (const PedPartition* part)
+msdos_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
PedPartition* new_part;
DosPartitionData* new_dos_data;
diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c
index 93de8f9..c4de55a 100644
--- a/libparted/labels/dvh.c
+++ b/libparted/labels/dvh.c
@@ -534,7 +534,7 @@ error:
}
static PedPartition*
-dvh_partition_duplicate (const PedPartition* part)
+dvh_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
PedPartition* result;
DVHPartData* part_data = part->disk_specific;
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 1d7f0c5..b5c8cdb 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1212,7 +1212,7 @@ error:
}
static PedPartition*
-gpt_partition_duplicate (const PedPartition* part)
+gpt_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
PedPartition* result;
GPTPartitionData* part_data = part->disk_specific;
diff --git a/libparted/labels/loop.c b/libparted/labels/loop.c
index 10ba29e..60c22eb 100644
--- a/libparted/labels/loop.c
+++ b/libparted/labels/loop.c
@@ -201,7 +201,7 @@ loop_partition_new (const PedDisk* disk, PedPartitionType part_type,
}
static PedPartition*
-loop_partition_duplicate (const PedPartition* part)
+loop_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
PedPartition* result;
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index c1f3dc7..42abd66 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -1154,7 +1154,7 @@ error:
}
static PedPartition*
-mac_partition_duplicate (const PedPartition* part)
+mac_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
PedPartition* new_part;
MacPartitionData* new_mac_data;
diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c
index f392bea..7fe23ab 100644
--- a/libparted/labels/pc98.c
+++ b/libparted/labels/pc98.c
@@ -568,7 +568,7 @@ error:
}
static PedPartition*
-pc98_partition_duplicate (const PedPartition* part)
+pc98_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
PedPartition* new_part;
PC98PartitionData* new_pc98_data;
diff --git a/libparted/labels/rdb.c b/libparted/labels/rdb.c
index c39230d..e0bb936 100644
--- a/libparted/labels/rdb.c
+++ b/libparted/labels/rdb.c
@@ -851,7 +851,7 @@ amiga_partition_new (const PedDisk* disk, PedPartitionType part_type,
}
static PedPartition*
-amiga_partition_duplicate (const PedPartition* part)
+amiga_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
PedPartition *new_part;
struct PartitionBlock *new_amiga_part;
diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c
index 41580a4..1451252 100644
--- a/libparted/labels/sun.c
+++ b/libparted/labels/sun.c
@@ -500,7 +500,7 @@ error:
}
static PedPartition*
-sun_partition_duplicate (const PedPartition* part)
+sun_partition_duplicate (const PedPartition* part, PedDisk* disk)
{
PedPartition* new_part;
SunPartitionData* new_sun_data;
--
1.6.0.6

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program Summary: The GNU disk partition manipulation program
Name: parted Name: parted
Version: 1.9.0 Version: 1.9.0
Release: 19%{?dist} Release: 20%{?dist}
License: GPLv3+ License: GPLv3+
Group: Applications/System Group: Applications/System
URL: http://www.gnu.org/software/parted URL: http://www.gnu.org/software/parted
@ -17,8 +17,6 @@ Patch4: %{name}-1.9.0-pop-push-error.patch
Patch5: %{name}-1.9.0-no-cylinder-align.patch Patch5: %{name}-1.9.0-no-cylinder-align.patch
Patch6: %{name}-1.9.0-remove-struct-elem.patch Patch6: %{name}-1.9.0-remove-struct-elem.patch
Patch7: %{name}-1.9.0-move-function-declarations.patch Patch7: %{name}-1.9.0-move-function-declarations.patch
Patch8: %{name}-1.9.0-dasd-duplicate.patch
Patch9: %{name}-1.9.0-new-duplicate.patch
Patch10: %{name}-1.9.0-handle-dup-error.patch Patch10: %{name}-1.9.0-handle-dup-error.patch
Patch11: %{name}-1.9.0-swap-flag.patch Patch11: %{name}-1.9.0-swap-flag.patch
Patch12: %{name}-1.9.0-volkeysize.patch Patch12: %{name}-1.9.0-volkeysize.patch
@ -28,6 +26,7 @@ Patch15: %{name}-1.9.0-dont-touch-part-nodes.patch
Patch16: %{name}-1.9.0-ped_partition_is_busy-no-exception.patch Patch16: %{name}-1.9.0-ped_partition_is_busy-no-exception.patch
Patch17: %{name}-1.9.0-gpt-big-endian.patch Patch17: %{name}-1.9.0-gpt-big-endian.patch
Patch18: %{name}-1.9.0-export-alignment-info.patch Patch18: %{name}-1.9.0-export-alignment-info.patch
Patch19: %{name}-1.9.0-dasd-fixes.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel BuildRequires: e2fsprogs-devel
@ -39,6 +38,7 @@ BuildRequires: texinfo
BuildRequires: device-mapper-devel BuildRequires: device-mapper-devel
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
BuildRequires: libuuid-devel BuildRequires: libuuid-devel
BuildRequires: libblkid-devel >= 2.17
Requires(post): /sbin/ldconfig Requires(post): /sbin/ldconfig
Requires(post): /sbin/install-info Requires(post): /sbin/install-info
@ -72,8 +72,6 @@ Parted library, you need to install this package.
%patch5 -p1 -b .no-cylinder-align %patch5 -p1 -b .no-cylinder-align
%patch6 -p1 -b .remove-struct-elem %patch6 -p1 -b .remove-struct-elem
%patch7 -p1 -b .move-function-declarations %patch7 -p1 -b .move-function-declarations
%patch8 -p1 -b .dasd-duplicate
%patch9 -p1 -b .new-duplicate
%patch10 -p1 -b .handle-dup-error %patch10 -p1 -b .handle-dup-error
%patch11 -p1 -b .swap-flag %patch11 -p1 -b .swap-flag
%patch12 -p1 -b .volkeysize %patch12 -p1 -b .volkeysize
@ -83,6 +81,7 @@ Parted library, you need to install this package.
%patch16 -p1 -b .ped_partition_is_busy %patch16 -p1 -b .ped_partition_is_busy
%patch17 -p1 -b .gpt-big-endian %patch17 -p1 -b .gpt-big-endian
%patch18 -p1 -b .export-align %patch18 -p1 -b .export-align
%patch19 -p1 -b .dasd
aclocal --force -I m4 aclocal --force -I m4
autoconf --force autoconf --force
autoheader --force autoheader --force
@ -148,6 +147,11 @@ fi
%{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc %{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc
%changelog %changelog
* Tue Nov 3 2009 Hans de Goede <hdegoede@redhat.com> 1.9.0-20
- Fix error when creating a fresh dasd disk (#532425)
- Rewrite dasd disk duplication patches, as the old old ones conflicted
with fixing creating a fresh dasd disk
* Fri Oct 30 2009 Hans de Goede <hdegoede@redhat.com> 1.9.0-19 * Fri Oct 30 2009 Hans de Goede <hdegoede@redhat.com> 1.9.0-19
- Fix a segfault introduced by -18 when operating on plain files - Fix a segfault introduced by -18 when operating on plain files