parted/revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch
Petr Uzel b5a4ceef04 - update to parted-3.1 (fate#316110)
- changes in parted-3.1:
  * Changes in behavior
    - Floppy drives are no longer scanned on linux: they cannot be
      partitioned anyhow, and some users have a misconfigured BIOS
      that claims to have a floppy when they don't, and scanning
      gets hung up.
    - parted: the mkpart command has changed semantics with regard
      to specifying the end of the partition.  If the end is
      specified using units of MiB, GiB, etc., parted subtracts one
      sector from the specified value.  With this change, it is now
      possible to create partitions like 1MiB-2MiB, 2MiB-3MiB and
      so on.
  * Many bugfixes (see changelog)
- changes in parted-3.0:
  * Changes in behavior
    - Remove all FS-related (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' command changed semantics:
      it no longer resizes the filesystem, but only moves end
      sector of the partition
- libparted-devel contains libparted-fs-resize library 
- add ability to change size of the partition (ignoring contained
  filesystem) with 'resize' command; this command has different
  semantics than the former 'resize' command which upstream
  decided to drop
  - parted-resize-command.patch (fate#316110)
- when using syncmbr on POWER, make the first partition type 0x41

OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=79
2014-01-09 16:35:35 +00:00

314 lines
9.5 KiB
Diff

From ff10810537db7b9d1f287bed3c71a7570d395ba2 Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@suse.cz>
Date: Wed, 8 Jan 2014 18:01:15 +0100
Subject: [PATCH] Revert "gpt: add commands to manipulate pMBR boot flag"
This reverts commit a73918ea6d9477ac3e8dad11ed62c87aecc49714.
Conflicts:
libparted/labels/gpt.c
---
include/parted/disk.in.h | 4 --
libparted/disk.c | 3 --
libparted/labels/gpt.c | 59 +-----------------------------------------
parted/parted.c | 66 -----------------------------------------------
parted/ui.c | 29 --------------------
parted/ui.h | 3 --
6 files changed, 4 insertions(+), 160 deletions(-)
Index: parted-3.1/include/parted/disk.in.h
===================================================================
--- parted-3.1.orig/include/parted/disk.in.h
+++ parted-3.1/include/parted/disk.in.h
@@ -36,11 +36,9 @@ 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_GPT_PMBR_BOOT
+#define PED_DISK_LAST_FLAG PED_DISK_CYLINDER_ALIGNMENT
/**
* Partition types
Index: parted-3.1/libparted/disk.c
===================================================================
--- parted-3.1.orig/libparted/disk.c
+++ parted-3.1/libparted/disk.c
@@ -836,8 +836,7 @@ 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,
Index: parted-3.1/libparted/labels/gpt.c
===================================================================
--- parted-3.1.orig/libparted/labels/gpt.c
+++ parted-3.1/libparted/labels/gpt.c
@@ -264,7 +264,6 @@ struct __attribute__ ((packed)) _GPTDisk
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 */
@@ -536,7 +535,6 @@ 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:
@@ -845,14 +843,6 @@ gpt_read_headers (PedDisk const *disk,
*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))
@@ -1090,7 +1080,7 @@ error:
#ifndef DISCOVER_ONLY
/* Write the protective MBR (to keep DOS happy) */
static int
-_write_pmbr (PedDevice *dev, bool pmbr_boot)
+_write_pmbr (PedDevice *dev)
{
/* The UEFI spec is not clear about what to do with the following
elements of the Protective MBR (pmbr): BootCode (0-440B),
@@ -1115,8 +1105,6 @@ _write_pmbr (PedDevice *dev, bool pmbr_b
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);
@@ -1237,7 +1225,7 @@ gpt_write (const PedDisk *disk)
ptes_crc = efi_crc32 (ptes, ptes_bytes);
/* Write protective MBR */
- if (!_write_pmbr (disk->dev, gpt_disk_data->pmbr_boot))
+ if (!_write_pmbr (disk->dev))
goto error_free_ptes;
/* Write PTH and PTEs */
@@ -1523,46 +1511,6 @@ gpt_partition_enumerate (PedPartition *p
}
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;
@@ -1850,9 +1798,6 @@ 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)
};
Index: parted-3.1/parted/parted.c
===================================================================
--- parted-3.1.orig/parted/parted.c
+++ parted-3.1/parted/parted.c
@@ -1608,43 +1608,6 @@ 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;
@@ -1685,18 +1648,6 @@ 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;
@@ -1933,23 +1884,6 @@ 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 (
Index: parted-3.1/parted/ui.c
===================================================================
--- parted-3.1.orig/parted/ui.c
+++ parted-3.1/parted/ui.c
@@ -1116,35 +1116,6 @@ command_line_get_disk_type (const char*
}
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)
{
Index: parted-3.1/parted/ui.h
===================================================================
--- parted-3.1.orig/parted/ui.h
+++ parted-3.1/parted/ui.h
@@ -63,9 +63,6 @@ extern int command_line_get_fs_type (con
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);