- Rebasing Fedora patches with upstream master since v3.1 release

- Summary of important changes from upstream:
  - add support for a new Linux-specific GPT partition type code
  - partprobe: remove partitions when there is no partition table
  - libparted: refactor device-mapper partition sync code
  - libparted: remove extraneous blkpg add partition ped exception
  - libparted: don't probe every dm device in probe_all
- New Fedora changes:
  - libparted: Add Intel Rapid Start Technology partition flag.
  - libparted: Add UEFI System Partition flag.
  - libparted: Add hfs_esp partition flag to GPT.
  - libparted: Recognize btrfs filesystem
  - tests: Add btrfs and xfs to the fs probe test
This commit is contained in:
Brian C. Lane 2013-08-28 09:13:40 -07:00
parent 1f3d038aae
commit a248769183
78 changed files with 9191 additions and 742 deletions

View File

@ -0,0 +1,50 @@
From f6835518a7a8722b247079799a9145c3101f9a8a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Fri, 2 Mar 2012 17:59:32 +0100
Subject: [PATCH 01/69] maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
---
.prev-version | 2 +-
NEWS | 3 +++
cfg.mk | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/.prev-version b/.prev-version
index 9f55b2c..8c50098 100644
--- a/.prev-version
+++ b/.prev-version
@@ -1 +1 @@
-3.0
+3.1
diff --git a/NEWS b/NEWS
index fe0fcdd..3bef20e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
GNU parted NEWS -*- outline -*-
+* Noteworthy changes in release ?.? (????-??-??) [?]
+
+
* Noteworthy changes in release 3.1 (2012-03-02) [stable]
** New features
diff --git a/cfg.mk b/cfg.mk
index ba8ba77..c6a00c8 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -42,7 +42,7 @@ local-checks-to-skip = \
# Now that we have better (check.mk) tests, make this the default.
export VERBOSE = yes
-old_NEWS_hash = 04810d10a532cf2e75d602ddda0d64b1
+old_NEWS_hash = bd453bcf049e292a9677c094d24a29dd
include $(srcdir)/dist-check.mk
--
1.8.3.1

View File

@ -1,8 +1,7 @@
From 9343e79fee796a142a4bd12674aa3fdb56526eb6 Mon Sep 17 00:00:00 2001
From b55724f291fa405f652fbbc5cae6e36cc8a2d200 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 20 Mar 2012 16:08:25 -0700
Subject: [PATCH 1/2] libparted: check PMBR before GPT partition table
(#805272)
Date: Tue, 20 Mar 2012 17:25:22 -0700
Subject: [PATCH 02/69] libparted: check PMBR before GPT partition table
The UEFI spec requires that a valid GPT disk label have a PMBR
partition. This moves the PMBR check to before the GPT check,
@ -12,20 +11,29 @@ The previous behavior would cause problems in the following situation:
1. format a disk as GPT
2. re-format it as MSDOS using tools that don't understand GPT
Subsequent operations with parted would then complain about the invlid
PMBR, but would not allow the disk to be used as a msdos disk. This
change causes parted to tread the disk as a msdos disk.
Subsequent operations with parted would then complain about the invalid
PMBR, but would not allow the disk to be used as an msdos disk. This
change causes parted to recognize the msdos partition table.
* libparted/labels/gpt.c (gpt_probe): Move _pmbr_is_valid test
* libparted/labels/gpt.c (gpt_probe): Move _pmbr_is_valid test.
Reported by Chris Murphy in http://bugzilla.redhat.com/805272
---
libparted/labels/gpt.c | 44 +++++++++++++-------------------------------
1 files changed, 13 insertions(+), 31 deletions(-)
libparted/labels/gpt.c | 47 ++++++++++++++---------------------------------
1 file changed, 14 insertions(+), 33 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 84bdc12..e57b3a2 100644
index 84bdc12..91ad71a 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -465,6 +465,17 @@ gpt_probe (const PedDevice *dev)
@@ -457,7 +457,6 @@ _pmbr_is_valid (const LegacyMBR_t *mbr)
static int
gpt_probe (const PedDevice *dev)
{
- GuidPartitionTableHeader_t *gpt = NULL;
int gpt_sig_found = 0;
PED_ASSERT (dev != NULL);
@@ -465,47 +464,29 @@ gpt_probe (const PedDevice *dev)
if (dev->length <= 1)
return 0;
@ -33,7 +41,7 @@ index 84bdc12..e57b3a2 100644
+ if (!ptt_read_sector (dev, 0, &label))
+ return 0;
+
+ if (!_pmbr_is_valid ((const LegacyMBR_t *) label))
+ if (!_pmbr_is_valid (label))
+ {
+ free (label);
+ return 0;
@ -43,8 +51,9 @@ index 84bdc12..e57b3a2 100644
void *pth_raw = ped_malloc (pth_get_size (dev));
if (ped_device_read (dev, pth_raw, 1, GPT_HEADER_SECTORS)
|| ped_device_read (dev, pth_raw, dev->length - 1, GPT_HEADER_SECTORS))
@@ -472,40 +483,11 @@ gpt_probe (const PedDevice *dev)
gpt = pth_new_from_raw (dev, pth_raw);
{
- gpt = pth_new_from_raw (dev, pth_raw);
+ GuidPartitionTableHeader_t *gpt = pth_new_from_raw (dev, pth_raw);
if (gpt->Signature == PED_CPU_TO_LE64 (GPT_HEADER_SIGNATURE))
gpt_sig_found = 1;
+ pth_free (gpt);
@ -87,5 +96,5 @@ index 84bdc12..e57b3a2 100644
static PedDisk *
--
1.7.7.6
1.8.3.1

View File

@ -0,0 +1,98 @@
From 5021bbdc6ee892890c2c6fede806b9ad6a6a9378 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 20 Mar 2012 17:25:23 -0700
Subject: [PATCH 03/69] tests: add t0301-overwrite-gpt-pmbr.sh
Make sure parted checks the PMBR before the GPT partition table.
* NEWS: Update with new GPT behavior.
* tests/overwrite-gpt-pmbr.sh: New test.
* tests/Makefile.am (TESTS): Add it.
---
NEWS | 5 +++++
tests/Makefile.am | 1 +
tests/t0301-overwrite-gpt-pmbr.sh | 44 +++++++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+)
create mode 100755 tests/t0301-overwrite-gpt-pmbr.sh
diff --git a/NEWS b/NEWS
index 3bef20e..3969c44 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ GNU parted NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
+** Bug Fixes
+
+ libparted: treat a disk with no pMBR as an msdos-labeled disk
+ even when it has valid GPT headers.
+
* Noteworthy changes in release 3.1 (2012-03-02) [stable]
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1b37fd9..1264812 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -28,6 +28,7 @@ TESTS = \
t0250-gpt.sh \
t0280-gpt-corrupt.sh \
t0300-dos-on-gpt.sh \
+ t0301-overwrite-gpt-pmbr.sh \
t0400-loop-clobber-infloop.sh \
t0500-dup-clobber.sh \
t0501-duplicate.sh \
diff --git a/tests/t0301-overwrite-gpt-pmbr.sh b/tests/t0301-overwrite-gpt-pmbr.sh
new file mode 100755
index 0000000..e7edb66
--- /dev/null
+++ b/tests/t0301-overwrite-gpt-pmbr.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Test creating a msdos partition over a GPT partition with
+# fdisk which doesn't remove the GPT partitions, only the PMBR
+
+# Copyright (C) 2009-2012 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/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+dev=loop-file
+
+# Create a GPT partition table.
+dd if=/dev/null of=$dev bs=$ss seek=80 2> /dev/null || framework_failure
+parted -s $dev mklabel gpt > out 2>&1 || framework_failure_
+compare /dev/null out || framework_failure_
+
+# Create an MSDOS partition table in another file.
+dd if=/dev/null of=m bs=$ss seek=80 2> /dev/null || framework_failure
+parted -s m mklabel msdos > out 2>&1 || framework_failure_
+compare /dev/null out || framework_failure_
+
+# Transplant the MSDOS MBR into the GPT-formatted image.
+dd if=m of=$dev bs=$ss count=1 conv=notrunc || framework_failure_
+
+# Now, try to create a GPT partition table in $dev.
+# Before, parted would prompt, asking about the apparent inconsistency.
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+Exit $fail
--
1.8.3.1

View File

@ -0,0 +1,37 @@
From 7fd33a6d24da6a82b830552999b2332140f556d4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 26 Mar 2012 21:52:08 +0200
Subject: [PATCH 04/69] tests: remove bogus envvar setting from
t0300-dos-on-gpt.sh
* tests/t0300-dos-on-gpt.sh: Remove envvar setting that effectively
disabled testing(only in this test) of simulated sector sizes smaller
than 4KiB.
Also, use a much smaller backing file.
---
tests/t0300-dos-on-gpt.sh | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tests/t0300-dos-on-gpt.sh b/tests/t0300-dos-on-gpt.sh
index 41bc391..fbe8d7c 100755
--- a/tests/t0300-dos-on-gpt.sh
+++ b/tests/t0300-dos-on-gpt.sh
@@ -17,13 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
-
-PARTED_SECTOR_SIZE=4096
-export PARTED_SECTOR_SIZE
+ss=$sector_size_
dev=loop-file
# create a backing file large enough for a GPT partition table
-dd if=/dev/null of=$dev seek=4001 2> /dev/null || framework_failure
+dd if=/dev/null of=$dev bs=$ss seek=80 2> /dev/null || framework_failure
# create a GPT partition table
parted -s $dev mklabel gpt > out 2>&1 || fail=1
--
1.8.3.1

View File

@ -0,0 +1,51 @@
From 4ac1c02b590668c93afdb48900e0858de58cda3a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 8 Jun 2012 13:19:25 +0100
Subject: [PATCH 05/69] gpt: fix endianness bug in
gpt_get_max_supported_partition_count
* libparted/labels/gpt.c (gpt_get_max_supported_partition_count):
Take endianness of pth->FirstUsableLBA into account (64-bit,
little endian) when calculating the maximum number of partitions.
* NEWS (Bug fixes): Mention it.
---
NEWS | 3 +++
libparted/labels/gpt.c | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 3969c44..f929b99 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ GNU parted NEWS -*- outline -*-
** Bug Fixes
+ libparted: gpt: fix gpt_get_max_supported_partition_count to work
+ also on little-endian systems.
+
libparted: treat a disk with no pMBR as an msdos-labeled disk
even when it has valid GPT headers.
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 91ad71a..6032e3f 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1785,12 +1785,12 @@ gpt_get_max_supported_partition_count (const PedDisk *disk, int *max_n)
if (!_header_is_valid (disk, pth, 1))
{
- pth->FirstUsableLBA = 34;
+ pth->FirstUsableLBA = PED_CPU_TO_LE64 (34);
pth->SizeOfPartitionEntry
= PED_CPU_TO_LE32 (sizeof (GuidPartitionEntry_t));
}
- *max_n = (disk->dev->sector_size * (pth->FirstUsableLBA - 2)
+ *max_n = (disk->dev->sector_size * (PED_LE64_TO_CPU (pth->FirstUsableLBA) - 2)
/ PED_LE32_TO_CPU (pth->SizeOfPartitionEntry));
pth_free (pth);
return true;
--
1.8.3.1

View File

@ -0,0 +1,110 @@
From e38df2d81f0a4647711ffeb92a32c99e7ce9a92d Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 9 Jun 2012 17:26:21 +0200
Subject: [PATCH 06/69] tests: add a test to exercise just-fixed code
* tests/print-max.c: Extend to provide coverage of
ped_disk_get_max_supported_partition_count, too.
* tests/t9021-maxima.sh (max_n_partitions): New function, with
naively hard-coded max-number-of-partitions-per-partition-table-type
values.
Use it to ensure that each expected value matches the actual one.
* cfg.mk: Exempt this test's use of error from the syntax-check
for unmarked diagnostics.
---
cfg.mk | 2 ++
tests/print-max.c | 10 ++++++++++
tests/t9021-maxima.sh | 26 +++++++++++++++++++++++++-
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/cfg.mk b/cfg.mk
index c6a00c8..45d2ac2 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -69,3 +69,5 @@ exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
exclude_file_name_regexp--sc_prohibit_path_max_allocation = \
^libparted/arch/beos\.c$$
+
+exclude_file_name_regexp--sc_unmarked_diagnostics = ^tests/print-max\.c$$
diff --git a/tests/print-max.c b/tests/print-max.c
index 7560d49..41aa8c6 100644
--- a/tests/print-max.c
+++ b/tests/print-max.c
@@ -2,9 +2,11 @@
#include <parted/parted.h>
#include <stdio.h>
#include <stdlib.h>
+#include <errno.h>
#include "closeout.h"
#include "progname.h"
+#include "error.h"
int
main (int argc, char **argv)
@@ -26,8 +28,16 @@ main (int argc, char **argv)
PedSector max_length = ped_disk_max_partition_length (disk);
PedSector max_start_sector = ped_disk_max_partition_start_sector (disk);
+ if (!ped_device_open(dev))
+ error (EXIT_FAILURE, errno, "failed to open %s\n", dev_name);
+ int max_n_partitions;
+ bool ok = ped_disk_get_max_supported_partition_count (disk,
+ &max_n_partitions);
+
printf ("max len: %llu\n", (unsigned long long) max_length);
printf ("max start sector: %llu\n", (unsigned long long) max_start_sector);
+ printf ("max number of partitions: %d\n",
+ ok ? max_n_partitions : -1);
ped_disk_destroy (disk);
ped_device_destroy (dev);
diff --git a/tests/t9021-maxima.sh b/tests/t9021-maxima.sh
index 0570585..ca10d17 100755
--- a/tests/t9021-maxima.sh
+++ b/tests/t9021-maxima.sh
@@ -23,6 +23,27 @@ dev=dev-file
PATH="..:$PATH"
export PATH
+max_n_partitions()
+{
+ case $1 in
+
+ # Technically, msdos partition tables have no limit on the maximum number
+ # of partitions, but we pretend it is 64 due to implementation details.
+ msdos) m=64;;
+
+ gpt) m=128;;
+ dvh) m=16;;
+ sun) m=8;;
+ mac) m=65536;;
+ bsd) m=8;;
+ amiga) m=128;;
+ loop) m=1;;
+ pc98) case $ss in 512) m=16;; *) m=64;; esac;;
+ *) warn_ invalid partition table type: $1 1>&2; exit 1;;
+ esac
+ echo $m
+}
+
# FIXME: add aix when/if it's supported again
for t in msdos gpt dvh sun mac bsd amiga loop pc98; do
echo $t
@@ -40,8 +61,11 @@ for t in msdos gpt dvh sun mac bsd amiga loop pc98; do
esac
print-max $dev > out 2>&1 || fail=1
+ m=$(max_n_partitions $t) || fail=1
printf '%s\n' "max len: $max_len" \
- "max start sector: $max_start" > exp || fail=1
+ "max start sector: $max_start" \
+ "max number of partitions: $m" \
+ > exp || fail=1
compare exp out || fail=1
done
--
1.8.3.1

View File

@ -0,0 +1,51 @@
From 89377f99947391c081df6dad27edf6ac3daec5c0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 28 Aug 2012 19:47:54 +0200
Subject: [PATCH 07/69] maint: avoid new syntax-check failure re @xref
* doc/parted.texi: Adjust @xref usage: it must be used only
at start of sentence.
* doc/parted-pt_BR.texi: Likewise.
---
doc/parted-pt_BR.texi | 4 ++--
doc/parted.texi | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/parted-pt_BR.texi b/doc/parted-pt_BR.texi
index 8eb5cec..8878f83 100644
--- a/doc/parted-pt_BR.texi
+++ b/doc/parted-pt_BR.texi
@@ -1094,7 +1094,7 @@ de sistemas operacionais Microsoft.
@item raid
(MSDOS) - este sinalizador pode ser habilitado para dizer ao Linux que
-essa partição é uma partição de software RAID @xref{LVM e RAID}.
+essa partição é uma partição de software RAID. @xref{LVM e RAID}.
@item LVM
(MSDOS) - este sinalizador pode ser habilitado para dizer à partição
@@ -1994,7 +1994,7 @@ mudan
com o kernel 2.4, e quando nós adicionarmos suporte a ele.)
Se você quer redimensionar sua partição root ou de boot, use um disco
-de boot @xref{Discos de boot do Parted}, ou use o redimensionador
+de boot @pxref{Discos de boot do Parted}, ou use o redimensionador
online do Andreas Dilger, incluído no pacote ext2resize @ref{Ext2}.
@menu
diff --git a/doc/parted.texi b/doc/parted.texi
index 6561d0e..1601151 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -348,7 +348,7 @@ specify the location in ``G''). Use the sector unit ``s'' to specify exact
locations. With parted-2.4 and newer,
IEC binary units like ``MiB'', ``GiB'', ``TiB'', etc., specify
exact locations as well.
-See @xref{IEC binary units}.
+@xref{IEC binary units}.
If you don't give a parameter to a command, Parted will prompt you for it.
For example:
--
1.8.3.1

View File

@ -0,0 +1,28 @@
From 00a5736ff2220229d75d4259c582ae0a62539915 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 28 Aug 2012 19:49:25 +0200
Subject: [PATCH 08/69] maint: don't prohibit strncpy just yet
* cfg.mk (local-checks-to-skip): Add sc_prohibit_strncpy,
so that we do not yet enable the strncpy prohibition.
There are many uses, and it will be a lot of work to remove
all of them.
---
cfg.mk | 1 +
1 file changed, 1 insertion(+)
diff --git a/cfg.mk b/cfg.mk
index 45d2ac2..3d3014c 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -34,6 +34,7 @@ local-checks-to-skip = \
sc_error_message_period \
sc_file_system \
sc_prohibit_strcmp \
+ sc_prohibit_strncpy \
sc_prohibit_atoi_atof \
sc_require_test_exit_idiom \
sc_space_tab \
--
1.8.3.1

View File

@ -0,0 +1,576 @@
From 92154e8dfb35c70f6792c4efed9cd97b4c84cbcb Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 28 Aug 2012 19:50:48 +0200
Subject: [PATCH 09/69] build: update gnulib, bootstrap and init.sh
---
bootstrap | 267 ++++++++++++++++++++++++++++++++++++++--------------------
gnulib | 2 +-
tests/init.sh | 13 ++-
3 files changed, 185 insertions(+), 97 deletions(-)
diff --git a/bootstrap b/bootstrap
index 31eb651..e3e270b 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2012-02-11.09; # UTC
+scriptversion=2012-07-19.14; # UTC
# Bootstrap this package from checked-out sources.
@@ -36,6 +36,10 @@ nl='
LC_ALL=C
export LC_ALL
+# Ensure that CDPATH is not set. Otherwise, the output from cd
+# would cause trouble in at least one use below.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
local_gl_dir=gl
me=$0
@@ -73,6 +77,33 @@ Running without arguments will suffice in most cases.
EOF
}
+# warnf_ FORMAT-STRING ARG1...
+warnf_ ()
+{
+ warnf_format_=$1
+ shift
+ nl='
+'
+ case $* in
+ *$nl*) me_=$(printf "$me"|tr "$nl|" '??')
+ printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;;
+ *) printf "$me: $warnf_format_" "$@" ;;
+ esac >&2
+}
+
+# warn_ WORD1...
+warn_ ()
+{
+ # If IFS does not start with ' ', set it and emit the warning in a subshell.
+ case $IFS in
+ ' '*) warnf_ '%s\n' "$*";;
+ *) (IFS=' '; warn_ "$@");;
+ esac
+}
+
+# die WORD1...
+die() { warn_ "$@"; exit 1; }
+
# Configuration.
# Name of the Makefile.am
@@ -126,7 +157,8 @@ extract_package_name='
p
}
'
-package=`sed -n "$extract_package_name" configure.ac` || exit
+package=$(sed -n "$extract_package_name" configure.ac) \
+ || die 'cannot find package name in configure.ac'
gnulib_name=lib$package
build_aux=build-aux
@@ -182,6 +214,8 @@ use_git=true
# otherwise find the first of the NAMES that can be run (i.e.,
# supports --version). If found, set ENVVAR to the program name,
# die otherwise.
+#
+# FIXME: code duplication, see also gnu-web-doc-update.
find_tool ()
{
find_tool_envvar=$1
@@ -199,19 +233,15 @@ find_tool ()
else
find_tool_error_prefix="\$$find_tool_envvar: "
fi
- if test x"$find_tool_res" = x; then
- echo >&2 "$me: one of these is required: $find_tool_names"
- exit 1
- fi
- ($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
- echo >&2 "$me: ${find_tool_error_prefix}cannot run $find_tool_res --version"
- exit 1
- }
+ test x"$find_tool_res" != x \
+ || die "one of these is required: $find_tool_names"
+ ($find_tool_res --version </dev/null) >/dev/null 2>&1 \
+ || die "${find_tool_error_prefix}cannot run $find_tool_res --version"
eval "$find_tool_envvar=\$find_tool_res"
eval "export $find_tool_envvar"
}
-# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
+# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
find_tool SHA1SUM sha1sum gsha1sum shasum
# Override the default configuration, if necessary.
@@ -226,7 +256,6 @@ esac
test -z "${gnulib_extra_files}" && \
gnulib_extra_files="
$build_aux/install-sh
- $build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
@@ -252,7 +281,7 @@ do
usage
exit;;
--gnulib-srcdir=*)
- GNULIB_SRCDIR=`expr "X$option" : 'X--gnulib-srcdir=\(.*\)'`;;
+ GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
--skip-po)
SKIP_PO=t;;
--force)
@@ -266,21 +295,15 @@ do
--no-git)
use_git=false;;
*)
- echo >&2 "$0: $option: unknown option"
- exit 1;;
+ die "$option: unknown option";;
esac
done
-if $use_git || test -d "$GNULIB_SRCDIR"; then
- :
-else
- echo "$0: Error: --no-git requires --gnulib-srcdir" >&2
- exit 1
-fi
+$use_git || test -d "$GNULIB_SRCDIR" \
+ || die "Error: --no-git requires --gnulib-srcdir"
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
- echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
- exit 1
+ die "Bootstrapping from a non-checked-out distribution is risky."
fi
# Ensure that lines starting with ! sort last, per gitignore conventions
@@ -303,10 +326,10 @@ insert_sorted_if_absent() {
file=$1
str=$2
test -f $file || touch $file
- echo "$str" | sort_patterns - $file | cmp - $file > /dev/null \
+ echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|| { echo "$str" | sort_patterns - $file > $file.bak \
&& mv $file.bak $file; } \
- || exit 1
+ || die "insert_sorted_if_absent $file $str: failed"
}
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
@@ -319,7 +342,7 @@ insert_vc_ignore() {
# A .gitignore entry that does not start with '/' applies
# recursively to subdirectories, so prepend '/' to every
# .gitignore entry.
- pattern=`echo "$pattern" | sed s,^,/,`;;
+ pattern=$(echo "$pattern" | sed s,^,/,);;
esac
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
}
@@ -330,11 +353,8 @@ grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
>/dev/null && found_aux_dir=yes
grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
>/dev/null && found_aux_dir=yes
-if test $found_aux_dir = no; then
- echo "$0: expected line not found in configure.ac. Add the following:" >&2
- echo " AC_CONFIG_AUX_DIR([$build_aux])" >&2
- exit 1
-fi
+test $found_aux_dir = yes \
+ || die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
# If $build_aux doesn't exist, create it now, otherwise some bits
# below will malfunction. If creating it, also mark it as ignored.
@@ -423,31 +443,48 @@ check_versions() {
$use_git || continue
fi
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
- appvar=`echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
+ appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_')
test "$appvar" = TAR && appvar=AMTAR
case $appvar in
GZIP) ;; # Do not use $GZIP: it contains gzip options.
*) eval "app=\${$appvar-$app}" ;;
esac
+
+ # Handle the still-experimental Automake-NG programs specially.
+ # They remain named as the mainstream Automake programs ("automake",
+ # and "aclocal") to avoid gratuitous incompatibilities with
+ # pre-existing usages (by, say, autoreconf, or custom autogen.sh
+ # scripts), but correctly identify themselves (as being part of
+ # "GNU automake-ng") when asked their version.
+ case $app in
+ automake-ng|aclocal-ng)
+ app=${app%-ng}
+ ($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
+ warn_ "Error: '$app' not found or not from Automake-NG"
+ ret=1
+ continue
+ } ;;
+ esac
if [ "$req_ver" = "-" ]; then
# Merely require app to exist; not all prereq apps are well-behaved
# so we have to rely on $? rather than get_version.
$app --version >/dev/null 2>&1
if [ 126 -le $? ]; then
- echo "$me: Error: '$app' not found" >&2
+ warn_ "Error: '$app' not found"
ret=1
fi
else
# Require app to produce a new enough version string.
inst_ver=$(get_version $app)
if [ ! "$inst_ver" ]; then
- echo "$me: Error: '$app' not found" >&2
+ warn_ "Error: '$app' not found"
ret=1
else
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
if [ ! "$latest_ver" = "$inst_ver" ]; then
- echo "$me: Error: '$app' version == $inst_ver is too old" >&2
- echo " '$app' version >= $req_ver is required" >&2
+ warnf_ '%s\n' \
+ "Error: '$app' version == $inst_ver is too old" \
+ " '$app' version >= $req_ver is required"
ret=1
fi
fi
@@ -492,10 +529,8 @@ esac
# When we can deduce that gnulib-tool will require patch,
# and when patch is not already listed as a prerequisite, add it, too.
-if test ! -d "$local_gl_dir" \
- || find "$local_gl_dir" -name '*.diff' -exec false {} +; then
- :
-else
+if test -d "$local_gl_dir" \
+ && ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then
case $buildreq in
*patch*) ;;
*) buildreq="patch -
@@ -506,11 +541,10 @@ fi
if ! printf "$buildreq" | check_versions; then
echo >&2
if test -f README-prereq; then
- echo "$0: See README-prereq for how to get the prerequisite programs" >&2
+ die "See README-prereq for how to get the prerequisite programs"
else
- echo "$0: Please install the prerequisite programs" >&2
+ die "Please install the prerequisite programs"
fi
- exit 1
fi
echo "$0: Bootstrapping from checked-out $package sources..."
@@ -539,7 +573,7 @@ git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@"
}
-gnulib_path=`git_modules_config submodule.gnulib.path`
+gnulib_path=$(git_modules_config submodule.gnulib.path)
test -z "$gnulib_path" && gnulib_path=gnulib
# Get gnulib files.
@@ -612,10 +646,10 @@ download_po_files() {
subdir=$1
domain=$2
echo "$me: getting translations into $subdir for $domain..."
- cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
+ cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
eval "$cmd" && return
# Fallback to HTTP.
- cmd=`printf "$po_download_command_format2" "$subdir" "$domain"`
+ cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
eval "$cmd"
}
@@ -638,7 +672,7 @@ update_po_files() {
&& ls "$ref_po_dir"/*.po 2>/dev/null |
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
- langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
+ langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
test "$langs" = '*' && langs=x
for po in $langs; do
case $po in x) continue;; esac
@@ -675,18 +709,18 @@ symlink_to_dir()
# If the destination directory doesn't exist, create it.
# This is required at least for "lib/uniwidth/cjk.h".
- dst_dir=`dirname "$dst"`
+ dst_dir=$(dirname "$dst")
if ! test -d "$dst_dir"; then
mkdir -p "$dst_dir"
# If we've just created a directory like lib/uniwidth,
# tell version control system(s) it's ignorable.
# FIXME: for now, this does only one level
- parent=`dirname "$dst_dir"`
+ parent=$(dirname "$dst_dir")
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
- insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'`
+ insert_vc_ignore $ig "${dst_dir##*/}"
done
fi
@@ -710,10 +744,10 @@ symlink_to_dir()
# so that broken tools aren't confused into skipping needed builds. See
# <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
test -h "$dst" &&
- src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
- dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
+ src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
+ dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
test "$src_i" = "$dst_i" &&
- both_ls=`ls -dt "$src" "$dst"` &&
+ both_ls=$(ls -dt "$src" "$dst") &&
test "X$both_ls" = "X$dst$nl$src" || {
dot_dots=
case $src in
@@ -721,11 +755,10 @@ symlink_to_dir()
*)
case /$dst/ in
*//* | */../* | */./* | /*/*/*/*/*/)
- echo >&2 "$me: invalid symlink calculation: $src -> $dst"
- exit 1;;
- /*/*/*/*/) dot_dots=../../../;;
- /*/*/*/) dot_dots=../../;;
- /*/*/) dot_dots=../;;
+ die "invalid symlink calculation: $src -> $dst";;
+ /*/*/*/*/) dot_dots=../../../;;
+ /*/*/*/) dot_dots=../../;;
+ /*/*/) dot_dots=../;;
esac;;
esac
@@ -736,6 +769,22 @@ symlink_to_dir()
}
}
+version_controlled_file() {
+ parent=$1
+ file=$2
+ if test -d .git; then
+ git rm -n "$file" > /dev/null 2>&1
+ elif test -d .svn; then
+ svn log -r HEAD "$file" > /dev/null 2>&1
+ elif test -d CVS; then
+ grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
+ grep '^/[^/]*/[0-9]' > /dev/null
+ else
+ warn_ "no version control for $file?"
+ false
+ fi
+}
+
# NOTE: we have to be careful to run both autopoint and libtoolize
# before gnulib-tool, since gnulib-tool is likely to provide newer
# versions of files "installed" by these two programs.
@@ -748,37 +797,54 @@ with_gettext=yes
grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
with_gettext=no
-if test $with_gettext = yes; then
- # Released autopoint has the tendency to install macros that have been
- # obsoleted in current gnulib, so run this before gnulib-tool.
- echo "$0: $AUTOPOINT --force"
- $AUTOPOINT --force || exit
-fi
+if test $with_gettext = yes || test $use_libtool = 1; then
-# Autoreconf runs aclocal before libtoolize, which causes spurious
-# warnings if the initial aclocal is confused by the libtoolized
-# (or worse out-of-date) macro directory.
-if test $use_libtool = 1; then
- echo "running: $LIBTOOLIZE --copy --install"
- $LIBTOOLIZE --copy --install
-fi
+ tempbase=.bootstrap$$
+ trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
-version_controlled_file() {
- dir=$1
- file=$2
- found=no
- if test -d CVS; then
- grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
- grep '^/[^/]*/[0-9]' > /dev/null && found=yes
- elif test -d .git; then
- git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
- elif test -d .svn; then
- svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes
- else
- echo "$me: no version control for $dir/$file?" >&2
+ > $tempbase.0 > $tempbase.1 &&
+ find . ! -type d -print | sort > $tempbase.0 || exit
+
+ if test $with_gettext = yes; then
+ # Released autopoint has the tendency to install macros that have been
+ # obsoleted in current gnulib, so run this before gnulib-tool.
+ echo "$0: $AUTOPOINT --force"
+ $AUTOPOINT --force || exit
fi
- test $found = yes
-}
+
+ # Autoreconf runs aclocal before libtoolize, which causes spurious
+ # warnings if the initial aclocal is confused by the libtoolized
+ # (or worse out-of-date) macro directory.
+ # libtoolize 1.9b added the --install option; but we support back
+ # to libtoolize 1.5.22, where the install action was default.
+ if test $use_libtool = 1; then
+ install=
+ case $($LIBTOOLIZE --help) in
+ *--install*) install=--install ;;
+ esac
+ echo "running: $LIBTOOLIZE $install --copy"
+ $LIBTOOLIZE $install --copy
+ fi
+
+ find . ! -type d -print | sort >$tempbase.1
+ old_IFS=$IFS
+ IFS=$nl
+ for file in $(comm -13 $tempbase.0 $tempbase.1); do
+ IFS=$old_IFS
+ parent=${file%/*}
+ version_controlled_file "$parent" "$file" || {
+ for dot_ig in x $vc_ignore; do
+ test $dot_ig = x && continue
+ ig=$parent/$dot_ig
+ insert_vc_ignore "$ig" "${file##*/}"
+ done
+ }
+ done
+ IFS=$old_IFS
+
+ rm -f $tempbase.0 $tempbase.1
+ trap - 1 2 13 15
+fi
# Import from gnulib.
@@ -804,11 +870,12 @@ echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
for file in $gnulib_files; do
- symlink_to_dir "$GNULIB_SRCDIR" $file || exit
+ symlink_to_dir "$GNULIB_SRCDIR" $file \
+ || die "failed to symlink $file"
done
bootstrap_post_import_hook \
- || { echo >&2 "$me: bootstrap_post_import_hook failed"; exit 1; }
+ || die "bootstrap_post_import_hook failed"
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
@@ -836,16 +903,17 @@ echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
"$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
AUTOPOINT=true LIBTOOLIZE=true \
$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
- || exit 1
+ || die "autoreconf failed"
# Get some extra files from gnulib, overriding existing files.
for file in $gnulib_extra_files; do
case $file in
*/INSTALL) dst=INSTALL;;
- build-aux/*) dst=$build_aux/`expr "$file" : 'build-aux/\(.*\)'`;;
+ build-aux/*) dst=$build_aux/${file#build-aux/};;
*) dst=$file;;
esac
- symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit
+ symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
+ || die "failed to symlink $file"
done
if test $with_gettext = yes; then
@@ -861,7 +929,19 @@ if test $with_gettext = yes; then
a\
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
}
- ' po/Makevars.template >po/Makevars || exit 1
+ ' po/Makevars.template >po/Makevars \
+ || die 'cannot generate po/Makevars'
+
+ # If the 'gettext' module is in use, grab the latest Makefile.in.in.
+ # If only the 'gettext-h' module is in use, assume autopoint already
+ # put the correct version of this file into place.
+ case $gnulib_modules in
+ *gettext-h*) ;;
+ *gettext*)
+ cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \
+ || die "cannot create po/Makefile.in.in"
+ ;;
+ esac
if test -d runtime-po; then
# Similarly for runtime-po/Makevars, but not quite the same.
@@ -875,7 +955,8 @@ if test $with_gettext = yes; then
a\
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
}
- ' po/Makevars.template >runtime-po/Makevars || exit 1
+ ' po/Makevars.template >runtime-po/Makevars \
+ || die 'cannot generate runtime-po/Makevars'
# Copy identical files from po to runtime-po.
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
diff --git a/gnulib b/gnulib
index 50bb21e..e1abd50 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 50bb21eab7dfc87bbfcbc75f0232407110cdd296
+Subproject commit e1abd50b01d6bd61bd0c996ca17378cd569c0aa1
diff --git a/tests/init.sh b/tests/init.sh
index ae86714..5f6e638 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -207,6 +207,14 @@ else
fi
fi
+# If this is bash, turn off all aliases.
+test -n "$BASH_VERSION" && unalias -a
+
+# Note that when supporting $EXEEXT (transparently mapping from PROG_NAME to
+# PROG_NAME.exe), we want to support hyphen-containing names like test-acos.
+# That is part of the shell-selection test above. Why use aliases rather
+# than functions? Because support for hyphen-containing aliases is more
+# widespread than that for hyphen-containing function names.
test -n "$EXEEXT" && shopt -s expand_aliases
# Enable glibc's malloc-perturbing option.
@@ -403,8 +411,7 @@ path_prepend_ ()
case $path_dir_ in
'') fail_ "invalid path dir: '$1'";;
/*) abs_path_dir_=$path_dir_;;
- *) abs_path_dir_=`cd "$initial_cwd_/$path_dir_" && echo "$PWD"` \
- || fail_ "invalid path dir: $path_dir_";;
+ *) abs_path_dir_=$initial_cwd_/$path_dir_;;
esac
case $abs_path_dir_ in
*:*) fail_ "invalid path dir: '$abs_path_dir_'";;
@@ -440,7 +447,7 @@ setup_ ()
pfx_=`testdir_prefix_`
test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \
|| fail_ "failed to create temporary directory in $initial_cwd_"
- cd "$test_dir_"
+ cd "$test_dir_" || fail_ "failed to cd to temporary directory"
# As autoconf-generated configure scripts do, ensure that IFS
# is defined initially, so that saving and restoring $IFS works.
--
1.8.3.1

View File

@ -0,0 +1,86 @@
From a185e958b5614ea7e606e85d3de879c5ffc127c0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Thu, 30 Aug 2012 18:53:13 +0200
Subject: [PATCH 10/69] build: prefer $(AM_CPPFLAGS) over $(INCLUDES)
The latter is obsolete, and might be removed in future Automake versions.
Moreover, it's already been removed in Automake-NG, so its use would make
a port to Automake-NG more difficult.
* parted/Makefile.am (INCLUDES): Rename ...
(AM_CPPFLAGS): ... like this.
* partprobe/Makefile.am: Likewise.
* libparted/fs/Makefile.am: Likewise.
* libparted/Makefile.am: Likewise.
* libparted/labels/Makefile.am: Likewise.
Copyright-paperwork-exempt: yes
---
libparted/Makefile.am | 2 +-
libparted/fs/Makefile.am | 2 +-
libparted/labels/Makefile.am | 2 +-
parted/Makefile.am | 2 +-
partprobe/Makefile.am | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libparted/Makefile.am b/libparted/Makefile.am
index 7cf35b2..bdc7976 100644
--- a/libparted/Makefile.am
+++ b/libparted/Makefile.am
@@ -62,4 +62,4 @@ libparted_la_LIBADD = \
EXTRA_DIST = mbr.s
-INCLUDES = $(partedincludedir) $(INTLINCS)
+AM_CPPFLAGS = $(partedincludedir) $(INTLINCS)
diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am
index 8d48ea1..7fe364a 100644
--- a/libparted/fs/Makefile.am
+++ b/libparted/fs/Makefile.am
@@ -114,7 +114,7 @@ libparted_fs_resize_la_SOURCES = \
r/hfs/reloc_plus.c \
r/hfs/reloc_plus.h
-INCLUDES = \
+AM_CPPFLAGS = \
-I$(top_srcdir)/libparted/labels \
$(partedincludedir) \
$(INTLINCS)
diff --git a/libparted/labels/Makefile.am b/libparted/labels/Makefile.am
index 7fe347b..ec8abeb 100644
--- a/libparted/labels/Makefile.am
+++ b/libparted/labels/Makefile.am
@@ -37,7 +37,7 @@ liblabels_la_SOURCES = \
liblabels_la_LIBADD = $(OS_LIBS) $(INTLLIBS)
-INCLUDES = $(partedincludedir) $(INTLINCS)
+AM_CPPFLAGS = $(partedincludedir) $(INTLINCS)
BUILT_SOURCES = pt-limit.c
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
diff --git a/parted/Makefile.am b/parted/Makefile.am
index 0b23693..e7bba2e 100644
--- a/parted/Makefile.am
+++ b/parted/Makefile.am
@@ -48,6 +48,6 @@ parted_LDFLAGS = $(PARTEDLDFLAGS)
# Tell the linker to omit references to unused shared libraries.
parted_LDFLAGS += $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
-INCLUDES = $(partedincludedir) $(INTLINCS)
+AM_CPPFLAGS = $(partedincludedir) $(INTLINCS)
MAINTAINERCLEANFILES += Makefile.in
diff --git a/partprobe/Makefile.am b/partprobe/Makefile.am
index dbe2c9f..c0304a0 100644
--- a/partprobe/Makefile.am
+++ b/partprobe/Makefile.am
@@ -13,4 +13,4 @@ partprobe_LDADD = \
partprobe_LDFLAGS = $(PARTEDLDFLAGS)
-INCLUDES = $(partedincludedir) $(INTLINCS)
+AM_CPPFLAGS = $(partedincludedir) $(INTLINCS)
--
1.8.3.1

View File

@ -0,0 +1,47 @@
From 605c53ad0f209b9f62a15c3f89a9930860153489 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Thu, 30 Aug 2012 18:53:14 +0200
Subject: [PATCH 11/69] build: don't list files with unknown suffix in _SOURCES
While this works with mainline Automake (which blindly treats source
files with an unknown extension as if they were header files), it is
undocumented (albeit admittedly unlikely to change). Moreover, it no
longer works with Automake-NG (and that's by design), so the use of
such feature would make a port to Automake-NG more difficult.
* libparted/labels/Makefile.am (liblabels_la_SOURCES): ... don't
list 'pt-limit.gperf' here; rather ...
(EXTRA_DIST): ... list 'pt-limit.c' and 'pt-limit.gperf' here.
(EXTRA_DIST, BUILT_SOURCES): Enhance few comments.
Copyright-paperwork-exempt: yes
---
libparted/labels/Makefile.am | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libparted/labels/Makefile.am b/libparted/labels/Makefile.am
index ec8abeb..f4e4d27 100644
--- a/libparted/labels/Makefile.am
+++ b/libparted/labels/Makefile.am
@@ -39,10 +39,11 @@ liblabels_la_LIBADD = $(OS_LIBS) $(INTLLIBS)
AM_CPPFLAGS = $(partedincludedir) $(INTLINCS)
+# Included by 'pt-tools.c', so needs to be built early.
BUILT_SOURCES = pt-limit.c
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
-liblabels_la_SOURCES += pt-limit.gperf
-EXTRA_DIST = $(BUILT_SOURCES)
+# DOn't add this to '_SOURCES', because it's not to be compiled!
+EXTRA_DIST= pt-limit.c
GPERF = gperf
GPERF_OPTIONS = \
@@ -55,3 +56,4 @@ pt-limit.c: pt-limit.gperf
> $@-tmp
chmod a-w $@-tmp
mv $@-tmp $@
+EXTRA_DIST += pt-limit.gperf
--
1.8.3.1

View File

@ -0,0 +1,36 @@
From 904a8d31d2906e8e653d670e508c4c6bd4b264c1 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Thu, 30 Aug 2012 18:53:15 +0200
Subject: [PATCH 12/69] build: prefer pattern rules over suffix rules
That is acceptable, because the GNU parted build system already
requires GNU make anyway: the $(subst ...) built-in is used in the
common recipe for the 'ss-1024', 'ss-2048' and 'ss-4096' targets
in Makefile.am.
* include/parted/Makefile.am (.in.h.h): Rename ...
(%.h: %.in.h): ... as this pattern rule.
(SUFFIXES): Delete, no more needed.
Copyright-paperwork-exempt: yes
---
include/parted/Makefile.am | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/parted/Makefile.am b/include/parted/Makefile.am
index 19236f0..6f808c6 100644
--- a/include/parted/Makefile.am
+++ b/include/parted/Makefile.am
@@ -44,8 +44,7 @@ subst_pure_attr = \
$(BUILT_SOURCES): Makefile.am
-SUFFIXES = .in.h .h
-.in.h.h:
+%.h: %.in.h
$(AM_V_GEN)rm -f $@ $@-t
$(AM_V_at)perl -p \
-e '$(subst_const_attr);' \
--
1.8.3.1

View File

@ -0,0 +1,53 @@
From 803b2f58760ed82e5eb182df75ba18c00c9f43bf Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Thu, 30 Aug 2012 18:53:16 +0200
Subject: [PATCH 13/69] build: enable subdir-objects Automake option globally
That option is enabled unconditionally in Automake-NG, and enabling
it also for mainline Automake will help to ensure no unexpected
incompatibilities is introduced in a potential port to Automake-NG.
Moreover, if we have a source file 'sub/foo.c', having it compiled
in 'sub/foo.o' rather than in 'foo.o' is undeniably cleaner and more
natural.
* configure.ac (AM_INIT_AUTOMAKE): Add 'subdir-objects'.
* libparted/fs/Makefile.am (AUTOMAKE_OPTIONS): No need to declare
'subdir-objects' explicitly now.
Copyright-paperwork-exempt: yes
---
configure.ac | 3 ++-
libparted/fs/Makefile.am | 2 --
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1444279..49ef75c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,8 @@ AC_SUBST([LT_CURRENT])
AC_SUBST([LT_REVISION])
AC_SUBST([LT_AGE])
-AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz color-tests parallel-tests])
+AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz color-tests parallel-tests
+ subdir-objects])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
AC_CANONICAL_HOST
diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am
index 7fe364a..064f11a 100644
--- a/libparted/fs/Makefile.am
+++ b/libparted/fs/Makefile.am
@@ -3,8 +3,6 @@
#
# This file may be modified and/or distributed without restriction.
-AUTOMAKE_OPTIONS = subdir-objects
-
partedincludedir = -I$(top_builddir)/include -I$(top_srcdir)/include
AM_CFLAGS = $(WARN_CFLAGS)
--
1.8.3.1

View File

@ -0,0 +1,32 @@
From 2bd66d7d3e5a1924c65c051d4b639c5ab48bbb99 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Thu, 30 Aug 2012 18:53:17 +0200
Subject: [PATCH 14/69] tests: prefer AM_TESTS_ENVIRONMENT over
TESTS_ENVIRONMENT
The latter should be reserved for user overrides.
* tests/Makefile.am (TESTS_ENVIRONMENT): Rename ...
(AM_TESTS_ENVIRONMENT): ... like this.
Copyright-paperwork-exempt: yes
---
tests/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1264812..33e8f8e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -96,7 +96,7 @@ sep = $(PATH_SEPARATOR)
# variables that can perturb tests are unset or set to expected values.
# The rest are envvar settings that propagate build-related Makefile
# variables to test scripts.
-TESTS_ENVIRONMENT = \
+AM_TESTS_ENVIRONMENT = \
tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
TMPDIR=$$tmp__; export TMPDIR; \
export \
--
1.8.3.1

View File

@ -0,0 +1,41 @@
From af4d0f5706740848c3fef67a7ea0b78cf31ddb90 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Thu, 30 Aug 2012 18:53:18 +0200
Subject: [PATCH 15/69] tests: remove unused AM_TESTS_ENVIRONMENT entries
Probably a copy&paste errors, likely from the TESTS_ENVIRONMENT
definition in the 'tests/Makefile.am' in GNU coreutils.
* tests/Makefile.am (AM_TESTS_ENVIRONMENT): Don't define nor export
any of the variables PREFERABLY_POSIX_SHELL, REPLACE_GETCWD, CC,
MAKE, PERL.
Copyright-paperwork-exempt: yes
---
tests/Makefile.am | 5 -----
1 file changed, 5 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 33e8f8e..c97400b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -107,16 +107,11 @@ AM_TESTS_ENVIRONMENT = \
srcdir='$(srcdir)' \
top_srcdir='$(top_srcdir)' \
AWK='$(AWK)' \
- CC='$(CC)' \
- MAKE=$(MAKE) \
PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \
PACKAGE_VERSION=$(PACKAGE_VERSION) \
CONFIG_HEADER='$(abs_top_builddir)/lib/config.h' \
ENABLE_DEVICE_MAPPER=$(ENABLE_DEVICE_MAPPER) \
PARTED_TEST_NAME=`basename '$(abs_srcdir)'`,`echo $$tst|sed 's,^\./,,;s,/,-,g'`\
- PERL='$(PERL)' \
- PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
- REPLACE_GETCWD=$(REPLACE_GETCWD) \
PATH='$(abs_top_builddir)/parted$(PATH_SEPARATOR)'"$$PATH" \
VERSION=$(VERSION) \
; 9>&2
--
1.8.3.1

View File

@ -0,0 +1,51 @@
From b2338d71549462c1dfbb434111b5c46701f54261 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Thu, 30 Aug 2012 18:53:19 +0200
Subject: [PATCH 16/69] build: require Automake >= 1.11.6
Now that we use AM_TESTS_ENVIRONMENT, we should require at least
Automake >= 1.11.2; but since all the Automake version until 1.11.5
are vulnerable to CVE-2012-3386:
<https://lists.gnu.org/archive/html/automake/2012-07/msg00023.html>
it's even better to require 1.11.6.
* configure.ac (AM_INIT_AUTOMAKE): Bump version requirement to 1.11.6.
* bootstrap.conf ($buildreq): Likewise.
Copyright-paperwork-exempt: yes
---
bootstrap.conf | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index b4456b2..39a5506 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -130,7 +130,7 @@ mkdir -p gnulib-tests
# Build prerequisites
buildreq="\
autoconf 2.61
-automake 1.11
+automake 1.11.6
autopoint -
bc -
gettext -
diff --git a/configure.ac b/configure.ac
index 49ef75c..832fc20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@ AC_SUBST([LT_CURRENT])
AC_SUBST([LT_REVISION])
AC_SUBST([LT_AGE])
-AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz color-tests parallel-tests
+AM_INIT_AUTOMAKE([1.11.6 no-dist-gzip dist-xz color-tests parallel-tests
subdir-objects])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
--
1.8.3.1

View File

@ -0,0 +1,29 @@
From c7c9978f0bbf05517437ccc76ea8eff5d811aaef Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Thu, 30 Aug 2012 18:53:20 +0200
Subject: [PATCH 17/69] maint: make Autoconf version requirement consistent
* bootstrap.conf ($buildreq): Require Autoconf >= 2.63, not >= 2.61,
for consistency with what is done in AC_INIT in configure.ac
Copyright-paperwork-exempt: yes
---
bootstrap.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 39a5506..a5d5910 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -129,7 +129,7 @@ mkdir -p gnulib-tests
# Build prerequisites
buildreq="\
-autoconf 2.61
+autoconf 2.63
automake 1.11.6
autopoint -
bc -
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From 0406b2ce14fb86ede506c51d6b603b1f4a1ff42d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Thu, 30 Aug 2012 18:53:21 +0200
Subject: [PATCH 18/69] maint: tighten per version requirement
* bootstrap.conf ($buildreq): Require Perl >= 5.6 (not merely >= 5.5),
because that's the minimal version required by modern Automake and
Autoconf.
Copyright-paperwork-exempt: yes
---
bootstrap.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index a5d5910..7f4ee53 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -138,7 +138,7 @@ git 1.4.4
gperf 3.0.3
gzip -
makeinfo -
-perl 5.5
+perl 5.6
rsync -
tar -
"
--
1.8.3.1

View File

@ -0,0 +1,31 @@
From 464c0f9ae4af8346cd494c6434f4addabdd76e9d Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 11 Sep 2012 17:22:52 +0200
Subject: [PATCH 19/69] maint: remove unnecessary wcslen use
* parted/strlist.c (gettext_to_wchar): Tighten up test for
mbsrtowcs failure and remove unnecessary wcslen use.
---
parted/strlist.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/parted/strlist.c b/parted/strlist.c
index d34fb56..1f90c0e 100644
--- a/parted/strlist.c
+++ b/parted/strlist.c
@@ -112,10 +112,10 @@ gettext_to_wchar (const char* str)
memset(&ps, 0, sizeof (ps));
status = mbsrtowcs(result, &str, count, &ps);
- if (status == (size_t) -1)
+ if (str != NULL)
goto error;
- result = xrealloc (result, (wcslen (result) + 1) * sizeof (wchar_t));
+ result = xrealloc (result, (status + 1) * sizeof (wchar_t));
return result;
error:
--
1.8.3.1

View File

@ -0,0 +1,27 @@
From 1d67e37ef257d3d3847126f3b899b8b0e11aa186 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 12 Sep 2012 10:02:46 +0200
Subject: [PATCH 20/69] tests: clarify a comment: _reading_ gpt tables on tiny
devices
* tests/t0203-gpt-tiny-device-abort.sh: Clarify.
---
tests/t0203-gpt-tiny-device-abort.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/t0203-gpt-tiny-device-abort.sh b/tests/t0203-gpt-tiny-device-abort.sh
index 7283c55..bf281ff 100644
--- a/tests/t0203-gpt-tiny-device-abort.sh
+++ b/tests/t0203-gpt-tiny-device-abort.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# parted before 3.1 could abort for a pathologically small device with
-# a valid primary GPT header but no room for the backup header.
+# parted before 3.1 could abort while reading a pathologically small device
+# with a valid primary GPT header but no room for the backup header.
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
--
1.8.3.1

View File

@ -0,0 +1,31 @@
From 46d9108009ccb9ac567cc285a15efb05864932d5 Mon Sep 17 00:00:00 2001
From: Davidlohr Bueso <dave@gnu.org>
Date: Tue, 11 Sep 2012 19:22:32 +0200
Subject: [PATCH 21/69] gpt: require first_usable_LBA <= last_usable_LBA
When verifying GPT header integrity, ensure that the
first usable LBA is no larger than the last usable LBA.
* libparted/labels/gpt.c (_header_is_valid): Reject a header
with last_usable < first_usable.
---
libparted/labels/gpt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 6032e3f..83e518f 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -653,6 +653,10 @@ _header_is_valid (PedDisk const *disk, GuidPartitionTableHeader_t *gpt,
if (first_usable < 3)
return 0;
+ PedSector last_usable = PED_LE64_TO_CPU (gpt->LastUsableLBA);
+ if (last_usable < first_usable)
+ return 0;
+
origcrc = gpt->HeaderCRC32;
gpt->HeaderCRC32 = 0;
if (pth_crc32 (dev, gpt, &crc) != 0)
--
1.8.3.1

View File

@ -0,0 +1,38 @@
From 81faa9b3b957781871ec3ef0df6e357388f857a1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 12 Sep 2012 20:34:48 +0200
Subject: [PATCH 22/69] tests: update t7000-scripting.sh to avoid new FP
* tests/t7000-scripting.sh: Use -34s as the endpoint, not -1s,
to avoid a spurious difference. Also, remove quoting artifacts.
---
tests/t7000-scripting.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/t7000-scripting.sh b/tests/t7000-scripting.sh
index e64814b..859acda 100755
--- a/tests/t7000-scripting.sh
+++ b/tests/t7000-scripting.sh
@@ -47,7 +47,7 @@ for mkpart in mkpart; do
dd if=/dev/zero of=testfile bs=${ss}c count=$N 2> /dev/null || fail=1
# Test the scripting mode of $mkpart.
- parted -s testfile -- mklabel gpt "$mkpart" p-name ext3 1s -1s > out 2>&1
+ parted -s testfile -- mklabel gpt "$mkpart" p-name ext3 1s -34s > out 2>&1
test $? = 1 || fail=1
# Compare the real error and the expected one
@@ -60,8 +60,8 @@ for mkpart in mkpart; do
dd if=/dev/zero of=testfile bs=${ss}c count=$N 2> /dev/null || fail=1
# Test the interactive mode of $mkpart
echo n | \
- parted ---pretend-input-tty testfile \
- "mklabel gpt '$mkpart' p-name ext3 1s -1s" > out 2>&1 && fail=1
+ parted ---pretend-input-tty -- testfile \
+ mklabel gpt $mkpart p-name ext3 1s -34s > out 2>&1 && fail=1
# We have to format the output before comparing.
# normalize the actual output
--
1.8.3.1

View File

@ -0,0 +1,37 @@
From 48f236f9cf1bbcd4c9cc29ebaecee7ed189580e3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 12 Sep 2012 10:01:53 +0200
Subject: [PATCH 23/69] gpt: permit "mklabel gpt" on a 67-sector device
* libparted/labels/gpt.c (gpt_alloc): Correct checks in order to
allow creation of a GPT partition table on a 67-sector device.
The computation of the "data_end" sector number was one too low.
Whereas there are two sectors at the beginning of the disk (pMBR
and the GPT header sector), there is only one at the end: the
backup GPT header. That (67) is the size of the smallest GPT
partition table, allowing for *no* partition table sectors.
---
libparted/labels/gpt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 83e518f..564a889 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -501,11 +501,11 @@ gpt_alloc (const PedDevice *dev)
goto error;
data_start = 2 + GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
- data_end = dev->length - 2
+ data_end = dev->length - 1
- GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
/* If the device is too small to have room for data, reject it. */
- if (data_end <= data_start)
+ if (data_end < data_start)
goto error_free_disk;
disk->disk_specific = gpt_disk_data = ped_malloc (sizeof (GPTDiskData));
--
1.8.3.1

View File

@ -0,0 +1,38 @@
From 7ca7f595e4cef589db852394687a6ca0c2925fa7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 12 Sep 2012 10:48:33 +0200
Subject: [PATCH 24/69] gpt: when "mklabel gpt" fails, always provide a
diagnostic
* libparted/labels/gpt.c (gpt_alloc): When rejecting a device because
it is too small, give a diagnostic, as is done in every other failure
path through this function.
---
libparted/labels/gpt.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 564a889..63b30b9 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -504,9 +504,15 @@ gpt_alloc (const PedDevice *dev)
data_end = dev->length - 1
- GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
- /* If the device is too small to have room for data, reject it. */
+ /* If the device is too small to accommodate GPT headers, reject it. */
if (data_end < data_start)
- goto error_free_disk;
+ {
+ ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_OK,
+ _("device is so small it cannot even"
+ " accommodate GPT headers"));
+ goto error_free_disk;
+ }
disk->disk_specific = gpt_disk_data = ped_malloc (sizeof (GPTDiskData));
if (!disk->disk_specific)
--
1.8.3.1

View File

@ -0,0 +1,82 @@
From 42c1964bdc2311ec142453cf43a8737da81b2f0d Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 12 Sep 2012 10:43:17 +0200
Subject: [PATCH 25/69] tests: show that small dev now evokes "mklabel gpt"
diagnostic
* tests/t0203-gpt-create-on-min-sized-device.sh: New test.
* tests/Makefile.am (TESTS): Add it.
---
tests/Makefile.am | 1 +
tests/t0203-gpt-create-on-min-sized-device.sh | 47 +++++++++++++++++++++++++++
2 files changed, 48 insertions(+)
create mode 100644 tests/t0203-gpt-create-on-min-sized-device.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c97400b..66b9361 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,6 +16,7 @@ TESTS = \
t0202-gpt-pmbr.sh \
t0203-gpt-tiny-device-abort.sh \
t0203-gpt-shortened-device-primary-valid.sh \
+ t0203-gpt-create-on-min-sized-device.sh \
t0205-gpt-list-clobbers-pmbr.sh \
t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh \
t0207-IEC-binary-notation.sh \
diff --git a/tests/t0203-gpt-create-on-min-sized-device.sh b/tests/t0203-gpt-create-on-min-sized-device.sh
new file mode 100644
index 0000000..113e191
--- /dev/null
+++ b/tests/t0203-gpt-create-on-min-sized-device.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# parted 3.1 and prior would exit with no diagnostic when failing
+# to create a GPT partition table on a device that was too small.
+
+# Copyright (C) 2012 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/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+ss=$sector_size_
+
+# Create the smallest file that can accommodate a GPT partition table.
+dd if=/dev/null of=$dev bs=$ss seek=67 || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Create a file that is 1 sector smaller, and require failure,
+# *with* a diagnostic.
+rm -f $dev
+dd if=/dev/null of=$dev bs=$ss seek=66 || framework_failure
+
+echo Error: device is so small it cannot even accommodate GPT headers \
+ > exp || framework_failure
+
+# Try to create a GPT partition table in too little space. This must fail.
+parted -s $dev mklabel gpt > out 2>&1 && fail=1
+# There must be a diagnostic.
+compare out exp || fail=1
+
+Exit $fail
--
1.8.3.1

View File

@ -0,0 +1,27 @@
From bcc6517853c09f979951ab483bd6560d45bf8e3f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 20 Sep 2012 20:22:13 +0200
Subject: [PATCH 26/69] tests: avoid syntax-check failure for reversed compare
args
* tests/t0203-gpt-create-on-min-sized-device.sh: Reverse args,
so that any diff output (upon failed test) looks sensible.
---
tests/t0203-gpt-create-on-min-sized-device.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/t0203-gpt-create-on-min-sized-device.sh b/tests/t0203-gpt-create-on-min-sized-device.sh
index 113e191..4cec64c 100644
--- a/tests/t0203-gpt-create-on-min-sized-device.sh
+++ b/tests/t0203-gpt-create-on-min-sized-device.sh
@@ -42,6 +42,6 @@ echo Error: device is so small it cannot even accommodate GPT headers \
# Try to create a GPT partition table in too little space. This must fail.
parted -s $dev mklabel gpt > out 2>&1 && fail=1
# There must be a diagnostic.
-compare out exp || fail=1
+compare exp out || fail=1
Exit $fail
--
1.8.3.1

View File

@ -0,0 +1,78 @@
From 6c7932b90a9d078ffaf8ec9482b272c67d75a01d Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 4 Sep 2012 16:42:34 -0700
Subject: [PATCH 27/69] mac: don't let larger partition-table-specified block
size evoke UB
For example, in reading a MAC partition table on a 512-byte sector-size
disk, _disk_analyse_block_size could find reason to ask if it's ok to
increase that to e.g., 2048. Upon a positive reply, we would read 2048
bytes into a 512-byte buffer.
* libparted/labels/mac.c (mac_read): If needed, reallocate "buf"
to accommodate a new, larger sector size.
* NEWS (Bug fixes): Mention it.
---
NEWS | 7 +++++++
libparted/labels/mac.c | 14 +++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index f929b99..bab3afb 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,13 @@ GNU parted NEWS -*- outline -*-
** Bug Fixes
+ libparted: mac: a MAC partition table could have a block_size larger
+ than the one the kernel told us about. Upon reading that partition
+ table, libparted would ask if it's ok to use the larger block size.
+ If you were to respond in the affirmative, libparted would read the
+ larger number of bytes into a buffer of the shorter length,
+ overrunning it.
+
libparted: gpt: fix gpt_get_max_supported_partition_count to work
also on little-endian systems.
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index 1f59a1a..2485187 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -738,13 +738,16 @@ mac_read (PedDisk* disk)
if (!ptt_read_sector (disk->dev, 0, &buf))
return 0;
- MacRawDisk *raw_disk = (MacRawDisk *) buf;
+ MacRawDisk *raw_disk = buf;
if (!_check_signature (raw_disk))
goto error;
+ /* Record the original sector size; this function may change it. */
+ PedSector ss0 = disk->dev->sector_size;
if (!_disk_analyse_block_size (disk, raw_disk))
goto error;
+
if (!_disk_analyse_ghost_size (disk))
goto error;
ghost_size = mac_disk_data->ghost_size;
@@ -759,6 +762,15 @@ mac_read (PedDisk* disk)
mac_disk_data->block_size = raw_disk->block_size;
}
+ /* If _disk_analyse_block_size has increased the sector_size,
+ reallocate this buffer, so we can still read a sector into it. */
+ if (ss0 < disk->dev->sector_size) {
+ free (buf);
+ buf = ped_malloc (disk->dev->sector_size);
+ if (buf == NULL)
+ goto error;
+ }
+
for (num=1; num==1 || num <= last_part_entry_num; num++) {
void *raw_part = buf;
if (!ped_device_read (disk->dev, raw_part,
--
1.8.3.1

View File

@ -0,0 +1,83 @@
From 6499402a18baf22f08084acb289431b731d3afda Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 20 Sep 2012 20:18:50 +0200
Subject: [PATCH 28/69] tests: mac: exercise the just-fixed bug
* tests/t0350-mac-PT-increases-sector-size.sh: New test.
* tests/Makefile.am (TESTS): Add it.
---
tests/Makefile.am | 1 +
tests/t0350-mac-PT-increases-sector-size.sh | 49 +++++++++++++++++++++++++++++
2 files changed, 50 insertions(+)
create mode 100644 tests/t0350-mac-PT-increases-sector-size.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 66b9361..96abecb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,6 +30,7 @@ TESTS = \
t0280-gpt-corrupt.sh \
t0300-dos-on-gpt.sh \
t0301-overwrite-gpt-pmbr.sh \
+ t0350-mac-PT-increases-sector-size.sh \
t0400-loop-clobber-infloop.sh \
t0500-dup-clobber.sh \
t0501-duplicate.sh \
diff --git a/tests/t0350-mac-PT-increases-sector-size.sh b/tests/t0350-mac-PT-increases-sector-size.sh
new file mode 100644
index 0000000..2dbd8cd
--- /dev/null
+++ b/tests/t0350-mac-PT-increases-sector-size.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# With parted-3.1, a MAC partition table that specified a sector size (B)
+# larger than what the kernel told us (SS) would cause parted to read B
+# bytes into a smaller, SS-byte buffer, clobbering heap storage.
+
+# Copyright (C) 2012 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/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+require_512_byte_sector_size_
+
+dev=loop-file
+ss=$sector_size_
+
+dd if=/dev/null of=$dev bs=$ss seek=2000 || framework_failure
+parted -s $dev mklabel mac > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Poke a big-endian 1024 into the 2-byte block_size slot.
+perl -e 'print pack("S>", 1024)'|dd of=$dev bs=1 seek=2 count=2 conv=notrunc \
+ || fail=1
+
+printf 'ignore\ncancel\n' > in || framework_failure
+
+cat <<EOF > exp
+BYT;
+FILE:2000s:file:1024:512:unknown::;
+EOF
+
+parted -m ---pretend-input-tty $dev u s p < in > err 2>&1 || fail=1
+sed 's, * ,,g;s!^/[^:]*:!FILE:!' err \
+ | grep -Evi '^(ignore|fix|error|warning)' \
+ > k && mv k err || fail=1
+compare exp err || fail=1
+
+Exit $fail
--
1.8.3.1

View File

@ -0,0 +1,333 @@
From e6536360bd4496cee1f1bf2dfb0b11f6bdbbfd4b Mon Sep 17 00:00:00 2001
From: "Roderick W. Smith" <rodsmith@rodsbooks.com>
Date: Sun, 23 Sep 2012 21:29:10 +0200
Subject: [PATCH 29/69] add support for a new Linux-specific GPT partition type
code
* NEWS: Describe the new Linux-specific partition type code
and the new msftres flag that can be used to override this type
code, should it be necessary.
* doc/parted.texi: Describe of the new msftres flag.
* include/parted/disk.in.h [_PedPartitionFlag]: Add
PED_PARTITION_MSFT_DATA.
* libparted/disk.c: Add check for PED_PARTITION_MSFT_DATA, with
return of "msftdata", to ped_partition_flag_get_name()
* libparted/labels/gpt.c (PARTITION_LINUX_DATA_GUID): Define.
[_GPTPartitionData]: New member, "int msftdata".
(_parse_part_entry): Set the msftdata flag if and only if the
PARTITION_BASIC_DATA_GUID type code is in use;
(gpt_partition_new): Use the PARTITION_LINUX_DATA_GUID
type as the default type code
(gpt_partition_set_system): Set the PARTITION_BASIC_DATA_GUID type
code on partitions on which the msftdata flag is set and set
PARTITION_LINUX_DATA_GUID as the type by default.
Clear the msftdata flag in most tests in gpt_partition_set_flag()
(gpt_partition_set_flag): Add test for PED_PARTITION_MSFT_DATA, which
sets msftdata and other flags appropriately
(gpt_partition_get_flag): Add test for the PED_PARTITION_MSFT_DATA
item that returns the status of the msftdata flag
(gpt_partition_is_flag_available): Add test for
PED_PARTITION_MSFT_DATA item to
* tests/t0220-gpt-msftres.sh: Accommodate the fact that now,
partition table listings include "msftdata" for file systems
of type NTFS and FAT*.
For more discussion and justification, see
http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10456
---
NEWS | 19 +++++++++++++++++++
doc/parted.texi | 16 +++++++++++++++-
include/parted/disk.in.h | 5 +++--
libparted/disk.c | 2 ++
libparted/labels/gpt.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
tests/t0220-gpt-msftres.sh | 3 ++-
6 files changed, 84 insertions(+), 6 deletions(-)
diff --git a/NEWS b/NEWS
index bab3afb..4c4716d 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,25 @@ GNU parted NEWS -*- outline -*-
libparted: treat a disk with no pMBR as an msdos-labeled disk
even when it has valid GPT headers.
+** Changes in behavior
+
+ Added new Linux-specific partition GUID type code
+ (0FC63DAF-8483-4772-8E79-3D69D8477DE4) for Linux filesystem data on GPT
+ disks. This type code is now assigned as the default partition type code
+ for new partitions holding Linux filesystems.
+
+ Added new "msftdata" flag to identify partitions holding NTFS or FAT
+ filesystems on GPT disks. This flag corresponds to a GPT type code of
+ EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 ("Microsoft Basic Data"). Since
+ Linux filesystem partitions formerly used this type code, this flag may
+ optionally be set on Linux partitions to make the partition table type
+ codes match former configurations in case the new Linux filesystem type
+ code causes problems with some utility. Note that this flag cannot be
+ removed from NTFS or FAT partitions within parted except by setting a
+ competing flag, such as "boot" (which sets the type code used by EFI
+ System partitions) or "msftres" (which sets the "Microsoft Reserved" type
+ code).
+
* Noteworthy changes in release 3.1 (2012-03-02) [stable]
diff --git a/doc/parted.texi b/doc/parted.texi
index 1601151..b8db19d 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -793,6 +793,20 @@ on a partition that partition must be bootable.
For PC98 disk labels, all ext2 partitions must be bootable (this is
enforced by Parted).
+@item msftdata
+(GPT) - This flag identifies partitions that contain Microsoft filesystems
+(NTFS or FAT). It may optionally be set on Linux filesystems to mimic the
+type of configuration created by parted 3.0 and earlier, in which a
+separate Linux filesystem type code was not available on GPT disks. This
+flag can only be removed within parted by replacing it with a competing
+flag, such as boot or msftres.
+
+@item msftres
+(GPT) - This flag identifies a "Microsoft Reserved" partition, which is
+used by Windows on GPT disks. Note that this flag should not normally be
+set on Windows filesystem partitions (those that contain NTFS or FAT
+filesystems).
+
@item lba
(MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
MS Windows ME based operating systems to use Linear (LBA) mode.
@@ -907,7 +921,7 @@ which case this unit apply instead of the default unit for this
particular number, but CHS and cylinder units are not supported as
a suffix. If no suffix is given, then the default unit is assumed.
Parted will compute sensible ranges for the locations you specify
-(e.g. a range of +/- 500 MB when you specify the location in ``G'',
+(e.g., a range of +/- 500 MB when you specify the location in ``G'',
and a range of +/- 500 KB when you specify the location in ``M'')
and will select the nearest location in this range from the one you
wrote that satisfies constraints from both the operation, the
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index 9734edd..a34e11e 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -72,10 +72,11 @@ enum _PedPartitionFlag {
PED_PARTITION_BIOS_GRUB=12,
PED_PARTITION_APPLE_TV_RECOVERY=13,
PED_PARTITION_DIAG=14,
- PED_PARTITION_LEGACY_BOOT=15
+ PED_PARTITION_LEGACY_BOOT=15,
+ PED_PARTITION_MSFT_DATA=16
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_LEGACY_BOOT
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_MSFT_DATA
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index f9b5fd2..c4b1a01 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2433,6 +2433,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("prep");
case PED_PARTITION_MSFT_RESERVED:
return N_("msftres");
+ case PED_PARTITION_MSFT_DATA:
+ return N_("msftdata");
case PED_PARTITION_APPLE_TV_RECOVERY:
return N_("atvrecv");
case PED_PARTITION_DIAG:
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 63b30b9..490de70 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -122,6 +122,10 @@ typedef struct
((efi_guid_t) { PED_CPU_TO_LE32 (0x0657fd6d), PED_CPU_TO_LE16 (0xa4ab), \
PED_CPU_TO_LE16 (0x43c4), 0x84, 0xe5, \
{ 0x09, 0x33, 0xc8, 0x4b, 0x4f, 0x4f }})
+#define PARTITION_LINUX_DATA_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0x0FC63DAF), PED_CPU_TO_LE16 (0x8483), \
+ PED_CPU_TO_LE16 (0x4772), 0x8E, 0x79, \
+ { 0x3D, 0x69, 0xD8, 0x47, 0x7D, 0xE4 }})
#define PARTITION_LVM_GUID \
((efi_guid_t) { PED_CPU_TO_LE32 (0xe6d6d379), PED_CPU_TO_LE16 (0xf507), \
PED_CPU_TO_LE16 (0x44c2), 0xa2, 0x3c, \
@@ -280,6 +284,7 @@ typedef struct _GPTPartitionData
int hp_service;
int hidden;
int msftres;
+ int msftdata;
int atvrecv;
int msftrecv;
int legacy_boot;
@@ -788,6 +793,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
gpt_part_data->lvm = gpt_part_data->raid
= gpt_part_data->boot = gpt_part_data->hp_service
= gpt_part_data->hidden = gpt_part_data->msftres
+ = gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->legacy_boot
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
@@ -809,6 +815,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
gpt_part_data->hp_service = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID))
gpt_part_data->msftres = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_BASIC_DATA_GUID))
+ gpt_part_data->msftdata = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RECOVERY))
gpt_part_data->msftrecv = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID))
@@ -1318,7 +1326,7 @@ gpt_partition_new (const PedDisk *disk,
if (!gpt_part_data)
goto error_free_part;
- gpt_part_data->type = PARTITION_BASIC_DATA_GUID;
+ gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
gpt_part_data->lvm = 0;
gpt_part_data->raid = 0;
gpt_part_data->boot = 0;
@@ -1326,6 +1334,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->hp_service = 0;
gpt_part_data->hidden = 0;
gpt_part_data->msftres = 0;
+ gpt_part_data->msftdata = 0;
gpt_part_data->msftrecv = 0;
gpt_part_data->atvrecv = 0;
gpt_part_data->legacy_boot = 0;
@@ -1422,6 +1431,11 @@ gpt_partition_set_system (PedPartition *part,
gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID;
return 1;
}
+ if (gpt_part_data->msftdata)
+ {
+ gpt_part_data->type = PARTITION_BASIC_DATA_GUID;
+ return 1;
+ }
if (gpt_part_data->msftrecv)
{
gpt_part_data->type = PARTITION_MSFT_RECOVERY;
@@ -1453,7 +1467,7 @@ gpt_partition_set_system (PedPartition *part,
}
}
- gpt_part_data->type = PARTITION_BASIC_DATA_GUID;
+ gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
return 1;
}
@@ -1571,6 +1585,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
+ = gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1582,6 +1597,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->boot
= gpt_part_data->hp_service
= gpt_part_data->msftres
+ = gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1593,6 +1609,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
+ = gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1604,6 +1621,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
+ = gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1615,6 +1633,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->lvm
= gpt_part_data->bios_grub
= gpt_part_data->msftres
+ = gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1626,8 +1645,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->lvm
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
+ = gpt_part_data->msftdata
+ = gpt_part_data->msftrecv
+ = gpt_part_data->atvrecv = 0;
+ return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_MSFT_DATA:
+ gpt_part_data->msftres = state;
+ if (state) {
+ gpt_part_data->boot
+ = gpt_part_data->raid
+ = gpt_part_data->lvm
+ = gpt_part_data->bios_grub
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres
= gpt_part_data->msftrecv
= gpt_part_data->atvrecv = 0;
+ gpt_part_data->msftdata = 1;
+ } else {
+ gpt_part_data->msftdata = 0;
+ }
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_DIAG:
gpt_part_data->msftrecv = state;
@@ -1637,6 +1673,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->lvm
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
+ = gpt_part_data->msftdata
= gpt_part_data->msftres
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1649,6 +1686,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
+ = gpt_part_data->msftdata
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HIDDEN:
@@ -1687,6 +1725,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->hp_service;
case PED_PARTITION_MSFT_RESERVED:
return gpt_part_data->msftres;
+ case PED_PARTITION_MSFT_DATA:
+ return gpt_part_data->msftdata;
case PED_PARTITION_DIAG:
return gpt_part_data->msftrecv;
case PED_PARTITION_APPLE_TV_RECOVERY:
@@ -1716,6 +1756,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
case PED_PARTITION_BIOS_GRUB:
case PED_PARTITION_HPSERVICE:
case PED_PARTITION_MSFT_RESERVED:
+ case PED_PARTITION_MSFT_DATA:
case PED_PARTITION_DIAG:
case PED_PARTITION_APPLE_TV_RECOVERY:
case PED_PARTITION_HIDDEN:
diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh
index d522aec..bd14c84 100755
--- a/tests/t0220-gpt-msftres.sh
+++ b/tests/t0220-gpt-msftres.sh
@@ -56,7 +56,8 @@ printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:gpt::;\n" > exp
i=1
for type in $fs_types; do
end=$(expr $start + $part_size - 1)
- echo "$i:${start}s:${end}s:${part_size}s::$type:;" >> exp || fail=1
+ case $type in fat*|NTFS) flag=msftdata;; *) flag=;; esac
+ echo "$i:${start}s:${end}s:${part_size}s::$type:$flag;" >> exp || fail=1
parted -s $dev mkpart p-name $type ${start}s ${end}s > err 2>&1 || fail=1
compare /dev/null err || fail=1
parted -s $dev name $i $type > err 2>&1 || fail=1
--
1.8.3.1

View File

@ -0,0 +1,341 @@
From c987c73cbe773dfa3b14b911ffc243137195bbb3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 29 Sep 2012 12:10:35 +0200
Subject: [PATCH 30/69] tests: clean up tests
Use warn_ and $ME_ in place of warn and $ME; remove definitions of
the latter two. Remove unused code.
* tests/lvm-utils.sh: Remove file. All functions were either unused
or duplicated/better in t-lvm.sh.
* tests/Makefile.am (EXTRA_DIST): Remove it.
* tests/t-local.sh (scsi_debug_setup_): Use echo 1>&2, not warn_, to
emit to log file only, not console. The diagnostic it emitted (in
verbose mode) was more "informational" than a warning.
* tests/t9030-align-check.sh: Use warn_, not warn.
* tests/t-lvm.sh: Likewise, and use fail_, not error (undefined!).
* tests/t-lib-helpers.sh (device_mapper_required_): Use t-lvm.sh
and an explicit lvm_init_root_dir_ in place of lvm-utils.sh.
---
tests/Makefile.am | 2 +-
tests/lvm-utils.sh | 208 ---------------------------------------------
tests/t-lib-helpers.sh | 4 +-
tests/t-local.sh | 2 +-
tests/t-lvm.sh | 11 +--
tests/t9030-align-check.sh | 3 +-
6 files changed, 10 insertions(+), 220 deletions(-)
delete mode 100644 tests/lvm-utils.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 96abecb..80d5525 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -74,7 +74,7 @@ TESTS = \
t9050-partition-table-types.sh
EXTRA_DIST = \
- $(TESTS) lvm-utils.sh t-local.sh t-lvm.sh \
+ $(TESTS) t-local.sh t-lvm.sh \
init.cfg init.sh t-lib-helpers.sh gpt-header-munge
check_PROGRAMS = print-align print-max dup-clobber duplicate fs-resize
diff --git a/tests/lvm-utils.sh b/tests/lvm-utils.sh
deleted file mode 100644
index 456d265..0000000
--- a/tests/lvm-utils.sh
+++ /dev/null
@@ -1,208 +0,0 @@
-# Put lvm-related utilities here.
-# This file is sourced from test infrastructure.
-
-# Copyright (C) 2007-2010 Red Hat, Inc. All rights reserved.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions
-# of the GNU General Public License v.2.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-export LVM_SUPPRESS_FD_WARNINGS=1
-
-ME=$(basename "$0")
-warn() { echo >&2 "$ME: $@"; }
-
-unsafe_losetup_()
-{
- f=$1
-
- test -n "$G_dev_" \
- || fail_ "Internal error: unsafe_losetup_ called before init_root_dir_"
-
- # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
- for slash in '' /; do
- for i in 0 1 2 3 4 5 6 7 8 9; do
- dev=$G_dev_/loop$slash$i
- losetup $dev > /dev/null 2>&1 && continue;
- losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; }
- break
- done
- done
-
- return 1
-}
-
-loop_setup_()
-{
- file=$1
- dd if=/dev/zero of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
- || { warn "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
-
- # NOTE: this requires a new enough version of losetup
- dev=$(unsafe_losetup_ "$file") \
- || { warn "loop_setup_ failed: Unable to create loopback device"; return 1; }
-
- echo "$dev"
- return 0;
-}
-
-compare_two_fields_()
-{
- local cmd1=$1;
- local obj1=$2;
- local field1=$3;
- local cmd2=$4;
- local obj2=$5;
- local field2=$6;
- local val1;
- local val2;
-
- val1=$($cmd1 --noheadings -o $field1 $obj1)
- val2=$($cmd2 --noheadings -o $field2 $obj2)
-if test "$verbose" = "t"
-then
- echo "compare_two_fields_ $obj1($field1): $val1 $obj2($field2): $val2"
-fi
- test $val1 = $val2
-}
-
-compare_vg_field_()
-{
- local vg1=$1;
- local vg2=$2;
- local field=$3;
- local val1;
- local val2;
-
- val1=$(vgs --noheadings -o $field $vg1)
- val2=$(vgs --noheadings -o $field $vg2)
-if test "$verbose" = "t"
-then
- echo "compare_vg_field_ VG1: $val1 VG2: $val2"
-fi
- test $val1 = $val2
-}
-
-check_vg_field_()
-{
- local vg=$1;
- local field=$2;
- local expected=$3;
- local actual;
-
- actual=$(vgs --noheadings -o $field $vg)
-if test "$verbose" = "t"
-then
- echo "check_vg_field_ VG=$vg, field=$field, actual=$actual, expected=$expected"
-fi
- test $actual = $expected
-}
-
-check_pv_field_()
-{
- local pv=$1;
- local field=$2;
- local expected=$3;
- local actual;
-
- actual=$(pvs --noheadings -o $field $pv)
-if test "$verbose" = "t"
-then
- echo "check_pv_field_ PV=$pv, field=$field, actual=$actual, expected=$expected"
-fi
- test $actual = $expected
-}
-
-check_lv_field_()
-{
- local lv=$1;
- local field=$2;
- local expected=$3;
- local actual;
-
- actual=$(lvs --noheadings -o $field $lv)
-if test "$verbose" = "t"
-then
- echo "check_lv_field_ LV=$lv, field=$field, actual=$actual, expected=$expected"
-fi
- test $actual = $expected
-}
-
-vg_validate_pvlv_counts_()
-{
- local local_vg=$1
- local num_pvs=$2
- local num_lvs=$3
- local num_snaps=$4
-
- check_vg_field_ $local_vg pv_count $num_pvs &&
- check_vg_field_ $local_vg lv_count $num_lvs &&
- check_vg_field_ $local_vg snap_count $num_snaps
-}
-
-dmsetup_has_dm_devdir_support_()
-{
- # Detect support for the envvar. If it's supported, the
- # following command will fail with the expected diagnostic.
- out=$(DM_DEV_DIR=j dmsetup version 2>&1)
- test "$?:$out" = "1:Invalid DM_DEV_DIR envvar value." ||
- test "$?:$out" = "1:Invalid DM_DEV_DIR environment variable value."
-}
-
-# set up private /dev and /etc
-init_root_dir_()
-{
- test -n "$test_dir_" \
- || fail_ "Internal error: called init_root_dir_ before" \
- "defining \$test_dir_"
-
- # Define these two globals.
- G_root_=$test_dir_/root
- G_dev_=$G_root_/dev
-
- export LVM_SYSTEM_DIR=$G_root_/etc
- export DM_DEV_DIR=$G_dev_
-
- # Only the first caller does anything.
- mkdir -p $G_root_/etc $G_dev_ $G_dev_/mapper $G_root_/lib
- for i in 0 1 2 3 4 5 6 7; do
- mknod $G_root_/dev/loop$i b 7 $i
- done
- for i in $abs_top_builddir/dmeventd/mirror/*.so $abs_top_builddir/dmeventd/snapshot/*.so
- do
- # NOTE: This check is necessary because the loop above will give us the value
- # "$abs_top_builddir/dmeventd/mirror/*.so" if no files ending in 'so' exist.
- # This is the best way I could quickly determine to skip over this bogus value.
- if [ -f $i ]; then
- echo Setting up symlink from $i to $G_root_/lib
- ln -s $i $G_root_/lib
- fi
- done
- cat > $G_root_/etc/lvm.conf <<-EOF
- devices {
- dir = "$G_dev_"
- scan = "$G_dev_"
- filter = [ "a/loop/", "a/mirror/", "a/mapper/", "r/.*/" ]
- cache_dir = "$G_root_/etc"
- sysfs_scan = 0
- }
- log {
- verbose = $verboselevel
- syslog = 0
- indent = 1
- }
- backup {
- backup = 0
- archive = 0
- }
- global {
- library_dir = "$G_root_/lib"
- }
-EOF
-}
-
-init_root_dir_
diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh
index 4b3c122..6721003 100644
--- a/tests/t-lib-helpers.sh
+++ b/tests/t-lib-helpers.sh
@@ -395,6 +395,6 @@ wait_for_dev_to_disappear_()
device_mapper_required_()
{
- . "$abs_top_srcdir/tests/lvm-utils.sh" \
- || fail_ "device mapper setup failed"
+ . "$abs_top_srcdir/tests/t-lvm.sh"
+ lvm_init_root_dir_ || fail_ "device mapper setup failed"
}
diff --git a/tests/t-local.sh b/tests/t-local.sh
index dde1b8d..b40a5a0 100644
--- a/tests/t-local.sh
+++ b/tests/t-local.sh
@@ -100,7 +100,7 @@ scsi_debug_setup_()
modprobe scsi_debug "$@" || { rm -f stamp; return 1; }
scsi_debug_modprobe_succeeded_=1
test "$VERBOSE" = yes \
- && warn_ $ME_ modprobe scsi_debug succeeded
+ && echo $ME_ modprobe scsi_debug succeeded 1>&2
# Wait up to 2s (via .1s increments) for the list of devices to change.
# Sleeping for a fraction of a second requires GNU sleep, so fall
diff --git a/tests/t-lvm.sh b/tests/t-lvm.sh
index b08f934..9cee155 100644
--- a/tests/t-lvm.sh
+++ b/tests/t-lvm.sh
@@ -1,7 +1,7 @@
# Put lvm-related utilities here.
# This file is sourced from test infrastructure.
-# Copyright (C) 2007, 2008, 2010 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2007-2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -13,15 +13,12 @@
export LVM_SUPPRESS_FD_WARNINGS=1
-ME=$(basename "$0")
-warn() { echo >&2 "$ME: $@"; }
-
unsafe_losetup_()
{
f=$1
test -n "$G_dev_" \
- || error "Internal error: unsafe_losetup_ called before init_root_dir_"
+ || fail_ "Internal error: unsafe_losetup_ called before init_root_dir_"
# Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
for slash in '' /; do
@@ -40,11 +37,11 @@ loop_setup_()
{
file=$1
dd if=/dev/zero of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
- || { warn "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
+ || { warn_ "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
# NOTE: this requires a new enough version of losetup
dev=$(unsafe_losetup_ "$file" 2>/dev/null) \
- || { warn "loop_setup_ failed: Unable to create loopback device"; return 1; }
+ || { warn_ "loop_setup_ failed: Unable to create loopback device"; return 1; }
echo "$dev"
return 0;
diff --git a/tests/t9030-align-check.sh b/tests/t9030-align-check.sh
index b3618a7..f0830f0 100644
--- a/tests/t9030-align-check.sh
+++ b/tests/t9030-align-check.sh
@@ -49,7 +49,8 @@ while :; do
test $i = 70 && break
# Wait up to 10s for the partition file to disappear.
- wait_for_dev_to_disappear_ $p1 10 || { fail=1; warn $p1 failed to disappear; }
+ wait_for_dev_to_disappear_ $p1 10 \
+ || { fail=1; warn_ $ME_ $p1 failed to disappear; }
done
Exit $fail
--
1.8.3.1

View File

@ -0,0 +1,27 @@
From fb1faafaae67c328a34117573a71d1f02ef9f6fe Mon Sep 17 00:00:00 2001
From: Bob Beers <bob.beers.gmail.com>
Date: Thu, 4 Oct 2012 06:00:25 +0200
Subject: [PATCH 31/69] doc: libparted/disk.c: correct doxygen comment typo
* libparted/disk.c: s/PedPartition/PedDisk/
Copyright-paperwork-exempt: yes
---
libparted/disk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libparted/disk.c b/libparted/disk.c
index c4b1a01..d283674 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -1968,7 +1968,7 @@ _check_partition (PedDisk* disk, PedPartition* part)
}
/**
- * Adds PedPartition \p part to PedPartition \p disk.
+ * Adds PedPartition \p part to PedDisk \p disk.
*
* \warning The partition's geometry may be changed, subject to \p constraint.
* You could set \p constraint to <tt>ped_constraint_exact(&part->geom)</tt>,
--
1.8.3.1

View File

@ -0,0 +1,47 @@
From 478e472bf9f1c76b66a35ea75b45110152e5207d Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 6 Oct 2012 11:11:32 +0200
Subject: [PATCH 32/69] tests: stop using private "dev" directory for losetup
Something about Fedora 17's losetup changed so that using a private
dev directory no longer worked. Now, simply use /dev/ directly.
* tests/t-lvm.sh: Don't use $G_dev_. Not needed, and actually
caused the t6000-dm root-only test to fail on Fedora 17.
Also, redirect less to stderr: that helps diagnose failure.
---
tests/t-lvm.sh | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tests/t-lvm.sh b/tests/t-lvm.sh
index 9cee155..cf1b8b8 100644
--- a/tests/t-lvm.sh
+++ b/tests/t-lvm.sh
@@ -17,14 +17,13 @@ unsafe_losetup_()
{
f=$1
- test -n "$G_dev_" \
- || fail_ "Internal error: unsafe_losetup_ called before init_root_dir_"
+ G_dev_=/dev
# Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
for slash in '' /; do
for i in 0 1 2 3 4 5 6 7 8 9; do
dev=$G_dev_/loop$slash$i
- losetup $dev > /dev/null 2>&1 && continue;
+ losetup $dev 1>&2 && continue;
losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; }
break
done
@@ -40,7 +39,7 @@ loop_setup_()
|| { warn_ "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
# NOTE: this requires a new enough version of losetup
- dev=$(unsafe_losetup_ "$file" 2>/dev/null) \
+ dev=$(unsafe_losetup_ "$file") \
|| { warn_ "loop_setup_ failed: Unable to create loopback device"; return 1; }
echo "$dev"
--
1.8.3.1

View File

@ -0,0 +1,59 @@
From 718ac7342412aa7f32aaf3e9f379beb84883406e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 6 Oct 2012 15:09:56 +0200
Subject: [PATCH 33/69] maint: fix an error in the preceding commit log
Stefano Lattarini noticed an error in the log for
commit v3.1-32-g478e472. Arrange for that error
to be fixed in the generated ChangeLog file.
* build-aux/git-log-fix: New file.
* Makefile.am (gen-ChangeLog): Adjust rule to use it.
---
.gitignore | 3 ++-
Makefile.am | 1 +
build-aux/git-log-fix | 7 +++++++
3 files changed, 10 insertions(+), 1 deletion(-)
create mode 100644 build-aux/git-log-fix
diff --git a/.gitignore b/.gitignore
index 054d9ea..5bb95d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,7 +32,8 @@ Makefile.in
TAGS
aclocal.m4
autom4te.cache
-build-aux
+/build-aux/*
+!/build-aux/git-log-fix
config.cache
config.h
config.hin
diff --git a/Makefile.am b/Makefile.am
index 5e52a42..686b61c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -107,6 +107,7 @@ gen_start_date = 2000-01-01
gen-ChangeLog:
if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
+ --amend=$(srcdir)/build-aux/git-log-fix \
--since=$(gen_start_date) > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
diff --git a/build-aux/git-log-fix b/build-aux/git-log-fix
new file mode 100644
index 0000000..e2a68ee
--- /dev/null
+++ b/build-aux/git-log-fix
@@ -0,0 +1,7 @@
+# This file is expected to be used via gitlog-to-changelog's --amend=FILE
+# option. It specifies what changes to make to each given SHA1's commit
+# log and metadata, using Perl-eval'able expressions.
+
+478e472bf9f1c76b66a35ea75b45110152e5207d
+# Fix the log message:
+s,stderr,/dev/null,
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From 5fc054beb415344a0ce44c19e554937c9158d08e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 9 Oct 2012 14:02:15 +0200
Subject: [PATCH 34/69] tests: improve test for partitionable loop devices
* tests/init.cfg (require_partitionable_loop_device_): Skip
when cat fails.
---
tests/init.cfg | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/init.cfg b/tests/init.cfg
index 24b10bc..dc8b2bc 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -120,8 +120,9 @@ require_erasable_()
# At least Fedora 16 (kernel 3.1.6-1.fc16.x86_64) fails this test.
require_partitionable_loop_device_()
{
- case $(cat /sys/devices/virtual/block/$(basename $1)/ext_range) in
- 0|1) skip_ your system does not support loop partitioning;;
+ local f=/sys/devices/virtual/block/$(basename $1)/ext_range
+ case $(cat "$f") in
+ ''|0|1) skip_ your system is not configured to partition loop devices;;
esac
}
--
1.8.3.1

View File

@ -0,0 +1,58 @@
From 569e59d08fe2ec5e836536371e0a974a58e83166 Mon Sep 17 00:00:00 2001
From: Gilles Espinasse <g.esp@free.fr>
Date: Sun, 7 Oct 2012 15:40:23 +0200
Subject: [PATCH 35/69] tests: t8001: do not rely on "modprobe loop"
Remove 'rmmod loop' and 'modprobe loop max_part=7' commands.
The latter command may fail after the first command has run,
leaving the machine with no loop support.
This happens on my chroot, because:
- rmmod does not depend on the availability of the loop module,
- modprobe fails, since the kernel compiled inside the chroot
is different from the running kernel.
Instead, rely on t-lvm loop_setup_ to load the loop module, if required.
---
tests/t8001-loop-blkpg.sh | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/tests/t8001-loop-blkpg.sh b/tests/t8001-loop-blkpg.sh
index deef18b..9afde4a 100755
--- a/tests/t8001-loop-blkpg.sh
+++ b/tests/t8001-loop-blkpg.sh
@@ -20,6 +20,7 @@
require_root_
require_udevadm_settle_
+lvm_init_root_dir_
cleanup_fn_()
{
@@ -27,21 +28,14 @@ cleanup_fn_()
&& { udevadm settle --timeout=3; losetup -d "$loopdev"; }
}
-# If the loop module is loaded, unload it first
-if lsmod | grep '^loop[[:space:]]'; then
- rmmod loop || fail=1
-fi
-
-# Insert loop module with max_part > 1
-modprobe loop max_part=7 || fail=1
-
# Create backing file
dd if=/dev/zero of=backing_file bs=1M count=4 >/dev/null 2>&1 || fail=1
# Set up loop device on top of backing file
-loopdev=$(losetup -f --show backing_file)
+loopdev=$(loop_setup_ backing_file)
test -z "$loopdev" && fail=1
+# Skip this test if loop devices are not partitionable.
require_partitionable_loop_device_ $loopdev
# Expect this to succeed
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From 319e7cd590ae16460cfecb70715bf41ceec81d1e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 9 Oct 2012 15:40:33 +0200
Subject: [PATCH 36/69] build: do not rely on automake's AM_TESTS_ENVIRONMENT
* tests/Makefile.am (TESTS_ENVIRONMENT): Rename from
AM_TESTS_ENVIRONMENT, since it is not honored in automake-1.11.3
after all. This reverts commit v3.1-14-g2bd66d7. For now, I'll
leave the following commit that made bootstrap.conf require 1.11.2.
Prompted by a report of test failure from Phillip Susi.
---
tests/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 80d5525..cdc1c4b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -98,7 +98,7 @@ sep = $(PATH_SEPARATOR)
# variables that can perturb tests are unset or set to expected values.
# The rest are envvar settings that propagate build-related Makefile
# variables to test scripts.
-AM_TESTS_ENVIRONMENT = \
+TESTS_ENVIRONMENT = \
tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
TMPDIR=$$tmp__; export TMPDIR; \
export \
--
1.8.3.1

View File

@ -0,0 +1,24 @@
From 6a535214131b25b0f90dfff618ef6cf8083bb390 Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@suse.cz>
Date: Mon, 15 Oct 2012 10:31:50 +0200
Subject: [PATCH 37/69] build: .gitignore: ignore tests/fs-resize
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 5bb95d4..c2ccd4b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,6 +76,7 @@ stamp-h1
tags
tests/dup-clobber
tests/duplicate
+tests/fs-resize
tests/help-version.log
tests/old-init.sh
tests/print-align
--
1.8.3.1

View File

@ -0,0 +1,28 @@
From baa2ebd111d4f8df66254bc94ee79aeaae2a3f3e Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@suse.cz>
Date: Mon, 15 Oct 2012 10:31:54 +0200
Subject: [PATCH 38/69] partprobe: remove --no-update long option
It was deprecated and scheduled for removal in 2009.
* partprobe/partprobe.c (long_options): Remove "no-update" entry.
---
partprobe/partprobe.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c
index 8bccc4f..b8dca5e 100644
--- a/partprobe/partprobe.c
+++ b/partprobe/partprobe.c
@@ -57,9 +57,6 @@
static struct option const long_options[] =
{
- /* Note: the --no-update option is deprecated, and deliberately
- * not documented. FIXME: remove --no-update in 2009. */
- {"no-update", no_argument, NULL, 'd'},
{"dry-run", no_argument, NULL, 'd'},
{"summary", no_argument, NULL, 's'},
{"help", no_argument, NULL, 'h'},
--
1.8.3.1

View File

@ -0,0 +1,48 @@
From aec4b5228d1536452b1816731c41d9b37de2a25c Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@suse.cz>
Date: Mon, 15 Oct 2012 10:31:53 +0200
Subject: [PATCH 39/69] doc: update partprobe manpage
* doc/C/partprobe.8: Add long options, REPORTING BUGS section
and adjust DESCRIPTION section because it wasn't quite correct.
---
doc/C/partprobe.8 | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/doc/C/partprobe.8 b/doc/C/partprobe.8
index 6abf97d..48ae5dc 100644
--- a/doc/C/partprobe.8
+++ b/doc/C/partprobe.8
@@ -31,22 +31,23 @@ command.
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBpartprobe\fP is a program that informs the operating system kernel of
-partition table changes, by requesting that the operating system re-read
-the partition table.
+partition table changes.
.SH OPTIONS
This program uses short UNIX style options.
.TP
-.B \-d
+.B -d, --dry-run
Don't update the kernel.
.TP
-.B \-s
+.B -s, --summary
Show a summary of devices and their partitions.
.TP
-.B \-h
+.B -h, --help
Show summary of options.
.TP
-.B \-v
+.B -v, --version
Show version of program.
+.SH REPORTING BUGS
+Report bugs to <bug-parted@gnu.org>
.SH SEE ALSO
.BR parted (8).
.SH AUTHOR
--
1.8.3.1

View File

@ -0,0 +1,67 @@
From 05917368a7867a17d6b2e0df16bf54239aa52107 Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@suse.cz>
Date: Mon, 15 Oct 2012 10:31:52 +0200
Subject: [PATCH 40/69] partprobe: remove partitions when there is no partition
table
When partprobe detects no partition table on a device, it should
tell the kernel to drop partitions on that device, but it did not.
* parted/partprobe.c (process_dev): When ped_disk_probe fails,
create a dummy (empty) partition table and use that.
* NEWS (Bug fixes): Mention it.
Addresses: https://bugzilla.novell.com/783419
---
NEWS | 3 +++
partprobe/partprobe.c | 21 ++++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 4c4716d..293f5e4 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,9 @@ GNU parted NEWS -*- outline -*-
libparted: treat a disk with no pMBR as an msdos-labeled disk
even when it has valid GPT headers.
+ partprobe now tells the kernel to forget about any partitions
+ on a device that has no recognizable partition table.
+
** Changes in behavior
Added new Linux-specific partition GUID type code
diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c
index b8dca5e..0919d3f 100644
--- a/partprobe/partprobe.c
+++ b/partprobe/partprobe.c
@@ -106,12 +106,23 @@ process_dev (PedDevice* dev)
PedDisk* disk;
disk_type = ped_disk_probe (dev);
- if (!disk_type || !strcmp (disk_type->name, "loop"))
+ if (disk_type && !strcmp (disk_type->name, "loop"))
return 1;
-
- disk = ped_disk_new (dev);
- if (!disk)
- goto error;
+ else if (!disk_type) {
+ /* Partition table not found, so create dummy,
+ empty one */
+ disk_type = ped_disk_type_get("msdos");
+ if (!disk_type)
+ goto error;
+
+ disk = ped_disk_new_fresh (dev, disk_type);
+ if (!disk)
+ goto error_destroy_disk;
+ } else {
+ disk = ped_disk_new (dev);
+ if (!disk)
+ goto error;
+ }
if (!opt_no_inform) {
if (!ped_disk_commit_to_os (disk))
goto error_destroy_disk;
--
1.8.3.1

View File

@ -0,0 +1,65 @@
From c897203a7f65a05e57c67e6cddee3f70110d0824 Mon Sep 17 00:00:00 2001
From: Jim Meyering <jim@meyering.net>
Date: Wed, 17 Oct 2012 16:55:02 +0200
Subject: [PATCH 41/69] maint: use $(AM_V_GEN) to cut down on build noise
* doc/Makefile.am: Prefix each rule with $(AM_V_GEN).
* doc/po4a.mk (dist_man_MANS): Likewise.
---
doc/Makefile.am | 2 +-
doc/po4a.mk | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 08046d1..e773efa 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -12,6 +12,6 @@ EXTRA_DIST = FAT \
.PHONY: updatepo
updatepo:
- list='$(SUBDIRS)'; for dir in $$list; do \
+ $(AM_V_GEN)list='$(SUBDIRS)'; for dir in $$list; do \
$(MAKE) -C "$$dir" updatepo; \
done
diff --git a/doc/po4a.mk b/doc/po4a.mk
index b378121..aaf4024 100644
--- a/doc/po4a.mk
+++ b/doc/po4a.mk
@@ -41,13 +41,13 @@ install-man: install-man1 install-man5 install-man8
# For each .po, try to generate the man page
all-local:
- for po in `ls -1 $(srcdir)/*.$(lang).po 2>/dev/null`; do \
+ $(AM_V_GEN)for po in `ls -1 $(srcdir)/*.$(lang).po 2>/dev/null`; do \
$(MAKE) $$(basename $${po%.$(lang).po}); \
done
# Remove the man pages that were generated from a .po
clean-local:
- for po in `ls -1 $(srcdir)/*.$(lang).po 2>/dev/null`; do \
+ $(AM_V_GEN)for po in `ls -1 $(srcdir)/*.$(lang).po 2>/dev/null`; do \
rm -f $$(basename $${po%.$(lang).po}); \
done
@@ -55,7 +55,7 @@ clean-local:
# Update the PO in srcdir, according to the POT in C.
# Based on the gettext po/Makefile.in.in
updatepo:
- tmpdir=`pwd`; \
+ $(AM_V_GEN)tmpdir=`pwd`; \
cd $(srcdir); \
for po in *.$(lang).po; do \
case "$$po" in '*'*) continue;; esac; \
@@ -83,7 +83,7 @@ dist-hook: updatepo
# Build the pages
partprobe.8:
- for locale in pt_BR ; do \
+ $(AM_V_GEN)for locale in pt_BR ; do \
po4a-translate -f man -m $(srcdir)/../C/$@ -p $@.$$locale.po -l $@ $(po4a_translate_options) ; \
if [ -f $(srcdir)/$@.$$locale.po.addendum ]; then \
po4a-translate -f man -m $(srcdir)/../C/$@ -p $@.$$locale.po -l $@ -a $(srcdir)/$@.$$locale.po.addendum $(po4a_translate_options) ; \
--
1.8.3.1

View File

@ -0,0 +1,337 @@
From d9f34625df17b30013e141516c2722b77b4b6eea Mon Sep 17 00:00:00 2001
From: Jim Meyering <jim@meyering.net>
Date: Wed, 17 Oct 2012 23:07:55 +0200
Subject: [PATCH 42/69] maint: regenerate .po, .pot files
---
doc/C/po/partprobe.8.pot | 59 ++++++++++++++++--------------
doc/pt_BR/partprobe.8.pt_BR.po | 83 +++++++++++++++++++++++++++---------------
2 files changed, 85 insertions(+), 57 deletions(-)
diff --git a/doc/C/po/partprobe.8.pot b/doc/C/po/partprobe.8.pot
index 19bd79f..d061382 100644
--- a/doc/C/po/partprobe.8.pot
+++ b/doc/C/po/partprobe.8.pot
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2011-02-26 06:06+0100\n"
+"POT-Creation-Date: 2012-10-17 21:43+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -93,106 +93,111 @@ msgstr ""
msgid "This manual page documents briefly the B<partprobe> command."
msgstr ""
-# type: Plain text
#. TeX users may be more comfortable with the \fB<whatever>\fP and
#. \fI<whatever>\fP escape sequences to invode bold face and italics,
#. respectively.
#. type: Plain text
-#: partprobe.8:36
+#: partprobe.8:35
msgid ""
"B<partprobe> is a program that informs the operating system kernel of "
-"partition table changes, by requesting that the operating system re-read the "
-"partition table."
+"partition table changes."
msgstr ""
# type: SH
#. type: SH
-#: partprobe.8:36
+#: partprobe.8:35
#, no-wrap
msgid "OPTIONS"
msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:38
+#: partprobe.8:37
msgid "This program uses short UNIX style options."
msgstr ""
-# type: TP
#. type: TP
-#: partprobe.8:38
+#: partprobe.8:37
#, no-wrap
-msgid "B<-d>"
+msgid "B<-d, --dry-run>"
msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:41
+#: partprobe.8:40
msgid "Don't update the kernel."
msgstr ""
-# type: TP
#. type: TP
-#: partprobe.8:41
+#: partprobe.8:40
#, no-wrap
-msgid "B<-s>"
+msgid "B<-s, --summary>"
msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:44
+#: partprobe.8:43
msgid "Show a summary of devices and their partitions."
msgstr ""
-# type: TP
#. type: TP
-#: partprobe.8:44
+#: partprobe.8:43
#, no-wrap
-msgid "B<-h>"
+msgid "B<-h, --help>"
msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:47
+#: partprobe.8:46
msgid "Show summary of options."
msgstr ""
-# type: TP
#. type: TP
-#: partprobe.8:47
+#: partprobe.8:46
#, no-wrap
-msgid "B<-v>"
+msgid "B<-v, --version>"
msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:50
+#: partprobe.8:49
msgid "Show version of program."
msgstr ""
+#. type: SH
+#: partprobe.8:49
+#, no-wrap
+msgid "REPORTING BUGS"
+msgstr ""
+
+#. type: Plain text
+#: partprobe.8:51
+msgid "Report bugs to E<lt>bug-parted@gnu.orgE<gt>"
+msgstr ""
+
# type: SH
#. type: SH
-#: partprobe.8:50
+#: partprobe.8:51
#, no-wrap
msgid "SEE ALSO"
msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:52
+#: partprobe.8:53
msgid "B<parted>(8)."
msgstr ""
# type: SH
#. type: SH
-#: partprobe.8:52
+#: partprobe.8:53
#, no-wrap
msgid "AUTHOR"
msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:54
+#: partprobe.8:55
msgid ""
"This manual page was written by Timshel Knoll E<lt>timshel@debian.orgE<gt>, "
"for the Debian GNU/Linux system (but may be used by others)."
diff --git a/doc/pt_BR/partprobe.8.pt_BR.po b/doc/pt_BR/partprobe.8.pt_BR.po
index ffa47d7..4870d09 100644
--- a/doc/pt_BR/partprobe.8.pt_BR.po
+++ b/doc/pt_BR/partprobe.8.pt_BR.po
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2011-02-26 06:06+0100\n"
+"POT-Creation-Date: 2012-10-17 21:43+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Tassia Camoes Araujo <tassia@debian-ba.org>\n"
"Language-Team: l10n portuguese <debian-l10n-portuguese@lists.debian.org>\n"
@@ -100,11 +100,11 @@ msgstr "Esta página de manual documenta brevemente o comando B<partprobe>"
#. \fI<whatever>\fP escape sequences to invode bold face and italics,
#. respectively.
#. type: Plain text
-#: partprobe.8:36
+#: partprobe.8:35
+#, fuzzy
msgid ""
"B<partprobe> is a program that informs the operating system kernel of "
-"partition table changes, by requesting that the operating system re-read the "
-"partition table."
+"partition table changes."
msgstr ""
"B<partprobe> é uma programa que informa ao kernel do sistema operacional "
"sobre mudanças na tabela de partição, requisitando que o sistema operacional "
@@ -112,95 +112,118 @@ msgstr ""
# type: SH
#. type: SH
-#: partprobe.8:36
+#: partprobe.8:35
#, no-wrap
msgid "OPTIONS"
msgstr "OPÇÕES"
# type: Plain text
#. type: Plain text
-#: partprobe.8:38
+#: partprobe.8:37
msgid "This program uses short UNIX style options."
msgstr "Este programa usa opções de estilo curtas do UNIX."
-# type: TP
#. type: TP
-#: partprobe.8:38
+#: partprobe.8:37
#, no-wrap
-msgid "B<-d>"
-msgstr "B<-d>"
+msgid "B<-d, --dry-run>"
+msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:41
+#: partprobe.8:40
msgid "Don't update the kernel."
msgstr "Não atualiza o kernel."
-# type: TP
#. type: TP
-#: partprobe.8:41
+#: partprobe.8:40
#, no-wrap
-msgid "B<-s>"
-msgstr "B<-s>"
+msgid "B<-s, --summary>"
+msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:44
+#: partprobe.8:43
msgid "Show a summary of devices and their partitions."
msgstr "Mostra um sumário dos dispositivos e suas partições."
-# type: TP
#. type: TP
-#: partprobe.8:44
+#: partprobe.8:43
#, no-wrap
-msgid "B<-h>"
-msgstr "B<-h>"
+msgid "B<-h, --help>"
+msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:47
+#: partprobe.8:46
msgid "Show summary of options."
msgstr "Mostra sumário de opções."
-# type: TP
#. type: TP
-#: partprobe.8:47
+#: partprobe.8:46
#, no-wrap
-msgid "B<-v>"
-msgstr "B<-v>"
+msgid "B<-v, --version>"
+msgstr ""
# type: Plain text
#. type: Plain text
-#: partprobe.8:50
+#: partprobe.8:49
msgid "Show version of program."
msgstr "Mostra versão do programa."
+#. type: SH
+#: partprobe.8:49
+#, no-wrap
+msgid "REPORTING BUGS"
+msgstr ""
+
+#. type: Plain text
+#: partprobe.8:51
+msgid "Report bugs to E<lt>bug-parted@gnu.orgE<gt>"
+msgstr ""
+
# type: SH
#. type: SH
-#: partprobe.8:50
+#: partprobe.8:51
#, no-wrap
msgid "SEE ALSO"
msgstr "VEJA TAMBÉM"
# type: Plain text
#. type: Plain text
-#: partprobe.8:52
+#: partprobe.8:53
msgid "B<parted>(8)."
msgstr "B<parted>(8)."
# type: SH
#. type: SH
-#: partprobe.8:52
+#: partprobe.8:53
#, no-wrap
msgid "AUTHOR"
msgstr "AUTOR"
# type: Plain text
#. type: Plain text
-#: partprobe.8:54
+#: partprobe.8:55
msgid ""
"This manual page was written by Timshel Knoll E<lt>timshel@debian.orgE<gt>, "
"for the Debian GNU/Linux system (but may be used by others)."
msgstr ""
"Esta página de manual foi escrita por Timshel Knoll E<lt>timshel@debian."
"orgE<gt>, para o sistema Debian GNU/Linux (mas pode ser usado por outros)."
+
+# type: TP
+#~ msgid "B<-d>"
+#~ msgstr "B<-d>"
+
+# type: TP
+#~ msgid "B<-s>"
+#~ msgstr "B<-s>"
+
+# type: TP
+#~ msgid "B<-h>"
+#~ msgstr "B<-h>"
+
+# type: TP
+#~ msgid "B<-v>"
+#~ msgstr "B<-v>"
--
1.8.3.1

View File

@ -0,0 +1,83 @@
From 2ab9f04692e74c8b1daae68f1c22c5723f6c39ef Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 17 Oct 2012 21:42:12 +0200
Subject: [PATCH 43/69] tests: cleanup losetup usage
The unsafe_losetup_ function was failing because losetup didn't
recognize that the 'private' /dev/loopX devices were the same as
/dev/loopX, it would fail even if one was in use. Switch to using
losetup --show which is a cleaner solution.
Also use sparse file for loop_setup to save space.
* tests/t-lvm.sh (unsafe_losetup_): Remove function.
(loop_setup_): Use losetup's --show option instead.
Use dd with /dev/null, not /dev/zero.
* tests/t6001-psep.sh: Use loop_setup_ rather than losetup --show.
---
tests/t-lvm.sh | 23 ++---------------------
tests/t6001-psep.sh | 8 ++------
2 files changed, 4 insertions(+), 27 deletions(-)
diff --git a/tests/t-lvm.sh b/tests/t-lvm.sh
index cf1b8b8..001523b 100644
--- a/tests/t-lvm.sh
+++ b/tests/t-lvm.sh
@@ -13,33 +13,14 @@
export LVM_SUPPRESS_FD_WARNINGS=1
-unsafe_losetup_()
-{
- f=$1
-
- G_dev_=/dev
-
- # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
- for slash in '' /; do
- for i in 0 1 2 3 4 5 6 7 8 9; do
- dev=$G_dev_/loop$slash$i
- losetup $dev 1>&2 && continue;
- losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; }
- break
- done
- done
-
- return 1
-}
-
loop_setup_()
{
file=$1
- dd if=/dev/zero of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
+ dd if=/dev/null of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
|| { warn_ "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
# NOTE: this requires a new enough version of losetup
- dev=$(unsafe_losetup_ "$file") \
+ dev=$(losetup --show -f "$file") \
|| { warn_ "loop_setup_ failed: Unable to create loopback device"; return 1; }
echo "$dev"
diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh
index 490c6d2..1859ac9 100644
--- a/tests/t6001-psep.sh
+++ b/tests/t6001-psep.sh
@@ -44,14 +44,10 @@ cleanup_fn_() {
# create a file of size N bytes
N=10M
-# create the test file
-f1=$(pwd)/1; dd if=/dev/null of=$f1 bs=1 seek=$N 2> /dev/null || fail=1
-f2=$(pwd)/2; dd if=/dev/null of=$f2 bs=1 seek=$N 2> /dev/null || fail=1
-
-d1=$(loop_setup_ "$f1") \
+f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
|| skip_ "is this partition mounted with 'nodev'?"
-d2=$(loop_setup_ "$f2") \
+f2=$(pwd)/2 ;d2=$(loop_setup_ "$f2") \
|| skip_ "is this partition mounted with 'nodev'?"
dmsetup_cmd="0 `blockdev --getsz $d1` linear $d1 0"
--
1.8.3.1

View File

@ -0,0 +1,34 @@
From d3a81337ff149294b7cf63c45a61ffa24fa542c5 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@redhat.com>
Date: Tue, 23 Oct 2012 11:07:29 +0200
Subject: [PATCH 44/69] build: default to --enable-gcc-warnings in a git tree
Anyone building from cloned sources can be assumed to have a new
enough environment, such that enabling gcc warnings by default will
be useful. Tarballs still default to no warnings, and the default
can still be overridden with --disable-gcc-warnings.
* configure.ac (gl_gcc_warnings): Set default based on environment.
---
configure.ac | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 832fc20..417f325 100644
--- a/configure.ac
+++ b/configure.ac
@@ -187,7 +187,11 @@ AC_ARG_ENABLE([gcc-warnings],
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
esac
gl_gcc_warnings=$enableval],
- [gl_gcc_warnings=no]
+ [if test -d "$srcdir"/.git; then
+ gl_gcc_warnings=yes
+ else
+ gl_gcc_warnings=no
+ fi]
)
if test "$gl_gcc_warnings" = yes; then
--
1.8.3.1

View File

@ -0,0 +1,638 @@
From f0c0d53f998964e187f59de32ac92a2c0e2d5da9 Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Sun, 14 Oct 2012 23:59:58 -0400
Subject: [PATCH 45/69] libparted: refactor device-mapper partition sync code
The device-mapper partition sync code was still using the remove all
partitions, then add new partitions method. Refactor to use the same
algorithm as regular disks: try to remove all, and ignore any that could
not be removed but have not changed.
---
NEWS | 3 +
libparted/arch/linux.c | 405 ++++++++++++++++++++++---------------------------
tests/Makefile.am | 1 +
tests/t6002-dm-busy.sh | 92 +++++++++++
4 files changed, 274 insertions(+), 227 deletions(-)
create mode 100644 tests/t6002-dm-busy.sh
diff --git a/NEWS b/NEWS
index 293f5e4..a40d69b 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ GNU parted NEWS -*- outline -*-
** Bug Fixes
+ libparted: Don't fail to manipulate partitions on dmraid disks that
+ have other partitions in use.
+
libparted: mac: a MAC partition table could have a block_size larger
than the one the kernel told us about. Upon reading that partition
table, libparted would ask if it's ok to use the larger block size.
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index e2c4139..70b26a9 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -285,7 +285,7 @@ struct blkdev_ioctl_param {
/* Maximum number of partitions supported by linux. */
#define MAX_NUM_PARTS 64
-static char* _device_get_part_path (PedDevice* dev, int num);
+static char* _device_get_part_path (PedDevice const *dev, int num);
static int _partition_is_mounted_by_path (const char* path);
static int
@@ -2225,28 +2225,53 @@ zasprintf (const char *format, ...)
return r < 0 ? NULL : resultp;
}
-static char*
-_device_get_part_path (PedDevice *dev, int num)
+static char *
+dm_canonical_path (PedDevice const *dev)
{
- size_t path_len = strlen (dev->path);
+ LinuxSpecific const *arch_specific = LINUX_SPECIFIC (dev);
+ /* Get map name from devicemapper */
+ struct dm_task *task = dm_task_create (DM_DEVICE_INFO);
+ if (!task)
+ goto err;
+ if (!dm_task_set_major_minor (task, arch_specific->major,
+ arch_specific->minor, 0))
+ goto err;
+ if (!dm_task_run(task))
+ goto err;
+ char *dev_name = zasprintf ("/dev/mapper/%s", dm_task_get_name (task));
+ if (dev_name == NULL)
+ goto err;
+ dm_task_destroy (task);
+ return dev_name;
+err:
+ return NULL;
+}
+
+static char*
+_device_get_part_path (PedDevice const *dev, int num)
+{
+ char *devpath = (dev->type == PED_DEVICE_DM
+ ? dm_canonical_path (dev) : dev->path);
+ size_t path_len = strlen (devpath);
char *result;
/* Check for devfs-style /disc => /partN transformation
unconditionally; the system might be using udev with devfs rules,
and if not the test is harmless. */
- if (5 < path_len && !strcmp (dev->path + path_len - 5, "/disc")) {
+ if (5 < path_len && !strcmp (devpath + path_len - 5, "/disc")) {
/* replace /disc with /part%d */
result = zasprintf ("%.*s/part%d",
- (int) (path_len - 5), dev->path, num);
+ (int) (path_len - 5), devpath, num);
} else {
char const *p = (dev->type == PED_DEVICE_DAC960
|| dev->type == PED_DEVICE_CPQARRAY
|| dev->type == PED_DEVICE_ATARAID
- || isdigit (dev->path[path_len - 1])
+ || isdigit (devpath[path_len - 1])
? "p" : "");
- result = zasprintf ("%s%s%d", dev->path, p, num);
+ result = zasprintf ("%s%s%d", devpath, p, num);
}
-
+ if (dev->type == PED_DEVICE_DM)
+ free (devpath);
return result;
}
@@ -2530,6 +2555,8 @@ static unsigned int
_device_get_partition_range(PedDevice const* dev)
{
int range;
+ if (dev->type == PED_DEVICE_DM)
+ return MAX_NUM_PARTS;
bool ok = _sysfs_int_entry_from_dev(dev, "ext_range", &range);
if (!ok)
@@ -2538,6 +2565,128 @@ _device_get_partition_range(PedDevice const* dev)
return range > 1 ? range : 0;
}
+#ifdef ENABLE_DEVICE_MAPPER
+static int
+_dm_remove_partition(PedDisk* disk, int partno)
+{
+ int rc;
+ char *part_name = _device_get_part_path (disk->dev, partno);
+
+ int fd = open (part_name, O_RDONLY | O_EXCL);
+ if (fd == -1) {
+ if (errno == ENOENT)
+ errno = ENXIO; /* nothing to remove, device already doesn't exist */
+ free (part_name);
+ return 0;
+ }
+ close (fd);
+ struct dm_task *task = dm_task_create(DM_DEVICE_REMOVE);
+ if (!task) {
+ free (part_name);
+ return 0;
+ }
+ dm_task_set_name (task, part_name);
+ rc = dm_task_run(task);
+ dm_task_update_nodes();
+ dm_task_destroy(task);
+ free (part_name);
+ if (!rc)
+ return 0;
+
+ return 1;
+}
+
+static bool
+_dm_get_partition_start_and_length(PedPartition const *part,
+ unsigned long long *start,
+ unsigned long long *length)
+{
+ struct dm_task* task = NULL;
+ int rc = 0;
+
+ if (!(task = dm_task_create(DM_DEVICE_TABLE)))
+ return 0;
+ char *path = _device_get_part_path (part->disk->dev, part->num);
+ PED_ASSERT(path);
+ dm_task_set_name(task, path);
+ if (!dm_task_run(task))
+ goto err;
+
+ int major, minor;
+ char *params;
+ char *target_type;
+ dm_get_next_target(task, NULL, (uint64_t *)start, (uint64_t *)length, &target_type, &params);
+ if (sscanf (params, "%d:%d %Ld", &major, &minor, start) != 3)
+ goto err;
+ rc = 1;
+err:
+ free (path);
+ dm_task_destroy(task);
+ return rc;
+}
+
+
+static int
+_dm_add_partition (PedDisk* disk, const PedPartition* part)
+{
+ LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev);
+ char *params = NULL;
+ char *vol_name = NULL;
+
+ /* Get map name from devicemapper */
+ struct dm_task *task = dm_task_create (DM_DEVICE_INFO);
+ if (!task)
+ goto err;
+
+ if (!dm_task_set_major_minor (task, arch_specific->major,
+ arch_specific->minor, 0))
+ goto err;
+
+ if (!dm_task_run(task))
+ goto err;
+
+ const char *dev_name = dm_task_get_name (task);
+ size_t name_len = strlen (dev_name);
+ vol_name = zasprintf ("%s%s%d",
+ dev_name,
+ isdigit (dev_name[name_len - 1]) ? "p" : "",
+ part->num);
+ if (vol_name == NULL)
+ goto err;
+
+ /* Caution: dm_task_destroy frees dev_name. */
+ dm_task_destroy (task);
+ task = NULL;
+ if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major,
+ arch_specific->minor, part->geom.start)))
+ goto err;
+
+ task = dm_task_create (DM_DEVICE_CREATE);
+ if (!task)
+ goto err;
+
+ dm_task_set_name (task, vol_name);
+ dm_task_add_target (task, 0, part->geom.length,
+ "linear", params);
+ if (dm_task_run (task)) {
+ dm_task_update_nodes ();
+ dm_task_destroy (task);
+ free (params);
+ free (vol_name);
+ return 1;
+ } else {
+ _dm_remove_partition (disk, part->num);
+ }
+err:
+ dm_task_update_nodes();
+ if (task)
+ dm_task_destroy (task);
+ free (params);
+ free (vol_name);
+ return 0;
+}
+#endif
+
/*
* Sync the partition table in two step process:
* 1. Remove all of the partitions from the kernel's tables, but do not attempt
@@ -2558,8 +2707,23 @@ _disk_sync_part_table (PedDisk* disk)
PED_ASSERT(disk != NULL);
PED_ASSERT(disk->dev != NULL);
int lpn;
-
unsigned int part_range = _device_get_partition_range(disk->dev);
+ int (*add_partition)(PedDisk* disk, const PedPartition *part);
+ int (*remove_partition)(PedDisk* disk, int partno);
+ bool (*get_partition_start_and_length)(PedPartition const *part,
+ unsigned long long *start,
+ unsigned long long *length);
+
+
+ if (disk->dev->type == PED_DEVICE_DM) {
+ add_partition = _dm_add_partition;
+ remove_partition = _dm_remove_partition;
+ get_partition_start_and_length = _dm_get_partition_start_and_length;
+ } else {
+ add_partition = _blkpg_add_partition;
+ remove_partition = _blkpg_remove_partition;
+ get_partition_start_and_length = _kernel_get_partition_start_and_length;
+ }
/* lpn = largest partition number. */
if (ped_disk_get_max_supported_partition_count(disk, &lpn))
@@ -2594,7 +2758,7 @@ _disk_sync_part_table (PedDisk* disk)
int j;
for (j = 0; j < lpn; j++) {
if (!ok[j]) {
- ok[j] = _blkpg_remove_partition (disk, j + 1);
+ ok[j] = remove_partition (disk, j + 1);
errnums[j] = errno;
if (!ok[j] && errnums[j] == EBUSY)
busy = true;
@@ -2611,8 +2775,8 @@ _disk_sync_part_table (PedDisk* disk)
unsigned long long length;
unsigned long long start;
/* get start and length of existing partition */
- if (!_kernel_get_partition_start_and_length(part,
- &start, &length))
+ if (!get_partition_start_and_length(part,
+ &start, &length))
goto cleanup;
if (start == part->geom.start
&& length == part->geom.length)
@@ -2625,7 +2789,7 @@ _disk_sync_part_table (PedDisk* disk)
}
/* add the (possibly modified or new) partition */
- if (!_blkpg_add_partition (disk, part)) {
+ if (!add_partition (disk, part)) {
ped_exception_throw (
PED_EXCEPTION_ERROR,
PED_EXCEPTION_RETRY_CANCEL,
@@ -2671,215 +2835,6 @@ _disk_sync_part_table (PedDisk* disk)
return ret;
}
-#ifdef ENABLE_DEVICE_MAPPER
-static int
-_dm_remove_map_name(char *name)
-{
- struct dm_task *task = NULL;
- int rc;
-
- task = dm_task_create(DM_DEVICE_REMOVE);
- if (!task)
- return 1;
-
- dm_task_set_name (task, name);
-
- rc = dm_task_run(task);
- dm_task_update_nodes();
- dm_task_destroy(task);
- if (!rc)
- return 1;
-
- return 0;
-}
-
-static int
-_dm_is_part (struct dm_info *this, char *name)
-{
- struct dm_task* task = NULL;
- struct dm_info* info = alloca(sizeof *info);
- struct dm_deps* deps = NULL;
- int rc = 0;
- unsigned int i;
-
- task = dm_task_create(DM_DEVICE_DEPS);
- if (!task)
- return 0;
-
- dm_task_set_name(task, name);
- if (!dm_task_run(task))
- goto err;
-
- memset(info, '\0', sizeof *info);
- dm_task_get_info(task, info);
- if (!info->exists)
- goto err;
-
- deps = dm_task_get_deps(task);
- if (!deps)
- goto err;
-
- for (i = 0; i < deps->count; i++) {
- unsigned int ma = major(deps->device[i]),
- mi = minor(deps->device[i]);
-
- if (ma == this->major && mi == this->minor)
- rc = 1;
- }
-
-err:
- dm_task_destroy(task);
- return rc;
-}
-
-static int
-_dm_remove_parts (PedDevice* dev)
-{
- struct dm_task* task = NULL;
- struct dm_info* info = alloca(sizeof *info);
- struct dm_names* names = NULL;
- unsigned int next = 0;
- int rc;
- LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
-
- task = dm_task_create(DM_DEVICE_LIST);
- if (!task)
- goto err;
-
- if (!dm_task_set_major_minor (task, arch_specific->major,
- arch_specific->minor, 0))
- goto err;
-
- if (!dm_task_run(task))
- goto err;
-
- memset(info, '\0', sizeof *info);
- dm_task_get_info(task, info);
- if (!info->exists)
- goto err;
-
- names = dm_task_get_names(task);
- if (!names)
- goto err;
-
- rc = 0;
- do {
- names = (void *) ((char *) names + next);
-
- if (_dm_is_part(info, names->name))
- rc += _dm_remove_map_name(names->name);
-
- next = names->next;
- } while (next);
-
- dm_task_update_nodes();
- dm_task_destroy(task);
- task = NULL;
-
- if (!rc)
- return 1;
-err:
- if (task)
- dm_task_destroy(task);
- ped_exception_throw (PED_EXCEPTION_WARNING, PED_EXCEPTION_IGNORE,
- _("parted was unable to re-read the partition "
- "table on %s (%s). This means Linux won't know "
- "anything about the modifications you made. "),
- dev->path, strerror (errno));
- return 0;
-}
-
-static int
-_dm_add_partition (PedDisk* disk, PedPartition* part)
-{
- char* vol_name = NULL;
- const char* dev_name = NULL;
- char* params = NULL;
- LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev);
-
- /* Get map name from devicemapper */
- struct dm_task *task = dm_task_create (DM_DEVICE_INFO);
- if (!task)
- goto err;
-
- if (!dm_task_set_major_minor (task, arch_specific->major,
- arch_specific->minor, 0))
- goto err;
-
- if (!dm_task_run(task))
- goto err;
-
- dev_name = dm_task_get_name (task);
-
- if (isdigit (dev_name[strlen (dev_name) - 1])) {
- if ( ! (vol_name = zasprintf ("%sp%d", dev_name, part->num)))
- goto err;
- } else if ( ! (vol_name = zasprintf ("%s%d", dev_name, part->num)))
- goto err;
-
- /* Caution: dm_task_destroy frees dev_name. */
- dm_task_destroy (task);
- task = NULL;
-
- if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major,
- arch_specific->minor, part->geom.start)))
- goto err;
-
- task = dm_task_create (DM_DEVICE_CREATE);
- if (!task)
- goto err;
-
- dm_task_set_name (task, vol_name);
- dm_task_add_target (task, 0, part->geom.length,
- "linear", params);
- if (dm_task_run (task)) {
- //printf("0 %ld linear %s\n", part->geom.length, params);
- dm_task_update_nodes();
- dm_task_destroy(task);
- free(params);
- free(vol_name);
- return 1;
- } else {
- _dm_remove_map_name(vol_name);
- }
-err:
- dm_task_update_nodes();
- if (task)
- dm_task_destroy (task);
- free (params);
- free (vol_name);
- return 0;
-}
-
-static int
-_dm_reread_part_table (PedDisk* disk)
-{
- int largest_partnum = ped_disk_get_last_partition_num (disk);
- if (largest_partnum <= 0)
- return 1;
-
- int rc = 1;
- int last = PED_MIN (largest_partnum, 16);
- int i;
-
- sync();
- if (!_dm_remove_parts(disk->dev))
- rc = 0;
-
- for (i = 1; i <= last; i++) {
- PedPartition* part;
-
- part = ped_disk_get_partition (disk, i);
- if (!part)
- continue;
-
- if (!_dm_add_partition (disk, part))
- rc = 0;
- }
- return rc;
-}
-#endif
-
static int
_have_blkpg ()
{
@@ -2897,10 +2852,6 @@ _have_blkpg ()
static int
linux_disk_commit (PedDisk* disk)
{
-#ifdef ENABLE_DEVICE_MAPPER
- if (disk->dev->type == PED_DEVICE_DM)
- return _dm_reread_part_table (disk);
-#endif
if (disk->dev->type != PED_DEVICE_FILE) {
/* We now require BLKPG support. If this assertion fails,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cdc1c4b..4649c0a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -58,6 +58,7 @@ TESTS = \
t5000-tags.sh \
t6000-dm.sh \
t6001-psep.sh \
+ t6002-dm-busy.sh \
t6100-mdraid-partitions.sh \
t7000-scripting.sh \
t8000-loop.sh \
diff --git a/tests/t6002-dm-busy.sh b/tests/t6002-dm-busy.sh
new file mode 100644
index 0000000..9807b40
--- /dev/null
+++ b/tests/t6002-dm-busy.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+# ensure that parted can alter a partition on a dmraid disk
+# while another one is mounted
+
+# Copyright (C) 2008-2012 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/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+
+# We could make this work for arbitrary sector size, but I'm lazy.
+require_512_byte_sector_size_
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
+
+# Device maps names - should be random to not conflict with existing ones on
+# the system
+linear_=plinear-$$
+
+d1=
+f1=
+dev=
+cleanup_fn_() {
+ umount "${dev}p2" > /dev/null 2>&1
+ dmsetup remove ${linear_}p1
+ dmsetup remove ${linear_}p2
+ dmsetup remove $linear_
+ test -n "$d1" && losetup -d "$d1"
+ rm -f "$f1"
+}
+
+f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
+ || fail=1
+
+# setup: create a mapping
+n=204800
+echo "0 $n linear $d1 0" | dmsetup create $linear_ || fail=1
+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 -a none mkpart primary fat32 1s 1000s > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+parted -s $dev -a none mkpart primary fat32 1001s 200000s > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# wait for new partition device to appear
+wait_for_dev_to_appear_ ${dev}p2 || fail_ ${dev}p2 did not appear
+
+mkfs.vfat -F 32 ${dev}p2 || fail_ mkfs.vfat failed
+
+mount_point=$(pwd)/mnt
+
+mkdir $mount_point || fail=1
+mount "${dev}p2" "$mount_point" || fail=1
+
+# Removal of unmounted partition must succeed.
+parted -s "$dev" rm 1 > /dev/null 2>&1 || fail=1
+
+# Removal of mounted partition must fail.
+parted -s "$dev" rm 2 > /dev/null 2>&1 && fail=1
+
+parted -m -s "$dev" u s print > out 2>&1 || fail=1
+sed "s,^$dev,DEV," out > k; mv k out
+
+# Create expected output file.
+cat <<EOF >> exp || fail=1
+BYT;
+DEV:${n}s:dm:512:512:msdos:Linux device-mapper (linear):;
+2:1001s:200000s:199000s:fat32::lba;
+EOF
+
+compare exp out || fail=1
+
+Exit $fail
--
1.8.3.1

View File

@ -0,0 +1,71 @@
From f87ff28d1aa8eff085e737ab22d031b0519e5510 Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Sun, 14 Oct 2012 23:59:59 -0400
Subject: [PATCH 46/69] libparted: remove extraneous blkpg add partition ped
exception
_blkpg_add_partition was throwing an exception if it failed to add the
new partition, in addition to _disk_sync_part_table throwing one, and
then bailing out. Instead of bailing out, just log the error for
reporting later and continue.
---
libparted/arch/linux.c | 21 +++------------------
tests/t2310-dos-extended-2-sector-min-offset.sh | 3 +--
2 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 70b26a9..5721d4b 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2407,18 +2407,7 @@ _blkpg_add_partition (PedDisk* disk, const PedPartition *part)
if (!_blkpg_part_command (disk->dev, &linux_part,
BLKPG_ADD_PARTITION)) {
- return ped_exception_throw (
- PED_EXCEPTION_ERROR,
- PED_EXCEPTION_IGNORE_CANCEL,
- _("Error informing the kernel about modifications to "
- "partition %s -- %s. This means Linux won't know "
- "about any changes you made to %s until you reboot "
- "-- so you shouldn't mount it or use it in any way "
- "before rebooting."),
- linux_part.devname,
- strerror (errno),
- linux_part.devname)
- == PED_EXCEPTION_IGNORE;
+ return 0;
}
return 1;
@@ -2790,12 +2779,8 @@ _disk_sync_part_table (PedDisk* disk)
/* add the (possibly modified or new) partition */
if (!add_partition (disk, part)) {
- ped_exception_throw (
- PED_EXCEPTION_ERROR,
- PED_EXCEPTION_RETRY_CANCEL,
- _("Failed to add partition %d (%s)"),
- i, strerror (errno));
- goto cleanup;
+ ok[i - 1] = 0;
+ errnums[i - 1] = errno;
}
}
}
diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh
index 89453ae..17c777c 100644
--- a/tests/t2310-dos-extended-2-sector-min-offset.sh
+++ b/tests/t2310-dos-extended-2-sector-min-offset.sh
@@ -39,8 +39,7 @@ $scsi_dev:2048s:scsi:512:512:msdos:Linux scsi_debug:;
EOF
cat <<EOF > err.exp || framework_failure
-Error: Error informing the kernel about modifications to partition $p5 -- Device or resource busy. This means Linux won't know about any changes you made to $p5 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
-Error: Failed to add partition 5 (Device or resource busy)
+Error: Partition(s) 5 on $scsi_dev have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
EOF
# Create a DOS label with an extended partition starting at sector 64.
--
1.8.3.1

View File

@ -0,0 +1,225 @@
From 3cb820632a13a91e0c2e579aedbe8e86b4f0040e Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Fri, 19 Oct 2012 17:32:00 +0200
Subject: [PATCH 47/69] libparted: don't probe every dm device in probe_all
We were probing every dm device. Only probe dmraid whole disk
(non-partition) devices instead. This removes the clutter of
LVM logical volumes, and dmraid partitions from the list, which
usually do not make sense to partition.
* NEWS (Changes in behavior): Mention it.
* libparted/arch/linux.c (_is_dmraid_device): New function.
(_dm_is_part): Likewise.
(_probe_dm_devices): Use the latter.
* tests/t6003-dm-hide.sh: New test.
* tests/Makefile.am (TESTS): Add it.
---
NEWS | 3 ++
libparted/arch/linux.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++-
tests/Makefile.am | 1 +
tests/t6003-dm-hide.sh | 60 +++++++++++++++++++++++++++++++++++++
4 files changed, 144 insertions(+), 1 deletion(-)
create mode 100644 tests/t6003-dm-hide.sh
diff --git a/NEWS b/NEWS
index a40d69b..89541fd 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,9 @@ GNU parted NEWS -*- outline -*-
** Changes in behavior
+ parted -l no longer lists device-mapper devices other than
+ dmraid whole disks.
+
Added new Linux-specific partition GUID type code
(0FC63DAF-8483-4772-8E79-3D69D8477DE4) for Linux filesystem data on GPT
disks. This type code is now assigned as the default partition type code
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 5721d4b..083591f 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -65,6 +65,8 @@
# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
#endif
+#define STRPREFIX(a, b) (strncmp (a, b, strlen (b)) == 0)
+
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#ifndef __NR__llseek
@@ -478,6 +480,82 @@ bad:
return r;
}
+/* Return nonzero if device-mapper device, DEVPATH, is part of a dmraid
+ array. Use the heuristic of checking for the string "DMRAID-" at the
+ start of its UUID. */
+static int
+_is_dmraid_device (const char *devpath)
+{
+ int rc = 0;
+
+ char const *dm_name = strrchr (devpath, '/');
+ char const *dm_basename = dm_name && *(++dm_name) ? dm_name : devpath;
+ struct dm_task *task = dm_task_create (DM_DEVICE_DEPS);
+ if (!task)
+ return 0;
+
+ dm_task_set_name (task, dm_basename);
+ if (!dm_task_run (task))
+ goto err;
+
+ const char *dmraid_uuid = dm_task_get_uuid (task);
+ if (STRPREFIX (dmraid_uuid, "DMRAID-"))
+ rc = 1;
+
+err:
+ dm_task_destroy (task);
+ return rc;
+}
+
+/* We consider a dm device that is a linear mapping with a *
+ * single target that also is a dm device to be a partition */
+
+static int
+_dm_is_part (const char *path)
+{
+ int rc = 0;
+ struct dm_task *task = dm_task_create (DM_DEVICE_DEPS);
+ if (!task)
+ return 0;
+
+ dm_task_set_name(task, path);
+ if (!dm_task_run(task))
+ goto err;
+
+ struct dm_info *info = alloca (sizeof *info);
+ memset(info, '\0', sizeof *info);
+ dm_task_get_info (task, info);
+ if (!info->exists)
+ goto err;
+
+ struct dm_deps *deps = dm_task_get_deps (task);
+ if (!deps)
+ goto err;
+
+ if (deps->count != 1)
+ goto err;
+ if (!_is_dm_major (major (deps->device[0])))
+ goto err;
+ dm_task_destroy (task);
+ if (!(task = dm_task_create (DM_DEVICE_TABLE)))
+ return 0;
+ dm_task_set_name (task, path);
+ if (!dm_task_run (task))
+ goto err;
+
+ char *target_type = NULL;
+ char *params = NULL;
+ uint64_t start, length;
+
+ dm_get_next_target (task, NULL, &start, &length, &target_type, &params);
+ if (strcmp (target_type, "linear"))
+ goto err;
+ rc = 1;
+
+err:
+ dm_task_destroy(task);
+ return rc;
+}
static int
_probe_dm_devices ()
@@ -504,7 +582,8 @@ _probe_dm_devices ()
if (stat (buf, &st) != 0)
continue;
- if (_is_dm_major(major(st.st_rdev)))
+ if (_is_dm_major(major(st.st_rdev)) && _is_dmraid_device (buf)
+ && !_dm_is_part(buf))
_ped_device_probe (buf);
}
closedir (mapper_dir);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4649c0a..4ec08da 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -59,6 +59,7 @@ TESTS = \
t6000-dm.sh \
t6001-psep.sh \
t6002-dm-busy.sh \
+ t6003-dm-hide.sh \
t6100-mdraid-partitions.sh \
t7000-scripting.sh \
t8000-loop.sh \
diff --git a/tests/t6003-dm-hide.sh b/tests/t6003-dm-hide.sh
new file mode 100644
index 0000000..3cfdc43
--- /dev/null
+++ b/tests/t6003-dm-hide.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# ensure that parted -l only shows dmraid device-mapper devices
+
+# Copyright (C) 2008-2012 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/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+require_root_
+lvm_init_root_dir_
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
+
+# Device maps names - should be random to not conflict with existing ones on
+# the system
+linear_=plinear-$$
+
+d1=
+f1=
+dev=
+cleanup_fn_() {
+ dmsetup remove $linear_
+ test -n "$d1" && losetup -d "$d1"
+ rm -f "$f1"
+}
+
+f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
+ || fail=1
+
+# setup: create a mapping
+echo "0 2048 linear $d1 0" | dmsetup create $linear_ || fail=1
+dev="$DM_DEV_DIR/mapper/$linear_"
+
+# device should not show up
+
+parted -l >out 2>&1
+! grep $linear_ out || fail=1
+
+dmsetup remove $linear_
+echo "0 2048 linear $d1 0" | dmsetup create $linear_ -u "DMRAID-fake" || fail=1
+
+# device should now show up
+
+parted -l >out 2>&1
+grep $linear_ out || fail=1
+
+Exit $fail
--
1.8.3.1

View File

@ -0,0 +1,71 @@
From 2224076fef1a54391cf090149ba9308ae90067eb Mon Sep 17 00:00:00 2001
From: Jim Meyering <jim@meyering.net>
Date: Fri, 19 Oct 2012 18:09:19 +0200
Subject: [PATCH 48/69] tests: make t6003-dm-hide work reliably on F17
* tests/t6003-dm-hide.sh: Adjust to work reliably on Fedora 17.
---
tests/t6003-dm-hide.sh | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/tests/t6003-dm-hide.sh b/tests/t6003-dm-hide.sh
index 3cfdc43..59baae9 100644
--- a/tests/t6003-dm-hide.sh
+++ b/tests/t6003-dm-hide.sh
@@ -19,7 +19,6 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
require_root_
-lvm_init_root_dir_
test "x$ENABLE_DEVICE_MAPPER" = xyes \
|| skip_ "no device-mapper support"
@@ -32,7 +31,10 @@ d1=
f1=
dev=
cleanup_fn_() {
- dmsetup remove $linear_
+ # Insist. Sometimes the initial removal fails (race?).
+ # When that happens, a second removal appears to be sufficient.
+ dmsetup remove $linear_ || dmsetup remove $linear_
+
test -n "$d1" && losetup -d "$d1"
rm -f "$f1"
}
@@ -41,20 +43,25 @@ f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
|| fail=1
# setup: create a mapping
-echo "0 2048 linear $d1 0" | dmsetup create $linear_ || fail=1
-dev="$DM_DEV_DIR/mapper/$linear_"
-
-# device should not show up
+echo 0 2048 linear $d1 0 | dmsetup create $linear_ || fail=1
+dev=/dev/mapper/$linear_
+# No "DMRAID-" UUID prefix, hence the device should not show up.
parted -l >out 2>&1
-! grep $linear_ out || fail=1
+grep "^Disk $dev:" out && fail=1
+# Unless we perform both dmsetup-remove *and* losetup -d,
+# the following dmsetup-create would fail with EBUSY.
dmsetup remove $linear_
-echo "0 2048 linear $d1 0" | dmsetup create $linear_ -u "DMRAID-fake" || fail=1
+losetup -d "$d1" || fail=1
+# Reopen (or get new) loop device.
+d1=$(loop_setup_ "$f1") || fail=1
-# device should now show up
+# This time, use a fake UUID.
+echo 0 2048 linear $d1 0 | dmsetup create $linear_ -u "DMRAID-fake-$$" || fail=1
+# Thus, the device should now show up.
parted -l >out 2>&1
-grep $linear_ out || fail=1
+grep "^Disk $dev:" out || fail=1
Exit $fail
--
1.8.3.1

View File

@ -0,0 +1,77 @@
From 21be64fc6ef60a1e9dc7bc352131be58cc59d61d Mon Sep 17 00:00:00 2001
From: Jim Meyering <jim@meyering.net>
Date: Wed, 2 Jan 2013 12:52:14 +0100
Subject: [PATCH 49/69] doc: 1MiB-alignment is not enough for cheap flash
drives
* doc/parted.texi: Add an example that aligns to 4GiB, and
reference Arnd Bergman's LWN article.
---
doc/parted.texi | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/doc/parted.texi b/doc/parted.texi
index b8db19d..008c383 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -14,7 +14,7 @@ and manipulating partition tables.
@ifnottex @c texi2pdf don't understand copying and insertcopying ???
@c modifications must also be done in the titlepage
@copying
-Copyright @copyright{} 1999-2012 Free Software Foundation, Inc.
+Copyright @copyright{} 1999-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -577,15 +577,44 @@ partition table.
@item ufs
@end itemize
-Example:
+For example, the following creates a logical partition that will contain
+an ext2 file system. The partition will start at the beginning of the disk,
+and end 692.1 megabytes into the disk.
@example
(parted) @kbd{mkpart logical 0.0 692.1}
@end example
-Create a logical partition that will contain an ext2 file system. The
-partition will start at the beginning of the disk, and end 692.1
-megabytes into the disk.
+Now, we will show how to partition a low-end flash
+device (``low-end'', as of 2011/2012).
+For such devices, you should use 4MiB-aligned partitions@footnote{
+Cheap flash drives will be with us for a long time to
+come, and, for them, 1MiB alignment is not enough.
+Use at least 4MiB-aligned partitions.
+For details, see Arnd Bergman's article,
+@uref{http://http://lwn.net/Articles/428584/} and its many comments.}.
+This command creates a tiny place-holder partition at the beginning, and
+then uses all remaining space to create the partition you'll actually use:
+
+@example
+$ @kbd{parted -s /dev/sdX -- mklabel msdos \}
+@kbd{ mkpart primary fat32 64s 4MiB \}
+@kbd{ mkpart primary fat32 4MiB -1s}
+@end example
+
+Note the use of @samp{--}, to prevent the following @samp{-1s} last-sector
+indicator from being interpreted as an invalid command-line option.
+The above creates two empty partitions. The first is unaligned and tiny,
+with length less than 4MiB.
+The second partition starts precisely at the 4MiB mark
+and extends to the end of the device.
+
+The next step is typically to create a file system in the second partition:
+
+@example
+$ @kbd{mkfs.vfat /dev/sdX2}
+@end example
+
@end deffn
--
1.8.3.1

View File

@ -0,0 +1,19 @@
From 960eda93fc53ea18e8e98109a00661ac5e8a88f8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <jim@meyering.net>
Date: Sun, 6 Jan 2013 11:06:23 +0100
Subject: [PATCH 50/69] build: update gnulib submodule to latest
---
gnulib | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gnulib b/gnulib
index e1abd50..164ebfe 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit e1abd50b01d6bd61bd0c996ca17378cd569c0aa1
+Subproject commit 164ebfe612d8460c15d7acf1927faef6943571b6
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
From 1c659d5cc6830c6f4f26660e9049582afbad3fd3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <jim@meyering.net>
Date: Sun, 6 Jan 2013 11:37:15 +0100
Subject: [PATCH 52/69] maint: avoid new warning/error with gcc-4.8.0 20130105
* configure.ac (WERROR_CFLAGS): Disable -Wsuggest-attribute=format.
It was suggesting to apply the gnu_printf attribute to vsnprintf.
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index fef0b53..b04eb3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -235,6 +235,7 @@ if test "$gl_gcc_warnings" = yes; then
nw="$nw -Wstrict-overflow" # expr.c, pr.c, tr.c, factor.c
nw="$nw -Wstack-protector" # libparted/label/gpt.c
# ?? -Wstrict-overflow
+ nw="$nw -Wsuggest-attribute=format" # suggests to use gnu_printf for vsnprintf
gl_MANYWARN_ALL_GCC([ws])
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
--
1.8.3.1

View File

@ -1,18 +1,18 @@
From 43663f1226da0a6284b5f52f6e2f741473c077b6 Mon Sep 17 00:00:00 2001
From f29ccfe5b9639d8626db50e9f4ecbe10d6cd7736 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 3 Feb 2012 13:03:27 -0800
Subject: [PATCH] libparted: copy pmbr_boot when duplicating GPT disk
Subject: [PATCH 53/69] libparted: copy pmbr_boot when duplicating GPT disk
* libparted/labels/gpt.c (gpt_duplicate): copy pmbr_boot flag
---
libparted/labels/gpt.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
1 file changed, 1 insertion(+)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index bad9ed4..0f07250 100644
index 490de70..25490af 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -562,6 +562,7 @@ gpt_duplicate (const PedDisk *disk)
@@ -556,6 +556,7 @@ gpt_duplicate (const PedDisk *disk)
old_disk_data->data_area.length);
new_disk_data->entry_count = old_disk_data->entry_count;
new_disk_data->uuid = old_disk_data->uuid;
@ -21,5 +21,5 @@ index bad9ed4..0f07250 100644
}
--
1.7.6.5
1.8.3.1

View File

@ -1,33 +1,34 @@
From 166491bd870df6877e04831c9da593e2f8e77ca8 Mon Sep 17 00:00:00 2001
From 516c821481540ca74490ce3374eac2f801c4908d Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 19 Apr 2012 17:11:09 -0700
Subject: [PATCH] tests: test creating 20 device-mapper partitions (#803108)
Subject: [PATCH 54/69] tests: test creating 20 device-mapper partitions
(#803108)
* tests/t6002-dm-many-partitions.sh: Make sure > 17 partitions appear in
* tests/t6004-dm-many-partitions.sh: Make sure > 17 partitions appear in
device mapper.
---
tests/Makefile.am | 1 +
tests/t6002-dm-many-partitions.sh | 60 +++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 0 deletions(-)
create mode 100755 tests/t6002-dm-many-partitions.sh
tests/t6004-dm-many-partitions.sh | 60 +++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
create mode 100755 tests/t6004-dm-many-partitions.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1b37fd9..57771be 100644
index 4ec08da..923839d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -55,6 +55,7 @@ TESTS = \
t5000-tags.sh \
t6000-dm.sh \
@@ -60,6 +60,7 @@ TESTS = \
t6001-psep.sh \
+ t6002-dm-many-partitions.sh \
t6002-dm-busy.sh \
t6003-dm-hide.sh \
+ t6004-dm-many-partitions.sh \
t6100-mdraid-partitions.sh \
t7000-scripting.sh \
t8000-loop.sh \
diff --git a/tests/t6002-dm-many-partitions.sh b/tests/t6002-dm-many-partitions.sh
diff --git a/tests/t6004-dm-many-partitions.sh b/tests/t6004-dm-many-partitions.sh
new file mode 100755
index 0000000..4d08e72
--- /dev/null
+++ b/tests/t6002-dm-many-partitions.sh
+++ b/tests/t6004-dm-many-partitions.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# device-mapper: create many partitions
@ -90,5 +91,5 @@ index 0000000..4d08e72
+
+Exit $fail
--
1.7.7.6
1.8.3.1

View File

@ -0,0 +1,168 @@
From d74a3657dcd9341e54aa28deecf3e21d72cb3207 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 22 Aug 2013 18:08:30 -0700
Subject: [PATCH 55/69] libparted: use dm_udev_wait (#698121)
This is based on Peter Rajnoha's patch to use dm_udev_wait to
synchronize with udev.
This requires libdevmapper v1.02.39 and higher.
mailing list thread:
https://lists.gnu.org/archive/html/bug-parted/2010-09/msg00007.html
* libparted/arch/linux.c (_dm_task_run_wait): New function
(_is_dm_major): Add cookie and change call to _dm_task_run_wait
(_is_dmraid_device): Same
(_dm_is_part): Same
(dm_canonical_path): Same
(_dm_remove_partition): Same
(_dm_get_partition_start_and_length): Same
(_dm_add_partition): Same
(linux_new): Enable udev sync support
---
libparted/arch/linux.c | 52 +++++++++++++++++++++++++++++++++-----------------
1 file changed, 34 insertions(+), 18 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 2bb8774..1c5faa5 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -438,6 +438,17 @@ _is_virtblk_major (int major)
#ifdef ENABLE_DEVICE_MAPPER
static int
+_dm_task_run_wait (struct dm_task *task, uint32_t cookie)
+{
+ int rc = 0;
+
+ rc = dm_task_run (task);
+ dm_udev_wait (cookie);
+
+ return rc;
+}
+
+static int
_is_dm_major (int major)
{
return _major_type_in_devices (major, "device-mapper");
@@ -466,7 +477,7 @@ _dm_maptype (PedDevice *dev)
dm_task_no_open_count(dmt);
- if (!dm_task_run(dmt))
+ if (!dm_task_run (dmt))
goto bad;
dm_get_next_target(dmt, NULL, &start, &length, &target_type, &params);
@@ -519,7 +530,7 @@ _dm_is_part (const char *path)
return 0;
dm_task_set_name(task, path);
- if (!dm_task_run(task))
+ if (!dm_task_run (task))
goto err;
struct dm_info *info = alloca (sizeof *info);
@@ -1398,6 +1409,10 @@ linux_new (const char* path)
dev->dirty = 0;
dev->boot_dirty = 0;
+#ifdef ENABLE_DEVICE_MAPPER
+ dm_udev_set_sync_support(1);
+#endif
+
if (!_device_probe_type (dev))
goto error_free_arch_specific;
@@ -2316,7 +2331,7 @@ dm_canonical_path (PedDevice const *dev)
if (!dm_task_set_major_minor (task, arch_specific->major,
arch_specific->minor, 0))
goto err;
- if (!dm_task_run(task))
+ if (!dm_task_run (task))
goto err;
char *dev_name = zasprintf ("/dev/mapper/%s", dm_task_get_name (task));
if (dev_name == NULL)
@@ -2637,31 +2652,29 @@ _device_get_partition_range(PedDevice const* dev)
static int
_dm_remove_partition(PedDisk* disk, int partno)
{
- int rc;
+ int rc = 0;
+ uint32_t cookie = 0;
char *part_name = _device_get_part_path (disk->dev, partno);
int fd = open (part_name, O_RDONLY | O_EXCL);
if (fd == -1) {
if (errno == ENOENT)
errno = ENXIO; /* nothing to remove, device already doesn't exist */
- free (part_name);
- return 0;
+ goto err;
}
close (fd);
struct dm_task *task = dm_task_create(DM_DEVICE_REMOVE);
- if (!task) {
- free (part_name);
- return 0;
- }
+ if (!task)
+ goto err;
dm_task_set_name (task, part_name);
- rc = dm_task_run(task);
+ if (!dm_task_set_cookie (task, &cookie, 0))
+ goto err;
+ rc = _dm_task_run_wait (task, cookie);
dm_task_update_nodes();
dm_task_destroy(task);
+err:
free (part_name);
- if (!rc)
- return 0;
-
- return 1;
+ return rc;
}
static bool
@@ -2677,7 +2690,7 @@ _dm_get_partition_start_and_length(PedPartition const *part,
char *path = _device_get_part_path (part->disk->dev, part->num);
PED_ASSERT(path);
dm_task_set_name(task, path);
- if (!dm_task_run(task))
+ if (!dm_task_run (task))
goto err;
int major, minor;
@@ -2700,6 +2713,7 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev);
char *params = NULL;
char *vol_name = NULL;
+ uint32_t cookie = 0;
/* Get map name from devicemapper */
struct dm_task *task = dm_task_create (DM_DEVICE_INFO);
@@ -2710,7 +2724,7 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
arch_specific->minor, 0))
goto err;
- if (!dm_task_run(task))
+ if (!dm_task_run (task))
goto err;
const char *dev_name = dm_task_get_name (task);
@@ -2736,7 +2750,9 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
dm_task_set_name (task, vol_name);
dm_task_add_target (task, 0, part->geom.length,
"linear", params);
- if (dm_task_run (task)) {
+ if (!dm_task_set_cookie (task, &cookie, 0))
+ goto err;
+ if (_dm_task_run_wait (task, cookie)) {
dm_task_update_nodes ();
dm_task_destroy (task);
free (params);
--
1.8.3.1

View File

@ -0,0 +1,80 @@
From 2fb2bce8db7e7ea035bd288a8f1c9ef8ad4c0f5b Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 23 Aug 2013 11:45:25 -0700
Subject: [PATCH 56/69] libparted: preserve the uuid on dm partitions (#832145)
* libparted/arch/linux.c (_dm_add_partition): Set the uuid if there was
one.
---
libparted/arch/linux.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 1c5faa5..375be83 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2711,9 +2711,12 @@ static int
_dm_add_partition (PedDisk* disk, const PedPartition* part)
{
LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev);
- char *params = NULL;
- char *vol_name = NULL;
- uint32_t cookie = 0;
+ char* params = NULL;
+ char* vol_name = NULL;
+ const char* dev_name = NULL;
+ char* vol_uuid = NULL;
+ const char* dev_uuid = NULL;
+ uint32_t cookie = 0;
/* Get map name from devicemapper */
struct dm_task *task = dm_task_create (DM_DEVICE_INFO);
@@ -2727,7 +2730,7 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
if (!dm_task_run (task))
goto err;
- const char *dev_name = dm_task_get_name (task);
+ dev_name = dm_task_get_name (task);
size_t name_len = strlen (dev_name);
vol_name = zasprintf ("%s%s%d",
dev_name,
@@ -2736,6 +2739,11 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
if (vol_name == NULL)
goto err;
+ dev_uuid = dm_task_get_uuid (task);
+ if (dev_uuid && (strlen(dev_uuid) > 0)
+ && !(vol_uuid = zasprintf ("part%d-%s", part->num, dev_uuid)))
+ goto err;
+
/* Caution: dm_task_destroy frees dev_name. */
dm_task_destroy (task);
task = NULL;
@@ -2748,6 +2756,8 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
goto err;
dm_task_set_name (task, vol_name);
+ if (vol_uuid)
+ dm_task_set_uuid (task, vol_uuid);
dm_task_add_target (task, 0, part->geom.length,
"linear", params);
if (!dm_task_set_cookie (task, &cookie, 0))
@@ -2756,6 +2766,7 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
dm_task_update_nodes ();
dm_task_destroy (task);
free (params);
+ free (vol_uuid);
free (vol_name);
return 1;
} else {
@@ -2766,6 +2777,7 @@ err:
if (task)
dm_task_destroy (task);
free (params);
+ free (vol_uuid);
free (vol_name);
return 0;
}
--
1.8.3.1

View File

@ -1,33 +1,33 @@
From cc96f793bb4fb088123a40fb9d802e7db1fdbffb Mon Sep 17 00:00:00 2001
From: Brian C. Lane <bcl@redhat.com>
From 06bbbc8aff0c2d495941b36da1dfa24b00eb2bba Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 7 Aug 2012 10:14:03 -0700
Subject: [PATCH] tests: Make sure dm UUIDs are not erased
Subject: [PATCH 57/69] tests: Make sure dm UUIDs are not erased
* tests/t6003-dm-uuid.sh: Make sure dm UUIDs are not erased
* tests/t6005-dm-uuid.sh: Make sure dm UUIDs are not erased
---
tests/Makefile.am | 1 +
tests/t6003-dm-uuid.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 0 deletions(-)
create mode 100755 tests/t6003-dm-uuid.sh
tests/t6005-dm-uuid.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+)
create mode 100755 tests/t6005-dm-uuid.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 57771be..98310f2 100644
index 923839d..57e8642 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -56,6 +56,7 @@ TESTS = \
t6000-dm.sh \
t6001-psep.sh \
t6002-dm-many-partitions.sh \
+ t6003-dm-uuid.sh \
@@ -61,6 +61,7 @@ TESTS = \
t6002-dm-busy.sh \
t6003-dm-hide.sh \
t6004-dm-many-partitions.sh \
+ t6005-dm-uuid.sh \
t6100-mdraid-partitions.sh \
t7000-scripting.sh \
t8000-loop.sh \
diff --git a/tests/t6003-dm-uuid.sh b/tests/t6003-dm-uuid.sh
diff --git a/tests/t6005-dm-uuid.sh b/tests/t6005-dm-uuid.sh
new file mode 100755
index 0000000..1751cb4
index 0000000..f58cb06
--- /dev/null
+++ b/tests/t6003-dm-uuid.sh
@@ -0,0 +1,59 @@
+++ b/tests/t6005-dm-uuid.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+# device-mapper: preserve uuid
+# The dm's partitions uuid would be removed when creating new partitions
@ -66,8 +66,7 @@ index 0000000..1751cb4
+}
+
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$loop_file bs=$ss seek=$ns || framework_failure
+dev=$(losetup --show -f $loop_file) || framework_failure
+dev=$(loop_setup_ $loop_file) || framework_failure
+dmsetup create $dm_name --table "0 $ns linear $dev 0" || framework_failure
+dmsetup rename $dm_name --setuuid f139317b-f98a-45d7-ab3b-9b4e0a336872 || framework_failure
+
@ -88,5 +87,5 @@ index 0000000..1751cb4
+
+Exit $fail
--
1.7.7.6
1.8.3.1

View File

@ -1,6 +1,7 @@
Subject: [PATCH] libparted: add support for implicit FBA DASD partitions
From 1b8d3ef06b3ea813bb02f6ef85d77a4162d57064 Mon Sep 17 00:00:00 2001
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
Date: Wed, 21 Aug 2013 16:09:56 -0700
Subject: [PATCH 58/69] libparted: add support for implicit FBA DASD partitions
Fixed Block Access (FBA) DASDs are mainframe-specific disk devices
which are layed out as a sequence of 512-byte sectors. In contrast
@ -19,15 +20,16 @@ to parted.
Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
---
include/parted/fdasd.h | 2 +
include/parted/fdasd.in.h | 2 ++
libparted/labels/dasd.c | 63 ++++++++++++++++++++++++++++++++++++++++-------
libparted/labels/fdasd.c | 5 +++
libparted/labels/fdasd.c | 5 ++++
3 files changed, 61 insertions(+), 9 deletions(-)
--- a/include/parted/fdasd.h
+++ b/include/parted/fdasd.h
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
index ac30134..a755246 100644
--- a/include/parted/fdasd.in.h
+++ b/include/parted/fdasd.in.h
@@ -194,6 +194,8 @@ typedef struct fdasd_anchor {
volume_label_t *vlabel;
config_data_t confdata[USABLE_PARTITIONS];
@ -37,6 +39,8 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
} fdasd_anchor_t;
enum offset {lower, upper};
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index a769866..b4e80b1 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -71,6 +71,7 @@ typedef struct {
@ -157,9 +161,11 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
/*
For LDL or CMS there may be trailing metadata as well.
For example: the last block of a CMS reserved file,
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index e235dd3..f92065f 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -721,6 +721,7 @@ fdasd_check_volume (fdasd_anchor_t *anc,
@@ -721,6 +721,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd)
unsigned long b = -1;
char str[LINE_LENGTH];
@ -167,7 +173,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
vtoc_read_volume_label (fd, anc->label_pos, v);
if (strncmp(v->vollbl, vtoc_ebcdic_enc ("VOL1", str, 4), 4) == 0) {
@@ -800,6 +801,8 @@ fdasd_get_geometry (const PedDevice *dev
@@ -800,6 +801,8 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
dasd_info.dev_type = 13200;
dasd_info.label_block = 2;
dasd_info.devno = 513;
@ -176,7 +182,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
} else {
if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
fdasd_error(anc, unable_to_ioctl,
@@ -820,6 +823,8 @@ fdasd_get_geometry (const PedDevice *dev
@@ -820,6 +823,8 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
anc->label_pos = dasd_info.label_block * blksize;
anc->devno = dasd_info.devno;
anc->fspace_trk = anc->geo.cylinders * anc->geo.heads - FIRST_USABLE_TRK;
@ -185,3 +191,6 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
}
/*
--
1.8.3.1

View File

@ -1,6 +1,7 @@
Subject: [PATCH] libparted: add support for EAV DASD partitions
From 72e2982d5767be628fd9380ce9f16ba2d2f474ae Mon Sep 17 00:00:00 2001
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
Date: Wed, 21 Aug 2013 16:27:13 -0700
Subject: [PATCH 59/69] libparted: add support for EAV DASD partitions
Extended Address Volume (EAV) DASDs are ECKD DASDs with more than
65520 cylinders. This patch adds support for recognizing and
@ -12,17 +13,18 @@ s390-tools package.
Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
---
include/parted/fdasd.h | 89 ++++++++++++++++--
include/parted/vtoc.h | 58 ++++++++++--
libparted/labels/dasd.c | 1
libparted/labels/fdasd.c | 226 ++++++++++++++++++++++++++++++++---------------
include/parted/fdasd.in.h | 89 +++++++++++++++---
include/parted/vtoc.in.h | 59 ++++++++++--
libparted/labels/dasd.c | 1 +
libparted/labels/fdasd.c | 226 ++++++++++++++++++++++++++++++++--------------
libparted/labels/vtoc.c | 173 ++++++++++++++++++++++++++++++-----
5 files changed, 435 insertions(+), 112 deletions(-)
5 files changed, 436 insertions(+), 112 deletions(-)
--- a/include/parted/fdasd.h
+++ b/include/parted/fdasd.h
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
index a755246..b4e7dd1 100644
--- a/include/parted/fdasd.in.h
+++ b/include/parted/fdasd.in.h
@@ -74,6 +74,80 @@ typedef struct dasd_information_t {
char configuration_data[256]; /* from read_configuration_data */
} dasd_information_t;
@ -137,14 +139,16 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
struct fdasd_hd_geometry geo;
unsigned int label_block;
unsigned int FBA_layout;
--- a/include/parted/vtoc.h
+++ b/include/parted/vtoc.h
@@ -42,7 +42,18 @@
diff --git a/include/parted/vtoc.in.h b/include/parted/vtoc.in.h
index d79ce39..499c2d3 100644
--- a/include/parted/vtoc.in.h
+++ b/include/parted/vtoc.in.h
@@ -42,6 +42,18 @@
#define VOLSER_LENGTH 6
#define BIG_DISK_SIZE 0x10000
+#define LV_COMPAT_CYL 0xFFFE
+
+/*****************************************************************************
+ * SECTION: Definition from hdreq.h *
+ *****************************************************************************/
@ -156,9 +160,9 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
+ unsigned long start;
+};
typedef struct ttr ttr_t;
typedef struct cchhb cchhb_t;
@@ -59,6 +70,7 @@ typedef struct ds5ext ds5ext_t
@@ -59,6 +71,7 @@ typedef struct ds5ext ds5ext_t;
typedef struct format5_label format5_label_t;
typedef struct ds7ext ds7ext_t;
typedef struct format7_label format7_label_t;
@ -166,7 +170,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
struct __attribute__ ((packed)) ttr {
u_int16_t tt;
@@ -169,6 +181,10 @@ struct __attribute__ ((packed)) dev_cons
@@ -169,6 +182,10 @@ struct __attribute__ ((packed)) dev_const {
u_int8_t DS4DEVDB; /* number of directory blocks per track */
};
@ -177,7 +181,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
struct __attribute__ ((packed)) format1_label {
char DS1DSNAM[44]; /* data set name */
u_int8_t DS1FMTID; /* format identifier */
@@ -229,7 +245,11 @@ struct __attribute__ ((packed)) format4_
@@ -229,7 +246,11 @@ struct __attribute__ ((packed)) format4_label {
char res2[10]; /* reserved */
u_int8_t DS4EFLVL; /* extended free-space management level */
cchhb_t DS4EFPTR; /* pointer to extended free-space info */
@ -190,7 +194,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
};
struct __attribute__ ((packed)) ds5ext {
@@ -261,12 +281,28 @@ struct __attribute__ ((packed)) format7_
@@ -261,12 +282,28 @@ struct __attribute__ ((packed)) format7_label {
cchhb_t DS7PTRDS; /* pointer to next FMT7 DSCB */
};
@ -221,7 +225,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
void vtoc_set_date (labeldate_t *d, u_int8_t year, u_int16_t day);
void vtoc_volume_label_init (volume_label_t *vlabel);
@@ -295,14 +331,16 @@ void vtoc_write_label (int fd, unsigned
@@ -295,14 +332,16 @@ void vtoc_write_label (int fd, unsigned long position,
format1_label_t const *f1,
format4_label_t const *f4,
format5_label_t const *f5,
@ -240,7 +244,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
unsigned int tracks,
unsigned int blocks,
unsigned int blksize,
@@ -329,8 +367,16 @@ void vtoc_update_format7_label_add (form
@@ -329,8 +368,16 @@ void vtoc_update_format7_label_add (format7_label_t *f7, int verbose,
void vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
u_int32_t a, u_int32_t b);
@ -258,6 +262,8 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
+ u_int32_t trk);
#endif /* VTOC_H */
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index b4e80b1..081b3c5 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -631,6 +631,7 @@ dasd_write (const PedDisk* disk)
@ -268,9 +274,11 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
memcpy(anchor.vlabel, &disk_specific->vlabel, sizeof(volume_label_t));
anchor.vlabel_changed++;
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index f92065f..2735b2a 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -59,6 +59,48 @@ setpos (fdasd_anchor_t *anc, int dsn, in
@@ -59,6 +59,48 @@ setpos (fdasd_anchor_t *anc, int dsn, int pos)
anc->partno[dsn] = pos;
}
@ -335,7 +343,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
free(p);
p = q;
}
@@ -154,17 +198,6 @@ fdasd_error (fdasd_anchor_t *anc, enum f
@@ -154,17 +198,6 @@ fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char const *str)
}
/*
@ -353,7 +361,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
* initializes the anchor structure and allocates some
* memory for the labels
*/
@@ -216,9 +249,16 @@ fdasd_initialize_anchor (fdasd_anchor_t
@@ -216,9 +249,16 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
if (anc->f7 == NULL)
fdasd_error(anc, malloc_failed, "FMT7 DSCB.");
@ -370,7 +378,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
v = malloc(sizeof(volume_label_t));
if (v == NULL)
@@ -259,6 +299,8 @@ fdasd_initialize_anchor (fdasd_anchor_t
@@ -259,6 +299,8 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
q = p;
}
@ -379,7 +387,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
}
/*
@@ -269,44 +311,46 @@ fdasd_write_vtoc_labels (fdasd_anchor_t
@@ -269,44 +311,46 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd)
{
PDEBUG
partition_info_t *p;
@ -436,7 +444,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
/* re-use the existing data set name */
c2 = strchr (c1, '.');
if (c2 != NULL)
@@ -325,11 +369,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t
@@ -325,11 +369,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd)
while (getpos (anc, k) > -1)
k++;
@ -449,7 +457,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
strncpy (ch, "LINUX.V " " ", 44);
@@ -366,8 +406,32 @@ fdasd_write_vtoc_labels (fdasd_anchor_t
@@ -366,8 +406,32 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd)
vtoc_ebcdic_enc (ch, ch, 44);
@ -515,7 +523,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
/* re-use the existing data set name */
c2 = strchr (c1, '.');
if (c2 != NULL)
@@ -426,11 +495,7 @@ fdasd_prepare_labels (fdasd_anchor_t *an
@@ -426,11 +495,7 @@ fdasd_prepare_labels (fdasd_anchor_t *anc, int fd)
while (getpos (anc, k) > -1)
k++;
@ -528,7 +536,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
strncpy (ch, "LINUX.V " " ", 44);
@@ -466,7 +531,6 @@ fdasd_prepare_labels (fdasd_anchor_t *an
@@ -466,7 +531,6 @@ fdasd_prepare_labels (fdasd_anchor_t *anc, int fd)
}
vtoc_ebcdic_enc (ch, ch, 44);
@ -536,7 +544,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
}
return 1;
@@ -482,6 +546,7 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc
@@ -482,6 +546,7 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc)
vtoc_init_format4_label(anc->f4,
USABLE_PARTITIONS,
anc->geo.cylinders,
@ -544,7 +552,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
anc->geo.heads,
anc->geo.sectors,
anc->blksize,
@@ -492,8 +557,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc
@@ -492,8 +557,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc)
vtoc_set_freespace(anc->f4, anc->f5, anc->f7,
'+', anc->verbose,
FIRST_USABLE_TRK,
@ -555,7 +563,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
for (i = 0; i < USABLE_PARTITIONS; i++) {
bzero(p->f1, sizeof(format1_label_t));
@@ -507,7 +572,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc
@@ -507,7 +572,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc)
}
anc->used_partitions = 0;
@ -565,7 +573,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
for (i=0; i<USABLE_PARTITIONS; i++)
setpos(anc, i, -1);
@@ -526,15 +592,15 @@ fdasd_update_partition_info (fdasd_ancho
@@ -526,15 +592,15 @@ fdasd_update_partition_info (fdasd_anchor_t *anc)
{
PDEBUG
partition_info_t *q = NULL, *p = anc->first;
@ -584,7 +592,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
if (i == 1)
/* there is no partition at all */
anc->fspace_trk = max - FIRST_USABLE_TRK + 1;
@@ -546,8 +612,8 @@ fdasd_update_partition_info (fdasd_ancho
@@ -546,8 +612,8 @@ fdasd_update_partition_info (fdasd_anchor_t *anc)
/* this is a valid format 1 label */
p->used = 0x01;
@ -595,7 +603,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
p->len_trk = p->end_trk - p->start_trk + 1;
if (i == 1) {
@@ -618,14 +684,22 @@ fdasd_process_valid_vtoc (fdasd_anchor_t
@@ -618,14 +684,22 @@ fdasd_process_valid_vtoc (fdasd_anchor_t * anc, unsigned long b, int fd)
format1_label_t q;
char s[5], *ch;
@ -619,7 +627,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
if (p == NULL)
break;
memcpy (p->f1, &q, f1size);
@@ -669,6 +743,12 @@ fdasd_process_valid_vtoc (fdasd_anchor_t
@@ -669,6 +743,12 @@ fdasd_process_valid_vtoc (fdasd_anchor_t * anc, unsigned long b, int fd)
memcpy (anc->f7, &q, f1size);
f7_counter++;
break;
@ -632,7 +640,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
}
b += anc->blksize;
@@ -718,7 +798,7 @@ fdasd_check_volume (fdasd_anchor_t *anc,
@@ -718,7 +798,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd)
{
PDEBUG
volume_label_t *v = anc->vlabel;
@ -641,7 +649,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
char str[LINE_LENGTH];
memset(v, 0, sizeof(volume_label_t));
@@ -784,6 +864,7 @@ fdasd_get_geometry (const PedDevice *dev
@@ -784,6 +864,7 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
PDEBUG
int blksize = 0;
dasd_information_t dasd_info;
@ -649,7 +657,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
/* We can't get geometry from a regular file,
so simulate something usable, for the sake of testing. */
@@ -803,6 +884,8 @@ fdasd_get_geometry (const PedDevice *dev
@@ -803,6 +884,8 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
dasd_info.devno = 513;
dasd_info.label_block = 2;
dasd_info.FBA_layout = 0;
@ -658,7 +666,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
} else {
if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
fdasd_error(anc, unable_to_ioctl,
@@ -816,13 +899,20 @@ fdasd_get_geometry (const PedDevice *dev
@@ -816,13 +899,20 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
if (ioctl(f, BIODASDINFO, &dasd_info) != 0)
fdasd_error(anc, unable_to_ioctl,
_("Could not retrieve disk information."));
@ -680,7 +688,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
anc->label_block = dasd_info.label_block;
anc->FBA_layout = dasd_info.FBA_layout;
}
@@ -850,20 +940,17 @@ fdasd_get_partition_data (fdasd_anchor_t
@@ -850,20 +940,17 @@ fdasd_get_partition_data (fdasd_anchor_t *anc, extent_t *part_extent,
unsigned int *stop_ptr)
{
PDEBUG
@ -705,7 +713,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
h = anc->f4->DS4DEVCT.DS4DSTRK;
limit = (h * c - 1);
@@ -1019,7 +1106,6 @@ fdasd_add_partition (fdasd_anchor_t *anc
@@ -1019,7 +1106,6 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start,
cchhb_t hf1;
partition_info_t *p;
extent_t ext;
@ -713,7 +721,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
PDEBUG;
@@ -1032,8 +1118,14 @@ fdasd_add_partition (fdasd_anchor_t *anc
@@ -1032,8 +1118,14 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start,
if (fdasd_get_partition_data(anc, &ext, p, &start, &stop) != 0)
return 0;
@ -730,7 +738,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
PDEBUG;
fdasd_enqueue_new_partition(anc);
@@ -1041,23 +1133,17 @@ fdasd_add_partition (fdasd_anchor_t *anc
@@ -1041,23 +1133,17 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start,
PDEBUG;
anc->used_partitions += 1;
@ -758,9 +766,11 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
anc->vtoc_changed++;
diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c
index cf2990e..fdfa94f 100644
--- a/libparted/labels/vtoc.c
+++ b/libparted/labels/vtoc.c
@@ -218,11 +218,32 @@ vtoc_set_extent (extent_t *ext, u_int8_t
@@ -218,11 +218,32 @@ vtoc_set_extent (extent_t *ext, u_int8_t typeind, u_int8_t seqno,
}
void
@ -796,7 +806,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
}
static void
@@ -234,12 +255,63 @@ vtoc_set_ttr (ttr_t *addr, u_int16_t tt,
@@ -234,12 +255,63 @@ vtoc_set_ttr (ttr_t *addr, u_int16_t tt, u_int8_t r)
}
void
@ -864,7 +874,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
}
void
@@ -506,7 +578,8 @@ vtoc_write_label (int f, unsigned long p
@@ -506,7 +578,8 @@ vtoc_write_label (int f, unsigned long position,
format1_label_t const *f1,
format4_label_t const *f4,
format5_label_t const *f5,
@ -874,7 +884,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
{
PDEBUG
int t;
@@ -542,6 +615,17 @@ vtoc_write_label (int f, unsigned long p
@@ -542,6 +615,17 @@ vtoc_write_label (int f, unsigned long position,
vtoc_error(unable_to_write, "vtoc_write_label",
_("Could not write VTOC FMT7 DSCB."));
}
@ -892,7 +902,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
}
/*
@@ -549,7 +633,8 @@ vtoc_write_label (int f, unsigned long p
@@ -549,7 +633,8 @@ vtoc_write_label (int f, unsigned long position,
*/
void
vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions,
@ -902,7 +912,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
unsigned int blocks, unsigned int blksize,
u_int16_t dev_type)
{
@@ -574,7 +659,7 @@ vtoc_init_format4_label (format4_label_t
@@ -574,7 +659,7 @@ vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions,
f4->DS4DEVAC = 0x00;
/* -- begin f4->DS4DEVCT -- */
@ -911,7 +921,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
f4->DS4DEVCT.DS4DSTRK = tracks;
switch (dev_type) {
@@ -613,7 +698,11 @@ vtoc_init_format4_label (format4_label_t
@@ -613,7 +698,11 @@ vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions,
bzero(f4->res2, sizeof(f4->res2));
f4->DS4EFLVL = 0x00;
bzero(&f4->DS4EFPTR, sizeof(f4->DS4EFPTR));
@ -924,7 +934,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
}
/*
@@ -647,11 +736,12 @@ vtoc_init_format7_label (format7_label_t
@@ -647,11 +736,12 @@ vtoc_init_format7_label (format7_label_t *f7)
}
/*
@ -940,7 +950,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
{
PDEBUG
struct tm * creatime;
@@ -666,7 +756,6 @@ vtoc_init_format1_label (char *volid, un
@@ -666,7 +756,6 @@ vtoc_init_format1_label (char *volid, unsigned int blksize,
sprintf(str, "PART .NEW ");
vtoc_ebcdic_enc(str, str, 44);
strncpy(f1->DS1DSNAM, str, 44);
@ -948,7 +958,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
strncpy(f1->DS1DSSN, " ", 6);
f1->DS1VOLSQ = 0x0001;
@@ -704,6 +793,37 @@ vtoc_init_format1_label (char *volid, un
@@ -704,6 +793,37 @@ vtoc_init_format1_label (char *volid, unsigned int blksize,
vtoc_set_cchhb(&f1->DS1PTRDS, 0x0000, 0x0000, 0x00);
}
@ -986,7 +996,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
/*
* do some updates to the VTOC format4 label
*/
@@ -1060,7 +1180,7 @@ vtoc_update_format7_label_add (format7_l
@@ -1060,7 +1180,7 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose,
if ((ext->a + ext->b) == 0x00000000)
continue;
@ -995,7 +1005,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
/* this extent precedes the new one */
ext->b = tmp->b;
bzero(tmp, sizeof(ds7ext_t));
@@ -1074,7 +1194,7 @@ vtoc_update_format7_label_add (format7_l
@@ -1074,7 +1194,7 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose,
continue;
}
@ -1004,7 +1014,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
/* this extent succeeds the new one */
ext->a = tmp->a;
bzero(tmp, sizeof(ds7ext_t));
@@ -1119,7 +1239,7 @@ vtoc_update_format7_label_del (format7_l
@@ -1119,7 +1239,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
if ((a == ext->a) && (b < ext->b)) {
/* left-bounded in free space gap */
@ -1013,7 +1023,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
if (verbose)
puts ("FMT7 add extent: left-bounded");
@@ -1130,7 +1250,7 @@ vtoc_update_format7_label_del (format7_l
@@ -1130,7 +1250,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
if ((a > ext->a) && (b == ext->b)) {
/* right-bounded in free space gap */
@ -1022,7 +1032,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
if (verbose)
puts ("FMT7 add extent: right-bounded");
@@ -1141,8 +1261,8 @@ vtoc_update_format7_label_del (format7_l
@@ -1141,8 +1261,8 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
if ((a > ext->a) && (b < ext->b)) {
/* partition devides free space into 2 pieces */
@ -1033,7 +1043,7 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
if (verbose)
puts ("FMT7 add extent: 2 pieces");
@@ -1172,14 +1292,19 @@ vtoc_update_format7_label_del (format7_l
@@ -1172,14 +1292,19 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
void
vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5,
format7_label_t *f7, char ch, int verbose,
@ -1056,3 +1066,6 @@ Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
else
puts ("BUG: syntax error in vtoc_set_freespace call");
--
1.8.3.1

View File

@ -1,6 +1,7 @@
Subject: [PATCH] libparted: mklabel to support EAV DASD
From 4e9468fe51b6183936a7564dc51da389b89fe15d Mon Sep 17 00:00:00 2001
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
Date: Wed, 21 Aug 2013 16:36:08 -0700
Subject: [PATCH 60/69] libparted: mklabel to support EAV DASD
Extended Address Volume (EAV) DASDs are ECKD DASDs with more than
65520 cylinders. This patch adds support for mklabel to properly
@ -8,13 +9,15 @@ handle unformatted EAV DASDs.
Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
---
include/parted/fdasd.h | 1
libparted/labels/fdasd.c | 92 +++++++++++++++++++++++++++++++++++++++++++++-
include/parted/fdasd.in.h | 1 -
libparted/labels/fdasd.c | 92 +++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 90 insertions(+), 3 deletions(-)
--- a/include/parted/fdasd.h
+++ b/include/parted/fdasd.h
@@ -288,7 +288,6 @@ void fdasd_get_geometry (const PedDevice
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
index b4e7dd1..3692596 100644
--- a/include/parted/fdasd.in.h
+++ b/include/parted/fdasd.in.h
@@ -288,7 +288,6 @@ void fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int fd);
void fdasd_check_api_version (fdasd_anchor_t *anc, int fd);
int fdasd_check_volume (fdasd_anchor_t *anc, int fd);
int fdasd_write_labels (fdasd_anchor_t *anc, int fd);
@ -22,9 +25,11 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
void fdasd_recreate_vtoc(fdasd_anchor_t *anc);
partition_info_t * fdasd_add_partition (fdasd_anchor_t *anc,
unsigned int start, unsigned int stop);
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index 2735b2a..b58b2be 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -581,6 +581,22 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc
@@ -581,6 +581,22 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc)
anc->vtoc_changed++;
}
@ -47,7 +52,7 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
/*
* sets some important partition data
* (like used, start_trk, end_trk, len_trk)
@@ -769,6 +785,52 @@ fdasd_process_valid_vtoc (fdasd_anchor_t
@@ -769,6 +785,52 @@ fdasd_process_valid_vtoc (fdasd_anchor_t * anc, unsigned long b, int fd)
fdasd_update_partition_info (anc);
}
@ -100,7 +105,7 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
static int
fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd)
{
@@ -781,6 +843,8 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t
@@ -781,6 +843,8 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd)
if (anc->f4->DS4IDFMT == 0xf4) {
fdasd_process_valid_vtoc (anc, b, fd);
return 0;
@ -109,7 +114,7 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
}
if (strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("LNX1",str,4),4) == 0 ||
strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("CMS1",str,4),4) == 0)
@@ -817,13 +881,37 @@ fdasd_check_volume (fdasd_anchor_t *anc,
@@ -817,13 +881,37 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd)
else
return 0;
} else {
@ -119,6 +124,7 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
} else if (strncmp (v->volkey, vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0 ||
strncmp (v->volkey, vtoc_ebcdic_enc ("CMS1", str, 4), 4) == 0) {
return 0;
- }
+ } else if (anc->FBA_layout == 1) {
+ /* Some times LDL formatted disks does not
+ contain any volume label */
@ -130,7 +136,7 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
+ - FIRST_USABLE_TRK;
+
+ fdasd_init_volume_label(anc, fd);
+
+ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
+ anc->geo.cylinders, anc->formatted_cylinders,
+ anc->geo.heads, anc->geo.sectors,
@ -144,8 +150,10 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
+ anc->formatted_cylinders * anc->geo.heads - 1,
+ anc->formatted_cylinders, anc->geo.heads);
+ return 0;
}
-
+ }
return 1;
}
--
1.8.3.1

View File

@ -1,18 +1,21 @@
Subject: [PATCH] libparted: Avoid dasd as default disk type while probe
From 0dadb22c962c33149dbce5808ebfb43cc799c242 Mon Sep 17 00:00:00 2001
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
Date: Wed, 21 Aug 2013 16:37:17 -0700
Subject: [PATCH 61/69] libparted: Avoid dasd as default disk type while probe
This patch avoids setting 'dasd' as a default disk type for
'disk image file' at the time of probe.
Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
---
include/parted/fdasd.h | 1 +
include/parted/fdasd.in.h | 1 +
libparted/labels/fdasd.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
--- a/include/parted/fdasd.h
+++ b/include/parted/fdasd.h
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
index 3692596..6f6a7e0 100644
--- a/include/parted/fdasd.in.h
+++ b/include/parted/fdasd.in.h
@@ -261,6 +261,7 @@ typedef struct fdasd_anchor {
struct fdasd_hd_geometry geo;
unsigned int label_block;
@ -21,9 +24,11 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
} fdasd_anchor_t;
enum offset {lower, upper};
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index b58b2be..7de5f34 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -301,6 +301,7 @@ fdasd_initialize_anchor (fdasd_anchor_t
@@ -301,6 +301,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
}
anc->hw_cylinders = 0;
anc->formatted_cylinders = 0;
@ -31,7 +36,7 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
}
/*
@@ -892,7 +893,7 @@ fdasd_check_volume (fdasd_anchor_t *anc,
@@ -890,7 +891,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd)
/* Some times LDL formatted disks does not
contain any volume label */
return 1;
@ -40,7 +45,7 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
/* didn't find VOL1 volume label */
anc->formatted_cylinders = anc->hw_cylinders;
anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads
@@ -976,6 +977,7 @@ fdasd_get_geometry (const PedDevice *dev
@@ -974,6 +975,7 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
dasd_info.FBA_layout = 0;
anc->hw_cylinders = ((st.st_size / blksize) / anc->geo.sectors) /
anc->geo.heads;
@ -48,7 +53,7 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
} else {
if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
fdasd_error(anc, unable_to_ioctl,
@@ -997,6 +999,8 @@ fdasd_get_geometry (const PedDevice *dev
@@ -995,6 +997,8 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
anc->hw_cylinders = characteristics->long_no_cyl;
else
anc->hw_cylinders = characteristics->no_cyl;
@ -57,3 +62,6 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
}
anc->dev_type = dasd_info.dev_type;
--
1.8.3.1

View File

@ -1,6 +1,7 @@
Subject: [PATCH] libparted: mklabel to support EDEV DASD
From b4758f5b4af423174871a68c235d20a646f4807b Mon Sep 17 00:00:00 2001
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
Date: Wed, 21 Aug 2013 16:37:17 -0700
Subject: [PATCH 62/69] libparted: mklabel to support EDEV DASD
Fixed Block Access (FBA) DASDs are mainframe-specific disk devices
which are layed out as a sequence of 512-byte sectors. This patch adds
@ -8,34 +9,38 @@ support for mklabel to properly handle FBA devices.
Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
---
libparted/labels/fdasd.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
libparted/labels/fdasd.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index 7de5f34..1f87937 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -869,19 +869,21 @@ fdasd_check_volume (fdasd_anchor_t *anc,
@@ -870,19 +870,21 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd)
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 (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 (rc < 0)
+ return 1;
+ else
@ -46,3 +51,6 @@ Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
}
} else if (strncmp (v->volkey, vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0 ||
strncmp (v->volkey, vtoc_ebcdic_enc ("CMS1", str, 4), 4) == 0) {
--
1.8.3.1

View File

@ -1,7 +1,7 @@
From c17f0c2e68960969789427eca20ddab1b8e4fcc6 Mon Sep 17 00:00:00 2001
From 73ed3e0ba21afec398f3b1cfb6ee013cf4ce3fc2 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 1 Nov 2012 16:22:42 -0700
Subject: [PATCH] libparted: don't canonicalize /dev/md/ paths (#872361)
Subject: [PATCH 63/69] libparted: don't canonicalize /dev/md/ paths (#872361)
This is the same issue we have with /dev/mapper/ paths that was fixed in
commit c1eb485b9fd8919e18f192d678bc52b0488e6ee0. When libparted
@ -33,5 +33,5 @@ index 738b320..cdcc117 100644
if (!normal_path)
/* Well, maybe it is just that the file does not exist.
--
1.7.11.7
1.8.3.1

View File

@ -1,27 +1,21 @@
From 7d4947fd094f1dda491473a57a9275971405684e Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <parted-owner@fedoraproject.org>
From ea9d81655bbcd5e125ae6bd36a7ac0b95b00ec15 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 17 Apr 2013 14:59:36 -0700
Subject: [PATCH] tests: rewrite t6001 to use /dev/mapper
Subject: [PATCH 64/69] tests: rewrite t6001 to use /dev/mapper
This test begain failing because using a private copy of /dev/mapper
This test began 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(-)
tests/t6001-psep.sh | 42 +++++++++++++++++-------------------------
1 file changed, 17 insertions(+), 25 deletions(-)
diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh
index 1859ac9..0c1ab99 100644
index da6b8a1..809ff9e 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 @@
@@ -19,10 +19,7 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
require_root_
@ -33,25 +27,25 @@ index 1859ac9..0c1ab99 100644
# Device maps names - should be random to not conflict with existing ones on
# the system
@@ -41,25 +39,19 @@ cleanup_fn_() {
@@ -41,25 +38,19 @@ cleanup_fn_() {
rm -f "$f1 $f2";
}
-# create a file of size N bytes
-N=10M
-
-f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
- || skip_ "is this partition mounted with 'nodev'?"
+loop_file_1=loop-file-1-$$
+loop_file_2=loop-file-2-$$
-f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
-f2=$(pwd)/2 ;d2=$(loop_setup_ "$f2") \
- || 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
@ -68,7 +62,7 @@ index 1859ac9..0c1ab99 100644
compare /dev/null out || fail=1
#make sure device name is correct
@@ -67,17 +59,18 @@ test -e ${dev}p1 || fail=1
@@ -67,17 +58,18 @@ test -e ${dev}p1 || fail=1
#repeat on name not ending in a digit
# setup: create a mapping
@ -94,5 +88,5 @@ index 1859ac9..0c1ab99 100644
+
Exit $fail
--
1.8.1.4
1.8.3.1

View File

@ -0,0 +1,384 @@
From e6a23531e0cb40c2cc75f1e8fbb86ab872cb6f1b Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 26 Aug 2013 16:27:00 -0700
Subject: [PATCH 65/69] libparted: Add Intel Rapid Start Technology partition
flag.
This adds support for the irst partition type flag. Sets the type to
0x84 on MS-DOS and D3BFE2DE-3DAF-11DF-BA-40-E3A556D89593 on GPT.
* NEWS (Changes in behavior): Mention it.
* doc/C/parted.8: Document irst flag.
* doc/parted.texti: Document irst flag.
* include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_IRST flag
* libparted/disk.c (ped_partition_flag_get_name): Add irst flag
* libparted/labels/dos.c (DosPartitionData): Likewise
(raw_part_parse): Likewise
(msdos_partition_new): Likewise
(msdos_partition_duplicate): Likewise
(msdos_partition_set_system): Likewise
(clear_flags): Likewise
(msdos_partition_set_flag): Likewise
(msdos_partition_get_flag): Likewise
(msdos_partition_is_flag_available): Likewise
* libparted/labels/gpt.c: Add PARTITION_IRST_GUID
(GPTPartitionData): Add irst flag
(_parse_part_entry): Likewise
(gpt_partition_new): Likewise
(gpt_partition_set_system): Likewise
(gpt_partition_set_flag): Likewise
(gpt_partition_get_flag): Likewise
(gpt_partition_is_flag_available): Likewise
---
NEWS | 4 ++++
doc/C/parted.8 | 2 +-
doc/parted.texi | 4 ++++
include/parted/disk.in.h | 5 +++--
libparted/disk.c | 2 ++
libparted/labels/dos.c | 21 +++++++++++++++++++++
libparted/labels/gpt.c | 39 +++++++++++++++++++++++++++++++++++++++
7 files changed, 74 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 98f7c6e..b53a9d0 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,10 @@ GNU parted NEWS -*- outline -*-
** Changes in behavior
+ Added new partition type flag, irst, for use with Intel Rapid Start
+ Technology. On MS-DOS disk labels it sets the type to 0x84 and on GPT
+ it sets the GUID to D3BFE2DE-3DAF-11DF-BA-40-E3A556D89593.
+
parted -l no longer lists device-mapper devices other than
dmraid whole disks.
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index a9f73f5..2f8e9f5 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -104,7 +104,7 @@ or an LVM logical volume if necessary.
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
-"legacy_boot" and "palo".
+"legacy_boot", "irst" and "palo".
\fIstate\fP should be either "on" or "off".
.TP
.B unit \fIunit\fP
diff --git a/doc/parted.texi b/doc/parted.texi
index 008c383..fd8ccb9 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -836,6 +836,10 @@ used by Windows on GPT disks. Note that this flag should not normally be
set on Windows filesystem partitions (those that contain NTFS or FAT
filesystems).
+@item irst
+(MS-DOS, GPT) - this flag identifies an Intel Rapid Start Technology
+partition.
+
@item lba
(MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
MS Windows ME based operating systems to use Linear (LBA) mode.
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index aa905c5..585383d 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -73,10 +73,11 @@ enum _PedPartitionFlag {
PED_PARTITION_APPLE_TV_RECOVERY=13,
PED_PARTITION_DIAG=14,
PED_PARTITION_LEGACY_BOOT=15,
- PED_PARTITION_MSFT_DATA=16
+ PED_PARTITION_MSFT_DATA=16,
+ PED_PARTITION_IRST=17
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_MSFT_DATA
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_IRST
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index d3cd5bb..4ca7255 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2441,6 +2441,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("diag");
case PED_PARTITION_LEGACY_BOOT:
return N_("legacy_boot");
+ case PED_PARTITION_IRST:
+ return N_("irst");
default:
ped_exception_throw (
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index b8c161f..f8591ff 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -85,6 +85,7 @@ static const char MBR_BOOT_CODE[] = {
#define PARTITION_LDM 0x42
#define PARTITION_LINUX_SWAP 0x82
#define PARTITION_LINUX 0x83
+#define PARTITION_IRST 0x84
#define PARTITION_LINUX_EXT 0x85
#define PARTITION_LINUX_LVM 0x8e
#define PARTITION_HFS 0xaf
@@ -159,6 +160,7 @@ typedef struct {
int palo;
int prep;
int diag;
+ int irst;
OrigState* orig; /* used for CHS stuff */
} DosPartitionData;
@@ -924,6 +926,7 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part,
dos_data->lba = raw_part_is_lba (raw_part);
dos_data->palo = raw_part->type == PARTITION_PALO;
dos_data->prep = raw_part->type == PARTITION_PREP;
+ dos_data->irst = raw_part->type == PARTITION_IRST;
dos_data->orig = ped_malloc (sizeof (OrigState));
if (!dos_data->orig) {
ped_partition_destroy (part);
@@ -1326,6 +1329,7 @@ msdos_partition_new (const PedDisk* disk, PedPartitionType part_type,
dos_data->lba = 0;
dos_data->palo = 0;
dos_data->prep = 0;
+ dos_data->irst = 0;
} else {
part->disk_specific = NULL;
}
@@ -1361,6 +1365,7 @@ msdos_partition_duplicate (const PedPartition* part)
new_dos_data->lba = old_dos_data->lba;
new_dos_data->palo = old_dos_data->palo;
new_dos_data->prep = old_dos_data->prep;
+ new_dos_data->irst = old_dos_data->irst;
if (old_dos_data->orig) {
new_dos_data->orig = ped_malloc (sizeof (OrigState));
@@ -1409,6 +1414,7 @@ msdos_partition_set_system (PedPartition* part,
dos_data->lvm = 0;
dos_data->palo = 0;
dos_data->prep = 0;
+ dos_data->irst = 0;
if (dos_data->lba)
dos_data->system = PARTITION_EXT_LBA;
else
@@ -1441,6 +1447,10 @@ msdos_partition_set_system (PedPartition* part,
dos_data->system = PARTITION_PREP;
return 1;
}
+ if (dos_data->irst) {
+ dos_data->system = PARTITION_IRST;
+ return 1;
+ }
if (!fs_type)
dos_data->system = PARTITION_LINUX;
@@ -1477,6 +1487,7 @@ clear_flags (DosPartitionData *dos_data)
dos_data->lvm = 0;
dos_data->palo = 0;
dos_data->prep = 0;
+ dos_data->irst = 0;
dos_data->raid = 0;
}
@@ -1555,6 +1566,12 @@ msdos_partition_set_flag (PedPartition* part,
dos_data->prep = state;
return ped_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_IRST:
+ if (state)
+ clear_flags (dos_data);
+ dos_data->irst = state;
+ return ped_partition_set_system (part, part->fs_type);
+
default:
return 0;
}
@@ -1597,6 +1614,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
case PED_PARTITION_PREP:
return dos_data->prep;
+ case PED_PARTITION_IRST:
+ return dos_data->irst;
+
default:
return 0;
}
@@ -1619,6 +1639,7 @@ msdos_partition_is_flag_available (const PedPartition* part,
case PED_PARTITION_LBA:
case PED_PARTITION_PALO:
case PED_PARTITION_PREP:
+ case PED_PARTITION_IRST:
case PED_PARTITION_DIAG:
return 1;
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 25490af..0b7d08b 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -146,6 +146,10 @@ typedef struct
((efi_guid_t) { PED_CPU_TO_LE32 (0x5265636F), PED_CPU_TO_LE16 (0x7665), \
PED_CPU_TO_LE16 (0x11AA), 0xaa, 0x11, \
{ 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC }})
+#define PARTITION_IRST_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \
+ PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \
+ { 0xE3, 0xA5, 0x56, 0xD8, 0x95, 0x93 }})
struct __attribute__ ((packed)) _GuidPartitionTableHeader_t
{
@@ -288,6 +292,7 @@ typedef struct _GPTPartitionData
int atvrecv;
int msftrecv;
int legacy_boot;
+ int irst;
} GPTPartitionData;
static PedDiskType gpt_disk_type;
@@ -797,6 +802,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->legacy_boot
+ = gpt_part_data->irst
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
if (pte->Attributes.RequiredToFunction & 0x1)
@@ -822,6 +828,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
gpt_part_data->msftrecv = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID))
gpt_part_data->atvrecv = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID))
+ gpt_part_data->irst = 1;
return part;
}
@@ -1339,6 +1347,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->msftrecv = 0;
gpt_part_data->atvrecv = 0;
gpt_part_data->legacy_boot = 0;
+ gpt_part_data->irst = 0;
uuid_generate ((unsigned char *) &gpt_part_data->uuid);
swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid));
memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
@@ -1447,6 +1456,11 @@ gpt_partition_set_system (PedPartition *part,
gpt_part_data->type = PARTITION_APPLE_TV_RECOVERY_GUID;
return 1;
}
+ if (gpt_part_data->irst)
+ {
+ gpt_part_data->type = PARTITION_IRST_GUID;
+ return 1;
+ }
if (fs_type)
{
@@ -1588,6 +1602,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_BIOS_GRUB:
@@ -1600,6 +1615,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_RAID:
@@ -1612,6 +1628,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_LVM:
@@ -1624,6 +1641,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HPSERVICE:
@@ -1636,6 +1654,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_RESERVED:
@@ -1648,6 +1667,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->hp_service
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_DATA:
@@ -1660,6 +1680,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->hp_service
= gpt_part_data->msftres
= gpt_part_data->msftrecv
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
gpt_part_data->msftdata = 1;
} else {
@@ -1676,6 +1697,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->hp_service
= gpt_part_data->msftdata
= gpt_part_data->msftres
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_APPLE_TV_RECOVERY:
@@ -1688,8 +1710,22 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->hp_service
= gpt_part_data->msftres
= gpt_part_data->msftdata
+ = gpt_part_data->irst
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_IRST:
+ gpt_part_data->irst = state;
+ if (state)
+ gpt_part_data->boot
+ = gpt_part_data->raid
+ = gpt_part_data->lvm
+ = gpt_part_data->bios_grub
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres
+ = gpt_part_data->msftdata
+ = gpt_part_data->msftrecv
+ = gpt_part_data->atvrecv = 0;
+ return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HIDDEN:
gpt_part_data->hidden = state;
return 1;
@@ -1736,6 +1772,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->hidden;
case PED_PARTITION_LEGACY_BOOT:
return gpt_part_data->legacy_boot;
+ case PED_PARTITION_IRST:
+ return gpt_part_data->irst;
case PED_PARTITION_SWAP:
case PED_PARTITION_LBA:
case PED_PARTITION_ROOT:
@@ -1762,6 +1800,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
case PED_PARTITION_APPLE_TV_RECOVERY:
case PED_PARTITION_HIDDEN:
case PED_PARTITION_LEGACY_BOOT:
+ case PED_PARTITION_IRST:
return 1;
case PED_PARTITION_SWAP:
case PED_PARTITION_ROOT:
--
1.8.3.1

View File

@ -0,0 +1,241 @@
From 1cb8a0e1c6a459b1f9e77501f0e7c582a031fdef Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 26 Aug 2013 17:43:09 -0700
Subject: [PATCH 66/69] libparted: Add UEFI System Partition flag.
This adds support for the ESP partition type on MS-DOS. It also aliases
it to the boot flag on GPT which sets the ESP GUID type.
* NEWS (Changes in behavior): Mention it.
* doc/C/parted.8: Document esp flag.
* doc/parted.texti: Document esp flag.
* include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_ESP flag
* libparted/disk.c (ped_partition_flag_get_name): Add esp flag
* libparted/labels/dos.c (DosPartitionData): Likewise
(raw_part_parse): Likewise
(msdos_partition_new): Likewise
(msdos_partition_duplicate): Likewise
(msdos_partition_set_system): Likewise
(clear_flags): Likewise
(msdos_partition_set_flag): Likewise
(msdos_partition_get_flag): Likewise
(msdos_partition_is_flag_available): Likewise
* libparted/labels/gpt.c (gpt_partition_set_flag): Add PED_PARTITION_ESP
(gpt_partition_get_flag): Likewise
(gpt_partition_is_flag_available): Likewise
---
NEWS | 3 +++
doc/C/parted.8 | 2 +-
doc/parted.texi | 4 ++++
include/parted/disk.in.h | 5 +++--
libparted/disk.c | 2 ++
libparted/labels/dos.c | 21 +++++++++++++++++++++
libparted/labels/gpt.c | 3 +++
7 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index b53a9d0..541ea1c 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,9 @@ GNU parted NEWS -*- outline -*-
** Changes in behavior
+ Added new partition type flag, esp, to set the type to 0xEF on MS-DOS.
+ Also aliased to boot on GPT to set the UEFI ESP GUID.
+
Added new partition type flag, irst, for use with Intel Rapid Start
Technology. On MS-DOS disk labels it sets the type to 0x84 and on GPT
it sets the GUID to D3BFE2DE-3DAF-11DF-BA-40-E3A556D89593.
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index 2f8e9f5..f8e6a3d 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -104,7 +104,7 @@ or an LVM logical volume if necessary.
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
-"legacy_boot", "irst" and "palo".
+"legacy_boot", "irst", "esp" and "palo".
\fIstate\fP should be either "on" or "off".
.TP
.B unit \fIunit\fP
diff --git a/doc/parted.texi b/doc/parted.texi
index fd8ccb9..a5effd5 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -840,6 +840,10 @@ filesystems).
(MS-DOS, GPT) - this flag identifies an Intel Rapid Start Technology
partition.
+@item esp
+(MS-DOS, GPT) - this flag identifies a UEFI System Partition. On GPT
+it is an alias for boot.
+
@item lba
(MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
MS Windows ME based operating systems to use Linear (LBA) mode.
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index 585383d..d144e21 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -74,10 +74,11 @@ enum _PedPartitionFlag {
PED_PARTITION_DIAG=14,
PED_PARTITION_LEGACY_BOOT=15,
PED_PARTITION_MSFT_DATA=16,
- PED_PARTITION_IRST=17
+ PED_PARTITION_IRST=17,
+ PED_PARTITION_ESP=18
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_IRST
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index 4ca7255..c22b2a2 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2443,6 +2443,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("legacy_boot");
case PED_PARTITION_IRST:
return N_("irst");
+ case PED_PARTITION_ESP:
+ return N_("esp");
default:
ped_exception_throw (
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index f8591ff..fc7292a 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -92,6 +92,7 @@ static const char MBR_BOOT_CODE[] = {
#define PARTITION_SUN_UFS 0xbf
#define PARTITION_DELL_DIAG 0xde
#define PARTITION_GPT 0xee
+#define PARTITION_ESP 0xef
#define PARTITION_PALO 0xf0
#define PARTITION_PREP 0x41
#define PARTITION_LINUX_RAID 0xfd
@@ -161,6 +162,7 @@ typedef struct {
int prep;
int diag;
int irst;
+ int esp;
OrigState* orig; /* used for CHS stuff */
} DosPartitionData;
@@ -927,6 +929,7 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part,
dos_data->palo = raw_part->type == PARTITION_PALO;
dos_data->prep = raw_part->type == PARTITION_PREP;
dos_data->irst = raw_part->type == PARTITION_IRST;
+ dos_data->esp = raw_part->type == PARTITION_ESP;
dos_data->orig = ped_malloc (sizeof (OrigState));
if (!dos_data->orig) {
ped_partition_destroy (part);
@@ -1330,6 +1333,7 @@ msdos_partition_new (const PedDisk* disk, PedPartitionType part_type,
dos_data->palo = 0;
dos_data->prep = 0;
dos_data->irst = 0;
+ dos_data->esp = 0;
} else {
part->disk_specific = NULL;
}
@@ -1366,6 +1370,7 @@ msdos_partition_duplicate (const PedPartition* part)
new_dos_data->palo = old_dos_data->palo;
new_dos_data->prep = old_dos_data->prep;
new_dos_data->irst = old_dos_data->irst;
+ new_dos_data->esp = old_dos_data->esp;
if (old_dos_data->orig) {
new_dos_data->orig = ped_malloc (sizeof (OrigState));
@@ -1415,6 +1420,7 @@ msdos_partition_set_system (PedPartition* part,
dos_data->palo = 0;
dos_data->prep = 0;
dos_data->irst = 0;
+ dos_data->esp = 0;
if (dos_data->lba)
dos_data->system = PARTITION_EXT_LBA;
else
@@ -1451,6 +1457,10 @@ msdos_partition_set_system (PedPartition* part,
dos_data->system = PARTITION_IRST;
return 1;
}
+ if (dos_data->esp) {
+ dos_data->system = PARTITION_ESP;
+ return 1;
+ }
if (!fs_type)
dos_data->system = PARTITION_LINUX;
@@ -1488,6 +1498,7 @@ clear_flags (DosPartitionData *dos_data)
dos_data->palo = 0;
dos_data->prep = 0;
dos_data->irst = 0;
+ dos_data->esp = 0;
dos_data->raid = 0;
}
@@ -1572,6 +1583,12 @@ msdos_partition_set_flag (PedPartition* part,
dos_data->irst = state;
return ped_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_ESP:
+ if (state)
+ clear_flags (dos_data);
+ dos_data->esp = state;
+ return ped_partition_set_system (part, part->fs_type);
+
default:
return 0;
}
@@ -1617,6 +1634,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
case PED_PARTITION_IRST:
return dos_data->irst;
+ case PED_PARTITION_ESP:
+ return dos_data->esp;
+
default:
return 0;
}
@@ -1640,6 +1660,7 @@ msdos_partition_is_flag_available (const PedPartition* part,
case PED_PARTITION_PALO:
case PED_PARTITION_PREP:
case PED_PARTITION_IRST:
+ case PED_PARTITION_ESP:
case PED_PARTITION_DIAG:
return 1;
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 0b7d08b..64b92b4 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1592,6 +1592,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
switch (flag)
{
+ case PED_PARTITION_ESP:
case PED_PARTITION_BOOT:
gpt_part_data->boot = state;
if (state)
@@ -1754,6 +1755,7 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->raid;
case PED_PARTITION_LVM:
return gpt_part_data->lvm;
+ case PED_PARTITION_ESP:
case PED_PARTITION_BOOT:
return gpt_part_data->boot;
case PED_PARTITION_BIOS_GRUB:
@@ -1801,6 +1803,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
case PED_PARTITION_HIDDEN:
case PED_PARTITION_LEGACY_BOOT:
case PED_PARTITION_IRST:
+ case PED_PARTITION_ESP:
return 1;
case PED_PARTITION_SWAP:
case PED_PARTITION_ROOT:
--
1.8.3.1

View File

@ -0,0 +1,286 @@
From a5542113ab8bde419edfcc5ac46f6a5f6e575dd5 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 27 Aug 2013 11:52:54 -0700
Subject: [PATCH 67/69] libparted: Add hfs_esp partition flag to GPT.
Mac uses a HFS+ formatted partition for ESP. When dual booting with
Linux we need a way to differentiate between the Mac partition and the
one created by Linux which contains just enough stuff to fake OSX into
displaying a nice logo and allowing it to be selected for boot. I
generated a GUID (47CB5633-7E3E-408B-B7B8-2D915B7B21B1) and added a new
flag to control it.
* NEWS (Changes in behavior): Mention it.
* doc/C/parted.8: Document hfs_esp flag.
* doc/parted.texti: Document hfs_esp flag.
* include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_HFS_ESP flag
* libparted/disk.c (ped_partition_flag_get_name): Add hfs_esp flag
* libparted/labels/gpt.c: Add PARTITION_HFS_ESP_GUID
(GPTPartitionData): Add hfs_esp flag
(_parse_part_entry): Likewise
(gpt_partition_new): Likewise
(gpt_partition_set_system): Set PARTITION_HFS_ESP_GUID
(gpt_partition_set_flag): Add hfs_esp and PED_PARTITION_HFS_ESP
(gpt_partition_get_flag): Likewise
(gpt_partition_is_flag_available): Likewise
---
NEWS | 8 ++++++++
doc/C/parted.8 | 2 +-
doc/parted.texi | 4 ++++
include/parted/disk.in.h | 5 +++--
libparted/disk.c | 2 ++
libparted/labels/gpt.c | 41 +++++++++++++++++++++++++++++++++++++++++
6 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 541ea1c..026e897 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,14 @@ GNU parted NEWS -*- outline -*-
** Changes in behavior
+ Added new GPT partition type flag, hfs_esp, that sets the GUID to
+ 47CB5633-7E3E-408B-B7B8-2D915B7B21B1 so that you can distinguish
+ between OSX's native HFS+ partition and one used Linux on UEFI. The
+ way Mac handles UEFI is unique, it only uses the standard ESP for
+ firmware updates and needs a HFS+ formatted partition for UEFI. This
+ GUID will allow dual booting Linux systems to determine the correct
+ partition to use when upgrading or re-installing systems.
+
Added new partition type flag, esp, to set the type to 0xEF on MS-DOS.
Also aliased to boot on GPT to set the UEFI ESP GUID.
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index f8e6a3d..ccbfd18 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -104,7 +104,7 @@ or an LVM logical volume if necessary.
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
-"legacy_boot", "irst", "esp" and "palo".
+"legacy_boot", "irst", "esp", "hfs_esp" and "palo".
\fIstate\fP should be either "on" or "off".
.TP
.B unit \fIunit\fP
diff --git a/doc/parted.texi b/doc/parted.texi
index a5effd5..ee5b3f7 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -844,6 +844,10 @@ partition.
(MS-DOS, GPT) - this flag identifies a UEFI System Partition. On GPT
it is an alias for boot.
+@item hfs_esp
+(GPT) - this flag identifies a special UEFI HFS+ ESP for use with Mac
+hardware.
+
@item lba
(MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
MS Windows ME based operating systems to use Linear (LBA) mode.
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index d144e21..c34c294 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -75,10 +75,11 @@ enum _PedPartitionFlag {
PED_PARTITION_LEGACY_BOOT=15,
PED_PARTITION_MSFT_DATA=16,
PED_PARTITION_IRST=17,
- PED_PARTITION_ESP=18
+ PED_PARTITION_ESP=18,
+ PED_PARTITION_HFS_ESP=19
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_HFS_ESP
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index c22b2a2..7d24f74 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2445,6 +2445,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("irst");
case PED_PARTITION_ESP:
return N_("esp");
+ case PED_PARTITION_HFS_ESP:
+ return N_("hfs_esp");
default:
ped_exception_throw (
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 64b92b4..c72573c 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -150,6 +150,10 @@ typedef struct
((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \
PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \
{ 0xE3, 0xA5, 0x56, 0xD8, 0x95, 0x93 }})
+#define PARTITION_HFS_ESP_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0x47CB5633), PED_CPU_TO_LE16 (0x7E3E), \
+ PED_CPU_TO_LE16 (0x408B), 0xB7, 0xB8, \
+ { 0x2D, 0x91, 0x5B, 0x7B, 0x21, 0xB1 }})
struct __attribute__ ((packed)) _GuidPartitionTableHeader_t
{
@@ -293,6 +297,7 @@ typedef struct _GPTPartitionData
int msftrecv;
int legacy_boot;
int irst;
+ int hfs_esp;
} GPTPartitionData;
static PedDiskType gpt_disk_type;
@@ -803,6 +808,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
= gpt_part_data->msftrecv
= gpt_part_data->legacy_boot
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
if (pte->Attributes.RequiredToFunction & 0x1)
@@ -830,6 +836,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
gpt_part_data->atvrecv = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID))
gpt_part_data->irst = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_HFS_ESP_GUID))
+ gpt_part_data->hfs_esp = 1;
return part;
}
@@ -1348,6 +1356,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->atvrecv = 0;
gpt_part_data->legacy_boot = 0;
gpt_part_data->irst = 0;
+ gpt_part_data->hfs_esp = 0;
uuid_generate ((unsigned char *) &gpt_part_data->uuid);
swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid));
memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
@@ -1461,6 +1470,11 @@ gpt_partition_set_system (PedPartition *part,
gpt_part_data->type = PARTITION_IRST_GUID;
return 1;
}
+ if (gpt_part_data->hfs_esp)
+ {
+ gpt_part_data->type = PARTITION_HFS_ESP_GUID;
+ return 1;
+ }
if (fs_type)
{
@@ -1604,6 +1618,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_BIOS_GRUB:
@@ -1617,6 +1632,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_RAID:
@@ -1630,6 +1646,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_LVM:
@@ -1643,6 +1660,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HPSERVICE:
@@ -1656,6 +1674,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_RESERVED:
@@ -1669,6 +1688,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_DATA:
@@ -1682,6 +1702,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
gpt_part_data->msftdata = 1;
} else {
@@ -1699,6 +1720,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftres
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_APPLE_TV_RECOVERY:
@@ -1712,6 +1734,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_IRST:
@@ -1725,6 +1748,21 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
+ = gpt_part_data->hfs_esp
+ = gpt_part_data->atvrecv = 0;
+ return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_HFS_ESP:
+ gpt_part_data->hfs_esp = state;
+ if (state)
+ gpt_part_data->boot
+ = gpt_part_data->raid
+ = gpt_part_data->lvm
+ = gpt_part_data->bios_grub
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres
+ = gpt_part_data->msftdata
+ = gpt_part_data->msftrecv
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HIDDEN:
@@ -1776,6 +1814,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->legacy_boot;
case PED_PARTITION_IRST:
return gpt_part_data->irst;
+ case PED_PARTITION_HFS_ESP:
+ return gpt_part_data->hfs_esp;
case PED_PARTITION_SWAP:
case PED_PARTITION_LBA:
case PED_PARTITION_ROOT:
@@ -1804,6 +1844,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
case PED_PARTITION_LEGACY_BOOT:
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
+ case PED_PARTITION_HFS_ESP:
return 1;
case PED_PARTITION_SWAP:
case PED_PARTITION_ROOT:
--
1.8.3.1

View File

@ -0,0 +1,184 @@
From 7e43d97d8cbad8fbb51a818362293d6c2ab82304 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 27 Aug 2013 17:27:07 -0700
Subject: [PATCH 68/69] libparted: Recognize btrfs filesystem
Add support for showing 'btrfs' in the 'file system' column. Also
allows the used to enter btrfs as the fs type. It doesn't really do
anything -- just sets the partition type to linux.
* NEWS (Changes in behavior): Mention it.
* doc/parted.texti: Document btrfs fs.
* (libparted/fs/Makefile.am): Add btrfs.c
* (libparted/fs/btrfs/btrfs.c): Probe for btrfs
* (libparted/libparted.c): Register btrfs
---
NEWS | 3 ++
doc/parted.texi | 1 +
libparted/fs/Makefile.am | 1 +
libparted/fs/btrfs/btrfs.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++
libparted/libparted.c | 4 +++
5 files changed, 87 insertions(+)
create mode 100644 libparted/fs/btrfs/btrfs.c
diff --git a/NEWS b/NEWS
index 026e897..df259d6 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,9 @@ GNU parted NEWS -*- outline -*-
** Changes in behavior
+ Added support for recognizing btrfs filesystem. This simply displays
+ btrfs in the 'file system' column of the parted output.
+
Added new GPT partition type flag, hfs_esp, that sets the GUID to
47CB5633-7E3E-408B-B7B8-2D915B7B21B1 so that you can distinguish
between OSX's native HFS+ partition and one used Linux on UEFI. The
diff --git a/doc/parted.texi b/doc/parted.texi
index ee5b3f7..03522e7 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -575,6 +575,7 @@ partition table.
@item NTFS
@item reiserfs
@item ufs
+@item btrfs
@end itemize
For example, the following creates a logical partition that will contain
diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am
index aac03cc..1949617 100644
--- a/libparted/fs/Makefile.am
+++ b/libparted/fs/Makefile.am
@@ -23,6 +23,7 @@ libfs_la_SOURCES = \
amiga/asfs.c \
amiga/asfs.h \
amiga/a-interface.c \
+ btrfs/btrfs.c \
ext2/ext2.h \
ext2/ext2_fs.h \
ext2/interface.c \
diff --git a/libparted/fs/btrfs/btrfs.c b/libparted/fs/btrfs/btrfs.c
new file mode 100644
index 0000000..e5abed6
--- /dev/null
+++ b/libparted/fs/btrfs/btrfs.c
@@ -0,0 +1,78 @@
+/*
+ libparted - a library for manipulating disk partitions
+ Copyright (C) 2013 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/>.
+*/
+
+#include <config.h>
+
+#include <parted/parted.h>
+#include <parted/endian.h>
+
+/* Located 64k inside the partition (start of the first btrfs superblock) */
+#define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */
+#define BTRFS_CSUM_SIZE 32
+#define BTRFS_FSID_SIZE 16
+
+
+static PedGeometry*
+btrfs_probe (PedGeometry* geom)
+{
+ union {
+ struct {
+ /* Just enough of the btrfs_super_block to get the magic */
+ uint8_t csum[BTRFS_CSUM_SIZE];
+ uint8_t fsid[BTRFS_FSID_SIZE];
+ uint64_t bytenr;
+ uint64_t flags;
+ uint64_t magic;
+ } sb;
+ int8_t sector[8192];
+ } buf;
+ PedSector offset = (64*1024)/geom->dev->sector_size;
+
+ if (geom->length < offset+1)
+ return 0;
+ if (!ped_geometry_read (geom, &buf, offset, 1))
+ return 0;
+
+ if (PED_LE64_TO_CPU(buf.sb.magic) == BTRFS_MAGIC) {
+ return ped_geometry_new (geom->dev, geom->start, geom->length);
+ }
+ return NULL;
+}
+
+static PedFileSystemOps btrfs_ops = {
+ probe: btrfs_probe,
+};
+
+static PedFileSystemType btrfs_type = {
+ next: NULL,
+ ops: &btrfs_ops,
+ name: "btrfs",
+ block_sizes: ((int[2]){512, 0})
+};
+
+void
+ped_file_system_btrfs_init ()
+{
+ ped_file_system_type_register (&btrfs_type);
+}
+
+void
+ped_file_system_btrfs_done ()
+{
+ ped_file_system_type_unregister (&btrfs_type);
+}
diff --git a/libparted/libparted.c b/libparted/libparted.c
index 9923bfa..3afbf8e 100644
--- a/libparted/libparted.c
+++ b/libparted/libparted.c
@@ -109,6 +109,7 @@ extern void ped_file_system_hfs_init (void);
extern void ped_file_system_fat_init (void);
extern void ped_file_system_ext2_init (void);
extern void ped_file_system_nilfs2_init (void);
+extern void ped_file_system_btrfs_init (void);
static void
init_file_system_types ()
@@ -124,6 +125,7 @@ init_file_system_types ()
ped_file_system_fat_init ();
ped_file_system_ext2_init ();
ped_file_system_nilfs2_init ();
+ ped_file_system_btrfs_init ();
}
extern void ped_disk_aix_done ();
@@ -186,6 +188,7 @@ extern void ped_file_system_reiserfs_done (void);
extern void ped_file_system_ufs_done (void);
extern void ped_file_system_xfs_done (void);
extern void ped_file_system_amiga_done (void);
+extern void ped_file_system_btrfs_done (void);
static void
done_file_system_types ()
@@ -201,6 +204,7 @@ done_file_system_types ()
ped_file_system_ufs_done ();
ped_file_system_xfs_done ();
ped_file_system_amiga_done ();
+ ped_file_system_btrfs_done ();
}
static void _done() __attribute__ ((destructor));
--
1.8.3.1

View File

@ -0,0 +1,26 @@
From 17027da1eda39d20b2d6dca0a59ac4afc5409318 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 28 Aug 2013 08:47:26 -0700
Subject: [PATCH 69/69] tests: Add btrfs and xfs to the fs probe test
* tests/tests/t1700-probe-fs.sh: Add btrfs and xfs
---
tests/t1700-probe-fs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
index 7ce53d0..0418e73 100755
--- a/tests/t1700-probe-fs.sh
+++ b/tests/t1700-probe-fs.sh
@@ -22,7 +22,7 @@ require_512_byte_sector_size_
dev=loop-file
ss=$sector_size_
-for type in ext2 ext3 ext4 nilfs2; do
+for type in ext2 ext3 ext4 btrfs xfs nilfs2; do
( mkfs.$type -V ) >/dev/null 2>&1 \
|| { warn_ "$ME: no $type support"; continue; }
--
1.8.3.1

View File

@ -1,86 +0,0 @@
From e3f74af78b774b235123b9d5fa40fead3b003bb2 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 20 Jan 2012 15:31:43 -0800
Subject: [PATCH] libparted: use dm_udev_wait (#698121)
This applies Peter Rajnoha's patch to use dm_udev_wait to
synchronize with udev.
This requires libdevmapper v1.02.39 and higher.
Patch is from:
https://lists.gnu.org/archive/html/bug-parted/2010-09/msg00007.html
Resolves: rhbz#698121
---
libparted/arch/linux.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index e2c4139..1fcbcad 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -1319,6 +1319,10 @@ linux_new (const char* path)
dev->dirty = 0;
dev->boot_dirty = 0;
+#ifdef ENABLE_DEVICE_MAPPER
+ dm_udev_set_sync_support(1);
+#endif
+
if (!_device_probe_type (dev))
goto error_free_arch_specific;
@@ -2676,16 +2680,21 @@ static int
_dm_remove_map_name(char *name)
{
struct dm_task *task = NULL;
- int rc;
+ int rc = 0;
+ uint32_t cookie = 0;
task = dm_task_create(DM_DEVICE_REMOVE);
if (!task)
return 1;
dm_task_set_name (task, name);
+ if (!dm_task_set_cookie(task, &cookie, 0))
+ goto err;
rc = dm_task_run(task);
+ dm_udev_wait(cookie);
dm_task_update_nodes();
+err:
dm_task_destroy(task);
if (!rc)
return 1;
@@ -2796,6 +2805,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
const char* dev_name = NULL;
char* params = NULL;
LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev);
+ uint32_t cookie = 0;
/* Get map name from devicemapper */
struct dm_task *task = dm_task_create (DM_DEVICE_INFO);
@@ -2832,14 +2842,18 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
dm_task_set_name (task, vol_name);
dm_task_add_target (task, 0, part->geom.length,
"linear", params);
+ if (!dm_task_set_cookie(task, &cookie, 0))
+ goto err;
if (dm_task_run (task)) {
//printf("0 %ld linear %s\n", part->geom.length, params);
+ dm_udev_wait(cookie);
dm_task_update_nodes();
dm_task_destroy(task);
free(params);
free(vol_name);
return 1;
} else {
+ dm_udev_wait(cookie);
_dm_remove_map_name(vol_name);
}
err:
--
1.7.7.6

View File

@ -1,68 +0,0 @@
From 763d9aca0fd5c79c46243774c17b562013a93418 Mon Sep 17 00:00:00 2001
From: Brian C. Lane <bcl@redhat.com>
Date: Fri, 17 Sep 2010 09:21:24 -0700
Subject: [PATCH] Handle syncing partition changes when using blkext majors (#634980)
Also remove unused _device_get_partition_range function
---
libparted/arch/linux.c | 37 ++++---------------------------------
1 files changed, 4 insertions(+), 33 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 38f4e31..225d06b 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2391,35 +2391,6 @@ _blkpg_remove_partition (PedDisk* disk, int n)
}
/*
- * The number of partitions that a device can have depends on the kernel.
- * If we don't find this value in /sys/block/DEV/range, we will use our own
- * value.
- */
-static unsigned int
-_device_get_partition_range(PedDevice* dev)
-{
- int range, r;
- char path[128];
- FILE* fp;
- bool ok;
-
- r = snprintf(path, sizeof(path), "/sys/block/%s/range",
- last_component(dev->path));
- if (r < 0 || r >= sizeof(path))
- return MAX_NUM_PARTS;
-
- fp = fopen(path, "r");
- if (!fp)
- return MAX_NUM_PARTS;
-
- ok = fscanf(fp, "%d", &range) == 1;
- fclose(fp);
-
- /* (range <= 0) is none sense.*/
- return ok && range > 0 ? range : MAX_NUM_PARTS;
-}
-
-/*
* Sync the partition table in two step process:
* 1. Remove all of the partitions from the kernel's tables, but do not attempt
* removal of any partition for which the corresponding ioctl call fails.
@@ -2441,10 +2412,10 @@ _disk_sync_part_table (PedDisk* disk)
int lpn;
/* lpn = largest partition number. */
- if (ped_disk_get_max_supported_partition_count(disk, &lpn))
- lpn = PED_MIN(lpn, _device_get_partition_range(disk->dev));
- else
- lpn = _device_get_partition_range(disk->dev);
+ if (!ped_disk_get_max_supported_partition_count(disk, &lpn))
+ lpn = 256; /* HDG: not pretty but there is no other way
+ as we must make sure any removed partitions
+ actually get removed from the kernels view */
/* Its not possible to support largest_partnum < 0.
* largest_partnum == 0 would mean does not support partitions.
--
1.7.2.2

View File

@ -1,54 +0,0 @@
From 1190dc5b214ce6ba4cbeadbdd599ab3ebb2cbb13 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 8 Jun 2012 14:42:45 -0700
Subject: [PATCH] libparted: Fix endian error with FirstUsableLBA (#829960)
On big-endial systems (eg. ppc64) this would cause parted to
crash.
* NEWS: add new bugfix
* libparted/labels/gpt.c (gpt_get_max_supported_partition_count):
fix endian issues with pth->FirstUsableLBA
---
NEWS | 3 ++-
libparted/labels/gpt.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index b0a0657..596ab37 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,10 @@
GNU parted NEWS -*- outline -*-
-* Noteworthy changes in release 3.1-2 (2012-03-21) [Fedora]
+* Noteworthy changes in release 3.1-4 (2012-06-08) [Fedora]
** Bug Fixes
+ libparted: Don't crash on big-endian systems when using GPT
libparted: Treat disks without a PMBR as msdos labeled disks
even if they have GPT partition tables.
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index ab2145e..6ca33c8 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1787,12 +1787,12 @@ gpt_get_max_supported_partition_count (const PedDisk *disk, int *max_n)
if (!_header_is_valid (disk, pth, 1))
{
- pth->FirstUsableLBA = 34;
+ pth->FirstUsableLBA = PED_CPU_TO_LE64 (34);
pth->SizeOfPartitionEntry
= PED_CPU_TO_LE32 (sizeof (GuidPartitionEntry_t));
}
- *max_n = (disk->dev->sector_size * (pth->FirstUsableLBA - 2)
+ *max_n = (disk->dev->sector_size * (PED_LE64_TO_CPU (pth->FirstUsableLBA)-2)
/ PED_LE32_TO_CPU (pth->SizeOfPartitionEntry));
pth_free (pth);
return true;
--
1.7.7.6

View File

@ -1,71 +0,0 @@
From e2b9f9051c8d9905b15af0f7fa79c85502370b25 Mon Sep 17 00:00:00 2001
From: Brian C. Lane <bcl@redhat.com>
Date: Fri, 3 Aug 2012 17:03:50 -0700
Subject: [PATCH] libparted: preserve the uuid on dm partitions (#832145)
* libparted/arch/linux.c (_dm_add_partition): Set the uuid if there was
one.
---
libparted/arch/linux.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 37ddb5f..2c410a0 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2803,6 +2803,8 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
{
char* vol_name = NULL;
const char* dev_name = NULL;
+ char* vol_uuid = NULL;
+ const char* dev_uuid = NULL;
char* params = NULL;
LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev);
uint32_t cookie = 0;
@@ -2820,6 +2822,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
goto err;
dev_name = dm_task_get_name (task);
+ dev_uuid = dm_task_get_uuid (task);
if (isdigit (dev_name[strlen (dev_name) - 1])) {
if ( ! (vol_name = zasprintf ("%sp%d", dev_name, part->num)))
@@ -2827,6 +2830,10 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
} else if ( ! (vol_name = zasprintf ("%s%d", dev_name, part->num)))
goto err;
+ if ( dev_uuid && (strlen(dev_uuid) > 0) \
+ && ! (vol_uuid = zasprintf ("part%d-%s", part->num, dev_uuid)))
+ goto err;
+
/* Caution: dm_task_destroy frees dev_name. */
dm_task_destroy (task);
task = NULL;
@@ -2840,6 +2847,8 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
goto err;
dm_task_set_name (task, vol_name);
+ if (vol_uuid)
+ dm_task_set_uuid (task, vol_uuid);
dm_task_add_target (task, 0, part->geom.length,
"linear", params);
if (!dm_task_set_cookie(task, &cookie, 0))
@@ -2850,6 +2859,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
dm_task_update_nodes();
dm_task_destroy(task);
free(params);
+ free(vol_uuid);
free(vol_name);
return 1;
} else {
@@ -2861,6 +2871,7 @@ err:
if (task)
dm_task_destroy (task);
free (params);
+ free (vol_uuid);
free (vol_name);
return 0;
}
--
1.7.11.4

View File

@ -1,36 +0,0 @@
From 4ee2a7d03f6720c5f97eef93c4df4b9c52e79b5e Mon Sep 17 00:00:00 2001
From: Brian C. Lane <bcl@redhat.com>
Date: Tue, 4 Sep 2012 15:56:47 -0700
Subject: [PATCH] libparted: reallocate buf after _disk_analyse_block_size
call
The call to _disk_analyse_block_size may change the
disk->dev->sector_size, if this happens buf may be too small for
subsequent reads.
libparted/labels/mac.c (mac_read): reallocate buf
---
libparted/labels/mac.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index 1f59a1a..5fa8283 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -759,6 +759,13 @@ mac_read (PedDisk* disk)
mac_disk_data->block_size = raw_disk->block_size;
}
+ /* re-allocate buf in case _disk_analyse_block_size changed
+ * the sector_size */
+ free (buf);
+ buf = ped_malloc (disk->dev->sector_size);
+ if (!buf)
+ goto error;
+
for (num=1; num==1 || num <= last_part_entry_num; num++) {
void *raw_part = buf;
if (!ped_device_read (disk->dev, raw_part,
--
1.7.11.4

View File

@ -1,41 +0,0 @@
From 26fbffe8389e732be29225bd649adfdd5588b131 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 21 Mar 2012 15:34:20 -0700
Subject: [PATCH] libparted: use largest_partnum in dm_reread_part_table
(#803108)
DM devices can have more than 16 partitions, notify the kernel about
all of them.
Resolves: rhbz#803108
* libparted/arch/linux.c (dm_reread_part_table): Use largest_partnum
fixup
---
libparted/arch/linux.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 7dd664e..ed14f50 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2516,14 +2516,13 @@ _dm_reread_part_table (PedDisk* disk)
return 1;
int rc = 1;
- int last = PED_MIN (largest_partnum, 16);
int i;
sync();
if (!_dm_remove_parts(disk->dev))
rc = 0;
- for (i = 1; i <= last; i++) {
+ for (i = 1; i <= largest_partnum; i++) {
PedPartition* part;
part = ped_disk_get_partition (disk, i);
--
1.7.7.6

View File

@ -1,34 +0,0 @@
From 98f1556d8a134f54d62ebdac27e9d16aa7884983 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 20 Mar 2012 17:17:10 -0700
Subject: [PATCH 2/2] tests: add t0301-overwrite-gpt-pmbr.sh
Make sure parted checks the PMBR before the GPT partition table.
* NEWS: Update with new GPT behavior
* tests/Makefile.am: Add new test
* tests/overwrite-gpt-pmbr.sh: new test
---
NEWS | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
index fe0fcdd..b0a0657 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,12 @@
GNU parted NEWS -*- outline -*-
+* Noteworthy changes in release 3.1-2 (2012-03-21) [Fedora]
+
+** Bug Fixes
+
+ libparted: Treat disks without a PMBR as msdos labeled disks
+ even if they have GPT partition tables.
+
* Noteworthy changes in release 3.1 (2012-03-02) [stable]
** New features
--
1.7.7.6

View File

@ -1,137 +0,0 @@
From a1aa9eb26f357bb1a5111eb332594dfb7b39ace0 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 15 Oct 2012 17:27:18 -0700
Subject: [PATCH 1/2] tests: cleanup losetup usage
The unsafe_losetup_ function was failing because losetup didn't
recognize that the 'private' /dev/loopX devices were the same as
/dev/loopX, it would fail even if one was in use. Switch to using
losetup --show which is a cleaner solution.
Also use sparse file for loop_setup to save space.
---
tests/lvm-utils.sh | 24 ++----------------------
tests/t-lvm.sh | 24 ++----------------------
tests/t6001-psep.sh | 8 ++------
tests/t6003-dm-uuid.sh | 3 +--
4 files changed, 7 insertions(+), 52 deletions(-)
diff --git a/tests/lvm-utils.sh b/tests/lvm-utils.sh
index 456d265..a204b08 100644
--- a/tests/lvm-utils.sh
+++ b/tests/lvm-utils.sh
@@ -16,34 +16,14 @@ export LVM_SUPPRESS_FD_WARNINGS=1
ME=$(basename "$0")
warn() { echo >&2 "$ME: $@"; }
-unsafe_losetup_()
-{
- f=$1
-
- test -n "$G_dev_" \
- || fail_ "Internal error: unsafe_losetup_ called before init_root_dir_"
-
- # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
- for slash in '' /; do
- for i in 0 1 2 3 4 5 6 7 8 9; do
- dev=$G_dev_/loop$slash$i
- losetup $dev > /dev/null 2>&1 && continue;
- losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; }
- break
- done
- done
-
- return 1
-}
-
loop_setup_()
{
file=$1
- dd if=/dev/zero of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
+ dd if=/dev/null of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
|| { warn "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
# NOTE: this requires a new enough version of losetup
- dev=$(unsafe_losetup_ "$file") \
+ dev=$(losetup --show -f "$file") 2>/dev/null \
|| { warn "loop_setup_ failed: Unable to create loopback device"; return 1; }
echo "$dev"
diff --git a/tests/t-lvm.sh b/tests/t-lvm.sh
index b08f934..3c7657b 100644
--- a/tests/t-lvm.sh
+++ b/tests/t-lvm.sh
@@ -16,34 +16,14 @@ export LVM_SUPPRESS_FD_WARNINGS=1
ME=$(basename "$0")
warn() { echo >&2 "$ME: $@"; }
-unsafe_losetup_()
-{
- f=$1
-
- test -n "$G_dev_" \
- || error "Internal error: unsafe_losetup_ called before init_root_dir_"
-
- # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
- for slash in '' /; do
- for i in 0 1 2 3 4 5 6 7 8 9; do
- dev=$G_dev_/loop$slash$i
- losetup $dev > /dev/null 2>&1 && continue;
- losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; }
- break
- done
- done
-
- return 1
-}
-
loop_setup_()
{
file=$1
- dd if=/dev/zero of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
+ dd if=/dev/null of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
|| { warn "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
# NOTE: this requires a new enough version of losetup
- dev=$(unsafe_losetup_ "$file" 2>/dev/null) \
+ dev=$(losetup --show -f "$file") 2>/dev/null \
|| { warn "loop_setup_ failed: Unable to create loopback device"; return 1; }
echo "$dev"
diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh
index 490c6d2..1859ac9 100644
--- a/tests/t6001-psep.sh
+++ b/tests/t6001-psep.sh
@@ -44,14 +44,10 @@ cleanup_fn_() {
# create a file of size N bytes
N=10M
-# create the test file
-f1=$(pwd)/1; dd if=/dev/null of=$f1 bs=1 seek=$N 2> /dev/null || fail=1
-f2=$(pwd)/2; dd if=/dev/null of=$f2 bs=1 seek=$N 2> /dev/null || fail=1
-
-d1=$(loop_setup_ "$f1") \
+f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
|| skip_ "is this partition mounted with 'nodev'?"
-d2=$(loop_setup_ "$f2") \
+f2=$(pwd)/2 ;d2=$(loop_setup_ "$f2") \
|| skip_ "is this partition mounted with 'nodev'?"
dmsetup_cmd="0 `blockdev --getsz $d1` linear $d1 0"
diff --git a/tests/t6003-dm-uuid.sh b/tests/t6003-dm-uuid.sh
index 1751cb4..f58cb06 100755
--- a/tests/t6003-dm-uuid.sh
+++ b/tests/t6003-dm-uuid.sh
@@ -36,8 +36,7 @@ cleanup_() {
}
# create a file large enough to hold a GPT partition table
-dd if=/dev/null of=$loop_file bs=$ss seek=$ns || framework_failure
-dev=$(losetup --show -f $loop_file) || framework_failure
+dev=$(loop_setup_ $loop_file) || framework_failure
dmsetup create $dm_name --table "0 $ns linear $dev 0" || framework_failure
dmsetup rename $dm_name --setuuid f139317b-f98a-45d7-ab3b-9b4e0a336872 || framework_failure
--
1.7.11.4

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.1
Release: 13%{?dist}
Release: 14%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -13,25 +13,82 @@ Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source1: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
Source2: pubkey.jim.meyering
Patch0: parted-3.0-libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch
Patch1: parted-3.1-libparted-check-PMBR-before-GPT-partition-table-8052.patch
Patch2: parted-3.1-tests-add-t0301-overwrite-gpt-pmbr.sh.patch
Patch3: parted-3.1-libparted-Fix-endian-error-with-FirstUsableLBA.patch
Patch4: parted-2.1-libparted-use-dm_udev_wait-698121.patch
Patch5: parted-3.1-libparted-use-largest_partnum-in-dm_reread_part_tabl.patch
patch6: parted-3.1-test-creating-20-device-mapper-partitions.patch
Patch7: parted-3.1-libparted-preserve-the-uuid-on-dm-partitions.patch
Patch8: parted-3.1-tests-Make-sure-dm-UUIDs-are-not-erased.patch
Patch9: parted-3.1-libparted-reallocate-buf-after-_disk_analyse_block_s.patch
Patch10: parted-3.1-tests-cleanup-losetup-usage.patch
Patch11: parted-3.1-libparted-add-support-for-implicit-FBA-DASD-partitions.patch
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
Patch0001: 0001-maint-post-release-administrivia.patch
Patch0002: 0002-libparted-check-PMBR-before-GPT-partition-table.patch
Patch0003: 0003-tests-add-t0301-overwrite-gpt-pmbr.sh.patch
Patch0004: 0004-tests-remove-bogus-envvar-setting-from-t0300-dos-on-.patch
Patch0005: 0005-gpt-fix-endianness-bug-in-gpt_get_max_supported_part.patch
Patch0006: 0006-tests-add-a-test-to-exercise-just-fixed-code.patch
Patch0007: 0007-maint-avoid-new-syntax-check-failure-re-xref.patch
Patch0008: 0008-maint-don-t-prohibit-strncpy-just-yet.patch
# Won't work when applied to the tar.xz
#Patch0009: 0009-build-update-gnulib-bootstrap-and-init.sh.patch
Patch0010: 0010-build-prefer-AM_CPPFLAGS-over-INCLUDES.patch
Patch0011: 0011-build-don-t-list-files-with-unknown-suffix-in-_SOURC.patch
Patch0012: 0012-build-prefer-pattern-rules-over-suffix-rules.patch
Patch0013: 0013-build-enable-subdir-objects-Automake-option-globally.patch
Patch0014: 0014-tests-prefer-AM_TESTS_ENVIRONMENT-over-TESTS_ENVIRON.patch
Patch0015: 0015-tests-remove-unused-AM_TESTS_ENVIRONMENT-entries.patch
# No bootstrap.conf in tar.xz
#Patch0016: 0016-build-require-Automake-1.11.6.patch
#Patch0017: 0017-maint-make-Autoconf-version-requirement-consistent.patch
#Patch0018: 0018-maint-tighten-per-version-requirement.patch
Patch0019: 0019-maint-remove-unnecessary-wcslen-use.patch
Patch0020: 0020-tests-clarify-a-comment-_reading_-gpt-tables-on-tiny.patch
Patch0021: 0021-gpt-require-first_usable_LBA-last_usable_LBA.patch
Patch0022: 0022-tests-update-t7000-scripting.sh-to-avoid-new-FP.patch
Patch0023: 0023-gpt-permit-mklabel-gpt-on-a-67-sector-device.patch
Patch0024: 0024-gpt-when-mklabel-gpt-fails-always-provide-a-diagnost.patch
Patch0025: 0025-tests-show-that-small-dev-now-evokes-mklabel-gpt-dia.patch
Patch0026: 0026-tests-avoid-syntax-check-failure-for-reversed-compar.patch
Patch0027: 0027-mac-don-t-let-larger-partition-table-specified-block.patch
Patch0028: 0028-tests-mac-exercise-the-just-fixed-bug.patch
Patch0029: 0029-add-support-for-a-new-Linux-specific-GPT-partition-t.patch
Patch0030: 0030-tests-clean-up-tests.patch
Patch0031: 0031-doc-libparted-disk.c-correct-doxygen-comment-typo.patch
Patch0032: 0032-tests-stop-using-private-dev-directory-for-losetup.patch
# Won't apply to tar.xz
#Patch0033: 0033-maint-fix-an-error-in-the-preceding-commit-log.patch
Patch0034: 0034-tests-improve-test-for-partitionable-loop-devices.patch
Patch0035: 0035-tests-t8001-do-not-rely-on-modprobe-loop.patch
Patch0036: 0036-build-do-not-rely-on-automake-s-AM_TESTS_ENVIRONMENT.patch
# No .gitignore in tar.xz
#Patch0037: 0037-build-.gitignore-ignore-tests-fs-resize.patch
Patch0038: 0038-partprobe-remove-no-update-long-option.patch
Patch0039: 0039-doc-update-partprobe-manpage.patch
Patch0040: 0040-partprobe-remove-partitions-when-there-is-no-partiti.patch
Patch0041: 0041-maint-use-AM_V_GEN-to-cut-down-on-build-noise.patch
# Won't work with tar.xz
#Patch0042: 0042-maint-regenerate-.po-.pot-files.patch
Patch0043: 0043-tests-cleanup-losetup-usage.patch
# This causes builds to fail, it sees the build .git and switches on
#Patch0044: 0044-build-default-to-enable-gcc-warnings-in-a-git-tree.patch
Patch0045: 0045-libparted-refactor-device-mapper-partition-sync-code.patch
Patch0046: 0046-libparted-remove-extraneous-blkpg-add-partition-ped-.patch
Patch0047: 0047-libparted-don-t-probe-every-dm-device-in-probe_all.patch
Patch0048: 0048-tests-make-t6003-dm-hide-work-reliably-on-F17.patch
Patch0049: 0049-doc-1MiB-alignment-is-not-enough-for-cheap-flash-dri.patch
# Won't work on tar.xz
#Patch0050: 0050-build-update-gnulib-submodule-to-latest.patch
#Patch0051: 0051-maint-update-all-copyright-year-number-ranges.patch
Patch0052: 0052-maint-avoid-new-warning-error-with-gcc-4.8.0-2013010.patch
Patch0053: 0053-libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch
Patch0054: 0054-tests-test-creating-20-device-mapper-partitions-8031.patch
Patch0055: 0055-libparted-use-dm_udev_wait-698121.patch
Patch0056: 0056-libparted-preserve-the-uuid-on-dm-partitions-832145.patch
Patch0057: 0057-tests-Make-sure-dm-UUIDs-are-not-erased.patch
Patch0058: 0058-libparted-add-support-for-implicit-FBA-DASD-partitio.patch
Patch0059: 0059-libparted-add-support-for-EAV-DASD-partitions.patch
Patch0060: 0060-libparted-mklabel-to-support-EAV-DASD.patch
Patch0061: 0061-libparted-Avoid-dasd-as-default-disk-type-while-prob.patch
Patch0062: 0062-libparted-mklabel-to-support-EDEV-DASD.patch
Patch0063: 0063-libparted-don-t-canonicalize-dev-md-paths-872361.patch
Patch0064: 0064-tests-rewrite-t6001-to-use-dev-mapper.patch
Patch0065: 0065-libparted-Add-Intel-Rapid-Start-Technology-partition.patch
Patch0066: 0066-libparted-Add-UEFI-System-Partition-flag.patch
Patch0067: 0067-libparted-Add-hfs_esp-partition-flag-to-GPT.patch
Patch0068: 0068-libparted-Recognize-btrfs-filesystem.patch
Patch0069: 0069-tests-Add-btrfs-and-xfs-to-the-fs-probe-test.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@ -167,6 +224,21 @@ fi
%changelog
* Wed Aug 28 2013 Brian C. Lane <bcl@redhat.com> 3.1-14
- Rebasing Fedora patches with upstream master since v3.1 release
- Summary of important changes from upstream:
- add support for a new Linux-specific GPT partition type code
- partprobe: remove partitions when there is no partition table
- libparted: refactor device-mapper partition sync code
- libparted: remove extraneous blkpg add partition ped exception
- libparted: don't probe every dm device in probe_all
- New Fedora changes:
- libparted: Add Intel Rapid Start Technology partition flag.
- libparted: Add UEFI System Partition flag.
- libparted: Add hfs_esp partition flag to GPT.
- libparted: Recognize btrfs filesystem
- tests: Add btrfs and xfs to the fs probe test
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild