EFI GPT: when changing the partition type, select by default the current type

This commit is contained in:
Christophe Grenier 2008-08-06 09:20:13 +02:00
parent 41e90d881a
commit 6fd8c08ff6
2 changed files with 12 additions and 2 deletions

View file

@ -276,6 +276,16 @@ static void gpt_change_part_type(const disk_t *disk_car, partition_t *partition)
wattrset(stdscr, A_REVERSE); wattrset(stdscr, A_REVERSE);
wprintw(stdscr, "[ Proceed ]"); wprintw(stdscr, "[ Proceed ]");
wattroff(stdscr, A_REVERSE); wattroff(stdscr, A_REVERSE);
/* By default, select the current type */
for(i=0;gpt_sys_types[i].name!=NULL;i++)
{
if(guid_cmp(partition->part_type_gpt, gpt_sys_types[i].part_type)==0)
{
current_element_num=i;
while(current_element_num >= offset+3*INTER_CHGTYPE)
offset++;
}
}
while(1) while(1)
{ {
wmove(stdscr,5,0); wmove(stdscr,5,0);

View file

@ -2,7 +2,7 @@
File: guidcmp.c File: guidcmp.c
Copyright (C) 2007 Christophe GRENIER <grenier@cgsecurity.org> Copyright (C) 2007-2008 Christophe GRENIER <grenier@cgsecurity.org>
This software is free software; you can redistribute it and/or modify This software is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
static inline int guid_cmp (efi_guid_t left, efi_guid_t right) static inline int guid_cmp (const efi_guid_t left, const efi_guid_t right)
{ {
return memcmp(&left, &right, sizeof(efi_guid_t)); return memcmp(&left, &right, sizeof(efi_guid_t));
} }