From patchwork Tue Oct 4 14:35:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 612274 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp216905pvb; Tue, 4 Oct 2022 07:35:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7E97uRp/C9ZV85YZLomtFhZvc4pGdC4pWaoCRoHUikb4ZlRcFOcOvS+kp/vX2i+c+QH1Yb X-Received: by 2002:a17:907:6ea1:b0:783:cc69:342 with SMTP id sh33-20020a1709076ea100b00783cc690342mr18888577ejc.97.1664894151223; Tue, 04 Oct 2022 07:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664894151; cv=none; d=google.com; s=arc-20160816; b=psi9TflDBUXbamHzcl01c77TIAlCMWiLSrQlWqG/yEL9AfA36Cl9YU+Z4wpJzEsHI2 Sb2vxY3RkE7472tl9X5rvwaznlsr0vgTpAaXHHmjWbLNV3REYDqlASWdLe9iYkdzHQwp F9G1ToXFmdB4JpKSRXybX726HJ3Z0UazCY/OjcL5CyJfjr8sEoidPWI6U95aajowiskL Q+waeVdfe5yg3g/P0j9Wj5Yc63IkgKvjrRGVq8zaX6SSc+QhqMvekAckAtVmghfdAGuI nM+UIPMJ5VK6lV0G1kFuH6ipfZR6QXoXq4B2I5I1AQLiCer3HtypJEn0Ppra1BpfoxhA GiSA== 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=UGVZSQUZBN+SbeNcrd98tAXAovEH5vUFCoA1wVQ+Tzg=; b=nzSs711cJqXRxnqghg8b5Cm+Rz7reJSEZOEogpWzqxjp3f/a1XnmkGtnZUx1qgKyXa 8e0lPAzwXfPIH40UM0uwUEMFmyl4pvRLt1aVeY98CDIolgCTm7FO2M2aJo2Q3XV7WJQR N32ReC4E9vQ5v5gco1rXnZkDaoFY1icI9uZGOcSPU2RtUwt89oZjZL7gsB6SANftH+1s E0zPcSvlTjvNpjzn9BkBV+ixDeD8hbLak4zbP9Dw1KEKPIBEPZEu3CvhxpDM292+Ac3n ub968LFCe9hsv+R2yQthchHm3/esAic/sO2j17up+2q1Ih65Lb3kcqQqRq4FpqD6M9kr qlzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vfli1UAY; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id j6-20020a508a86000000b00447dfae6181si10138052edj.235.2022.10.04.07.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 07:35:51 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vfli1UAY; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 99C3084DFD; Tue, 4 Oct 2022 16:35:37 +0200 (CEST) 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="vfli1UAY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3685D84DAF; Tue, 4 Oct 2022 16:35:34 +0200 (CEST) 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-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) (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 148EB84C2D for ; Tue, 4 Oct 2022 16:35:30 +0200 (CEST) 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-pg1-x531.google.com with SMTP id r185so4115278pgr.12 for ; Tue, 04 Oct 2022 07:35:29 -0700 (PDT) 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; bh=UGVZSQUZBN+SbeNcrd98tAXAovEH5vUFCoA1wVQ+Tzg=; b=vfli1UAY3e6ArkS6CSGz/b3SOkC2pWEYDcbfzPnLzBJQVPaghq16SlxHpEE9jKR2dY FrOatpG4OVIt7Q0Ov/RW7ttWB4UWieKu5N5ZzR01rJE4wLYuIuiKBfRNouk+h3ZwUsAz Md999lFqaOgLs6HNtZT7+NhdKruHdv0iJesF+wCe26g24h/HCoF1CIEhMkG3QHVbml1B FYUY4R54zywoGH8tJFn0vN0V3DgD3Bx8dsEBryM/t+YGFeJs7k8mBODXVcEdsy2+QL3m BMtVCHsMKkWT1bpXtN6U0jj+pquzEzuXL31Fya8jKPiQs5gC7vJPOeDI6Rri0346dngV N4+w== 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; bh=UGVZSQUZBN+SbeNcrd98tAXAovEH5vUFCoA1wVQ+Tzg=; b=wCIMcYADo6Az8nnRRMcTS2Bl9eJN384G3feG02TtXh5+foORiRbPHspkcBAHJ8XSXd v0RFYJ2o9w2ib7Ndyrs9QhlVpm+QZwAfTmL1F/OBeL1QLLLovt/6v8zUes2wibRAVhTG FKMni4UdSV+fxIdfy8Pu0dXPIl791J+sxJWoHqQWyrL7JLFqWEH9z/304StH+t8vWu2Q z19E9W2H69XFM+7hG1aoz8NK6WLBh4jBFBTQVTV6LsFypRKkCdGWoJS9a0ugDeMFAT2m +euNMAEm0v1gs25MnlIGQraGbNm6rukBPeZcb1umfW7FqLXs72C2rnLEAvxTJvENpQGv yv+g== X-Gm-Message-State: ACrzQf1HTf7jJkSKUnj4UF4GmzOcDFRJxSMVpq11DRSCba/OY58xsHvH hRsoiqo9G55AM4XO9ledAFiCQvOl34jr6w== X-Received: by 2002:a05:6a00:1748:b0:55a:ddbe:85d7 with SMTP id j8-20020a056a00174800b0055addbe85d7mr28544314pfc.68.1664894127907; Tue, 04 Oct 2022 07:35:27 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id u6-20020a170902e80600b001783a917b9asm9044119plg.127.2022.10.04.07.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 07:35:27 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Masahisa Kojima Subject: [PATCH v2 2/6] eficonfig: expose append entry function Date: Tue, 4 Oct 2022 23:35:38 +0900 Message-Id: <20221004143543.30000-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221004143543.30000-1-masahisa.kojima@linaro.org> References: <20221004143543.30000-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 --- 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