From patchwork Tue Dec 10 15:47:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 1207142 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kontron.de Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47XPbJ33MCz9sPh for ; Wed, 11 Dec 2019 02:47:56 +1100 (AEDT) Received: from phobos.denx.de (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 122D280919; Tue, 10 Dec 2019 16:47:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kontron.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 1D863815F1; Tue, 10 Dec 2019 16:47:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from skedge04.snt-world.com (skedge04.snt-world.com [91.208.41.69]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5BC7E808E0 for ; Tue, 10 Dec 2019 16:47:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kontron.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=frieder.schrempf@kontron.de Received: from sntmail10s.snt-is.com (unknown [10.203.32.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by skedge04.snt-world.com (Postfix) with ESMTPS id B298571638E; Tue, 10 Dec 2019 16:47:40 +0100 (CET) Received: from sntmail12r.snt-is.com (10.203.32.182) by sntmail10s.snt-is.com (10.203.32.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 10 Dec 2019 16:47:40 +0100 Received: from sntmail12r.snt-is.com ([fe80::e551:8750:7bba:3305]) by sntmail12r.snt-is.com ([fe80::e551:8750:7bba:3305%3]) with mapi id 15.01.1713.004; Tue, 10 Dec 2019 16:47:40 +0100 From: Schrempf Frieder To: Abhishek Shah , Schrempf Frieder , Joe Hershberger , "Leon Yu" , =?iso-8859-1?q?Marek_Beh=FAn?= , Patrice Chotard , Simon Glass , Vladimir Olovyannikov Subject: [PATCH 1/2] menu: Make some parts of the menu available to other components Thread-Topic: [PATCH 1/2] menu: Make some parts of the menu available to other components Thread-Index: AQHVr3EnnmQP5fWbC0aPEUI2e2z1hQ== Date: Tue, 10 Dec 2019 15:47:40 +0000 Message-ID: <20191210154558.9307-1-frieder.schrempf@kontron.de> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-originating-ip: [172.25.9.193] x-c2processedorg: 51b406b7-48a2-4d03-b652-521f56ac89f3 MIME-Version: 1.0 X-SnT-MailScanner-Information: Please contact the ISP for more information X-SnT-MailScanner-ID: B298571638E.ADF1A X-SnT-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-SnT-MailScanner-SpamCheck: X-SnT-MailScanner-From: frieder.schrempf@kontron.de X-SnT-MailScanner-To: abhishek.shah@broadcom.com, benwolsieffer@gmail.com, joe.hershberger@ni.com, leoyu@nvidia.com, marek.behun@nic.cz, patrice.chotard@st.com, sjg@chromium.org, u-boot@lists.denx.de, vladimir.olovyannikov@broadcom.com X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Wolsieffer , "u-boot@lists.denx.de" Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean From: Frieder Schrempf In order to iterate over the menu entries and match for a specific name in the pxe boot, we need to properly export the needed structs and functions. Signed-off-by: Frieder Schrempf --- common/menu.c | 31 +------------------------------ include/menu.h | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/common/menu.c b/common/menu.c index 7b66d199a9..82b03f17f7 100644 --- a/common/menu.c +++ b/common/menu.c @@ -12,36 +12,7 @@ #include "menu.h" -/* - * Internally, each item in a menu is represented by a struct menu_item. - * - * These items will be alloc'd and initialized by menu_item_add and destroyed - * by menu_item_destroy, and the consumer of the interface never sees that - * this struct is used at all. - */ -struct menu_item { - char *key; - void *data; - struct list_head list; -}; -/* - * The menu is composed of a list of items along with settings and callbacks - * provided by the user. An incomplete definition of this struct is available - * in menu.h, but the full definition is here to prevent consumers from - * relying on its contents. - */ -struct menu { - struct menu_item *default_item; - int timeout; - char *title; - int prompt; - void (*item_data_print)(void *); - char *(*item_choice)(void *); - void *item_choice_data; - struct list_head items; - int item_cnt; -}; /* * An iterator function for menu items. callback will be called for each item @@ -51,7 +22,7 @@ struct menu { * used for search type operations. It is also safe for callback to remove the * item from the list of items. */ -static inline void *menu_items_iter(struct menu *m, +inline void *menu_items_iter(struct menu *m, void *(*callback)(struct menu *, struct menu_item *, void *), void *extra) { diff --git a/include/menu.h b/include/menu.h index 2d227c20bd..b3f8db87e4 100644 --- a/include/menu.h +++ b/include/menu.h @@ -6,8 +6,40 @@ #ifndef __MENU_H__ #define __MENU_H__ -struct menu; +/* + * Internally, each item in a menu is represented by a struct menu_item. + * + * These items will be alloc'd and initialized by menu_item_add and destroyed + * by menu_item_destroy, and the consumer of the interface never sees that + * this struct is used at all. + */ +struct menu_item { + char *key; + void *data; + struct list_head list; +}; + +/* + * The menu is composed of a list of items along with settings and callbacks + * provided by the user. An incomplete definition of this struct is available + * in menu.h, but the full definition is here to prevent consumers from + * relying on its contents. + */ +struct menu { + struct menu_item *default_item; + int timeout; + char *title; + int prompt; + void (*item_data_print)(void *); + char *(*item_choice)(void *); + void *item_choice_data; + struct list_head items; + int item_cnt; +}; +void *menu_items_iter(struct menu *m, + void *(*callback)(struct menu *, struct menu_item *, void *), + void *extra); struct menu *menu_create(char *title, int timeout, int prompt, void (*item_data_print)(void *), char *(*item_choice)(void *),