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

Jim Meyering meyering at alioth.debian.org
Fri Dec 11 16:33:31 UTC 2009


 NEWS                   |    4 ++++
 libparted/arch/linux.c |    3 +++
 tests/t8000-loop.sh    |   28 ++++++++--------------------
 3 files changed, 15 insertions(+), 20 deletions(-)

New commits:
commit 6792f263d47f9550869fde3a751aaf7349b91c0a
Author: Jim Meyering <meyering at redhat.com>
Date:   Fri Dec 11 16:56:45 2009 +0100

    tests: ensure that parted can partition a loop device
    
    * tests/t8000-loop.sh: Reverse sense of tests, now that
    partitioning a loop device succeeds again.
    * NEWS (Bug fixes): Mention it.

diff --git a/NEWS b/NEWS
index cd67678..b3d69bc 100644
--- a/NEWS
+++ b/NEWS
@@ -56,6 +56,10 @@ GNU parted NEWS                                    -*- outline -*-
 
 ** Bug fixes
 
+  parted can once again create partition tables on loop devices.
+  Before, "parted -s /dev/loop0 mklabel gpt" would fail.
+  [bug introduced in parted-1.9.0]
+
   improved >512-byte sector support: for example, printing a table on a
   4k-sector disk would show "Sector size (logical/physical): 4096B/512B",
   when the sizes should have been "4096B/4096B".
diff --git a/tests/t8000-loop.sh b/tests/t8000-loop.sh
index de4378a..e8c27fe 100755
--- a/tests/t8000-loop.sh
+++ b/tests/t8000-loop.sh
@@ -25,37 +25,25 @@ fi
 . $srcdir/t-lib.sh
 
 require_root_
-lvm_init_root_dir_
 
-d1=
+d1= f1=
 cleanup_()
 {
   test -n "$d1" && losetup -d "$d1"
-  rm -f "$f1";
+  rm -f "$f1"
 }
 
 f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
   || skip_test_ "is this partition mounted with 'nodev'?"
 
-printf '%s\n' \
-    'Warning: WARNING: the kernel failed to re-read the partition table on' \
-  > exp || framework_failure
-
 fail=0
 
-# Expect this to exit with status of 1.
-parted -s $d1 mklabel msdos > err 2>&1
-test $? = 1 || fail=1
-sed 's/^\(Warn.*table on\).*/\1/' err > k && mv k err || fail=1
-
-compare exp err || fail=1
-
-# Create a partition; expect to exit 1
-parted -s $d1 mkpart primary 1 10 > err 2>&1
-test $? = 1 || fail=1
-sed 's/^\(Warn.*table on\).*/\1/' err > k && mv k err || fail=1
+# Expect this to succeed.
+parted -s $d1 mklabel msdos > err 2>&1 || fail=1
+compare err /dev/null || fail=1     # expect no output
 
-# check for expected output
-compare exp err || fail=1
+# Create a partition
+parted -s $d1 mkpart primary 1 10 > err 2>&1 || fail=1
+compare err /dev/null || fail=1     # expect no output
 
 Exit $fail

commit 1983b7b517604aade6a317e8384bd5a58f8e20f5
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Fri Dec 11 11:24:52 2009 +0100

    linux: treat loopback devices as files
    
    We cannot do partition related ioctl's on loopback devices,
    so treat them as files.
    * libparted/arch/linux.c (LOOP_MAJOR): Define.
    * libparted/arch/linux.c (_device_probe_type): Treat loopback
    devices as files.
    Reported by Josef Bacik in http://bugzilla.redhat.com/546622

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 94cbae9..9d15bf2 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -254,6 +254,7 @@ struct blkdev_ioctl_param {
 #define SX8_MAJOR2              161
 #define XVD_MAJOR               202
 #define SDMMC_MAJOR             179
+#define LOOP_MAJOR              7
 
 #define SCSI_BLK_MAJOR(M) (                                             \
                 (M) == SCSI_DISK0_MAJOR                                 \
@@ -569,6 +570,8 @@ _device_probe_type (PedDevice* dev)
                 dev->type = PED_DEVICE_SDMMC;
         } else if (_is_virtblk_major(dev_major)) {
                 dev->type = PED_DEVICE_VIRTBLK;
+        } else if (dev_major == LOOP_MAJOR) {
+                dev->type = PED_DEVICE_FILE;
         } else {
                 dev->type = PED_DEVICE_UNKNOWN;
         }



More information about the Parted-commits mailing list