From 6fd8c08ff65214b26b97073e6fb197a44270017f Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Wed, 6 Aug 2008 09:20:13 +0200 Subject: [PATCH] EFI GPT: when changing the partition type, select by default the current type --- src/chgtype.c | 10 ++++++++++ src/guid_cmp.h | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/chgtype.c b/src/chgtype.c index 006b0522..a1e8658b 100644 --- a/src/chgtype.c +++ b/src/chgtype.c @@ -276,6 +276,16 @@ static void gpt_change_part_type(const disk_t *disk_car, partition_t *partition) wattrset(stdscr, A_REVERSE); wprintw(stdscr, "[ Proceed ]"); 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) { wmove(stdscr,5,0); diff --git a/src/guid_cmp.h b/src/guid_cmp.h index acf66313..14ccde80 100644 --- a/src/guid_cmp.h +++ b/src/guid_cmp.h @@ -2,7 +2,7 @@ File: guidcmp.c - Copyright (C) 2007 Christophe GRENIER + Copyright (C) 2007-2008 Christophe GRENIER 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 @@ -19,7 +19,7 @@ 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)); }