- gpt: add commands to manipulate pMBR boot flag (#754850)

- parted: when printing, also print the new disk flags
- tests: update tests for new disk flags output
- tests: add test for GPT PMBR pmbr_boot flag
- doc: update parted documentation
This commit is contained in:
Brian C. Lane 2012-02-02 13:13:05 -08:00
parent e28225b4fb
commit c45765537f
6 changed files with 954 additions and 1 deletions

View File

@ -0,0 +1,62 @@
From 6a38a57cb567ae4206bdfde09bcbed9e50639107 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 1 Feb 2012 13:12:00 -0800
Subject: [PATCH 5/5] doc: update parted documentation
* doc/parted.text: Add disk_set command.
---
doc/parted.texi | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/doc/parted.texi b/doc/parted.texi
index f6c64f5..bd8c33b 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -415,6 +415,7 @@ GNU Parted provides the following commands:
@menu
* align-check::
+* disk_set::
* help::
* mklabel::
* mkpart::
@@ -458,6 +459,36 @@ Example:
@end deffn
+@node disk_set
+@subsection disk_set
+@cindex disk_set, command description
+@cindex command description, disk_set
+
+@deffn Command disk_set @var{flag} @var{state}
+
+Changes a flag on the disk. A flag can be either ``on'' or ``off''.
+Some or all of these flags will be available, depending on what disk
+label you are using:
+
+@table @samp
+
+@item pmbr_boot
+(GPT) - this flag enables the boot flag on the GPT's protective MBR
+partition.
+
+@end table
+
+The disk's flags are displayed by the print command on the "Disk Flags:"
+line. They are also output as the last field of the disk information
+in machine mode.
+
+@example
+(parted) @kbd{disk_set pmbr_boot on}
+@end example
+
+Set the PMBR's boot flag.
+@end deffn
+
@node help
@subsection help
@cindex help, command description
--
1.7.6.5

View File

@ -0,0 +1,333 @@
From 88197d7ebf7f0e805749c4daf203e3dab778cd52 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg@redhat.com>
Date: Wed, 1 Feb 2012 15:12:20 +0100
Subject: [PATCH 1/6] gpt: add commands to manipulate pMBR boot flag
Some BIOS systems will only boot from GPT partitions if the boot flag is
set on the protective MBR partition. This adds the ability to set this
flag using the disk_set and disk_toggle commands.
* include/parted/disk.h (_PedDiskFlag): Add PED_DISK_GPT_PMBR_BOOT
* libparted/disk.c (ped_disk_flag_get_name): Add PED_DISK_GPT_PMBR_BOOT
* libparted/labels/gpt.c (_GPTDiskData): Add pmbr_boot flag.
(gpt_alloc): Init pmbr_boot to 0.
(gpt_read_headers): Set pmbr_boot state from PMBR boot flag.
(_write_pmbr): Add pmbr_boot flag and set PMBR boot flag from it.
(gpt_write): Pass pmbr_boot flag through to _write_pmbr
(gpt_disk_set_flag): New function
(gpt_disk_is_flag_available): New function
(gpt_disk_get_flag): New function
(gpt_disk_ops): Add disk_set_flag, disk_get_flag, disk_is_flag_available
* parted/parted.c (do_disk_set): New function
(do_disk_toggle): New function
(_init_commands): Add do_disk_set and do_disk_toggle
* parted/ui.c (command_line_get_disk_flag): New function
* parted/ui.h: Add command_line_get_disk_flag prototype.
---
include/parted/disk.h | 5 +++-
libparted/disk.c | 3 +-
libparted/labels/gpt.c | 60 ++++++++++++++++++++++++++++++++++++++++++-
parted/parted.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++
parted/ui.c | 29 +++++++++++++++++++++
parted/ui.h | 3 ++
6 files changed, 162 insertions(+), 4 deletions(-)
diff --git a/include/parted/disk.h b/include/parted/disk.h
index dd461fb..fb9898e 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -36,9 +36,12 @@ enum _PedDiskFlag {
This flag is available for msdos and sun disklabels (for sun labels
it only controls the aligning of the end of the partition) */
PED_DISK_CYLINDER_ALIGNMENT=1,
+ /* This flag controls whether the boot flag of a GPT PMBR is set */
+ PED_DISK_GPT_PMBR_BOOT=2,
+
};
#define PED_DISK_FIRST_FLAG PED_DISK_CYLINDER_ALIGNMENT
-#define PED_DISK_LAST_FLAG PED_DISK_CYLINDER_ALIGNMENT
+#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT
/**
* Partition types
diff --git a/libparted/disk.c b/libparted/disk.c
index 1057aa8..f763ac1 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -836,7 +836,8 @@ ped_disk_flag_get_name(PedDiskFlag flag)
switch (flag) {
case PED_DISK_CYLINDER_ALIGNMENT:
return N_("cylinder_alignment");
-
+ case PED_DISK_GPT_PMBR_BOOT:
+ return N_("pmbr_boot");
default:
ped_exception_throw (
PED_EXCEPTION_BUG,
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 7b4e014..689ea46 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -264,6 +264,7 @@ struct __attribute__ ((packed)) _GPTDiskData
PedGeometry data_area;
int entry_count;
efi_guid_t uuid;
+ int pmbr_boot;
};
/* uses libparted's disk_specific field in PedPartition, to store our info */
@@ -535,6 +536,7 @@ gpt_alloc (const PedDevice *dev)
gpt_disk_data->entry_count = GPT_DEFAULT_PARTITION_ENTRIES;
uuid_generate ((unsigned char *) &gpt_disk_data->uuid);
swap_uuid_and_efi_guid ((unsigned char *) (&gpt_disk_data->uuid));
+ gpt_disk_data->pmbr_boot = 0;
return disk;
error_free_disk:
@@ -848,6 +850,15 @@ gpt_read_headers (PedDisk const *disk,
*primary_gpt = NULL;
*backup_gpt = NULL;
PedDevice const *dev = disk->dev;
+ GPTDiskData *gpt_disk_data = disk->disk_specific;
+ LegacyMBR_t *mbr;
+
+ if (!ptt_read_sector (dev, 0, (void *)&mbr))
+ return 1;
+
+ if (mbr->PartitionRecord[0].BootIndicator == 0x80)
+ gpt_disk_data->pmbr_boot = 1;
+ free (mbr);
void *s1;
if (!ptt_read_sector (dev, 1, &s1))
@@ -1085,7 +1096,7 @@ error:
#ifndef DISCOVER_ONLY
/* Write the protective MBR (to keep DOS happy) */
static int
-_write_pmbr (PedDevice *dev)
+_write_pmbr (PedDevice *dev, bool pmbr_boot)
{
/* The UEFI spec is not clear about what to do with the following
elements of the Protective MBR (pmbr): BootCode (0-440B),
@@ -1110,6 +1121,8 @@ _write_pmbr (PedDevice *dev)
pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (0xFFFFFFFF);
else
pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (dev->length - 1UL);
+ if (pmbr_boot)
+ pmbr->PartitionRecord[0].BootIndicator = 0x80;
int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA,
GPT_PMBR_SECTORS);
@@ -1226,7 +1239,7 @@ gpt_write (const PedDisk *disk)
ptes_crc = efi_crc32 (ptes, ptes_size);
/* Write protective MBR */
- if (!_write_pmbr (disk->dev))
+ if (!_write_pmbr (disk->dev, gpt_disk_data->pmbr_boot))
goto error_free_ptes;
/* Write PTH and PTEs */
@@ -1529,6 +1542,46 @@ gpt_partition_enumerate (PedPartition *part)
}
static int
+gpt_disk_set_flag (PedDisk *disk, PedDiskFlag flag, int state)
+{
+ GPTDiskData *gpt_disk_data = disk->disk_specific;
+ switch (flag)
+ {
+ case PED_DISK_GPT_PMBR_BOOT:
+ gpt_disk_data->pmbr_boot = state;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static int
+gpt_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag)
+{
+ switch (flag)
+ {
+ case PED_DISK_GPT_PMBR_BOOT:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static int
+gpt_disk_get_flag (const PedDisk *disk, PedDiskFlag flag)
+{
+ GPTDiskData *gpt_disk_data = disk->disk_specific;
+ switch (flag)
+ {
+ case PED_DISK_GPT_PMBR_BOOT:
+ return gpt_disk_data->pmbr_boot;
+ break;
+ default:
+ return 0;
+ }
+}
+
+static int
gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
{
GPTPartitionData *gpt_part_data;
@@ -1816,6 +1869,9 @@ static PedDiskOps gpt_disk_ops =
partition_set_name: gpt_partition_set_name,
partition_get_name: gpt_partition_get_name,
+ disk_set_flag: gpt_disk_set_flag,
+ disk_get_flag: gpt_disk_get_flag,
+ disk_is_flag_available: gpt_disk_is_flag_available,
PT_op_function_initializers (gpt)
};
diff --git a/parted/parted.c b/parted/parted.c
index 32c2fcc..4220265 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1475,6 +1475,43 @@ error:
}
static int
+do_disk_set (PedDevice** dev)
+{
+ PedDisk* disk;
+ PedDiskFlag flag;
+ int state;
+
+ disk = ped_disk_new (*dev);
+ if (!disk)
+ goto error;
+
+ if (!command_line_get_disk_flag (_("Flag to Invert?"), disk, &flag))
+ goto error_destroy_disk;
+ state = (ped_disk_get_flag (disk, flag) == 0 ? 1 : 0);
+
+ if (!is_toggle_mode) {
+ if (!command_line_get_state (_("New state?"), &state))
+ goto error_destroy_disk;
+ }
+
+ if (!ped_disk_set_flag (disk, flag, state))
+ goto error_destroy_disk;
+ if (!ped_disk_commit (disk))
+ goto error_destroy_disk;
+ ped_disk_destroy (disk);
+
+ if ((*dev)->type != PED_DEVICE_FILE)
+ disk_is_modified = 1;
+
+ return 1;
+
+error_destroy_disk:
+ ped_disk_destroy (disk);
+error:
+ return 0;
+}
+
+static int
do_set (PedDevice** dev)
{
PedDisk* disk;
@@ -1515,6 +1552,18 @@ error:
}
static int
+do_disk_toggle (PedDevice **dev)
+{
+ int result;
+
+ is_toggle_mode = 1;
+ result = do_disk_set (dev);
+ is_toggle_mode = 0;
+
+ return result;
+}
+
+static int
do_toggle (PedDevice **dev)
{
int result;
@@ -1751,6 +1800,23 @@ NULL),
str_list_create (_(device_msg), NULL), 1));
command_register (commands, command_create (
+ str_list_create_unique ("disk_set", _("disk_set"), NULL),
+ do_disk_set,
+ str_list_create (
+_("disk_set FLAG STATE change the FLAG on selected device"),
+NULL),
+ str_list_create (flag_msg, _(state_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("disk_toggle", _("disk_toggle"), NULL),
+ do_disk_toggle,
+ str_list_create (
+_("disk_toggle [FLAG] toggle the state of FLAG on "
+"selected device"),
+NULL),
+ str_list_create (flag_msg, NULL), 1));
+
+command_register (commands, command_create (
str_list_create_unique ("set", _("set"), NULL),
do_set,
str_list_create (
diff --git a/parted/ui.c b/parted/ui.c
index 6d2fde1..d66029f 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -1113,6 +1113,35 @@ command_line_get_disk_type (const char* prompt, const PedDiskType*(* value))
}
int
+command_line_get_disk_flag (const char* prompt, const PedDisk* disk,
+ PedDiskFlag* flag)
+{
+ StrList* opts = NULL;
+ PedPartitionFlag walk = 0;
+ char* flag_name;
+
+ while ( (walk = ped_disk_flag_next (walk)) ) {
+ if (ped_disk_is_flag_available (disk, walk)) {
+ const char* walk_name;
+
+ walk_name = ped_disk_flag_get_name (walk);
+ opts = str_list_append (opts, walk_name);
+ opts = str_list_append_unique (opts, _(walk_name));
+ }
+ }
+
+ flag_name = command_line_get_word (prompt, NULL, opts, 1);
+ str_list_destroy (opts);
+
+ if (flag_name) {
+ *flag = ped_disk_flag_get_by_name (flag_name);
+ free (flag_name);
+ return 1;
+ } else
+ return 0;
+}
+
+int
command_line_get_part_flag (const char* prompt, const PedPartition* part,
PedPartitionFlag* flag)
{
diff --git a/parted/ui.h b/parted/ui.h
index 44b521a..2a27c86 100644
--- a/parted/ui.h
+++ b/parted/ui.h
@@ -63,6 +63,9 @@ extern int command_line_get_fs_type (const char* prompt,
const PedFileSystemType*(* value));
extern int command_line_get_disk_type (const char* prompt,
const PedDiskType*(* value));
+extern int command_line_get_disk_flag (const char* prompt,
+ const PedDisk* disk,
+ PedDiskFlag* flag);
extern int command_line_get_part_flag (const char* prompt,
const PedPartition* part,
PedPartitionFlag* flag);
--
1.7.6.5

View File

@ -0,0 +1,97 @@
From acb972e2dffecdb5e464236978d22bc6387a2f69 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 27 Jan 2012 16:59:03 -0800
Subject: [PATCH 2/5] parted: when printing, also print the new disk flags
This adds a 'Disk Flags:' line the displays the active disk flags.
In machine mode this is appended to the disk info line, after the
device model.
* parted/parted.c (disk_print_flags): New function
(_print_disk_info): Add Disk Flags information.
---
parted/parted.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/parted/parted.c b/parted/parted.c
index 4220265..38daf81 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -825,6 +825,43 @@ partition_print (PedPartition* part)
return 1;
}
+static char*
+disk_print_flags (PedDisk const *disk)
+{
+ PedDiskFlag flag;
+ int first_flag;
+ const char* name;
+ char* res = ped_malloc(1);
+ void* _res = res;
+
+ *res = '\0';
+ if (!disk)
+ return res;
+
+ first_flag = 1;
+ for (flag = ped_disk_flag_next (0); flag;
+ flag = ped_disk_flag_next (flag)) {
+ if (ped_disk_get_flag (disk, flag)) {
+ if (first_flag)
+ first_flag = 0;
+ else {
+ _res = res;
+ ped_realloc (&_res, strlen (res) + 1 + 2);
+ res = _res;
+ strncat (res, ", ", 2);
+ }
+
+ name = _(ped_disk_flag_get_name (flag));
+ _res = res;
+ ped_realloc (&_res, strlen (res) + 1 + strlen (name));
+ res = _res;
+ strcat(res, name);
+ }
+ }
+
+ return res;
+}
+
static void
_print_disk_geometry (const PedDevice *dev)
{
@@ -862,6 +899,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *disk)
default_unit == PED_UNIT_CYLINDER));
const char* pt_name = disk ? disk->type->name : "unknown";
+ char *disk_flags = disk_print_flags (disk);
if (opt_machine_mode) {
switch (default_unit) {
@@ -873,10 +911,10 @@ _print_disk_info (const PedDevice *dev, const PedDisk *disk)
break;
}
- printf ("%s:%s:%s:%lld:%lld:%s:%s;\n",
+ printf ("%s:%s:%s:%lld:%lld:%s:%s:%s;\n",
dev->path, end, transport[dev->type],
dev->sector_size, dev->phys_sector_size,
- pt_name, dev->model);
+ pt_name, dev->model, disk_flags);
} else {
printf (_("Model: %s (%s)\n"),
dev->model, transport[dev->type]);
@@ -894,7 +932,9 @@ _print_disk_info (const PedDevice *dev, const PedDisk *disk)
if (!opt_machine_mode) {
printf (_("Partition Table: %s\n"), pt_name);
+ printf (_("Disk Flags: %s\n"), disk_flags);
}
+ free (disk_flags);
}
static int
--
1.7.6.5

View File

@ -0,0 +1,112 @@
From 9c3bf96c790d963ff9dff7223a97c51989feaa75 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 1 Feb 2012 13:11:59 -0800
Subject: [PATCH 4/5] tests: add test for GPT PMBR pmbr_boot flag
* tests/t0209-gpt-pmbr_boot.sh: New test
* tests/Makefile.am: Add new test
* NEWS: Add information about the GPT PMBR pmbr_boot flag
---
NEWS | 21 ++++++++++++++++++++-
tests/Makefile.am | 1 +
tests/t0209-gpt-pmbr_boot.sh | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 1 deletions(-)
create mode 100755 tests/t0209-gpt-pmbr_boot.sh
diff --git a/NEWS b/NEWS
index e8ffed5..d535612 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,24 @@
GNU parted NEWS -*- outline -*-
+* Noteworthy changes in release 3.0-6 (Fedora)
+
+ Add the ability to set the boot flag on the GPT PMBR. This is needed
+ for some BIOS systems that refuse to boot from GPT unless this is set.
+ disk_set and disk_toggle commands can be used to set the pmbr_boot
+ flag on the disk.
+
+ The flag is also displayed in a new line, 'Disk Flags:' like this:
+
+ Model: (file)
+ Disk /home/bcl/disk.img: 4295MB
+ Sector size (logical/physical): 512B/512B
+ Partition Table: gpt
+ Disk Flags: pmbr_boot
+
+ Using -m the flags are added after the model name field:
+
+ /root/disk.img:4295MB:file:512:512:gpt::pmbr_boot;
+
* Noteworthy changes in release 3.0 (2011-05-30) [stable]
** Bug fixes
@@ -16,7 +35,7 @@ GNU parted NEWS -*- outline -*-
** Changes in behavior
- Remove all FS-related (file system-related) sub-commands; these commands
+ Remove all FS-gelated (file system-related) sub-commands; these commands
are no longer recognized because they were all dependent on parted "knowing"
too much about file system: mkpartfs, mkfs, cp, move, check, resize.
This change removes not just the user interface bits, but also the
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2218a2c..cd74ff9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,6 +15,7 @@ TESTS = \
t0205-gpt-list-clobbers-pmbr.sh \
t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh \
t0207-IEC-binary-notation.sh \
+ t0209-gpt-pmbr_boot.sh \
t0220-gpt-msftres.sh \
t0250-gpt.sh \
t0280-gpt-corrupt.sh \
diff --git a/tests/t0209-gpt-pmbr_boot.sh b/tests/t0209-gpt-pmbr_boot.sh
new file mode 100755
index 0000000..b15cc9c
--- /dev/null
+++ b/tests/t0209-gpt-pmbr_boot.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Ensure that pmbr_boot flag can be set
+
+# 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
+
+N=2M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare out /dev/null || fail=1
+
+# Set the pmbr_boot flag on the PMBR
+parted -s $dev disk_set pmbr_boot on
+
+# Check to see if the flag is set
+parted -m -s $dev u s p > out 2> err || fail=1
+grep "$dev:.*:gpt::pmbr_boot;" out || { cat out; fail=1; }
+
+Exit $fail
--
1.7.6.5

View File

@ -0,0 +1,337 @@
From 26d43fea236f7e1af0d9fd3531b39cceb5276c0e Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 1 Feb 2012 13:11:58 -0800
Subject: [PATCH 3/5] tests: update tests for new disk flags output
* tests/t0010-script-no-ctrl-chars.sh: Updated
* tests/t0100-print.sh: Updated
* tests/t0101-print-empty.sh: Updated
* tests/t0220-gpt-msftres.sh: Updated
* tests/t0250-gpt.sh: Updated
* tests/t0280-gpt-corrupt.sh: Updated
* tests/t2310-dos-extended-2-sector-min-offset.sh: Updated
* tests/t4000-sun-raid-type.sh: Updated
* tests/t4100-dvh-partition-limits.sh: Updated
* tests/t4100-msdos-partition-limits.sh: Updated
* tests/t4100-msdos-starting-sector.sh: Updated
* tests/t4200-partprobe.sh: Updated
* tests/t5000-tags.sh: Updated
* tests/t6000-dm.sh: Updated
* tests/t9040-many-partitions.sh: Updated
* tests/t9041-undetected-in-use-16th-partition.sh: Updated
---
tests/t0010-script-no-ctrl-chars.sh | 2 +-
tests/t0100-print.sh | 6 ++++--
tests/t0101-print-empty.sh | 2 ++
tests/t0220-gpt-msftres.sh | 2 +-
tests/t0250-gpt.sh | 2 +-
tests/t0280-gpt-corrupt.sh | 4 ++--
tests/t2310-dos-extended-2-sector-min-offset.sh | 2 +-
tests/t4000-sun-raid-type.sh | 2 +-
tests/t4100-dvh-partition-limits.sh | 6 ++++--
tests/t4100-msdos-partition-limits.sh | 6 ++++--
tests/t4100-msdos-starting-sector.sh | 4 ++--
tests/t4200-partprobe.sh | 2 +-
tests/t5000-tags.sh | 6 +++---
tests/t6000-dm.sh | 5 +++--
tests/t9040-many-partitions.sh | 2 +-
tests/t9041-undetected-in-use-16th-partition.sh | 2 +-
16 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/tests/t0010-script-no-ctrl-chars.sh b/tests/t0010-script-no-ctrl-chars.sh
index 49b3ff1..25efb73 100755
--- a/tests/t0010-script-no-ctrl-chars.sh
+++ b/tests/t0010-script-no-ctrl-chars.sh
@@ -32,7 +32,7 @@ compare out /dev/null || fail=1
TERM=xterm parted -m -s $dev u s p > out 2>&1 || fail=1
sed "s,.*/$dev:,$dev:," out > k && mv k out || fail=1
-printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:msdos:;\n" > exp || fail=1
+printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:msdos::;\n" > exp || fail=1
compare out exp || fail=1
diff --git a/tests/t0100-print.sh b/tests/t0100-print.sh
index d09b8ed..ccf58b4 100755
--- a/tests/t0100-print.sh
+++ b/tests/t0100-print.sh
@@ -27,6 +27,7 @@ Model: (file)
Disk .../$dev: 8s
Sector size (logical/physical): ${ss}B/${ss}B
Partition Table: msdos
+Disk Flags:
Number Start End Size Type File system Flags
@@ -46,10 +47,11 @@ msdos_magic='\125\252'
{ dd if=/dev/zero bs=510 count=1; printf "$msdos_magic"
dd if=/dev/zero bs=$(expr 8 '*' $ss - 510) count=1; } > $dev || fail=1
-# print the empty table' \
+# print the empty table
parted -s $dev unit s print >out 2>&1 || fail=1
-# prepare actual and expected output' \
+# prepare actual and expected output
+sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:," o2 > out || fail=1
# check for expected output
diff --git a/tests/t0101-print-empty.sh b/tests/t0101-print-empty.sh
index 3e77850..1c15eb2 100755
--- a/tests/t0101-print-empty.sh
+++ b/tests/t0101-print-empty.sh
@@ -28,6 +28,7 @@ Model: (file)
Disk .../$dev: 8s
Sector size (logical/physical): ${ss}B/${ss}B
Partition Table: unknown
+Disk Flags:
EOF
} > exp || framework_failure
@@ -38,6 +39,7 @@ dd if=/dev/zero of=$dev bs=$(expr 8 '*' $ss) count=1 >/dev/null 2>&1 || fail=1
parted -s $dev unit s print >out 2>&1 || fail=1
# prepare actual and expected output
+sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:,; \
s,^Error: .*/$dev:,Error: .../$dev:," o2 > out || fail=1
diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh
index 1247ee0..00d588c 100755
--- a/tests/t0220-gpt-msftres.sh
+++ b/tests/t0220-gpt-msftres.sh
@@ -52,7 +52,7 @@ parted -s $dev mklabel gpt > out 2>&1 || fail=1
# expect no output
compare out /dev/null || fail=1
-printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:gpt:;\n" > exp
+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)
diff --git a/tests/t0250-gpt.sh b/tests/t0250-gpt.sh
index 5f42440..d9e0496 100755
--- a/tests/t0250-gpt.sh
+++ b/tests/t0250-gpt.sh
@@ -35,7 +35,7 @@ parted -m -s $dev unit s print > t 2>&1 || fail=1
sed "s,.*/$dev:,$dev:," t > out || fail=1
# check for expected output
-printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt:;\n" \
+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \
> exp || fail=1
compare exp out || fail=1
diff --git a/tests/t0280-gpt-corrupt.sh b/tests/t0280-gpt-corrupt.sh
index df54817..375da0e 100755
--- a/tests/t0280-gpt-corrupt.sh
+++ b/tests/t0280-gpt-corrupt.sh
@@ -34,7 +34,7 @@ parted -m -s $dev unit s print > t 2>&1 || fail=1
sed "s,.*/$dev:,$dev:," t > out || fail=1
# check for expected output
-printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt:;\n" \
+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \
> exp || fail=1
compare exp out || fail=1
@@ -90,7 +90,7 @@ parted -m -s $dev u s print > out 2>&1 || fail=1
# check for expected output
printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:;\n" > exp || fail=1
-sed "s/.*gpt:;/file/" out > k && mv k out || fail=1
+sed "s/.*gpt::;/file/" out > k && mv k out || fail=1
compare exp out || fail=1
Exit $fail
diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh
index b86c6bc..aad575a 100644
--- a/tests/t2310-dos-extended-2-sector-min-offset.sh
+++ b/tests/t2310-dos-extended-2-sector-min-offset.sh
@@ -33,7 +33,7 @@ p5=${scsi_dev}5
cat <<EOF > exp || framework_failure
BYT;
-$scsi_dev:2048s:scsi:512:512:msdos:Linux scsi_debug;
+$scsi_dev:2048s:scsi:512:512:msdos:Linux scsi_debug:;
1:64s:128s:65s:::lba;
5:66s:128s:63s:::;
EOF
diff --git a/tests/t4000-sun-raid-type.sh b/tests/t4000-sun-raid-type.sh
index 91a9f63..84b170a 100755
--- a/tests/t4000-sun-raid-type.sh
+++ b/tests/t4000-sun-raid-type.sh
@@ -24,7 +24,7 @@ ss=$sector_size_
N=2000 # number of sectors
dev=sun-disk-file
-exp="BYT;\n---:${N}s:file:$ss:$ss:sun:;\n1:0s:127s:128s"
+exp="BYT;\n---:${N}s:file:$ss:$ss:sun::;\n1:0s:127s:128s"
# create an empty file as a test disk
dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh
index b57a1c3..1280f8e 100755
--- a/tests/t4100-dvh-partition-limits.sh
+++ b/tests/t4100-dvh-partition-limits.sh
@@ -129,9 +129,10 @@ do_mkpart_start_and_len $(echo 2^32-1|bc) 1000 || fail=1
# FIXME: In the long run, figure out if it's sensible.
cat > exp <<EOF
Model: (file)
-Disk: 4294970342s
+Disk $dev: 4294970342s
Sector size (logical/physical): ${ss}B/${ss}B
Partition Table: $table_type
+Disk Flags:
Number Start End Size Type File system Name Flags
9 0s 4095s 4096s extended
@@ -141,7 +142,8 @@ EOF
# print the result
parted -s $dev unit s p > out 2>&1 || fail=1
-sed "s/Disk .*:/Disk:/;s/ *$//" out > k && mv k out || fail=1
+sed "s/^Disk .*\($dev: [0-9][0-9]*s\)$/Disk \1/;s/ *$//" out > k \
+ && mv k out || fail=1
compare out exp || fail=1
# a partition start sector number of 2^32 must fail
diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh
index 4ec3c27..f8f1fc4 100755
--- a/tests/t4100-msdos-partition-limits.sh
+++ b/tests/t4100-msdos-partition-limits.sh
@@ -116,9 +116,10 @@ do_mkpart_start_and_len $(echo 2^32-1|bc) 1000 || fail=1
cat > exp <<EOF
Model: (file)
-Disk: 4294970342s
+Disk $dev: 4294970342s
Sector size (logical/physical): ${ss}B/${ss}B
Partition Table: $table_type
+Disk Flags:
Number Start End Size Type File system Flags
1 4294967295s 4294968294s 1000s primary
@@ -127,7 +128,8 @@ EOF
# print the result
parted -s $dev unit s p > out 2>&1 || fail=1
-sed "s/Disk .*:/Disk:/;s/ *$//" out > k && mv k out || fail=1
+sed "s/^Disk .*\($dev: [0-9][0-9]*s\)$/Disk \1/;s/ *$//" out > k \
+ && mv k out || fail=1
compare out exp || fail=1
# a partition start sector number of 2^32 must fail
diff --git a/tests/t4100-msdos-starting-sector.sh b/tests/t4100-msdos-starting-sector.sh
index f768646..26b5a57 100755
--- a/tests/t4100-msdos-starting-sector.sh
+++ b/tests/t4100-msdos-starting-sector.sh
@@ -38,7 +38,7 @@ compare out /dev/null || fail=1
# Test the output of print free with no partitions.
cat <<EOF > exp || fail=1
BYT;
-path:${N}s:file:$ss:$ss:msdos:;
+path:${N}s:file:$ss:$ss:msdos::;
1:32s:4095s:4064s:free;
EOF
@@ -54,7 +54,7 @@ compare out exp || fail=1
# Test the output of print free with one partition.
cat <<EOF > exp || fail=1
BYT;
-path:${N}s:file:$ss:$ss:msdos:;
+path:${N}s:file:$ss:$ss:msdos::;
1:32s:2047s:2016s:free;
1:2048s:4095s:2048s:::;
EOF
diff --git a/tests/t4200-partprobe.sh b/tests/t4200-partprobe.sh
index bd5e15d..41bc802 100755
--- a/tests/t4200-partprobe.sh
+++ b/tests/t4200-partprobe.sh
@@ -33,7 +33,7 @@ dvhtool -d $dev --unix-to-vh d data || fail=1
# Here's sample output from the parted...print command below:
# BYT;
-# /dev/sdd:128880s:scsi:512:512:dvh: Flash Disk;
+# /dev/sdd:128880s:scsi:512:512:dvh: Flash Disk:;
# 9:0s:4095s:4096s:::;
# 17:4s:11s:8s::data:;
diff --git a/tests/t5000-tags.sh b/tests/t5000-tags.sh
index ef2f610..47437d3 100755
--- a/tests/t5000-tags.sh
+++ b/tests/t5000-tags.sh
@@ -44,7 +44,7 @@ parted -m -s $dev unit s print > t 2>&1 || fail=1
sed "s,.*/$dev:,$dev:," t > out || fail=1
# check for expected output
-printf "BYT;\n$dev:${N}s:file:$ss:$ss:gpt:;\n" > exp || fail=1
+printf "BYT;\n$dev:${N}s:file:$ss:$ss:gpt::;\n" > exp || fail=1
compare exp out || fail=1
# add a partition
@@ -66,10 +66,10 @@ gen_exp()
{
cat <<EOF
BYT;
-$dev:${N}s:file:$ss:$ss:gpt:;
+$dev:${N}s:file:$ss:$ss:gpt::;
1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:;
BYT;
-$dev:${N}s:file:$ss:$ss:gpt:;
+$dev:${N}s:file:$ss:$ss:gpt::;
1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:bios_grub;
EOF
}
diff --git a/tests/t6000-dm.sh b/tests/t6000-dm.sh
index 03586c7..d593914 100755
--- a/tests/t6000-dm.sh
+++ b/tests/t6000-dm.sh
@@ -72,14 +72,15 @@ for type in linear ; do
compare out /dev/null || fail=1
parted -s "$dev" print > out 2>&1 || fail=1
- sed 's/^Disk .*: /Disk DEV: /' out > k; mv k out
+ sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
# Create expected output file.
cat <<EOF >> exp || fail=1
Model: Linux device-mapper ($type) (dm)
-Disk DEV: 524kB
+Disk $dev: 524kB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
+Disk Flags:
Number Start End Size Type File system Flags
diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh
index 1282c1f..55530fe 100644
--- a/tests/t9040-many-partitions.sh
+++ b/tests/t9040-many-partitions.sh
@@ -40,7 +40,7 @@ scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
scsi_dev=$(cat dev-name)
n=$((n_MiB * sectors_per_MiB))
-printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug;\n" \
+printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug:;\n" \
> exp || fail=1
parted -s $scsi_dev mklabel gpt || fail=1
diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh
index 74c30fc..1c6bad2 100644
--- a/tests/t9041-undetected-in-use-16th-partition.sh
+++ b/tests/t9041-undetected-in-use-16th-partition.sh
@@ -40,7 +40,7 @@ scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
scsi_dev=$(cat dev-name)
n=$((n_MiB * sectors_per_MiB))
-printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug;\n" \
+printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug:;\n" \
> exp || fail=1
parted -s $scsi_dev mklabel gpt || fail=1
--
1.7.6.5

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.0
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -32,6 +32,11 @@ Patch11: parted-3.0-libparted-make-pc98-detection-depend-on-signatures.patch
Patch12: parted-3.0-tests-add-tests-for-new-pc98-signatures-646053.patch
Patch13: parted-3.0-libparted-copy-flags-when-duplicating-GPT-partitions.patch
Patch14: parted-3.0-tests-add-new-test-to-check-ped_disk_duplicate.patch
Patch15: parted-3.0-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch
Patch16: parted-3.0-parted-when-printing-also-print-the-new-disk-flags.patch
Patch17: parted-3.0-tests-update-tests-for-new-disk-flags-output.patch
Patch18: parted-3.0-tests-add-test-for-GPT-PMBR-pmbr_boot-flag.patch
Patch19: parted-3.0-doc-update-parted-documentation.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -163,6 +168,13 @@ fi
%changelog
* Thu Feb 02 2012 Brian C. Lane <bcl@redhat.com> - 3.0-6
- gpt: add commands to manipulate pMBR boot flag (#754850)
- parted: when printing, also print the new disk flags
- tests: update tests for new disk flags output
- tests: add test for GPT PMBR pmbr_boot flag
- doc: update parted documentation
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild