- Allow RAID or LVM partition types on BSD disklabels. (jay.estabrook AT

hp.com, #427114)
This commit is contained in:
David Cantrell 2008-04-10 20:37:13 +00:00
parent 4e18b61870
commit 2667a15ebc
2 changed files with 120 additions and 1 deletions

113
parted-1.8.8-alpha.patch Normal file
View File

@ -0,0 +1,113 @@
diff -up parted-1.8.8/libparted/labels/bsd.c.alpha parted-1.8.8/libparted/labels/bsd.c
--- parted-1.8.8/libparted/labels/bsd.c.alpha 2007-07-23 07:58:31.000000000 -1000
+++ parted-1.8.8/libparted/labels/bsd.c 2008-02-05 14:34:01.000000000 -1000
@@ -108,6 +108,9 @@ typedef struct {
typedef struct {
uint8_t type;
+ int boot;
+ int raid;
+ int lvm;
} BSDPartitionData;
static PedDiskType bsd_disk_type;
@@ -394,6 +397,9 @@ bsd_partition_new (const PedDisk* disk,
if (!bsd_data)
goto error_free_part;
bsd_data->type = 0;
+ bsd_data->boot = 0;
+ bsd_data->raid = 0;
+ bsd_data->lvm = 0;
} else {
part->disk_specific = NULL;
}
@@ -423,6 +429,9 @@ bsd_partition_duplicate (const PedPartit
old_bsd_data = (BSDPartitionData*) part->disk_specific;
new_bsd_data = (BSDPartitionData*) new_part->disk_specific;
new_bsd_data->type = old_bsd_data->type;
+ new_bsd_data->boot = old_bsd_data->boot;
+ new_bsd_data->raid = old_bsd_data->raid;
+ new_bsd_data->lvm = old_bsd_data->lvm;
return new_part;
}
@@ -456,14 +465,61 @@ bsd_partition_set_system (PedPartition*
static int
bsd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
{
- /* no flags for bsd */
+ PedDisk* disk;
+// PedPartition* walk; // since -Werror, this unused variable would break build
+ BSDPartitionData* bsd_data;
+
+ PED_ASSERT (part != NULL, return 0);
+ PED_ASSERT (part->disk_specific != NULL, return 0);
+ PED_ASSERT (part->disk != NULL, return 0);
+
+ bsd_data = part->disk_specific;
+ disk = part->disk;
+
+ switch (flag) {
+ case PED_PARTITION_BOOT:
+ bsd_data->boot = state;
+ return 1;
+ case PED_PARTITION_RAID:
+ if (state) {
+ bsd_data->lvm = 0;
+ }
+ bsd_data->raid = state;
+ return 1;
+ case PED_PARTITION_LVM:
+ if (state) {
+ bsd_data->raid = 0;
+ }
+ bsd_data->lvm = state;
+ return 1;
+ default:
+ ;
+ }
return 0;
}
static int
bsd_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
{
- /* no flags for bsd */
+ BSDPartitionData* bsd_data;
+
+ PED_ASSERT (part != NULL, return 0);
+ PED_ASSERT (part->disk_specific != NULL, return 0);
+
+ bsd_data = part->disk_specific;
+ switch (flag) {
+ case PED_PARTITION_BOOT:
+ return bsd_data->boot;
+
+ case PED_PARTITION_RAID:
+ return bsd_data->raid;
+
+ case PED_PARTITION_LVM:
+ return bsd_data->lvm;
+
+ default:
+ ;
+ }
return 0;
}
@@ -471,7 +527,14 @@ static int
bsd_partition_is_flag_available (const PedPartition* part,
PedPartitionFlag flag)
{
- /* no flags for bsd */
+ switch (flag) {
+ case PED_PARTITION_BOOT:
+ case PED_PARTITION_RAID:
+ case PED_PARTITION_LVM:
+ return 1;
+ default:
+ ;
+ }
return 0;
}

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.8.8 Version: 1.8.8
Release: 4%{?dist} Release: 5%{?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
@ -16,6 +16,7 @@ Patch2: %{name}-1.8.8-noinst-headers.patch
Patch3: %{name}-1.8.8-manpage.patch Patch3: %{name}-1.8.8-manpage.patch
Patch4: %{name}-1.8.8-gcc-4.3.patch Patch4: %{name}-1.8.8-gcc-4.3.patch
Patch5: %{name}-1.8.8-nofixgpt.patch Patch5: %{name}-1.8.8-nofixgpt.patch
Patch6: %{name}-1.8.8-alpha.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
@ -58,6 +59,7 @@ Parted library, you need to install this package.
%patch3 -p1 -b .manpage %patch3 -p1 -b .manpage
%patch4 -p1 -b .gcc43 %patch4 -p1 -b .gcc43
%patch5 -p1 -b .nofixgpt %patch5 -p1 -b .nofixgpt
%patch6 -p1 -b .alpha
%build %build
%configure --enable-device-mapper --enable-selinux --disable-static %configure --enable-device-mapper --enable-selinux --disable-static
@ -115,6 +117,10 @@ fi
%{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc %{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc
%changelog %changelog
* Thu Apr 10 2008 David Cantrell <dcantrell@redhat.com> - 1.8.8-5
- Allow RAID or LVM partition types on BSD disklabels.
(jay.estabrook AT hp.com, #427114)
* Thu Apr 10 2008 Peter Jones <pjones@redhat.com> - 1.8.8-4 * Thu Apr 10 2008 Peter Jones <pjones@redhat.com> - 1.8.8-4
- Don't interactively ask to fix an AlternateGPT's location when not - Don't interactively ask to fix an AlternateGPT's location when not
at the end of the disk; this is so that disk images written to a at the end of the disk; this is so that disk images written to a