parted/parted-1.9.0-new-duplicate.patch
2009-07-21 14:59:01 +00:00

200 lines
6.9 KiB
Diff

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