- tests: t3310-flags.sh: skip pc98 when sector size != 512 (bcl)
- tests: Set optimal blocks to 64 for scsi_debug devices (bcl) - tests: t3310-flags.sh: Add tests for remaining table types (mike.fleetwood) - tests: t3310-flags.sh: Add test for dvh table flags (mike.fleetwood) - tests: t3310-flags.sh: Add test for mac table flags (mike.fleetwood) - libparted: Remove commented local variable from bsd_partition_set_flag() (mike.fleetwood) - libparted: Fix to report success when setting lvm flag on bsd table (mike.fleetwood) - tests: t3310-flags.sh: Add test for bsd table flags (mike.fleetwood) - tests: t3310-flags.sh: Stop excluding certain flags from being tested (mike.fleetwood) - tests: t3310-flags.sh: Query libparted for all flags to be tested (mike.fleetwood) - libparted: only IEC units are treated as exact (petr.uzel) - docs: Improve partition description in parted.texi (gareth.randall) - Add support for NVMe devices (petr.uzel) - libparted/dasd: correct the offset where the first partition begins (dongdwdw)
This commit is contained in:
parent
7e779bb347
commit
c6a1bfceda
@ -0,0 +1,54 @@
|
|||||||
|
From 40270928ff4ac2a87825f47e53c680ffb18b5bc4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
||||||
|
Date: Tue, 14 Jun 2016 12:19:40 +0200
|
||||||
|
Subject: [PATCH 41/53] libparted/dasd: correct the offset where the first
|
||||||
|
partition begins
|
||||||
|
|
||||||
|
The start point of first partition must start at least from the third
|
||||||
|
track of DASD, due to the existence of metadata in the first two track.
|
||||||
|
The previous constraint just sets all the device to be partitioned.
|
||||||
|
So when the start point of the first partition start before the third
|
||||||
|
track, (For example if it starts from.0) parted will exit abruptly.
|
||||||
|
And this kind of job must be done with constraint explicitly.
|
||||||
|
|
||||||
|
Then the constraint is modified to exclude the first two tracks and
|
||||||
|
to make the first partition start from the third track by default.
|
||||||
|
|
||||||
|
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
||||||
|
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
||||||
|
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
(cherry picked from commit 4126d0292c75cf7d50a2f4e9d485a52b5beafccc)
|
||||||
|
---
|
||||||
|
libparted/labels/dasd.c | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
||||||
|
index f79a867..4e68512 100644
|
||||||
|
--- a/libparted/labels/dasd.c
|
||||||
|
+++ b/libparted/labels/dasd.c
|
||||||
|
@@ -829,6 +829,7 @@ _primary_constraint (PedDisk* disk)
|
||||||
|
PedSector sector_size;
|
||||||
|
LinuxSpecific* arch_specific;
|
||||||
|
DasdDiskSpecific* disk_specific;
|
||||||
|
+ PedSector start;
|
||||||
|
|
||||||
|
PDEBUG;
|
||||||
|
|
||||||
|
@@ -842,7 +843,12 @@ _primary_constraint (PedDisk* disk)
|
||||||
|
if (!ped_alignment_init (&end_align, -1,
|
||||||
|
disk->dev->hw_geom.sectors * sector_size))
|
||||||
|
return NULL;
|
||||||
|
- if (!ped_geometry_init (&max_geom, disk->dev, 0, disk->dev->length))
|
||||||
|
+
|
||||||
|
+ start = (FIRST_USABLE_TRK * (long long) disk->dev->hw_geom.sectors
|
||||||
|
+ * (long long) arch_specific->real_sector_size
|
||||||
|
+ / (long long) disk->dev->sector_size);
|
||||||
|
+
|
||||||
|
+ if (!ped_geometry_init (&max_geom, disk->dev, start, disk->dev->length))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return ped_constraint_new(&start_align, &end_align, &max_geom,
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
105
0042-Add-support-for-NVMe-devices.patch
Normal file
105
0042-Add-support-for-NVMe-devices.patch
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
From 797d7b90c677e49552fbe7c526ce849b964e1ffe Mon Sep 17 00:00:00 2001
|
||||||
|
From: Petr Uzel <petr.uzel@suse.cz>
|
||||||
|
Date: Tue, 14 Jun 2016 13:17:00 +0200
|
||||||
|
Subject: [PATCH 42/53] Add support for NVMe devices
|
||||||
|
|
||||||
|
Recognize NVMe Devices, so "parted -s /dev/nvme0n1" now prints
|
||||||
|
"NVMe Device (nvme)" instead of "Model: Unknown (unknown)".
|
||||||
|
|
||||||
|
In order for a device to be recognized as NVMe, it has to
|
||||||
|
have a 'blkext' major number. But since this major can be
|
||||||
|
used also by other device types, we also check the device
|
||||||
|
path contains 'nvme' as a substring.
|
||||||
|
|
||||||
|
* NEWS: Mention the change
|
||||||
|
* include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_NVME
|
||||||
|
* libparted/arch/linux.c(BLKEXT_MAJOR): New define.
|
||||||
|
* libparted/arch/linux.c(_is_blkext_major): New function.
|
||||||
|
* libparted/arch/linux.c(_device_probe_type): Recognize NVMe devices.
|
||||||
|
* libparted/arch/linux.c(linux_new): Handle NVMe devices.
|
||||||
|
* parted/parted.c(do_print): Add "nvme" to list of transports.
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
(cherry picked from commit e4ae4330f3e33201aeeed3b7ca88e15d98d03e13)
|
||||||
|
---
|
||||||
|
include/parted/device.in.h | 3 ++-
|
||||||
|
libparted/arch/linux.c | 14 ++++++++++++++
|
||||||
|
parted/parted.c | 2 +-
|
||||||
|
3 files changed, 17 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/parted/device.in.h b/include/parted/device.in.h
|
||||||
|
index 82d4104..d38db44 100644
|
||||||
|
--- a/include/parted/device.in.h
|
||||||
|
+++ b/include/parted/device.in.h
|
||||||
|
@@ -49,7 +49,8 @@ typedef enum {
|
||||||
|
PED_DEVICE_VIRTBLK = 15,
|
||||||
|
PED_DEVICE_AOE = 16,
|
||||||
|
PED_DEVICE_MD = 17,
|
||||||
|
- PED_DEVICE_LOOP = 18
|
||||||
|
+ PED_DEVICE_LOOP = 18,
|
||||||
|
+ PED_DEVICE_NVME = 19
|
||||||
|
} PedDeviceType;
|
||||||
|
|
||||||
|
typedef struct _PedDevice PedDevice;
|
||||||
|
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
||||||
|
index eb01deb..b7ba5de 100644
|
||||||
|
--- a/libparted/arch/linux.c
|
||||||
|
+++ b/libparted/arch/linux.c
|
||||||
|
@@ -278,6 +278,7 @@ struct blkdev_ioctl_param {
|
||||||
|
#define SDMMC_MAJOR 179
|
||||||
|
#define LOOP_MAJOR 7
|
||||||
|
#define MD_MAJOR 9
|
||||||
|
+#define BLKEXT_MAJOR 259
|
||||||
|
|
||||||
|
#define SCSI_BLK_MAJOR(M) ( \
|
||||||
|
(M) == SCSI_DISK0_MAJOR \
|
||||||
|
@@ -441,6 +442,12 @@ _is_virtblk_major (int major)
|
||||||
|
return _major_type_in_devices (major, "virtblk");
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int
|
||||||
|
+_is_blkext_major (int major)
|
||||||
|
+{
|
||||||
|
+ return _major_type_in_devices (major, "blkext");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
#ifdef ENABLE_DEVICE_MAPPER
|
||||||
|
static int
|
||||||
|
_dm_task_run_wait (struct dm_task *task, uint32_t cookie)
|
||||||
|
@@ -692,6 +699,8 @@ _device_probe_type (PedDevice* dev)
|
||||||
|
dev->type = PED_DEVICE_LOOP;
|
||||||
|
} else if (dev_major == MD_MAJOR) {
|
||||||
|
dev->type = PED_DEVICE_MD;
|
||||||
|
+ } else if (_is_blkext_major(dev_major) && dev->path && strstr(dev->path, "nvme")) {
|
||||||
|
+ dev->type = PED_DEVICE_NVME;
|
||||||
|
} else {
|
||||||
|
dev->type = PED_DEVICE_UNKNOWN;
|
||||||
|
}
|
||||||
|
@@ -1465,6 +1474,11 @@ linux_new (const char* path)
|
||||||
|
goto error_free_arch_specific;
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case PED_DEVICE_NVME:
|
||||||
|
+ if (!init_generic (dev, _("NVMe Device")))
|
||||||
|
+ goto error_free_arch_specific;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
case PED_DEVICE_ATARAID:
|
||||||
|
if (!init_generic (dev, _("ATARAID Controller")))
|
||||||
|
goto error_free_arch_specific;
|
||||||
|
diff --git a/parted/parted.c b/parted/parted.c
|
||||||
|
index 06f9971..bd848c3 100644
|
||||||
|
--- a/parted/parted.c
|
||||||
|
+++ b/parted/parted.c
|
||||||
|
@@ -979,7 +979,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp)
|
||||||
|
"cpqarray", "file", "ataraid", "i2o",
|
||||||
|
"ubd", "dasd", "viodasd", "sx8", "dm",
|
||||||
|
"xvd", "sd/mmc", "virtblk", "aoe",
|
||||||
|
- "md", "loopback"};
|
||||||
|
+ "md", "loopback", "nvme"};
|
||||||
|
|
||||||
|
char* start = ped_unit_format (dev, 0);
|
||||||
|
PedUnit default_unit = ped_unit_get_default ();
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
61
0043-docs-Improve-partition-description-in-parted.texi.patch
Normal file
61
0043-docs-Improve-partition-description-in-parted.texi.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
From 22a2fd360f5f0f8e7e522712a6187b1c6ac74ba7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gareth Randall <gareth.randall@virgin.net>
|
||||||
|
Date: Fri, 30 Sep 2016 10:07:42 -0700
|
||||||
|
Subject: [PATCH 43/53] docs: Improve partition description in parted.texi
|
||||||
|
|
||||||
|
(cherry picked from commit e27ac8ff6706f67817f68246311899bd920b9c88)
|
||||||
|
---
|
||||||
|
doc/parted.texi | 36 +++++++++++++++++++++++++++++++-----
|
||||||
|
1 file changed, 31 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/doc/parted.texi b/doc/parted.texi
|
||||||
|
index 1b9c084..414179d 100644
|
||||||
|
--- a/doc/parted.texi
|
||||||
|
+++ b/doc/parted.texi
|
||||||
|
@@ -291,12 +291,38 @@ or you want to modify a root or boot partition, use GParted Live:
|
||||||
|
@section Introduction to Partitioning
|
||||||
|
@cindex partitioning overview
|
||||||
|
|
||||||
|
-Unfortunately, partitioning your disk is rather complicated. This is
|
||||||
|
-because there are interactions between many different systems that need
|
||||||
|
-to be taken into consideration.
|
||||||
|
+Partitioning is the process of dividing a storage device into local
|
||||||
|
+sections, called partitions, which help organize multiple filesystems
|
||||||
|
+and their associated operating systems.
|
||||||
|
+
|
||||||
|
+A storage device presents itself as a sequence of bytes, numbered
|
||||||
|
+starting from zero and increasing until the maximum capacity of the
|
||||||
|
+device is reached. Bytes are normally read and written a sector at a
|
||||||
|
+time, rather than individually. Each sector contains a fixed number
|
||||||
|
+of bytes, with the number determined by the device.
|
||||||
|
+
|
||||||
|
+@example
|
||||||
|
++------------------------------------------------------------+
|
||||||
|
+| storage device with no partitions |
|
||||||
|
++------------------------------------------------------------+
|
||||||
|
+0 start end
|
||||||
|
+@end example
|
||||||
|
+
|
||||||
|
+In order to store multiple filesystems, a storage device can be divided
|
||||||
|
+up in to multiple partitions. Each partition can be thought of as an
|
||||||
|
+area which contains a real filesystem inside of it. To show where these
|
||||||
|
+partitions are on the device a small table is written at the start,
|
||||||
|
+shown as PT in the diagram below. This table is called a partition
|
||||||
|
+table, or disklabel, and also stores the type of each partition and
|
||||||
|
+some flags.
|
||||||
|
+
|
||||||
|
+@example
|
||||||
|
++--+---------------+----------------+------------------------+
|
||||||
|
+|PT| Partition 1 | Partition 2 | Partition 3 |
|
||||||
|
++--+---------------+----------------+------------------------+
|
||||||
|
+0 start end
|
||||||
|
+@end example
|
||||||
|
|
||||||
|
-This manual used to introduce the reader to these systems and their
|
||||||
|
-working. This content has moved to the GNU Storage Guide.
|
||||||
|
|
||||||
|
@node Running Parted
|
||||||
|
@section Using GNU Parted
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
82
0044-libparted-only-IEC-units-are-treated-as-exact.patch
Normal file
82
0044-libparted-only-IEC-units-are-treated-as-exact.patch
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
From e4bf9b823452c0b98b394b8abcc67f887b6991b3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Petr Uzel <petr.uzel@suse.cz>
|
||||||
|
Date: Thu, 21 Jul 2016 16:46:46 +0200
|
||||||
|
Subject: [PATCH 44/53] libparted: only IEC units are treated as exact
|
||||||
|
|
||||||
|
If the user specifies start/end of the partition as a unit,
|
||||||
|
whose size happens to be power of two, we treat that as
|
||||||
|
exact address with exact placement.
|
||||||
|
|
||||||
|
Recently, commit 01900e056ec25083 added an exception for
|
||||||
|
percent units.
|
||||||
|
|
||||||
|
This logic however can fail also for cylinders, e.g. on DASD FBA disks,
|
||||||
|
which report CHS=(*, 128, 16) geometry, hence once cylinder is 1 MiB.
|
||||||
|
With cylinders as units, exact placement is not what the user wants.
|
||||||
|
|
||||||
|
Instead of adding cylinders to the blacklist, let's instead
|
||||||
|
whitelist units which should trigger exact placement.
|
||||||
|
|
||||||
|
* libparted/unit.c (is_power_of_2): Remove now unused function.
|
||||||
|
(ped_unit_parse_custom): Specify which units trigger exact placement.
|
||||||
|
* NEWS (Bug Fixes): Mention this.
|
||||||
|
|
||||||
|
(cherry picked from commit f4f38082fc4dbf0c28ccc7613c672fe279d3032e)
|
||||||
|
---
|
||||||
|
libparted/unit.c | 33 +++++++++++++++++----------------
|
||||||
|
1 file changed, 17 insertions(+), 16 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libparted/unit.c b/libparted/unit.c
|
||||||
|
index dddb5db..e47e868 100644
|
||||||
|
--- a/libparted/unit.c
|
||||||
|
+++ b/libparted/unit.c
|
||||||
|
@@ -481,12 +481,6 @@ parse_unit_suffix (const char* suffix, PedUnit suggested_unit)
|
||||||
|
return suggested_unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static bool
|
||||||
|
-is_power_of_2 (long long n)
|
||||||
|
-{
|
||||||
|
- return (n & (n - 1)) == 0;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
/**
|
||||||
|
* If \p str contains a valid description of a location on \p dev, then
|
||||||
|
* \p *sector is modified to describe the location and a geometry is created
|
||||||
|
@@ -540,16 +534,23 @@ ped_unit_parse_custom (const char* str, const PedDevice* dev, PedUnit unit,
|
||||||
|
}
|
||||||
|
|
||||||
|
unit_size = ped_unit_get_size (dev, unit);
|
||||||
|
- radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1;
|
||||||
|
- if (radius < 0)
|
||||||
|
- radius = 0;
|
||||||
|
- /* If the user specifies units in a power of 2, e.g., 4MiB, as in
|
||||||
|
- parted -s -- $dev mklabel gpt mkpart P-NAME 4MiB -34s
|
||||||
|
- do not use 4MiB as the range. Rather, presume that they
|
||||||
|
- are specifying precisely the starting or ending number,
|
||||||
|
- and treat "4MiB" just as we would treat "4194304B". */
|
||||||
|
- if (is_power_of_2 (unit_size) && unit != PED_UNIT_PERCENT)
|
||||||
|
- radius = 0;
|
||||||
|
+ switch (unit) {
|
||||||
|
+ /* If the user specifies the address using IEC units e.g., 4MiB, as in
|
||||||
|
+ parted -s -- $dev mklabel gpt mkpart P-NAME 4MiB -34s
|
||||||
|
+ do not use size of the unit as the range. Rather, presume that they
|
||||||
|
+ are specifying precisely the starting or ending number,
|
||||||
|
+ and treat "4MiB" just as we would treat "4194304B". */
|
||||||
|
+ case PED_UNIT_KIBIBYTE:
|
||||||
|
+ case PED_UNIT_MEBIBYTE:
|
||||||
|
+ case PED_UNIT_GIBIBYTE:
|
||||||
|
+ case PED_UNIT_TEBIBYTE:
|
||||||
|
+ radius = 0;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1;
|
||||||
|
+ if (radius < 0)
|
||||||
|
+ radius = 0;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
*sector = num * unit_size / dev->sector_size;
|
||||||
|
/* negative numbers count from the end */
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
188
0045-tests-t3310-flags.sh-Query-libparted-for-all-flags-t.patch
Normal file
188
0045-tests-t3310-flags.sh-Query-libparted-for-all-flags-t.patch
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
From 450dbead63306b242e8159c85641698bddf6d19e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||||
|
Date: Sat, 1 Oct 2016 16:40:16 +0100
|
||||||
|
Subject: [PATCH 45/53] tests: t3310-flags.sh: Query libparted for all flags to
|
||||||
|
be tested
|
||||||
|
|
||||||
|
Replace scanning the documentation for an incomplete list of flags with
|
||||||
|
querying libparted for the complete list of supported flags via the
|
||||||
|
added helper print-flags.
|
||||||
|
|
||||||
|
Correct $ME -> $ME_ in the warning messages. Improve the warning
|
||||||
|
messages by including the table type and flag name not correctly set or
|
||||||
|
cleared.
|
||||||
|
|
||||||
|
Plus minor changes:
|
||||||
|
(1) use slightly longer variable name primary_or_name;
|
||||||
|
(2) use longer test partition name PTNNAME; and
|
||||||
|
(3) stop shortening parted unit command to u.
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
---
|
||||||
|
tests/Makefile.am | 3 ++-
|
||||||
|
tests/print-flags.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
tests/t3310-flags.sh | 32 ++++++++++++++++--------------
|
||||||
|
3 files changed, 75 insertions(+), 16 deletions(-)
|
||||||
|
create mode 100644 tests/print-flags.c
|
||||||
|
|
||||||
|
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||||
|
index 6a06dce..a840304 100644
|
||||||
|
--- a/tests/Makefile.am
|
||||||
|
+++ b/tests/Makefile.am
|
||||||
|
@@ -92,7 +92,8 @@ EXTRA_DIST = \
|
||||||
|
init.cfg init.sh t-lib-helpers.sh gpt-header-munge \
|
||||||
|
gpt-header-move msdos-overlap
|
||||||
|
|
||||||
|
-check_PROGRAMS = print-align print-max dup-clobber duplicate fs-resize
|
||||||
|
+check_PROGRAMS = print-align print-flags print-max dup-clobber duplicate \
|
||||||
|
+ fs-resize
|
||||||
|
fs_resize_LDADD = \
|
||||||
|
$(top_builddir)/libparted/fs/libparted-fs-resize.la \
|
||||||
|
$(top_builddir)/libparted/libparted.la
|
||||||
|
diff --git a/tests/print-flags.c b/tests/print-flags.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..3176ca6
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/print-flags.c
|
||||||
|
@@ -0,0 +1,56 @@
|
||||||
|
+/* Print the available flags for a particular partition. */
|
||||||
|
+
|
||||||
|
+#include <config.h>
|
||||||
|
+#include <parted/parted.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include "progname.h"
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+main (int argc, char **argv)
|
||||||
|
+{
|
||||||
|
+ PedDevice *dev;
|
||||||
|
+ PedDisk *disk;
|
||||||
|
+ PedPartition *part;
|
||||||
|
+
|
||||||
|
+ set_program_name (argv[0]);
|
||||||
|
+
|
||||||
|
+ if (argc != 2 ) {
|
||||||
|
+ fprintf (stderr, "Usage: %s <device>\n", argv[0]);
|
||||||
|
+ return EXIT_FAILURE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ dev = ped_device_get(argv[1]);
|
||||||
|
+ if (!dev) {
|
||||||
|
+ fprintf (stderr, "Error: failed to create device %s\n",
|
||||||
|
+ argv[1]);
|
||||||
|
+ return EXIT_FAILURE;
|
||||||
|
+ }
|
||||||
|
+ if (!ped_device_open (dev)) {
|
||||||
|
+ fprintf (stderr, "Error: failed to open device %s\n", argv[1]);
|
||||||
|
+ return EXIT_FAILURE;
|
||||||
|
+ }
|
||||||
|
+ disk = ped_disk_new (dev);
|
||||||
|
+ if (!disk) {
|
||||||
|
+ fprintf (stderr,
|
||||||
|
+ "Error: failed to read partition table from device %s\n",
|
||||||
|
+ argv[1]);
|
||||||
|
+ return EXIT_FAILURE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ part = ped_disk_get_partition (disk, 1);
|
||||||
|
+ if (!part) {
|
||||||
|
+ fprintf (stderr,
|
||||||
|
+ "Error: failed to get partition 1 from device %s\n",
|
||||||
|
+ argv[1]);
|
||||||
|
+ return EXIT_FAILURE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (PedPartitionFlag flag = PED_PARTITION_FIRST_FLAG;
|
||||||
|
+ flag <= PED_PARTITION_LAST_FLAG; flag++)
|
||||||
|
+ {
|
||||||
|
+ if (ped_partition_is_flag_available (part, flag))
|
||||||
|
+ puts (ped_partition_flag_get_name (flag));
|
||||||
|
+ }
|
||||||
|
+ return EXIT_SUCCESS;
|
||||||
|
+}
|
||||||
|
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
||||||
|
index cb3024a..85a673a 100644
|
||||||
|
--- a/tests/t3310-flags.sh
|
||||||
|
+++ b/tests/t3310-flags.sh
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
-# Exercise the exclusive, single-bit flags.
|
||||||
|
+# Exercise partition flags.
|
||||||
|
|
||||||
|
# Copyright (C) 2010-2014 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
@@ -16,35 +16,37 @@
|
||||||
|
# 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
|
||||||
|
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted .
|
||||||
|
ss=$sector_size_
|
||||||
|
dev=dev-file
|
||||||
|
|
||||||
|
extract_flags()
|
||||||
|
{
|
||||||
|
- perl -nle '/^1:2048s:4095s:2048s::(?:P1)?:(.+);$/ and print $1' "$@"
|
||||||
|
+ perl -nle '/^1:2048s:4095s:2048s::(?:PTNNAME)?:(.+);$/ and print $1' "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
for table_type in msdos gpt; do
|
||||||
|
|
||||||
|
- # Extract flag names of type $table_type from the texinfo documentation.
|
||||||
|
case $table_type in
|
||||||
|
- msdos) search_term=MS-DOS; pri_or_name=pri;;
|
||||||
|
- gpt) search_term=GPT; pri_or_name=P1;;
|
||||||
|
+ gpt) primary_or_name='PTNNAME'
|
||||||
|
+ ;;
|
||||||
|
+ msdos) primary_or_name='primary'
|
||||||
|
+ ;;
|
||||||
|
esac
|
||||||
|
- flags=$(sed -n '/^@node set/,/^@node/p' \
|
||||||
|
- "$abs_top_srcdir/doc/parted.texi" \
|
||||||
|
- | perl -00 -ne \
|
||||||
|
- '/^\@item (\w+).*'"$search_term"'/s and print lc($1), "\n"')
|
||||||
|
|
||||||
|
n_sectors=5000
|
||||||
|
dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
|
||||||
|
|
||||||
|
parted -s $dev mklabel $table_type \
|
||||||
|
- mkpart $pri_or_name ext2 $((1*2048))s $((2*2048-1))s \
|
||||||
|
+ mkpart $primary_or_name ext2 $((1*2048))s $((2*2048-1))s \
|
||||||
|
> out 2> err || fail=1
|
||||||
|
compare /dev/null out || fail=1
|
||||||
|
|
||||||
|
+ # Query libparted for the available flags for this test partition.
|
||||||
|
+ flags=`print-flags $dev` \
|
||||||
|
+ || { warn_ "$ME_: $table_type: failed to get available flags";
|
||||||
|
+ fail=1; continue; }
|
||||||
|
+
|
||||||
|
for mode in on_only on_and_off ; do
|
||||||
|
for flag in $flags; do
|
||||||
|
|
||||||
|
@@ -53,18 +55,18 @@ for table_type in msdos gpt; do
|
||||||
|
case $flag in boot|lba|hidden) continue;; esac
|
||||||
|
|
||||||
|
# Turn on each flag, one at a time.
|
||||||
|
- parted -m -s $dev set 1 $flag on u s print > raw 2> err || fail=1
|
||||||
|
+ parted -m -s $dev set 1 $flag on unit s print > raw 2> err || fail=1
|
||||||
|
extract_flags raw > out
|
||||||
|
grep -F "$flag" out \
|
||||||
|
- || { warn_ "$ME: flag not turned on: $(cat out)"; fail=1; }
|
||||||
|
+ || { warn_ "$ME_: $table_type: flag '$flag' not turned on: $(cat out)"; fail=1; }
|
||||||
|
compare /dev/null err || fail=1
|
||||||
|
|
||||||
|
if test $mode = on_and_off; then
|
||||||
|
# Turn it off
|
||||||
|
- parted -m -s $dev set 1 $flag off u s print > raw 2> err || fail=1
|
||||||
|
+ parted -m -s $dev set 1 $flag off unit s print > raw 2> err || fail=1
|
||||||
|
extract_flags raw > out
|
||||||
|
grep -F "$flag" out \
|
||||||
|
- && { warn_ "$ME: flag not turned off: $(cat out)"; fail=1; }
|
||||||
|
+ && { warn_ "$ME_: $table_type: flag '$flag' not turned off: $(cat out)"; fail=1; }
|
||||||
|
compare /dev/null err || fail=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
From cfcfadac1d61093f900d1903f580818d244479ad Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||||
|
Date: Sat, 1 Oct 2016 16:40:17 +0100
|
||||||
|
Subject: [PATCH 46/53] tests: t3310-flags.sh: Stop excluding certain flags
|
||||||
|
from being tested
|
||||||
|
|
||||||
|
Also grep for whole words, grep -w, to avoid flag 'boot' being matched
|
||||||
|
as a substring of flag 'legacy_boot'.
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
---
|
||||||
|
tests/t3310-flags.sh | 9 ++-------
|
||||||
|
1 file changed, 2 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
||||||
|
index 85a673a..5cbf2da 100644
|
||||||
|
--- a/tests/t3310-flags.sh
|
||||||
|
+++ b/tests/t3310-flags.sh
|
||||||
|
@@ -49,15 +49,10 @@ for table_type in msdos gpt; do
|
||||||
|
|
||||||
|
for mode in on_only on_and_off ; do
|
||||||
|
for flag in $flags; do
|
||||||
|
-
|
||||||
|
- # Exclude the supplemental flags.
|
||||||
|
- # These are not boolean, like the others.
|
||||||
|
- case $flag in boot|lba|hidden) continue;; esac
|
||||||
|
-
|
||||||
|
# Turn on each flag, one at a time.
|
||||||
|
parted -m -s $dev set 1 $flag on unit s print > raw 2> err || fail=1
|
||||||
|
extract_flags raw > out
|
||||||
|
- grep -F "$flag" out \
|
||||||
|
+ grep -w "$flag" out \
|
||||||
|
|| { warn_ "$ME_: $table_type: flag '$flag' not turned on: $(cat out)"; fail=1; }
|
||||||
|
compare /dev/null err || fail=1
|
||||||
|
|
||||||
|
@@ -65,7 +60,7 @@ for table_type in msdos gpt; do
|
||||||
|
# Turn it off
|
||||||
|
parted -m -s $dev set 1 $flag off unit s print > raw 2> err || fail=1
|
||||||
|
extract_flags raw > out
|
||||||
|
- grep -F "$flag" out \
|
||||||
|
+ grep -w "$flag" out \
|
||||||
|
&& { warn_ "$ME_: $table_type: flag '$flag' not turned off: $(cat out)"; fail=1; }
|
||||||
|
compare /dev/null err || fail=1
|
||||||
|
fi
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
30
0047-tests-t3310-flags.sh-Add-test-for-bsd-table-flags.patch
Normal file
30
0047-tests-t3310-flags.sh-Add-test-for-bsd-table-flags.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From d7bcb49f1313da7deae0ca41ab402980fb3094a4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||||
|
Date: Sat, 1 Oct 2016 16:40:18 +0100
|
||||||
|
Subject: [PATCH 47/53] tests: t3310-flags.sh: Add test for bsd table flags
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
---
|
||||||
|
tests/t3310-flags.sh | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
||||||
|
index 5cbf2da..3f80213 100644
|
||||||
|
--- a/tests/t3310-flags.sh
|
||||||
|
+++ b/tests/t3310-flags.sh
|
||||||
|
@@ -25,9 +25,11 @@ extract_flags()
|
||||||
|
perl -nle '/^1:2048s:4095s:2048s::(?:PTNNAME)?:(.+);$/ and print $1' "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
-for table_type in msdos gpt; do
|
||||||
|
+for table_type in bsd gpt msdos; do
|
||||||
|
|
||||||
|
case $table_type in
|
||||||
|
+ bsd) primary_or_name=''
|
||||||
|
+ ;;
|
||||||
|
gpt) primary_or_name='PTNNAME'
|
||||||
|
;;
|
||||||
|
msdos) primary_or_name='primary'
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From fa15f7d65ad76872f9019f34dd2a1db0f678b0f9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||||
|
Date: Sat, 1 Oct 2016 16:40:19 +0100
|
||||||
|
Subject: [PATCH 48/53] libparted: Fix to report success when setting lvm flag
|
||||||
|
on bsd table
|
||||||
|
|
||||||
|
bsd_partition_set_flag() was falling through in the lvm flag case and
|
||||||
|
returning failure. Fix this by adding missing return 1 (success) like
|
||||||
|
for the other flags.
|
||||||
|
|
||||||
|
Found as a result of this bug reported by Timo Riikonen:
|
||||||
|
https://bugzilla.gnome.org/show_bug.cgi?id=769831
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
---
|
||||||
|
libparted/labels/bsd.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
|
||||||
|
index a8525a4..23daea8 100644
|
||||||
|
--- a/libparted/labels/bsd.c
|
||||||
|
+++ b/libparted/labels/bsd.c
|
||||||
|
@@ -488,6 +488,7 @@ bsd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
|
||||||
|
bsd_data->raid = 0;
|
||||||
|
}
|
||||||
|
bsd_data->lvm = state;
|
||||||
|
+ return 1;
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
From fe6d1478172071779135001e494afffb993a9068 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||||
|
Date: Sat, 1 Oct 2016 16:40:20 +0100
|
||||||
|
Subject: [PATCH 49/53] libparted: Remove commented local variable from
|
||||||
|
bsd_partition_set_flag()
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
---
|
||||||
|
libparted/labels/bsd.c | 1 -
|
||||||
|
1 file changed, 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
|
||||||
|
index 23daea8..f253a32 100644
|
||||||
|
--- a/libparted/labels/bsd.c
|
||||||
|
+++ b/libparted/labels/bsd.c
|
||||||
|
@@ -464,7 +464,6 @@ bsd_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
|
||||||
|
static int
|
||||||
|
bsd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
|
||||||
|
{
|
||||||
|
-// PedPartition* walk; // since -Werror, this unused variable would break build
|
||||||
|
BSDPartitionData* bsd_data;
|
||||||
|
|
||||||
|
PED_ASSERT (part != NULL);
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
126
0050-tests-t3310-flags.sh-Add-test-for-mac-table-flags.patch
Normal file
126
0050-tests-t3310-flags.sh-Add-test-for-mac-table-flags.patch
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
From 81b397bbc9eb270ef0b3ed52d40c3a76ecd9ac80 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||||
|
Date: Sat, 1 Oct 2016 16:40:21 +0100
|
||||||
|
Subject: [PATCH 50/53] tests: t3310-flags.sh: Add test for mac table flags
|
||||||
|
|
||||||
|
MAC partition table reserves partition 1 for the partition map
|
||||||
|
partition, so the created test partition will be number 2. Adapt
|
||||||
|
accordingly.
|
||||||
|
|
||||||
|
Setting flags 'root' and 'swap' also sets the partition name to 'root'
|
||||||
|
and 'swap' respectively, so no longer match the partition name in
|
||||||
|
extract_flags().
|
||||||
|
|
||||||
|
Don't test lvm and raid flags as they fail to be cleared with a single
|
||||||
|
set off command. See FIXME comment in the test for more details.
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
---
|
||||||
|
tests/print-flags.c | 12 +++++++-----
|
||||||
|
tests/t3310-flags.sh | 27 ++++++++++++++++++++++-----
|
||||||
|
2 files changed, 29 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/print-flags.c b/tests/print-flags.c
|
||||||
|
index 3176ca6..db088e8 100644
|
||||||
|
--- a/tests/print-flags.c
|
||||||
|
+++ b/tests/print-flags.c
|
||||||
|
@@ -12,11 +12,12 @@ main (int argc, char **argv)
|
||||||
|
PedDevice *dev;
|
||||||
|
PedDisk *disk;
|
||||||
|
PedPartition *part;
|
||||||
|
+ int partnum;
|
||||||
|
|
||||||
|
set_program_name (argv[0]);
|
||||||
|
|
||||||
|
- if (argc != 2 ) {
|
||||||
|
- fprintf (stderr, "Usage: %s <device>\n", argv[0]);
|
||||||
|
+ if (argc != 3 ) {
|
||||||
|
+ fprintf (stderr, "Usage: %s <device> <ptnnum>\n", argv[0]);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -38,11 +39,12 @@ main (int argc, char **argv)
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
- part = ped_disk_get_partition (disk, 1);
|
||||||
|
+ partnum = atoi (argv[2]);
|
||||||
|
+ part = ped_disk_get_partition (disk, partnum);
|
||||||
|
if (!part) {
|
||||||
|
fprintf (stderr,
|
||||||
|
- "Error: failed to get partition 1 from device %s\n",
|
||||||
|
- argv[1]);
|
||||||
|
+ "Error: failed to get partition %d from device %s\n",
|
||||||
|
+ partnum, argv[1]);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
||||||
|
index 3f80213..672160d 100644
|
||||||
|
--- a/tests/t3310-flags.sh
|
||||||
|
+++ b/tests/t3310-flags.sh
|
||||||
|
@@ -22,16 +22,22 @@ dev=dev-file
|
||||||
|
|
||||||
|
extract_flags()
|
||||||
|
{
|
||||||
|
- perl -nle '/^1:2048s:4095s:2048s::(?:PTNNAME)?:(.+);$/ and print $1' "$@"
|
||||||
|
+ perl -nle '/^[^:]*:2048s:4095s:2048s::[^:]*:(.+);$/ and print $1' "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
-for table_type in bsd gpt msdos; do
|
||||||
|
+for table_type in bsd gpt mac msdos; do
|
||||||
|
+ ptn_num=1
|
||||||
|
|
||||||
|
case $table_type in
|
||||||
|
bsd) primary_or_name=''
|
||||||
|
;;
|
||||||
|
gpt) primary_or_name='PTNNAME'
|
||||||
|
;;
|
||||||
|
+ mac) primary_or_name='PTNNAME'
|
||||||
|
+ # MAC table has the partition map partition as the first
|
||||||
|
+ # partition so the created test partition will be number 2.
|
||||||
|
+ ptn_num=2
|
||||||
|
+ ;;
|
||||||
|
msdos) primary_or_name='primary'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
@@ -45,14 +51,25 @@ for table_type in bsd gpt msdos; do
|
||||||
|
compare /dev/null out || fail=1
|
||||||
|
|
||||||
|
# Query libparted for the available flags for this test partition.
|
||||||
|
- flags=`print-flags $dev` \
|
||||||
|
+ flags=`print-flags $dev $ptn_num` \
|
||||||
|
|| { warn_ "$ME_: $table_type: failed to get available flags";
|
||||||
|
fail=1; continue; }
|
||||||
|
+ case $table_type in
|
||||||
|
+ mac) # FIXME: Setting root or swap flags also sets the partition
|
||||||
|
+ # name to root or swap respectively. Probably intended
|
||||||
|
+ # behaviour. Setting lvm or raid flags after root or swap
|
||||||
|
+ # takes two goes to clear the lvm or raid flag. Is this
|
||||||
|
+ # intended? For now don't test lvm or raid flags as this
|
||||||
|
+ # test only tries to clear the flags once which causes this
|
||||||
|
+ # test to fail.
|
||||||
|
+ flags=`echo "$flags" | egrep -v 'lvm|raid'`
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
|
||||||
|
for mode in on_only on_and_off ; do
|
||||||
|
for flag in $flags; do
|
||||||
|
# Turn on each flag, one at a time.
|
||||||
|
- parted -m -s $dev set 1 $flag on unit s print > raw 2> err || fail=1
|
||||||
|
+ parted -m -s $dev set $ptn_num $flag on unit s print > raw 2> err || fail=1
|
||||||
|
extract_flags raw > out
|
||||||
|
grep -w "$flag" out \
|
||||||
|
|| { warn_ "$ME_: $table_type: flag '$flag' not turned on: $(cat out)"; fail=1; }
|
||||||
|
@@ -60,7 +77,7 @@ for table_type in bsd gpt msdos; do
|
||||||
|
|
||||||
|
if test $mode = on_and_off; then
|
||||||
|
# Turn it off
|
||||||
|
- parted -m -s $dev set 1 $flag off unit s print > raw 2> err || fail=1
|
||||||
|
+ parted -m -s $dev set $ptn_num $flag off unit s print > raw 2> err || fail=1
|
||||||
|
extract_flags raw > out
|
||||||
|
grep -w "$flag" out \
|
||||||
|
&& { warn_ "$ME_: $table_type: flag '$flag' not turned off: $(cat out)"; fail=1; }
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
69
0051-tests-t3310-flags.sh-Add-test-for-dvh-table-flags.patch
Normal file
69
0051-tests-t3310-flags.sh-Add-test-for-dvh-table-flags.patch
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
From 797dbba3bb86178e17ccac46d3619936f75df1d4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||||
|
Date: Sat, 1 Oct 2016 16:40:22 +0100
|
||||||
|
Subject: [PATCH 51/53] tests: t3310-flags.sh: Add test for dvh table flags
|
||||||
|
|
||||||
|
DVH table reserves the first 4 MiB for the volume header information so
|
||||||
|
move the created test partition to immediately after that.
|
||||||
|
|
||||||
|
Exclude testing the boot flag as that can only be set on logical
|
||||||
|
partitions and this test script only uses primary partitions so far.
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
---
|
||||||
|
tests/t3310-flags.sh | 15 +++++++++++----
|
||||||
|
1 file changed, 11 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
||||||
|
index 672160d..e449589 100644
|
||||||
|
--- a/tests/t3310-flags.sh
|
||||||
|
+++ b/tests/t3310-flags.sh
|
||||||
|
@@ -22,15 +22,17 @@ dev=dev-file
|
||||||
|
|
||||||
|
extract_flags()
|
||||||
|
{
|
||||||
|
- perl -nle '/^[^:]*:2048s:4095s:2048s::[^:]*:(.+);$/ and print $1' "$@"
|
||||||
|
+ perl -nle '/^[^:]*:4096s:6143s:2048s::[^:]*:(.+);$/ and print $1' "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
-for table_type in bsd gpt mac msdos; do
|
||||||
|
+for table_type in bsd dvh gpt mac msdos; do
|
||||||
|
ptn_num=1
|
||||||
|
|
||||||
|
case $table_type in
|
||||||
|
bsd) primary_or_name=''
|
||||||
|
;;
|
||||||
|
+ dvh) primary_or_name='primary'
|
||||||
|
+ ;;
|
||||||
|
gpt) primary_or_name='PTNNAME'
|
||||||
|
;;
|
||||||
|
mac) primary_or_name='PTNNAME'
|
||||||
|
@@ -42,11 +44,11 @@ for table_type in bsd gpt mac msdos; do
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
- n_sectors=5000
|
||||||
|
+ n_sectors=8192
|
||||||
|
dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
|
||||||
|
|
||||||
|
parted -s $dev mklabel $table_type \
|
||||||
|
- mkpart $primary_or_name ext2 $((1*2048))s $((2*2048-1))s \
|
||||||
|
+ mkpart $primary_or_name ext2 $((4*1024))s $((6*1024-1))s \
|
||||||
|
> out 2> err || fail=1
|
||||||
|
compare /dev/null out || fail=1
|
||||||
|
|
||||||
|
@@ -55,6 +57,11 @@ for table_type in bsd gpt mac msdos; do
|
||||||
|
|| { warn_ "$ME_: $table_type: failed to get available flags";
|
||||||
|
fail=1; continue; }
|
||||||
|
case $table_type in
|
||||||
|
+ dvh) # FIXME: Exclude boot flag as that can only be set on logical
|
||||||
|
+ # partitions in the DVH disk label and this test only uses
|
||||||
|
+ # primary partitions.
|
||||||
|
+ flags=`echo "$flags" | egrep -v 'boot'`
|
||||||
|
+ ;;
|
||||||
|
mac) # FIXME: Setting root or swap flags also sets the partition
|
||||||
|
# name to root or swap respectively. Probably intended
|
||||||
|
# behaviour. Setting lvm or raid flags after root or swap
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -0,0 +1,55 @@
|
|||||||
|
From 1bd5c463377b0e54dc3bed840906a8df37bf6f7e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
||||||
|
Date: Sat, 1 Oct 2016 16:40:23 +0100
|
||||||
|
Subject: [PATCH 52/53] tests: t3310-flags.sh: Add tests for remaining table
|
||||||
|
types
|
||||||
|
|
||||||
|
Add test of flags for remaining table types: aix, amiga, pc98, sun and
|
||||||
|
loop. Note that support of writing AIX tables is not yet implemented in
|
||||||
|
parted and LOOP tables don't support partitions nor flags.
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
---
|
||||||
|
tests/t3310-flags.sh | 16 +++++++++++++++-
|
||||||
|
1 file changed, 15 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
||||||
|
index e449589..e97c3b9 100644
|
||||||
|
--- a/tests/t3310-flags.sh
|
||||||
|
+++ b/tests/t3310-flags.sh
|
||||||
|
@@ -25,10 +25,16 @@ extract_flags()
|
||||||
|
perl -nle '/^[^:]*:4096s:6143s:2048s::[^:]*:(.+);$/ and print $1' "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
-for table_type in bsd dvh gpt mac msdos; do
|
||||||
|
+for table_type in aix amiga bsd dvh gpt mac msdos pc98 sun loop; do
|
||||||
|
ptn_num=1
|
||||||
|
|
||||||
|
case $table_type in
|
||||||
|
+ aix) # Support for writing AIX disk labels and adding partitions
|
||||||
|
+ # is not yet implemented.
|
||||||
|
+ continue
|
||||||
|
+ ;;
|
||||||
|
+ amiga) primary_or_name='PTNNAME'
|
||||||
|
+ ;;
|
||||||
|
bsd) primary_or_name=''
|
||||||
|
;;
|
||||||
|
dvh) primary_or_name='primary'
|
||||||
|
@@ -42,6 +48,14 @@ for table_type in bsd dvh gpt mac msdos; do
|
||||||
|
;;
|
||||||
|
msdos) primary_or_name='primary'
|
||||||
|
;;
|
||||||
|
+ pc98) primary_or_name='PTNNAME'
|
||||||
|
+ ;;
|
||||||
|
+ sun) primary_or_name=''
|
||||||
|
+ ;;
|
||||||
|
+ loop) # LOOP table doesn't support creation of a partition nor any
|
||||||
|
+ # flags.
|
||||||
|
+ continue
|
||||||
|
+ ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
n_sectors=8192
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
From a5f1b41b0a10fc1dc64f17b677ddf14e15f8d40e Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
|
Date: Tue, 23 Aug 2016 08:55:18 -0700
|
||||||
|
Subject: [PATCH 53/53] tests: Set optimal blocks to 64 for scsi_debug devices
|
||||||
|
|
||||||
|
The Linux kernel 4.5 changed the optimal blocks count from 64 to 1024
|
||||||
|
This causes tests using scsi_debug devices to fail because of alignment
|
||||||
|
issues. Set the opt_blks to 64 so that we have consistent behavior
|
||||||
|
across kernels.
|
||||||
|
|
||||||
|
(cherry picked from commit bd2664285e4014d2d4c80cee3e87609272e1fca9)
|
||||||
|
---
|
||||||
|
tests/t-local.sh | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/t-local.sh b/tests/t-local.sh
|
||||||
|
index a7d5226..13073d2 100644
|
||||||
|
--- a/tests/t-local.sh
|
||||||
|
+++ b/tests/t-local.sh
|
||||||
|
@@ -98,7 +98,7 @@ scsi_debug_setup_()
|
||||||
|
# It is not trivial to determine the name of the device we're creating.
|
||||||
|
# Record the names of all /sys/block/sd* devices *before* probing:
|
||||||
|
touch stamp
|
||||||
|
- modprobe scsi_debug "$@" || { rm -f stamp; return 1; }
|
||||||
|
+ modprobe scsi_debug opt_blks=64 "$@" || { rm -f stamp; return 1; }
|
||||||
|
scsi_debug_modprobe_succeeded_=1
|
||||||
|
test "$VERBOSE" = yes \
|
||||||
|
&& echo $ME_ modprobe scsi_debug succeeded 1>&2
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
From a6ba22e539ae5836326703cf4e6d549f6628b861 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
|
Date: Tue, 4 Oct 2016 16:11:25 -0700
|
||||||
|
Subject: [PATCH] tests: t3310-flags.sh skip pc98 when sector size != 512
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/t3310-flags.sh | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
||||||
|
index e97c3b9..10ac50d 100644
|
||||||
|
--- a/tests/t3310-flags.sh
|
||||||
|
+++ b/tests/t3310-flags.sh
|
||||||
|
@@ -49,6 +49,8 @@ for table_type in aix amiga bsd dvh gpt mac msdos pc98 sun loop; do
|
||||||
|
msdos) primary_or_name='primary'
|
||||||
|
;;
|
||||||
|
pc98) primary_or_name='PTNNAME'
|
||||||
|
+ # pc98 only supports 512b sectors
|
||||||
|
+ [ $ss -ne 512 ] && continue
|
||||||
|
;;
|
||||||
|
sun) primary_or_name=''
|
||||||
|
;;
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
38
parted.spec
38
parted.spec
@ -4,7 +4,7 @@
|
|||||||
Summary: The GNU disk partition manipulation program
|
Summary: The GNU disk partition manipulation program
|
||||||
Name: parted
|
Name: parted
|
||||||
Version: 3.2
|
Version: 3.2
|
||||||
Release: 21%{?dist}
|
Release: 22%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: http://www.gnu.org/software/parted
|
URL: http://www.gnu.org/software/parted
|
||||||
@ -54,7 +54,20 @@ Patch0037: 0037-libparted-Fix-probing-AIX-disks-on-other-arches.patch
|
|||||||
Patch0038: 0038-partprobe-Open-the-device-once-for-probing.patch
|
Patch0038: 0038-partprobe-Open-the-device-once-for-probing.patch
|
||||||
Patch0039: 0039-Cleanup-mkpart-manpage-entry-1183077.patch
|
Patch0039: 0039-Cleanup-mkpart-manpage-entry-1183077.patch
|
||||||
Patch0040: 0040-doc-Add-information-about-quoting.patch
|
Patch0040: 0040-doc-Add-information-about-quoting.patch
|
||||||
|
Patch0041: 0041-libparted-dasd-correct-the-offset-where-the-first-pa.patch
|
||||||
|
Patch0042: 0042-Add-support-for-NVMe-devices.patch
|
||||||
|
Patch0043: 0043-docs-Improve-partition-description-in-parted.texi.patch
|
||||||
|
Patch0044: 0044-libparted-only-IEC-units-are-treated-as-exact.patch
|
||||||
|
Patch0045: 0045-tests-t3310-flags.sh-Query-libparted-for-all-flags-t.patch
|
||||||
|
Patch0046: 0046-tests-t3310-flags.sh-Stop-excluding-certain-flags-fr.patch
|
||||||
|
Patch0047: 0047-tests-t3310-flags.sh-Add-test-for-bsd-table-flags.patch
|
||||||
|
Patch0048: 0048-libparted-Fix-to-report-success-when-setting-lvm-fla.patch
|
||||||
|
Patch0049: 0049-libparted-Remove-commented-local-variable-from-bsd_p.patch
|
||||||
|
Patch0050: 0050-tests-t3310-flags.sh-Add-test-for-mac-table-flags.patch
|
||||||
|
Patch0051: 0051-tests-t3310-flags.sh-Add-test-for-dvh-table-flags.patch
|
||||||
|
Patch0052: 0052-tests-t3310-flags.sh-Add-tests-for-remaining-table-t.patch
|
||||||
|
Patch0053: 0053-tests-Set-optimal-blocks-to-64-for-scsi_debug-device.patch
|
||||||
|
Patch0054: 0054-tests-t3310-flags.sh-skip-pc98-when-sector-size-512.patch
|
||||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
BuildRequires: e2fsprogs-devel
|
BuildRequires: e2fsprogs-devel
|
||||||
BuildRequires: readline-devel
|
BuildRequires: readline-devel
|
||||||
@ -190,6 +203,27 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Oct 04 2016 Brian C. Lane <bcl@redhat.com> - 3.2-22
|
||||||
|
- tests: t3310-flags.sh: skip pc98 when sector size != 512 (bcl)
|
||||||
|
- tests: Set optimal blocks to 64 for scsi_debug devices (bcl)
|
||||||
|
- tests: t3310-flags.sh: Add tests for remaining table types (mike.fleetwood)
|
||||||
|
- tests: t3310-flags.sh: Add test for dvh table flags (mike.fleetwood)
|
||||||
|
- tests: t3310-flags.sh: Add test for mac table flags (mike.fleetwood)
|
||||||
|
- libparted: Remove commented local variable from bsd_partition_set_flag()
|
||||||
|
(mike.fleetwood)
|
||||||
|
- libparted: Fix to report success when setting lvm flag on bsd table
|
||||||
|
(mike.fleetwood)
|
||||||
|
- tests: t3310-flags.sh: Add test for bsd table flags (mike.fleetwood)
|
||||||
|
- tests: t3310-flags.sh: Stop excluding certain flags from being tested
|
||||||
|
(mike.fleetwood)
|
||||||
|
- tests: t3310-flags.sh: Query libparted for all flags to be tested
|
||||||
|
(mike.fleetwood)
|
||||||
|
- libparted: only IEC units are treated as exact (petr.uzel)
|
||||||
|
- docs: Improve partition description in parted.texi (gareth.randall)
|
||||||
|
- Add support for NVMe devices (petr.uzel)
|
||||||
|
- libparted/dasd: correct the offset where the first partition begins
|
||||||
|
(dongdwdw)
|
||||||
|
|
||||||
* Wed Jun 15 2016 Brian C. Lane <bcl@redhat.com> - 3.2-21
|
* Wed Jun 15 2016 Brian C. Lane <bcl@redhat.com> - 3.2-21
|
||||||
- Cleanup mkpart manpage entry (#1183077)
|
- Cleanup mkpart manpage entry (#1183077)
|
||||||
- doc: Add information about quoting
|
- doc: Add information about quoting
|
||||||
|
Loading…
Reference in New Issue
Block a user