diff --git a/Fix-help-text-for-disk_-set-toggle.patch b/Fix-help-text-for-disk_-set-toggle.patch new file mode 100644 index 0000000..5109e05 --- /dev/null +++ b/Fix-help-text-for-disk_-set-toggle.patch @@ -0,0 +1,79 @@ +From 3e005b4644d2a97da85c251f93d32d93e94bcccf Mon Sep 17 00:00:00 2001 +From: Phillip Susi +Date: Mon, 24 Feb 2014 11:29:43 -0500 +Subject: [PATCH] Fix help text for disk_{set,toggle} + +Fix the help text to show *disk* flags instead of partition flags. +--- + parted/parted.c | 23 +++++++++++++++++++++-- + 1 file changed, 21 insertions(+), 2 deletions(-) + +Index: parted-3.1/parted/parted.c +=================================================================== +--- parted-3.1.orig/parted/parted.c ++++ parted-3.1/parted/parted.c +@@ -144,6 +144,7 @@ static const char* number_msg = N_( + + static const char* label_type_msg_start = N_("LABEL-TYPE is one of: "); + static const char* flag_msg_start = N_("FLAG is one of: "); ++static const char* disk_flag_msg_start = N_("FLAG is one of: "); + static const char* unit_msg_start = N_("UNIT is one of: "); + static const char* min_or_opt_msg = N_("desired alignment: minimum or optimal"); + static const char* part_type_msg = N_("PART-TYPE is one of: primary, logical, " +@@ -170,6 +171,7 @@ static const char* copyright_msg = N_( + + static char* label_type_msg; + static char* flag_msg; ++static char* disk_flag_msg; + static char* unit_msg; + + static char* mkpart_fs_type_msg; +@@ -1845,6 +1847,7 @@ _init_messages () + PedFileSystemAlias* fs_alias; + PedDiskType* disk_type; + PedPartitionFlag part_flag; ++ PedDiskFlag disk_flag; + PedUnit unit; + + /* flags */ +@@ -1863,6 +1866,22 @@ _init_messages () + + flag_msg = str_list_convert (list); + str_list_destroy (list); ++/* disk flags */ ++ first = 1; ++ list = str_list_create (_(disk_flag_msg_start), NULL); ++ for (disk_flag = ped_disk_flag_next (0); disk_flag; ++ disk_flag = ped_disk_flag_next (disk_flag)) { ++ if (first) ++ first = 0; ++ else ++ str_list_append (list, ", "); ++ str_list_append (list, ++ _(ped_disk_flag_get_name (disk_flag))); ++ } ++ str_list_append (list, "\n"); ++ ++ disk_flag_msg = str_list_convert (list); ++ str_list_destroy (list); + + /* units */ + first = 1; +@@ -2055,7 +2074,7 @@ command_register (commands, command_crea + str_list_create ( + _("disk_set FLAG STATE change the FLAG on selected device"), + NULL), +- str_list_create (flag_msg, _(state_msg), NULL), 1)); ++ str_list_create (disk_flag_msg, _(state_msg), NULL), 1)); + + command_register (commands, command_create ( + str_list_create_unique ("disk_toggle", _("disk_toggle"), NULL), +@@ -2064,7 +2083,7 @@ command_register (commands, command_crea + _("disk_toggle [FLAG] toggle the state of FLAG on " + "selected device"), + NULL), +- str_list_create (flag_msg, NULL), 1)); ++ str_list_create (disk_flag_msg, NULL), 1)); + + command_register (commands, command_create ( + str_list_create_unique ("set", _("set"), NULL), diff --git a/parted.changes b/parted.changes index 2f49f2a..0fe54ef 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue May 20 10:27:17 UTC 2014 - puzel@suse.com + +- Fix the help text to show *disk* flags instead of partition flags + (bnc#872054): + - add: Fix-help-text-for-disk_-set-toggle.patch + ------------------------------------------------------------------- Tue Apr 29 13:06:09 UTC 2014 - puzel@suse.com diff --git a/parted.spec b/parted.spec index ca36835..2da7b6e 100644 --- a/parted.spec +++ b/parted.spec @@ -57,6 +57,7 @@ Patch29: libparted-dasd-do-not-use-first-tracks.patch Patch30: libparted-initialize-dasd-part-type.patch Patch31: libparted-use-BLKRRPART-for-DASD.patch.patch Patch32: libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch +Patch33: Fix-help-text-for-disk_-set-toggle.patch Patch100: parted-fatresize-autoconf.patch Requires: /sbin/udevadm BuildRequires: check-devel @@ -136,6 +137,7 @@ to develop applications that require these. %patch30 -p1 %patch31 -p1 %patch32 -p1 +%patch33 -p1 %patch100 -p1 %build diff --git a/revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch b/revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch deleted file mode 100644 index 21a7ab2..0000000 --- a/revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch +++ /dev/null @@ -1,313 +0,0 @@ -From ff10810537db7b9d1f287bed3c71a7570d395ba2 Mon Sep 17 00:00:00 2001 -From: Petr Uzel -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);