From patchwork Wed Nov 9 03:29:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 622914 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp16683pvb; Tue, 8 Nov 2022 19:27:59 -0800 (PST) X-Google-Smtp-Source: AMsMyM5MFQ91MpS/CXswZWUM1LzjZBKv7yzJ8HTU5sAW+QdXADU/uIuRMCOC1/HQf+8aMY4EuF2v X-Received: by 2002:a17:906:cc47:b0:7ad:d0de:3ce1 with SMTP id mm7-20020a170906cc4700b007add0de3ce1mr47680649ejb.329.1667964479737; Tue, 08 Nov 2022 19:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667964479; cv=none; d=google.com; s=arc-20160816; b=asFsPFcD8u1PIyGknYN9VauM0zUWn/S5K9d8umzc2e6Rrwn96aiYzgV8c+7rG/k8/Q jrfgVGz4zhUODruSa6LvoagiuSDqx6RenfonyVH+AhS2Rdyw6NAuwuoWWA5fItmBE4/m WyFkj+gwli3h6m1diBJFVw3ZSBK6VQgBZCE5dJEzyHGtpEb5qDPGczedMUjCY0tWMRRH YUCnXITkVjB9lxnj+WbaGESDr/yZGMb+2uuQCsr5r+B3JlplGzaKiEqHDJhIqq/pMkWH RPRhNgPtfs6k/Bd1jr46G7p11WJj6rMDSKrjL8SRRJT1L6GmUsvYY8gSrUbD30MBhDFo dc7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=0ERyheRvFp8/wHvmYCSbRcxDgU68ioohlTrwboamaxo=; b=HX/630RPiDMvw8s3Q47FX8S0CfHLGf1o/tH+Nrtbb+16JaUdG3/NNBayB87TItvutA xdUmcpcsAs3IdMHA5JP0V+qKhXL7ePo8S2KHukuM9SINtTZ/42SjxwVX9hmLhCFbuWoL XCeKqoSaMva3Qz7eb9jLELbicvLVsVs2XBA6N7uuSXEFweGphsz7VjRUnI2joOtGk5ZX p8Dw6GW92/CcoKWbFW7+gLoUvpT6p+8nEi7H54jJs4Vex8yfWFsaH08TTDGuQoy5amEr eyyaKNUB1PbbSwUV+8FBD+zHRQotqfRPWm76IEEAOKlUknydCHiydi2FhBFMnNZJ17Sr SMsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bFaqU/h7"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id sd2-20020a1709076e0200b007ae165c79c8si14678850ejc.940.2022.11.08.19.27.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 19:27:59 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bFaqU/h7"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 590988500C; Wed, 9 Nov 2022 04:27:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="bFaqU/h7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D514B84ED3; Wed, 9 Nov 2022 04:27:36 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7CA7984EF6 for ; Wed, 9 Nov 2022 04:27:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pl1-x636.google.com with SMTP id k7so15916327pll.6 for ; Tue, 08 Nov 2022 19:27:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=0ERyheRvFp8/wHvmYCSbRcxDgU68ioohlTrwboamaxo=; b=bFaqU/h7vIX4oKHOe8Hha2/KfhlcrcR4ADeRiDvXcQJ1N7PnXnCcuOFG6bN/XgwQpu o1WVVXB/DCg3vBaAAa7G330XUG0McmXGbdxa46yZTeJG35EszyVhpwnwJTJb8mIlSfbd l4pxZX6++38pRs8lDJqCW+m5PQ63D5Lml65IxNrPg2Gk1fjKP5/0nGCpxeEEpma9JGVj E/kgRu0jUbg+5bENLDuXZ01gpu7mZ4qPcOMxIgT9+jLDS/T1XhaR3wZXExye7wtFxhkU km0tlR3liTVd86YPl5WpwwIswJ0b/wWtTqRe/RhZPJuWe8o+s89Gedr7C0CxWfNqgoWF yB/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0ERyheRvFp8/wHvmYCSbRcxDgU68ioohlTrwboamaxo=; b=MgRtnaA/tZ5VYN9ccIZC4M+IFm2St7Wxlilo77mqGW6/tp48frb4N9e928zNcfAbyv WDZlsMT387T3nujEysdV29Tb9MS17KZpvFQSjPIEUWJP9CPymKhsCXaqksaSXIpOMx95 TanyCjKDNf3YSP95BJalzyDHLFfw2jKjlS7XO8F624CPl7T5Iu5r/FtOCIEoXoOwXWRW 3POVr92/JmiTiA2yQxfdBBbteddieik8v7B0QEvuLlLmL4bE89dc85pqYCoVuWsf70Py a1uJ8DD9wEixMhamW0qs430F1OYWP5GP1vUjjhnzNyDA2qEYdlAf50SrqHZiaJT6ydDj CM5Q== X-Gm-Message-State: ACrzQf0HHjlrEzVlE3NQoef+Gq9ABmL6Yg7BhVIDtP5NVKllkdlU1t5q f0ZRSXw7+GnrUI4V4z8NURbvPqr/sAVApw== X-Received: by 2002:a17:90a:be14:b0:213:c304:1d68 with SMTP id a20-20020a17090abe1400b00213c3041d68mr56611486pjs.80.1667964451555; Tue, 08 Nov 2022 19:27:31 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id l10-20020a170903120a00b00177faf558b5sm7742103plh.250.2022.11.08.19.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 19:27:31 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Etienne Carriere , Masahisa Kojima Subject: [PATCH v6 2/5] eficonfig: expose append entry function Date: Wed, 9 Nov 2022 12:29:01 +0900 Message-Id: <20221109032904.5361-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221109032904.5361-1-masahisa.kojima@linaro.org> References: <20221109032904.5361-1-masahisa.kojima@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean This commit exposes the eficonfig menu entry append function. Signed-off-by: Masahisa Kojima --- No change since v2 newly created in v2 cmd/eficonfig.c | 32 +++++++++++++++++--------------- include/efi_config.h | 5 +++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index f6a99bd01a..0cb0770ac3 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -263,7 +263,7 @@ efi_status_t eficonfig_process_quit(void *data) } /** - * append_entry() - append menu item + * eficonfig_append_menu_entry() - append menu item * * @efi_menu: pointer to the efimenu structure * @title: pointer to the entry title @@ -271,8 +271,9 @@ efi_status_t eficonfig_process_quit(void *data) * @data: pointer to the data to be passed to each entry callback * Return: status code */ -static efi_status_t append_entry(struct efimenu *efi_menu, - char *title, eficonfig_entry_func func, void *data) +efi_status_t eficonfig_append_menu_entry(struct efimenu *efi_menu, + char *title, eficonfig_entry_func func, + void *data) { struct eficonfig_entry *entry; @@ -295,12 +296,12 @@ static efi_status_t append_entry(struct efimenu *efi_menu, } /** - * append_quit_entry() - append quit entry + * eficonfig_append_quit_entry() - append quit entry * * @efi_menu: pointer to the efimenu structure * Return: status code */ -static efi_status_t append_quit_entry(struct efimenu *efi_menu) +efi_status_t eficonfig_append_quit_entry(struct efimenu *efi_menu) { char *title; efi_status_t ret; @@ -309,7 +310,7 @@ static efi_status_t append_quit_entry(struct efimenu *efi_menu) if (!title) return EFI_OUT_OF_RESOURCES; - ret = append_entry(efi_menu, title, eficonfig_process_quit, NULL); + ret = eficonfig_append_menu_entry(efi_menu, title, eficonfig_process_quit, NULL); if (ret != EFI_SUCCESS) free(title); @@ -341,7 +342,7 @@ void *eficonfig_create_fixed_menu(const struct eficonfig_item *items, int count) if (!title) goto out; - ret = append_entry(efi_menu, title, iter->func, iter->data); + ret = eficonfig_append_menu_entry(efi_menu, title, iter->func, iter->data); if (ret != EFI_SUCCESS) { free(title); goto out; @@ -634,14 +635,15 @@ static efi_status_t eficonfig_select_volume(struct eficonfig_select_file_info *f info->v = v; info->dp = device_path; info->file_info = file_info; - ret = append_entry(efi_menu, devname, eficonfig_volume_selected, info); + ret = eficonfig_append_menu_entry(efi_menu, devname, eficonfig_volume_selected, + info); if (ret != EFI_SUCCESS) { free(info); goto out; } } - ret = append_quit_entry(efi_menu); + ret = eficonfig_append_quit_entry(efi_menu); if (ret != EFI_SUCCESS) goto out; @@ -745,8 +747,8 @@ eficonfig_create_file_entry(struct efimenu *efi_menu, u32 count, (int (*)(const void *, const void *))sort_file); for (i = 0; i < entry_num; i++) { - ret = append_entry(efi_menu, tmp_infos[i]->file_name, - eficonfig_file_selected, tmp_infos[i]); + ret = eficonfig_append_menu_entry(efi_menu, tmp_infos[i]->file_name, + eficonfig_file_selected, tmp_infos[i]); if (ret != EFI_SUCCESS) goto out; } @@ -815,7 +817,7 @@ static efi_status_t eficonfig_select_file(struct eficonfig_select_file_info *fil if (ret != EFI_SUCCESS) goto err; - ret = append_quit_entry(efi_menu); + ret = eficonfig_append_quit_entry(efi_menu); if (ret != EFI_SUCCESS) goto err; @@ -1218,7 +1220,7 @@ static efi_status_t create_boot_option_entry(struct efimenu *efi_menu, char *tit utf16_utf8_strcpy(&p, val); } - return append_entry(efi_menu, buf, func, data); + return eficonfig_append_menu_entry(efi_menu, buf, func, data); } /** @@ -1677,7 +1679,7 @@ static efi_status_t eficonfig_add_boot_selection_entry(struct efimenu *efi_menu, utf16_utf8_strcpy(&p, lo.label); info->boot_index = boot_index; info->selected = selected; - ret = append_entry(efi_menu, buf, eficonfig_process_boot_selected, info); + ret = eficonfig_append_menu_entry(efi_menu, buf, eficonfig_process_boot_selected, info); if (ret != EFI_SUCCESS) { free(load_option); free(info); @@ -1736,7 +1738,7 @@ static efi_status_t eficonfig_show_boot_selection(unsigned int *selected) break; } - ret = append_quit_entry(efi_menu); + ret = eficonfig_append_quit_entry(efi_menu); if (ret != EFI_SUCCESS) goto out; diff --git a/include/efi_config.h b/include/efi_config.h index 098cac2115..86bc801211 100644 --- a/include/efi_config.h +++ b/include/efi_config.h @@ -95,4 +95,9 @@ efi_status_t eficonfig_get_unused_bootoption(u16 *buf, efi_status_t eficonfig_append_bootorder(u16 index); efi_status_t eficonfig_generate_media_device_boot_option(void); +efi_status_t eficonfig_append_menu_entry(struct efimenu *efi_menu, + char *title, eficonfig_entry_func func, + void *data); +efi_status_t eficonfig_append_quit_entry(struct efimenu *efi_menu); + #endif