2667a15ebc
hp.com, #427114)
114 lines
2.6 KiB
Diff
114 lines
2.6 KiB
Diff
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;
|
|
}
|
|
|