From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aaqbG-0004s7-Rd for mharc-grub-devel@gnu.org; Tue, 01 Mar 2016 15:08:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaqbE-0004ra-Ew for grub-devel@gnu.org; Tue, 01 Mar 2016 15:08:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaqbB-00020i-9V for grub-devel@gnu.org; Tue, 01 Mar 2016 15:08:52 -0500 Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]:33283) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaqbB-00020Y-2F for grub-devel@gnu.org; Tue, 01 Mar 2016 15:08:49 -0500 Received: by mail-lb0-x22f.google.com with SMTP id ed16so27914499lbb.0 for ; Tue, 01 Mar 2016 12:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=+hzQWPJpVaNnC7vNTYoi+6aRINB+vXWrhyMRI+nu2gI=; b=MOrnUsWqGeCVnrvU4JvMEiPV7E5fFVTyIltp46vDoWmgAZVdniI+v+fkPuLPNS7X7Q gicVFq5e2oDQfgvKh3CqN8fZKfdPaNeVJtNWJKu2H3nboBPfwqaEL/5r97jZdbN9wgbY e/+LhwWucg2JGMahCV6PEDMwPWZ9M8N43lz7sbaWhJoxmHBNHdyVPg+SmFXQ4tBQwfwk 9lxU3DUkrKjgSNX0NctQ4rg3jb2GWurhxC3oMTIWtzOCgH7ZEJhWnh7IZE+JCOljpvW5 Cdq/mnaMC0B1sYP4z8s/1ErHtwSG6FVyHaY1Xc9Vrv39p0PGoE+oUHiursG3wXTLD8kg /tZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=+hzQWPJpVaNnC7vNTYoi+6aRINB+vXWrhyMRI+nu2gI=; b=KfpsaE9B3KH3V+FOcrNenYtcY3gs03w+qDdSavH3UPKIBF3tRnihApI65e69EEQrSh +tas0UCzLfDDtC5xw3d2pxTgjMbqEKTcotjebGY8YeZRtJ9p1L5EmqReE9gkj/cwMx4J zs1VH9oFYJefopRTn1J1sidmiyt2Vgr71AUHELMc4cratGShVGLZe59JYABd7ia5zGaD GLe+YGR4H3P+f6ynU7PtutQAx8AYlH072h9r7jarqmm8MrlqG8902sYhWMpEdIGhxcrO gzfhxjQ5IATwiorE3tBOF+TJITZz74cWHZlWVNAedGCDmOEzjU7ErNV2pHrEq45A9zOS hZ0w== X-Gm-Message-State: AD7BkJKnBsE1jiCixdmi5US0JYKQ6wljbFrVo4Ht10DJSXCek3tpsd14WtzCoGKjkp7JXg== X-Received: by 10.112.201.67 with SMTP id jy3mr8658434lbc.25.1456862928268; Tue, 01 Mar 2016 12:08:48 -0800 (PST) Received: from [192.168.1.41] (ppp109-252-76-159.pppoe.spdop.ru. [109.252.76.159]) by smtp.gmail.com with ESMTPSA id z194sm5145152lfd.20.2016.03.01.12.08.46 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 Mar 2016 12:08:46 -0800 (PST) Subject: Re: [RFC 1/3] efi: add configuration table search function To: grub-devel@gnu.org References: <1456854103-12095-1-git-send-email-leif.lindholm@linaro.org> <1456854103-12095-2-git-send-email-leif.lindholm@linaro.org> From: Andrei Borzenkov Message-ID: <56D5F6CD.7070403@gmail.com> Date: Tue, 1 Mar 2016 23:08:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1456854103-12095-2-git-send-email-leif.lindholm@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c04::22f X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2016 20:08:53 -0000 01.03.2016 20:41, Leif Lindholm пишет: > Several places in the code iterates through the configuration tables > presented by the system table. > Add new function grub_efi_find_config_table to use for this instead. > --- > grub-core/kern/efi/efi.c | 18 ++++++++++++++++++ > include/grub/efi/efi.h | 3 +++ > 2 files changed, 21 insertions(+) > > diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c > index caf9bcc..41686ee 100644 > --- a/grub-core/kern/efi/efi.c > +++ b/grub-core/kern/efi/efi.c > @@ -911,3 +911,21 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1, > > return 0; > } > + > +/* Return pointer to vendor table identified by guid. */ > +void * > +grub_efi_find_config_table (const grub_efi_guid_t *guid) > +{ > + grub_efi_uintn_t i; > + > + for (i = 0; i < grub_efi_system_table->num_table_entries; i++) > + { > + grub_efi_configuration_table_t *table = > + &grub_efi_system_table->configuration_table[i]; > + > + if (! grub_memcmp (&table->vendor_guid, guid, > + sizeof (grub_efi_packed_guid_t))) Either both types are exactly the same and one should be dropped or this cannot be right. In view of recent discussion about structure member alignments I am not sure why grub_efi_packed_guid_t is needed and the code already was inconsistent in usage. > + return (void *) table->vendor_table; > + } > + return NULL; > +} > diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h > index 0e6fd86..65c7f95 100644 > --- a/include/grub/efi/efi.h > +++ b/include/grub/efi/efi.h > @@ -77,6 +77,9 @@ int > EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1, > const grub_efi_device_path_t *dp2); > > +void * > +EXPORT_FUNC (grub_efi_find_config_table) (const grub_efi_guid_t *guid); > + > extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, > char **device, > char **path); >