[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Tue Dec 23 10:08:29 UTC 2008


 doc/C/Makefile.am            |    6 +--
 libparted/labels/sun.c       |   41 ++++++++++++++++++++++---
 tests/Makefile.am            |    1 
 tests/t4000-sun-raid-type.sh |   68 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 106 insertions(+), 10 deletions(-)

New commits:
commit 9654bcfbdbeb2dede3a19084d31b41224d3a03f1
Author: Jim Meyering <meyering at redhat.com>
Date:   Tue Dec 23 10:20:20 2008 +0100

    avoid "make install" failure with latest GNU make
    
    * doc/C/Makefile.am (dist_man8_MANS): Use per-section variable
    names, as recommended by automake.
    (man_MANS): Remove redundant definition.

diff --git a/doc/C/Makefile.am b/doc/C/Makefile.am
index 447eb74..7d62b7b 100644
--- a/doc/C/Makefile.am
+++ b/doc/C/Makefile.am
@@ -1,11 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
-dist_man_MANS = \
+dist_man8_MANS = \
 	parted.8 \
 	partprobe.8
 
-man_MANS = $(dist_man_MANS)
-
 .PHONY: updatepo
 # Update the POT in srcdir
 # Make sure the update does not only consist in a new POT-Creation-Date
@@ -13,7 +11,7 @@ man_MANS = $(dist_man_MANS)
 updatepo:
 	cd $(srcdir); \
 	test -w . || exit 0; \
-	for name in $(dist_man_MANS); do \
+	for name in $(dist_man8_MANS); do \
 		echo $$name; \
 		cp po/$$name.pot po/$$name.new.pot; \
 		po4a-updatepo -f man -m $$name -p po/$$name.new.pot; \

commit 264854e21dccf11bd36955c0d377baa2c8402e87
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Mon Dec 22 09:39:23 2008 -0500

    sun partition tables: add support for RAID partition types
    
    This patch enables RAID as a supported partition type on Sun disk
    layouts, commonly found/used on SPARC hardware. It has been tested
    on Aurora SPARC Linux (and Fedora SPARC). I have no idea if Solaris
    supports Software RAID or not...
    
    Along with the code change, I wrote a test case that checks if the
    RAID partition type is supported on sun disk labels.
    
    * libparted/labels/sun.c [_SunPartitionData] (is_raid): New member.
    (sun_read): Initialize the ->is_raid member.
    (sun_partition_new): Clear is_raid, like all the other members.
    (sun_partition_duplicate): Propagate the is_raid member.
    (sun_partition_set_system): Make sun_data->type reflect is_raid.
    (sun_partition_set_flag): Also initialize ->is_raid.
    (sun_partition_get_flag): Handle PED_PARTITION_RAID.
    (sun_partition_is_flag_available): Likewise.
    * tests/t4000-sun-raid-type.sh: New file.
    * tests/Makefile.am (TESTS): Add t4000-sun-raid-type.sh.

diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c
index 6f1900b..76f2b78 100644
--- a/libparted/labels/sun.c
+++ b/libparted/labels/sun.c
@@ -87,6 +87,7 @@ struct _SunPartitionData {
 	int			is_boot;
 	int			is_root;
 	int			is_lvm;
+	int			is_raid;
 };
 
 struct _SunDiskData {
@@ -347,6 +348,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);
@@ -482,6 +484,7 @@ sun_partition_new (const PedDisk* disk, PedPartitionType part_type,
 		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;
 	}
@@ -515,6 +518,7 @@ sun_partition_duplicate (const PedPartition* part)
 	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;
 }
 
@@ -547,6 +551,10 @@ sun_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
 		sun_data->type = 0x8e;
 		return 1;
 	}
+	if (sun_data->is_raid) {
+		sun_data->type = 0xfd;
+		return 1;
+	}
 
 	sun_data->type = 0x83;
 	if (fs_type) {
@@ -573,20 +581,38 @@ sun_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
 	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:
@@ -612,6 +638,8 @@ sun_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
 			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;
@@ -627,6 +655,7 @@ sun_partition_is_flag_available (const PedPartition* part,
 		case PED_PARTITION_BOOT:
 		case PED_PARTITION_ROOT:
 		case PED_PARTITION_LVM:
+		case PED_PARTITION_RAID:
 			return 1;
 
 		default:
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1c8c753..ab3b7cb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -9,6 +9,7 @@ TESTS = \
   t2200-dos-label-recog.sh \
   t3000-constraints.sh \
   t3100-resize-ext2-partion.sh \
+  t4000-sun-raid-type.sh \
   t4100-msdos-partition-limits.sh \
   t4100-dvh-partition-limits.sh \
   t4200-partprobe.sh \
diff --git a/tests/t4000-sun-raid-type.sh b/tests/t4000-sun-raid-type.sh
new file mode 100755
index 0000000..34c56ee
--- /dev/null
+++ b/tests/t4000-sun-raid-type.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Written by Tom "spot" Callaway <tcallawa at redhat.com>
+# Derived from an example by Jim Meyering <jim at meyering.net>
+
+test_description="RAID support on sun disk type"
+
+: ${srcdir=.}
+. $srcdir/test-lib.sh
+
+N=10M
+dev=sun-disk-file
+exp="BYT;\n---:20480s:file:512:512:sun:;\n1:0s:50s:51s"
+test_expect_success \
+    'create an empty file as a test disk' \
+    'dd if=/dev/null of=$dev bs=1 seek=$N 2> /dev/null'
+
+test_expect_success \
+    'label the test disk as a sun disk' \
+    'parted -s $dev mklabel sun > out 2>&1'
+test_expect_success 'check for empty output' '$compare out /dev/null'
+
+test_expect_success \
+    'create a single partition' \
+    'parted -s $dev unit s mkpart ext2 0s 50s > out 2>&1'
+test_expect_success 'check for empty output' '$compare out /dev/null'
+
+test_expect_success \
+    'print the partition data in machine readable format' \
+    'parted -m -s $dev unit s p > out 2>&1 &&
+     sed "s,^.*/$dev:,---:," out > k && mv k out'
+
+test_expect_success \
+    'check for expected values for the partition' '
+    printf "$exp:::;\n" > exp &&
+    $compare out exp'
+
+test_expect_success \
+    'set the raid flag' \
+    'parted -s $dev set 1 raid >out 2>&1'
+test_expect_success 'check for empty output' '$compare out /dev/null'
+
+test_expect_success \
+    'print the partition data in machine readable format again' \
+    'parted -m -s $dev unit s p > out 2>&1 &&
+     sed "s,^.*/$dev:,---:," out > k && mv k out'
+
+test_expect_success \
+    'check for expected values (including raid flag) for the partition' '
+    printf "$exp:::raid;\n" > exp &&
+    $compare out exp'
+
+test_done



More information about the Parted-commits mailing list