Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932880Ab0HDOou (ORCPT ); Wed, 4 Aug 2010 10:44:50 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:51316 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932866Ab0HDOor convert rfc822-to-8bit (ORCPT ); Wed, 4 Aug 2010 10:44:47 -0400 MIME-Version: 1.0 In-Reply-To: <20100804090049.GH5464@nb.net.home> References: <1280887483-2979-2-git-send-email-wad@chromium.org> <20100804090049.GH5464@nb.net.home> Date: Wed, 4 Aug 2010 09:44:46 -0500 Message-ID: Subject: Re: [PATCH v2 2/3] genhd, efi: add efi partition metadata to hd_structs From: Will Drewry To: Karel Zak Cc: linux-kernel@vger.kernel.org, Kay Sievers , Jens Axboe , Tejun Heo , "David S. Miller" , Andrew Morton , Joe Perches , Jan Blunck , Greg Kroah-Hartman Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3276 Lines: 91 On Wed, Aug 4, 2010 at 4:00 AM, Karel Zak wrote: > On Tue, Aug 03, 2010 at 09:04:42PM -0500, Will Drewry wrote: >> This change extends the partition_meta_info structure to >> support EFI GPT-specific metadata and ensures that data >> is copied in on partition scanning. > > Why do want to store GPT-specific data (efi_guid_t) to > partition_meta_info? I think it would be better to use label and uuid > in a generic format (e.g. string or u8 uuid[16]) -- then you don't > have to use things like union, disklabel specific code to compare > uuids, etc. ?IMHO your current code is too complicated. > >> + ? ? ? ? ? ? info = alloc_part_info(NULL); >> + ? ? ? ? ? ? if (!info) { >> + ? ? ? ? ? ? ? ? ? ? printk(KERN_WARNING >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?"unable to allocate memory for part->info\n"); >> + ? ? ? ? ? ? ? ? ? ? continue; >> + ? ? ? ? ? ? } >> + ? ? ? ? ? ? info->format = PARTITION_META_INFO_FORMAT_EFI; >> + ? ? ? ? ? ? memcpy(info->efi.uuid.b, ptes[i].unique_partition_guid.b, >> + ? ? ? ? ? ? ? ? ? ? sizeof(info->efi.uuid.b)); >> + ? ? ? ? ? ? memcpy(info->efi.type.b, ptes[i].partition_type_guid.b, >> + ? ? ? ? ? ? ? ? ? ? sizeof(info->efi.type.b)); > > why do you need to partition type? For GPT, at least, the partition type isn't directly encoded anywhere else and it can be vendor specific. For instance, if a vendor wants to make an auto-configuring, they could reserve a VENDOR-ROOT-PRI0-PART-TYPE-GUID then easily create a mount path for it. Of course, that could easily be kludged by reusing a UUID. > >> + ? ? ? ? ? ? memcpy(info->efi.label, ptes[i].partition_name, >> + ? ? ? ? ? ? ? ? ? ? sizeof(info->efi.label)); > > the partition name is in UTF8LE, is it correct to use it in raw > format? Since the type was partition specific, I left the data untouched. It sounds like it'd be more useful to expose the data in a generic way which would mean converting it, I guess? >> + ? ? ? ? ? ? state->parts[i + 1].info = info; >> ? ? ? } >> ? ? ? kfree(ptes); >> ? ? ? kfree(gpt); >> diff --git a/include/linux/genhd.h b/include/linux/genhd.h >> index 7b6644a..beb98e3 100644 >> --- a/include/linux/genhd.h >> +++ b/include/linux/genhd.h >> @@ -91,11 +91,25 @@ struct disk_stats { >> ?enum partition_meta_info_format_t { >> ? ? ? /* Partition info format */ >> ? ? ? PARTITION_META_INFO_FORMAT_NONE = 0, >> + ? ? PARTITION_META_INFO_FORMAT_EFI, >> + ? ? /* Place additional formats here. */ >> + ? ? PARTITION_META_INFO_FORMAT_MAX, >> ?}; >> >> +#ifdef CONFIG_EFI_PARTITION >> +#include >> +#endif >> + >> ?struct partition_meta_info { >> ? ? ? enum partition_meta_info_format_t format; >> ? ? ? union { >> +#ifdef CONFIG_EFI_PARTITION >> + ? ? ? ? ? ? struct { >> + ? ? ? ? ? ? ? ? ? ? efi_guid_t uuid; >> + ? ? ? ? ? ? ? ? ? ? efi_guid_t type; >> + ? ? ? ? ? ? ? ? ? ? efi_char16_t label[72 / sizeof(efi_char16_t)]; >> + ? ? ? ? ? ? } efi; >> +#endif >> ? ? ? }; >> ?}; >> >> -- >> 1.7.0.4 >> > > -- > ?Karel Zak ? > ?http://karelzak.blogspot.com > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/