[Parted-commits] GNU Parted Official Repository: Changes to 'stable-1.8.x'

David Cantrell dcantrell-guest at alioth.debian.org
Tue Jul 31 19:02:19 UTC 2007


 include/parted/device.h              |    6 +++---
 libparted/arch/linux.c               |    8 ++++++++
 libparted/device.c                   |    4 ++++
 libparted/fs/linux_swap/linux_swap.c |    2 +-
 libparted/labels/dasd.c              |   19 +++++++++++++------
 5 files changed, 29 insertions(+), 10 deletions(-)

New commits:
commit b43bda3134059cdacb13e1a4d0a0bee8a543cfb0
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Tue Jul 31 14:06:09 2007 -0400

    Removed unused label (compiler warning).

diff --git a/libparted/fs/linux_swap/linux_swap.c b/libparted/fs/linux_swap/linux_swap.c
index c72a1b9..97da2d4 100644
--- a/libparted/fs/linux_swap/linux_swap.c
+++ b/libparted/fs/linux_swap/linux_swap.c
@@ -122,7 +122,7 @@ swap_clobber (PedGeometry* geom)
 
 error_close_fs:
 	swap_close (fs);
-error:
+
 	return 0;
 }
 #endif /* !DISCOVER_ONLY */

commit dfafc45a3775cc92d3cd89c9b35926cab23db512
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Tue Jul 31 14:00:31 2007 -0400

    When reading the DASD disk label, look at the partition flags as well as what is on the actual partition using ped_file_system_probe().  This avoids flags being set for partitions when they shouldn't be.

diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index c7d332d..bb3858f 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -216,8 +216,9 @@ dasd_probe (const PedDevice *dev)
 	struct fdasd_anchor anchor;
 
 	PED_ASSERT(dev != NULL, return 0);
-	PED_ASSERT((dev->type == PED_DEVICE_DASD
-			   || dev->type == PED_DEVICE_VIODASD), return 0);
+
+	if (!(dev->type == PED_DEVICE_DASD || dev->type == PED_DEVICE_VIODASD))
+		return 0;
 
 	arch_specific = LINUX_SPECIFIC(dev);
 
@@ -268,6 +269,7 @@ dasd_read (PedDisk* disk)
 	char str[20];
 	PedDevice* dev;
 	PedPartition* part;
+	PedFileSystemType *fs;
 	PedSector start, end;
 	PedConstraint* constraint_exact;
 	partition_info_t *p;
@@ -378,19 +380,24 @@ dasd_read (PedDisk* disk)
 
 		dasd_data = part->disk_specific;
 
-		if (strncmp(PART_TYPE_RAID, str, 6) == 0)
+		if ((strncmp(PART_TYPE_RAID, str, 6) == 0) &&
+		    (ped_file_system_probe(&part->geom) == NULL))
 			ped_partition_set_flag(part, PED_PARTITION_RAID, 1);
 		else
 			ped_partition_set_flag(part, PED_PARTITION_RAID, 0);
 
-		if (strncmp(PART_TYPE_LVM, str, 6) == 0)
+		if ((strncmp(PART_TYPE_LVM, str, 6) == 0) &&
+		    (ped_file_system_probe(&part->geom) == NULL))
 			ped_partition_set_flag(part, PED_PARTITION_LVM, 1);
 		else
 			ped_partition_set_flag(part, PED_PARTITION_LVM, 0);
 
 		if (strncmp(PART_TYPE_SWAP, str, 6) == 0) {
-			dasd_data->system = PARTITION_LINUX_SWAP;
-			PDEBUG;
+			fs = ped_file_system_probe(&part->geom);
+			if (strncmp(fs->name, "linux-swap", 10) == 0) {
+				dasd_data->system = PARTITION_LINUX_SWAP;
+				PDEBUG;
+			}
 		}
 
 		vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44);

commit 865ea3d3f2eb7918b64a00825dfa44e05651e2ad
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Tue Jul 31 13:59:27 2007 -0400

    If we cannot create a new PedDisk for the device we're looking at, return NULL rather than the device path.

diff --git a/libparted/device.c b/libparted/device.c
index 5db148b..17321cd 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -189,6 +189,10 @@ ped_device_get (const char* path)
 	ped_free (normal_path);
 	if (!walk)
 		return NULL;
+
+	if (!ped_disk_new (walk))
+		return NULL;
+
 	_device_register (walk);
 	return walk;
 }

commit 64861efcaae95f605614d5e4c6d9c35c5d5712d7
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Tue Jul 31 13:58:40 2007 -0400

    Detect Xen virtual block devices and identify them as such.

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 2e6afeb..0981be0 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -253,6 +253,7 @@ struct blkdev_ioctl_param {
 #define VIODASD_MAJOR           112
 #define SX8_MAJOR1              160
 #define SX8_MAJOR2              161
+#define XVD_MAJOR               202
 
 #define SCSI_BLK_MAJOR(M) (                                             \
                 (M) == SCSI_DISK0_MAJOR                                 \
@@ -455,6 +456,8 @@ _device_probe_type (PedDevice* dev)
         } else if (_is_dm_major(dev_major)) {
                 dev->type = PED_DEVICE_DM;
 #endif
+        } else if (dev_major == XVD_MAJOR && (dev_minor % 0x10 == 0)) {
+                dev->type = PED_DEVICE_XVD;
         } else {
                 dev->type = PED_DEVICE_UNKNOWN;
         }
@@ -1157,6 +1160,11 @@ linux_new (const char* path)
                 break;
 #endif
 
+        case PED_DEVICE_XVD:
+                if (!init_generic (dev, _("Xen Virtual Block Device")))
+                        goto error_free_arch_specific;
+                break;
+
         case PED_DEVICE_UNKNOWN:
                 if (!init_generic (dev, _("Unknown")))
                         goto error_free_arch_specific;

commit af4bea2ac854343609f3e6688bedd727ddf76ae6
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Tue Jul 31 13:57:55 2007 -0400

    Add the PED_DEVICE_XVD device type for Xen virtual block devices.

diff --git a/include/parted/device.h b/include/parted/device.h
index 0b77ee8..cf32dba 100644
--- a/include/parted/device.h
+++ b/include/parted/device.h
@@ -44,11 +44,11 @@ typedef enum {
         PED_DEVICE_UBD          = 8,
         PED_DEVICE_DASD         = 9,
         PED_DEVICE_VIODASD      = 10,
-        PED_DEVICE_SX8          = 11
+        PED_DEVICE_SX8          = 11,
 #ifdef ENABLE_DEVICE_MAPPER
-                                    ,
-        PED_DEVICE_DM           = 12
+        PED_DEVICE_DM           = 12,
 #endif
+        PED_DEVICE_XVD          = 13
 } PedDeviceType;
 
 typedef struct _PedDevice PedDevice;



More information about the Parted-commits mailing list