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

Otavio Salvador otavio at alioth.debian.org
Mon Oct 1 16:53:57 UTC 2007


 NEWS                                 |   47 ++++++++++++++++++++++++
 configure.ac                         |    4 +-
 debian/changelog                     |    2 -
 include/parted/device.h              |    6 +--
 libparted/arch/linux.c               |   66 +++++++++++++++++++++++++++++++----
 libparted/device.c                   |    1 
 libparted/fs/linux_swap/linux_swap.c |    2 -
 libparted/labels/dasd.c              |   19 ++++++----
 parted.lsm                           |    8 ++--
 scripts/release/tarball_upload.sh    |    2 -
 10 files changed, 132 insertions(+), 25 deletions(-)

New commits:
commit 212b5442453da1364296df5fcb9e8cd4363b84c8
Author: Otavio Salvador <otavio at ossystems.com.br>
Date:   Mon Oct 1 13:54:01 2007 -0300

    Change version to 1.8.8-1

diff --git a/debian/changelog b/debian/changelog
index 3bd6200..2bd54be 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-parted (1.8.7.git.2007.07.30-2) UNRELEASED; urgency=low
+parted (1.8.8-1) UNRELEASED; urgency=low
 
   [ Cyril Brulebois ]
   * debian/rules:

commit 5231100d66415a55bc7c1684b2b2ebab4912e53f
Author: Otavio Salvador <otavio at ossystems.com.br>
Date:   Thu Aug 30 09:52:03 2007 -0300

    Really duplicate the disk instead of readd every partition
    
    To avoid possible differences between the original disk layout and the
    duplicated one, a raw copy is done. Has been identified a case[1]
    where extended partitions had their positions changed due this.
    
     1. http://bugs.debian.org/294520
    
    The recipe[2] to reproduce the problem, on the provided URI, has been
    used to produced a test and hence be sure it's not forgotten anymore.
    
     2. http://bugs.debian.org/294520#34
    
    The fix has been produced by Samuel Thibault <samuel.thibault at ens-lyon.org>
    (cherry picked from commit 7baa9261b8648840b0d615ceaafcd473e9495dab)

diff --git a/libparted/disk.c b/libparted/disk.c
index 1582f26..52095d0 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -224,23 +224,24 @@ static int
 _add_duplicate_part (PedDisk* disk, PedPartition* old_part)
 {
 	PedPartition*	new_part;
-	PedConstraint*	constraint_exact;
+	int ret;
 
 	new_part = disk->type->ops->partition_duplicate (old_part);
 	if (!new_part)
 		goto error;
 	new_part->disk = disk;
 
-	constraint_exact = ped_constraint_exact (&new_part->geom);
-	if (!constraint_exact)
+	_disk_push_update_mode (disk);
+	ret = _disk_raw_add (disk, new_part);
+	_disk_pop_update_mode (disk);
+	if (!ret)
 		goto error_destroy_new_part;
-	if (!ped_disk_add_partition (disk, new_part, constraint_exact))
-       		goto error_destroy_constraint_exact;
-	ped_constraint_destroy (constraint_exact);
+#ifdef DEBUG
+	if (!_disk_check_sanity (disk))
+		goto error_destroy_new_part;
+#endif
 	return 1;
 
-error_destroy_constraint_exact:
-	ped_constraint_destroy (constraint_exact);
 error_destroy_new_part:
 	ped_partition_destroy (new_part);
 error:
diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index 12ad29f..d526207 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -3,13 +3,17 @@
 #
 # This file may be modified and/or distributed without restriction.
 
-TESTS = t1000-label.sh
+TESTS = t1000-label.sh t2000-disk.sh
 EXTRA_DIST = $(TESTS)
-bin_PROGRAMS     = label
+bin_PROGRAMS     = label disk
 label_CFLAGS    = $(CHECK_CFLAGS) -I$(top_srcdir)/include
 label_LDADD     = $(CHECK_LIBS) $(top_builddir)/libparted/libparted.la
 label_SOURCES   = common.h common.c label.c
 
+disk_CFLAGS    = $(CHECK_CFLAGS) -I$(top_srcdir)/include
+disk_LDADD     = $(CHECK_LIBS) $(top_builddir)/libparted/libparted.la
+disk_SOURCES   = common.h common.c disk.c
+
 MAINTAINERCLEANFILES = Makefile.in
 
 CLEANFILES = init.sh
diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
new file mode 100644
index 0000000..295ec05
--- /dev/null
+++ b/libparted/tests/disk.c
@@ -0,0 +1,111 @@
+#include <config.h>
+#include <unistd.h>
+
+#include <check.h>
+
+#include <parted/parted.h>
+
+#include "common.h"
+
+static char* temporary_disk;
+
+static void
+create_disk (void)
+{
+        temporary_disk = _create_disk (20);
+        fail_if (temporary_disk == NULL, "Failed to create temporary disk");
+}
+
+static void
+destroy_disk (void)
+{
+        unlink (temporary_disk);
+        free (temporary_disk);
+}
+
+/* TEST: Create a disklabel on a simple disk image */
+START_TEST (test_duplicate)
+{
+        PedDevice* dev = ped_device_get (temporary_disk);
+        if (dev == NULL)
+                return;
+
+        PedDiskType* type;
+        PedDisk* disk;
+        PedDisk* disk_dup;
+        PedPartition *part;
+        PedPartition *part_dup;
+        PedConstraint *constraint;
+
+        int part_num[] = {1, 5, 6, 0};
+
+        disk = _create_disk_label (dev, ped_disk_type_get ("msdos"));
+
+        constraint = ped_constraint_any (dev);
+
+        /* Primary partition from 16,4kB to 15MB */
+        part = ped_partition_new (disk, PED_PARTITION_EXTENDED,
+                                  NULL,
+                                  32, 29311);
+        ped_disk_add_partition (disk, part, constraint);
+
+        /* Logical partition from 10MB to 15MB */
+        part = ped_partition_new (disk, PED_PARTITION_LOGICAL,
+                                  ped_file_system_type_get ("ext2"),
+                                  19584, 29311);
+        ped_disk_add_partition (disk, part, constraint);
+
+        /* Logical partition from 16,4kB to 4981kB */
+        part = ped_partition_new (disk, PED_PARTITION_LOGICAL,
+                                  ped_file_system_type_get ("ext2"),
+                                  32, 9727);
+        ped_disk_add_partition (disk, part, constraint);
+
+        ped_disk_commit (disk);
+
+        ped_constraint_destroy (constraint);
+
+        disk_dup = ped_disk_duplicate (disk);
+
+        /* Checks if both partitions match */
+        for (int *i = part_num; *i != 0; i++) {
+                part = ped_disk_get_partition (disk, *i);
+                part_dup = ped_disk_get_partition (disk_dup, *i);
+
+                fail_if (part->geom.start != part_dup->geom.start ||
+                         part->geom.end != part_dup->geom.end,
+                         "Duplicated partition %d doesn't match. "
+                         "Details are start: %d/%d end: %d/%d\n",
+                         *i, part->geom.start, part_dup->geom.start,
+                         part->geom.end, part_dup->geom.end);
+        }
+
+        ped_disk_destroy (disk);
+        ped_device_destroy (dev);
+}
+END_TEST
+
+int
+main (void)
+{
+        int number_failed;
+        Suite* suite = suite_create ("Disk");
+        TCase* tcase_duplicate = tcase_create ("Duplicate");
+
+        /* Fail when an exception is raised */
+        ped_exception_set_handler (_test_exception_handler);
+
+        tcase_add_checked_fixture (tcase_duplicate, create_disk, destroy_disk);
+        tcase_add_test (tcase_duplicate, test_duplicate);
+        /* Disable timeout for this test */
+        tcase_set_timeout (tcase_duplicate, 0);
+        suite_add_tcase (suite, tcase_duplicate);
+
+        SRunner* srunner = srunner_create (suite);
+        srunner_run_all (srunner, CK_VERBOSE);
+
+        number_failed = srunner_ntests_failed (srunner);
+        srunner_free (srunner);
+
+        return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/libparted/tests/t2000-disk.sh b/libparted/tests/t2000-disk.sh
new file mode 100755
index 0000000..7a85b98
--- /dev/null
+++ b/libparted/tests/t2000-disk.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# Copyright (C) 2007 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/>.
+
+test_description='run the disk unit tests in a directory supporting O_DIRECT'
+# This wrapper around the ./label binary is used to find a directory
+# in which one can open a file with the O_DIRECT flag.
+
+. ./init.sh
+
+test_expect_success \
+    'run the actual tests' 'disk'
+
+test_done

commit 360dd61659bc4d5b6c0ee1f05cf1adc47c5da29b
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Thu Aug 9 16:01:32 2007 -0400

    Modify the curl command line used to upload files.
    
    Show the progress bar for file uploads.  Changed to using the short option
    for the upload file command.

diff --git a/scripts/release/tarball_upload.sh b/scripts/release/tarball_upload.sh
index 3806f5b..41ad605 100755
--- a/scripts/release/tarball_upload.sh
+++ b/scripts/release/tarball_upload.sh
@@ -180,7 +180,7 @@ for EXT in gz bz2; do
 			echo "-> skipping upload of $f"
 			continue
 		fi
-		curl --upload-file $PWD/$f $FTPURL
+		curl -# -T $PWD/$f $FTPURL
 		sleep 1
 		if [ $? -eq 0 ]; then
 			echo "-> successfully uploaded $f."

commit b738e95f6ec53af66c02c4f6dcefa22cbfb1eca1
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Thu Aug 9 13:37:45 2007 -0400

    Updated file sizes for the 1.8.8 release.

diff --git a/parted.lsm b/parted.lsm
index 216eaa3..3773884 100644
--- a/parted.lsm
+++ b/parted.lsm
@@ -10,8 +10,8 @@ Keywords: partition, partitioning, file system, format, hard disk, storage, disk
 Author: <clausen at gnu.org> (Andrew Clausen)
 Maintained-by: <parted-devel at lists.alioth.debian.org> (GNU Parted development team)
 Primary-site: ftp://ftp.gnu.org/gnu/parted
-1.4M parted-1.8.8.tar.bz2
-2.1M parted-1.8.8.tar.gz
+1.5M parted-1.8.8.tar.bz2
+2.3M parted-1.8.8.tar.gz
 Platforms: Linux, FreeBSD, BeOS; compiles with GCC and probably other C99 compilers.
 Copying-policy: GPL
 End

commit ad38116672ff61523feab80c9b85a9adb17ed94f
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Thu Aug 9 11:56:45 2007 -0400

    Updated NEWS file with version 1.8.8 items.

diff --git a/NEWS b/NEWS
index 536ec1a..ad8de48 100644
--- a/NEWS
+++ b/NEWS
@@ -5,14 +5,44 @@ GNU parted is now licensed under the GNU General Public License version 3
 or higher.  See the COPYING file for more details.
 
 libparted:
--
--
--
+- Add compute_block_counts() to improve ext2fs support.
+- Properly detect 'ext2 fs too small' cases.
+- Move formatting commands out of translatable strings.
+- Read an msdos partition table from a device with 2K sectors.
+- Remove always-false "Unable to open" diagnostic in ped_disk_new(), leave
+  the "unrecognized disk label" diagnostic.
+- Don't leak partition table buffer in amiga_read().
+- Don't read/write initialized memory with DEBUG turned on off for 'mklabel
+  bsd' and 'mklabel amiga' command calls.
+- Turn off DEBUG in libparted.c to avoid initializing all allocated memory
+  to '1' bits.
+- Correct handling of HeaderSize field in GPT labels.
+- Fix block number used when checking for ext2 fs state.
+- Add detection support for Xen virtual block devices (/dev/xvd*).
+- When reading DASD labels, check the filesystem type as well as partition
+  flags to determine what's on the partition.
+- Add _dm_probe_all() from Debian to probe for all device-mapper devices.
 
 parted:
--
--
--
+- Fixed exception handling in mkpart and mkpartfs commands.
+- Add the --dry-run option to the partprobe command.
+- Update docs: cannot specify 'primary' for a partition on a loop device.
+- Remove unused functions (get_spaces).
+- Fix off-by-one error in str_list_print_wrap().
+- Use xmalloc() and xrealloc() to check return values.
+- Fix invalid command line argument handling.
+- Close memory leaks in parted.c and table.c.
+- Fix warnings when compiling with translation support enabled.
+- Use a consistent prompt when asking for a file system type.
+- Update docs: don't reference old versions of gzip.
+
+misc:
+- Improve the testing framework in the tests/ subdirectory.  Build out more
+  of the testing scripts so we can start using that to ensure we don't
+  introduce regressions in releases.
+- Support testing with tmpfs filesystems on Linux.
+- Work around inadequate libreadline in the configure script.
+- Don't include config.h from internal headers.
 
 
 1.8.7

commit be2ace6e8d381fb836647234ac65d34a4a547e31
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Wed Aug 8 18:04:00 2007 -0400

    Sanity check for dev, safety checks on diobuf.
    
    Make sure diobuf is NULL before we begin and make sure it isn't NULL when
    we try to free it.  Throw an exception if dev is NULL and we enter this
    function.

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index cb9605f..462ab92 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -1446,8 +1446,9 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
 {
         LinuxSpecific*          arch_specific = LINUX_SPECIFIC (dev);
         PedExceptionOption      ex_status;
-        void*                   diobuf;
+        void*                   diobuf = NULL;
 
+        PED_ASSERT (dev != NULL, return 0);
         PED_ASSERT (dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, return 0);
 
         if (_get_linux_version() < KERNEL_VERSION (2,6,0)) {
@@ -1528,7 +1529,9 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
                                 break;
                 }
         }
-        free(diobuf);
+
+        if (diobuf)
+                free(diobuf);
 
         return 1;
 }

commit 4982d20086ea0b3d4ffdcd4d66da298fa923c762
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Wed Aug 8 18:02:37 2007 -0400

    Revert ped_disk_new() check from the other day.
    
    Do not try to call ped_disk_new() from ped_device_get().

diff --git a/libparted/device.c b/libparted/device.c
index 17321cd..fddf9b4 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -190,9 +190,6 @@ ped_device_get (const char* path)
 	if (!walk)
 		return NULL;
 
-	if (!ped_disk_new (walk))
-		return NULL;
-
 	_device_register (walk);
 	return walk;
 }

commit e1afb2b40859656cc76db311445bc0f41b81f684
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Mon Aug 6 10:48:40 2007 -0400

    Bump version to 1.8.8

diff --git a/parted.lsm b/parted.lsm
index c298040..216eaa3 100644
--- a/parted.lsm
+++ b/parted.lsm
@@ -1,7 +1,7 @@
 Begin4
 Title: parted
-Version: 1.8.7
-Entered-date: 
+Version: 1.8.8
+Entered-date:
 Description: GNU Parted is a program for creating, destroying, resizing,
 checking and copying partitions, and the filesystems on them. This is useful for
 creating space for new operating systems, reorganising disk usage, copying data
@@ -10,8 +10,8 @@ Keywords: partition, partitioning, file system, format, hard disk, storage, disk
 Author: <clausen at gnu.org> (Andrew Clausen)
 Maintained-by: <parted-devel at lists.alioth.debian.org> (GNU Parted development team)
 Primary-site: ftp://ftp.gnu.org/gnu/parted
-1.4M parted-1.8.7.tar.bz2
-2.1M parted-1.8.7.tar.gz
+1.4M parted-1.8.8.tar.bz2
+2.1M parted-1.8.8.tar.gz
 Platforms: Linux, FreeBSD, BeOS; compiles with GCC and probably other C99 compilers.
 Copying-policy: GPL
 End

commit a46b6af9dcb6e410f4a83d7d37395d08a7b0d5b9
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Mon Aug 6 10:48:23 2007 -0400

    Bump version to 1.8.8

diff --git a/configure.ac b/configure.ac
index f04cf59..f1284a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ dnl
 dnl This file may be modified and/or distributed without restriction.
 
 AC_PREREQ(2.61)
-AC_INIT([GNU parted],[1.8.7],[bug-parted at gnu.org])
+AC_INIT([GNU parted],[1.8.8],[bug-parted at gnu.org])
 
 AC_CONFIG_SRCDIR(include/parted/parted.h)
 
@@ -24,7 +24,7 @@ dnl function signatures changed),
 dnl set PED_BINARY_AGE _and_ PED_INTERFACE_AGE to 0.
 PED_MAJOR_VERSION=1
 PED_MINOR_VERSION=8
-PED_MICRO_VERSION=7
+PED_MICRO_VERSION=8
 PED_INTERFACE_AGE=0
 PED_BINARY_AGE=0
 PED_VERSION_SUFFIX=

commit 609b7ae6d274e479027bb46c4bd10227cd921803
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Tue Jul 31 15:41:22 2007 -0400

    Probe for all device-mapper devices.
    
    Add _dm_probe_all() from Debian and patch linux_probe_all() to probe for
    device-mapper devices after probing for standard devices.

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 0981be0..cb9605f 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -390,6 +390,39 @@ next:
         close(fd);
         return 0;
 }
+
+static int
+_probe_dm_devices ()
+{
+       DIR*            mapper_dir;
+       struct dirent*  dent;
+       char            buf [512];      /* readdir(3) claims d_name[256] */
+       struct stat     st;
+
+       mapper_dir = opendir ("/dev/mapper");
+       if (!mapper_dir)
+               return 0;
+
+       /* Search the /dev/mapper directory for devices w/ the same major
+        * number that was returned from _probe_lvm_major().
+        */
+       while ((dent = readdir (mapper_dir))) {
+               if (strcmp (dent->d_name, ".")  == 0 ||
+                   strcmp (dent->d_name, "..") == 0)
+                       continue;
+
+               snprintf (buf, sizeof (buf), "/dev/mapper/%s", dent->d_name);
+
+               if (stat (buf, &st) != 0)
+                       continue;
+
+               if (_is_dm_major(major(st.st_rdev)))
+                       _ped_device_probe (buf);
+       }
+       closedir (mapper_dir);
+
+       return 1;
+}
 #endif
 
 static int
@@ -1903,11 +1936,19 @@ linux_probe_all ()
          */
         _probe_standard_devices ();
 
- 	/* /sys/block is more reliable and consistent; fall back to using
- 	 * /proc/partitions if the former is unavailable, however.
- 	 */
- 	if (!_probe_sys_block ())
- 		_probe_proc_partitions ();
+#ifdef ENABLE_DEVICE_MAPPER
+        /* device-mapper devices aren't listed in /proc/partitions; or, if
+         * they are, they're listed as dm-X.  So, instead of relying on that,
+         * we do our own checks.
+         */
+        _probe_dm_devices ();
+#endif
+
+        /* /sys/block is more reliable and consistent; fall back to using
+         * /proc/partitions if the former is unavailable, however.
+         */
+        if (!_probe_sys_block ())
+                _probe_proc_partitions ();
 }
 
 static char*

commit 93abb3e4886d99219c198b0396324dbee3453de0
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Tue Jul 31 15:35:27 2007 -0400

    Updated NEWS file preparing for 1.8.8.

diff --git a/NEWS b/NEWS
index 92be739..536ec1a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,20 @@
+1.8.8
+=====
+
+GNU parted is now licensed under the GNU General Public License version 3
+or higher.  See the COPYING file for more details.
+
+libparted:
+-
+-
+-
+
+parted:
+-
+-
+-
+
+
 1.8.7
 =====
 

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