lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ae75ae31-a73b-4d15-9e67-5dc38b751c70@infradead.org>
Date: Sun, 29 Jun 2025 17:59:55 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Masahiro Yamada <masahiroy@...nel.org>, linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 05/66] kconfig: re-add menu_get_parent_menu() that returns
 parent menu



On 6/24/25 8:04 AM, Masahiro Yamada wrote:
> This helper returns the parent menu, or NULL if there is no parent.
> The main difference from the previous version is that it always returns
> the parent menu even when the given argument is itself a menu.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>

Acked-by: Randy Dunlap <rdunlap@...radead.org>
Tested-by: Randy Dunlap <rdunlap@...radead.org>


> ---
> 
>  scripts/kconfig/lkc.h  |  1 +
>  scripts/kconfig/menu.c | 14 ++++++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
> index 5cc85c3d4aaa..37b606c74bff 100644
> --- a/scripts/kconfig/lkc.h
> +++ b/scripts/kconfig/lkc.h
> @@ -97,6 +97,7 @@ bool menu_is_empty(struct menu *menu);
>  bool menu_is_visible(struct menu *menu);
>  bool menu_has_prompt(const struct menu *menu);
>  const char *menu_get_prompt(const struct menu *menu);
> +struct menu *menu_get_parent_menu(struct menu *menu);
>  struct menu *menu_get_menu_or_parent_menu(struct menu *menu);
>  int get_jump_key_char(void);
>  struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index ccb690bbf05d..a5e5b4fdcd93 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -575,6 +575,20 @@ const char *menu_get_prompt(const struct menu *menu)
>  	return NULL;
>  }
>  
> +/**
> + * menu_get_parent_menu - return the parent menu or NULL
> + * @menu: pointer to the menu
> + * return: the parent menu, or NULL if there is no parent.
> + */
> +struct menu *menu_get_parent_menu(struct menu *menu)
> +{
> +	for (menu = menu->parent; menu; menu = menu->parent)
> +		if (menu->type == M_MENU)
> +			return menu;
> +
> +	return NULL;
> +}
> +
>  /**
>   * menu_get_menu_or_parent_menu - return the parent menu or the menu itself
>   * @menu: pointer to the menu

-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ