Attached is a patch to enable RAID support for Sun disks. Aurora SPARC
Linux has been using this successfully for some time now.

It helps if I use semi-colons properly. Apologies. This patch is better. :)

Signed-off-by: Tom "spot" Callaway <tcall...@redhat.com>

~spot
diff -up parted-1.8.8/libparted/labels/sun.c.enableraid parted-1.8.8/libparted/labels/sun.c
--- parted-1.8.8/libparted/labels/sun.c.enableraid	2008-12-13 11:52:42.000000000 -0500
+++ parted-1.8.8/libparted/labels/sun.c	2008-12-13 11:57:27.000000000 -0500
@@ -85,6 +85,7 @@ struct _SunPartitionData {
 	int			is_boot;
 	int			is_root;
 	int			is_lvm;
+	int			is_raid;
 };
 
 struct _SunDiskData {
@@ -344,6 +345,7 @@ sun_read (PedDisk* disk)
 		sun_data->is_boot = sun_data->type == 0x1;
 		sun_data->is_root = sun_data->type == 0x2;
 		sun_data->is_lvm = sun_data->type == 0x8e;
+		sun_data->is_raid = sun_data->type == 0xfd;
 
 		part->num = i + 1;
 		part->fs_type = ped_file_system_probe (&part->geom);
@@ -479,6 +481,7 @@ sun_partition_new (const PedDisk* disk, 
 		sun_data->is_boot = 0;
 		sun_data->is_root = 0;
 		sun_data->is_lvm = 0;
+		sun_data->is_raid = 0;
 	} else {
 		part->disk_specific = NULL;
 	}
@@ -512,6 +515,7 @@ sun_partition_duplicate (const PedPartit
 	new_sun_data->is_boot = old_sun_data->is_boot;
 	new_sun_data->is_root = old_sun_data->is_root;
 	new_sun_data->is_lvm = old_sun_data->is_lvm;
+	new_sun_data->is_raid = old_sun_data->is_raid;
 	return new_part;
 }
 
@@ -544,6 +548,10 @@ sun_partition_set_system (PedPartition* 
 		sun_data->type = 0x8e;
 		return 1;
 	}
+	if (sun_data->is_raid) {
+		sun_data->type = 0xfd;
+		return 1;
+	}
 
 	sun_data->type = 0x83;
 	if (fs_type) {
@@ -570,20 +578,38 @@ sun_partition_set_flag (PedPartition* pa
 	switch (flag) {
 		case PED_PARTITION_BOOT:
 			sun_data->is_boot = state;
-			if (state)
-				sun_data->is_root = sun_data->is_lvm = 0;
+			if (state) {
+				sun_data->is_lvm = 0;
+				sun_data->is_raid = 0;
+				sun_data->is_root = 0;
+			}
 			return ped_partition_set_system (part, part->fs_type);
 
 		case PED_PARTITION_ROOT:
 			sun_data->is_root = state;
-			if (state)
-				sun_data->is_boot = sun_data->is_lvm = 0;
+			if (state) {
+				sun_data->is_boot = 0;
+				sun_data->is_lvm = 0;
+				sun_data->is_raid = 0;
+			}
 			return ped_partition_set_system (part, part->fs_type);
 
 		case PED_PARTITION_LVM:
 			sun_data->is_lvm = state;
-			if (state)
-				sun_data->is_root = sun_data->is_boot = 0;
+			if (state) {
+				sun_data->is_boot = 0;
+				sun_data->is_raid = 0;
+				sun_data->is_root = 0;
+			}
+			return ped_partition_set_system (part, part->fs_type);
+
+		case PED_PARTITION_RAID:
+			sun_data->is_raid = state;
+			if (state) {
+				sun_data->is_boot = 0;
+				sun_data->is_lvm = 0;
+				sun_data->is_root = 0;
+			}
 			return ped_partition_set_system (part, part->fs_type);
 
 		default:
@@ -609,6 +635,8 @@ sun_partition_get_flag (const PedPartiti
 			return sun_data->is_root;
 		case PED_PARTITION_LVM:
 			return sun_data->is_lvm;
+		case PED_PARTITION_RAID:
+			return sun_data->is_raid;
 
 		default:
 			return 0;
@@ -624,6 +652,7 @@ sun_partition_is_flag_available (const P
 		case PED_PARTITION_BOOT:
 		case PED_PARTITION_ROOT:
 		case PED_PARTITION_LVM:
+		case PED_PARTITION_RAID:
 			return 1;
 
 		default:
_______________________________________________
bug-parted mailing list
bug-parted@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-parted

Reply via email to