OSDN Git Service

gpt: add commands to manipulate pMBR boot flag
authorMatthew Garrett <mjg@redhat.com>
Wed, 1 Feb 2012 14:12:20 +0000 (15:12 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 2 Feb 2012 15:01:18 +0000 (16:01 +0100)
commita73918ea6d9477ac3e8dad11ed62c87aecc49714
tree21c699d0dfadd76674d6439d402743d2c4339918
parentcd280c622f5f5f8708ace2f04118d80d9a2c6a8f
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.in.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.in.h
libparted/disk.c
libparted/labels/gpt.c
parted/parted.c
parted/ui.c
parted/ui.h