From cdd78567ae3a87e3aa8c860fce6c3c0c22e4c269 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 17 Apr 2013 11:17:44 -0700 Subject: [PATCH] - libparted: mklabel to support EDEV DASD (#953146) - tests: rewrite t6001-psep.sh to use /dev/mapper --- parted-3.1-libparted-mklabel-edev.patch | 48 +++++++++ ...ests-rewrite-t6001-to-use-dev-mapper.patch | 98 +++++++++++++++++++ parted.spec | 8 +- 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 parted-3.1-libparted-mklabel-edev.patch create mode 100644 parted-3.1-tests-rewrite-t6001-to-use-dev-mapper.patch diff --git a/parted-3.1-libparted-mklabel-edev.patch b/parted-3.1-libparted-mklabel-edev.patch new file mode 100644 index 0000000..c2f869c --- /dev/null +++ b/parted-3.1-libparted-mklabel-edev.patch @@ -0,0 +1,48 @@ +Subject: [PATCH] libparted: mklabel to support EDEV DASD + +From: Nageswara R Sastry + +Fixed Block Access (FBA) DASDs are mainframe-specific disk devices +which are layed out as a sequence of 512-byte sectors. This patch adds +support for mklabel to properly handle FBA devices. + +Signed-off-by: Nageswara R Sastry +--- + libparted/labels/fdasd.c | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -869,19 +869,21 @@ fdasd_check_volume (fdasd_anchor_t *anc, + vtoc_read_volume_label (fd, anc->label_pos, v); + + if (strncmp(v->vollbl, vtoc_ebcdic_enc ("VOL1", str, 4), 4) == 0) { +- /* found VOL1 volume label */ +- b = (cchhb2blk (&v->vtoc, &anc->geo) - 1) * anc->blksize; ++ if (anc->FBA_layout != 1 ) { ++ /* found VOL1 volume label */ ++ b = (cchhb2blk (&v->vtoc, &anc->geo) - 1) * anc->blksize; + +- if (b > 0) { +- int rc; +- rc = fdasd_valid_vtoc_pointer (anc, b, fd); ++ if (b > 0) { ++ int rc; ++ rc = fdasd_valid_vtoc_pointer (anc, b, fd); + +- if (rc < 0) +- return 1; +- else +- return 0; +- } else { +- fdasd_invalid_vtoc_pointer(anc); ++ if (rc < 0) ++ return 1; ++ else ++ return 0; ++ } else { ++ fdasd_invalid_vtoc_pointer(anc); ++ } + } + } else if (strncmp (v->volkey, vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0 || + strncmp (v->volkey, vtoc_ebcdic_enc ("CMS1", str, 4), 4) == 0) { diff --git a/parted-3.1-tests-rewrite-t6001-to-use-dev-mapper.patch b/parted-3.1-tests-rewrite-t6001-to-use-dev-mapper.patch new file mode 100644 index 0000000..0e7884d --- /dev/null +++ b/parted-3.1-tests-rewrite-t6001-to-use-dev-mapper.patch @@ -0,0 +1,98 @@ +From 7d4947fd094f1dda491473a57a9275971405684e Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Wed, 17 Apr 2013 14:59:36 -0700 +Subject: [PATCH] tests: rewrite t6001 to use /dev/mapper + +This test begain failing because using a private copy of /dev/mapper +confuses the system. This fixes that and generally cleans up the test. + +tests/t6001.sh: update to use /dev/mapper directly +--- + tests/t6001-psep.sh | 43 ++++++++++++++++++------------------------- + 1 file changed, 18 insertions(+), 25 deletions(-) + +diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh +index 1859ac9..0c1ab99 100644 +--- a/tests/t6001-psep.sh ++++ b/tests/t6001-psep.sh +@@ -1,4 +1,5 @@ + #!/bin/sh ++ + # ensure that parted names partitions on dm disks correctly + + # Copyright (C) 2011-2012 Free Software Foundation, Inc. +@@ -19,10 +20,7 @@ + . "${srcdir=.}/init.sh"; path_prepend_ ../parted + + require_root_ +-lvm_init_root_dir_ +- +-test "x$ENABLE_DEVICE_MAPPER" = xyes \ +- || skip_ "no device-mapper support" ++(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" + + # Device maps names - should be random to not conflict with existing ones on + # the system +@@ -41,25 +39,19 @@ cleanup_fn_() { + rm -f "$f1 $f2"; + } + +-# create a file of size N bytes +-N=10M ++loop_file_1=loop-file-1-$$ ++loop_file_2=loop-file-2-$$ + +-f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \ +- || skip_ "is this partition mounted with 'nodev'?" ++d1=$(loop_setup_ $loop_file_1) || framework_failure ++d1_size=$(blockdev --getsz $d1) ++d2=$(loop_setup_ $loop_file_2) || framework_failure ++d2_size=$(blockdev --getsz $d2) + +-f2=$(pwd)/2 ;d2=$(loop_setup_ "$f2") \ +- || skip_ "is this partition mounted with 'nodev'?" +- +-dmsetup_cmd="0 `blockdev --getsz $d1` linear $d1 0" +-# setup: create a mapping +-echo "$dmsetup_cmd" | dmsetup create "$linear_" || fail=1 +-dev="$DM_DEV_DIR/mapper/$linear_" ++dmsetup create $linear_ --table "0 $d1_size linear $d1 0" || framework_failure ++dev="/dev/mapper/$linear_" + + # Create msdos partition table +-parted -s $dev mklabel msdos > out 2>&1 || fail=1 +-compare /dev/null out || fail=1 +- +-parted -s $dev mkpart primary fat32 1m 5m > out 2>&1 || fail=1 ++parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + #make sure device name is correct +@@ -67,17 +59,18 @@ test -e ${dev}p1 || fail=1 + + #repeat on name not ending in a digit + # setup: create a mapping +-echo "$dmsetup_cmd" | dmsetup create "$linear2_" || fail=1 +-dev="$DM_DEV_DIR/mapper/$linear2_" ++dmsetup create $linear2_ --table "0 $d2_size linear $d2 0" || framework_failure ++dev="/dev/mapper/$linear2_" + + # Create msdos partition table +-parted -s $dev mklabel msdos > out 2>&1 || fail=1 +-compare /dev/null out || fail=1 +- +-parted -s $dev mkpart primary fat32 1m 5m > out 2>&1 || fail=1 ++parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + #make sure device name is correct + test -e ${dev}1 || fail=1 + ++if [ -n "$fail" ]; then ++ ls /dev/mapper ++fi ++ + Exit $fail +-- +1.8.1.4 + diff --git a/parted.spec b/parted.spec index f10e3e3..93cbf7b 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.1 -Release: 11%{?dist} +Release: 12%{?dist} License: GPLv3+ Group: Applications/System URL: http://www.gnu.org/software/parted @@ -29,6 +29,8 @@ Patch12: parted-3.1-libparted-add-support-for-EAV-DASD-partitions.patch Patch13: parted-3.1-libparted-don-t-canonicalize-dev-md-paths.patch Patch14: parted-3.1-libparted-mklabel-eav.patch Patch15: parted-3.1-avoid-dasd-as-default-file-image-type.patch +Patch16: parted-3.1-libparted-mklabel-edev.patch +Patch17: parted-3.1-tests-rewrite-t6001-to-use-dev-mapper.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -165,6 +167,10 @@ fi %changelog +* Wed Apr 17 2013 Brian C. Lane 3.1-12 +- libparted: mklabel to support EDEV DASD (#953146) +- tests: rewrite t6001 to use /dev/mapper + * Thu Feb 14 2013 Fedora Release Engineering - 3.1-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild