[Parted-commits] GNU Parted Official Repository: Changes to 'stable-1.8.x'
David Cantrell
dcantrell-guest at alioth.debian.org
Fri Nov 9 16:24:41 UTC 2007
libparted/labels/bsd.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 65 insertions(+), 3 deletions(-)
New commits:
commit 6cf96a4cf31e9a061ec16a59a1cd4d2030cbcbf5
Author: David Cantrell <dcantrell at redhat.com>
Date: Wed Nov 7 11:52:47 2007 -0500
Add flags for BSD disklabels (needed for Linux on Alpha)
Patch from Sergey Tikhonov from the AlphaCore project.
(cherry picked from commit 4ea147a93642d4dbd044ecd68d068e4dab4f4e2c)
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
index f25353b..ee9aba0 100644
--- a/libparted/labels/bsd.c
+++ b/libparted/labels/bsd.c
@@ -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, PedPartitionType part_type,
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 PedPartition* part)
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,60 @@ bsd_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
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;
+ 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 +526,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;
}
More information about the Parted-commits
mailing list