linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kconfig: Document the 'menu' struct
@ 2017-10-04  3:37 Ulf Magnusson
  2017-10-05  3:13 ` Ulf Magnusson
  2017-12-07 14:52 ` Masahiro Yamada
  0 siblings, 2 replies; 3+ messages in thread
From: Ulf Magnusson @ 2017-10-04  3:37 UTC (permalink / raw)
  To: yann.morin.1998, linux-kbuild; +Cc: linux-kernel, Ulf Magnusson

Understanding what it represents helps a lot when reading the code, and
it's not obvious, so document it.

The ROOT_MENU flag is only set and tested by the gconf and qconf front
ends, so leave it undocumented here. The obvious guess for what it means
is correct.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
---
 scripts/kconfig/expr.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index a73f762..ae7583c 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -166,22 +166,67 @@ struct property {
 	for (st = sym->prop; st; st = st->next) \
 		if (st->text)
 
+/*
+ * Represents a node in the menu tree, as seen in e.g. menuconfig (though used
+ * for all front ends). Each symbol, menu, etc. defined in the Kconfig files
+ * gets a node. A symbol defined in multiple locations gets one node at each
+ * location.
+ */
 struct menu {
+	/* The next menu node at the same level */
 	struct menu *next;
+
+	/* The parent menu node, corresponding to e.g. a menu or choice */
 	struct menu *parent;
+
+	/* The first child menu node, for e.g. menus and choices */
 	struct menu *list;
+
+	/*
+	 * The symbol associated with the menu node. Choices are implemented as
+	 * a special kind of symbol. NULL for menus, comments, and ifs.
+	 */
 	struct symbol *sym;
+
+	/*
+	 * The prompt associated with the node. This holds the prompt for a
+	 * symbol as well as the text for a menu or comment, along with the
+	 * type (P_PROMPT, P_MENU, etc.)
+	 */
 	struct property *prompt;
+
+	/*
+	 * 'visible if' dependencies. If more than one is given, they will be
+	 * ANDed together.
+	 */
 	struct expr *visibility;
+
+	/*
+	 * Ordinary dependencies from e.g. 'depends on' and 'if', ANDed
+	 * together
+	 */
 	struct expr *dep;
+
+	/* MENU_* flags */
 	unsigned int flags;
+
+	/* Any help text associated with the node */
 	char *help;
+
+	/* The location where the menu node appears in the Kconfig files */
 	struct file *file;
 	int lineno;
+
+	/* For use by front ends that need to store auxiliary data */
 	void *data;
 };
 
+/*
+ * Set on a menu node when the corresponding symbol changes state in some way.
+ * Can be checked by front ends.
+ */
 #define MENU_CHANGED		0x0001
+
 #define MENU_ROOT		0x0002
 
 struct jump_key {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kconfig: Document the 'menu' struct
  2017-10-04  3:37 [PATCH] kconfig: Document the 'menu' struct Ulf Magnusson
@ 2017-10-05  3:13 ` Ulf Magnusson
  2017-12-07 14:52 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Magnusson @ 2017-10-05  3:13 UTC (permalink / raw)
  To: yann.morin.1998, linux-kbuild
  Cc: linux-kernel, Ulf Magnusson, Masahiro Yamada, Arnaud Lacombe

On Wed, Oct 4, 2017 at 5:37 AM, Ulf Magnusson <ulfalizer@gmail.com> wrote:
> Understanding what it represents helps a lot when reading the code, and
> it's not obvious, so document it.
>
> The ROOT_MENU flag is only set and tested by the gconf and qconf front
> ends, so leave it undocumented here. The obvious guess for what it means
> is correct.
>
> Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
> ---
>  scripts/kconfig/expr.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
>
> diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
> index a73f762..ae7583c 100644
> --- a/scripts/kconfig/expr.h
> +++ b/scripts/kconfig/expr.h
> @@ -166,22 +166,67 @@ struct property {
>         for (st = sym->prop; st; st = st->next) \
>                 if (st->text)
>
> +/*
> + * Represents a node in the menu tree, as seen in e.g. menuconfig (though used
> + * for all front ends). Each symbol, menu, etc. defined in the Kconfig files
> + * gets a node. A symbol defined in multiple locations gets one node at each
> + * location.
> + */
>  struct menu {
> +       /* The next menu node at the same level */
>         struct menu *next;
> +
> +       /* The parent menu node, corresponding to e.g. a menu or choice */
>         struct menu *parent;
> +
> +       /* The first child menu node, for e.g. menus and choices */
>         struct menu *list;
> +
> +       /*
> +        * The symbol associated with the menu node. Choices are implemented as
> +        * a special kind of symbol. NULL for menus, comments, and ifs.
> +        */
>         struct symbol *sym;
> +
> +       /*
> +        * The prompt associated with the node. This holds the prompt for a
> +        * symbol as well as the text for a menu or comment, along with the
> +        * type (P_PROMPT, P_MENU, etc.)
> +        */
>         struct property *prompt;
> +
> +       /*
> +        * 'visible if' dependencies. If more than one is given, they will be
> +        * ANDed together.
> +        */
>         struct expr *visibility;
> +
> +       /*
> +        * Ordinary dependencies from e.g. 'depends on' and 'if', ANDed
> +        * together
> +        */
>         struct expr *dep;
> +
> +       /* MENU_* flags */
>         unsigned int flags;
> +
> +       /* Any help text associated with the node */
>         char *help;
> +
> +       /* The location where the menu node appears in the Kconfig files */
>         struct file *file;
>         int lineno;
> +
> +       /* For use by front ends that need to store auxiliary data */
>         void *data;
>  };
>
> +/*
> + * Set on a menu node when the corresponding symbol changes state in some way.
> + * Can be checked by front ends.
> + */
>  #define MENU_CHANGED           0x0001
> +
>  #define MENU_ROOT              0x0002
>
>  struct jump_key {
> --
> 2.7.4
>

Adding some CCs just because I forgot. No panic.

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kconfig: Document the 'menu' struct
  2017-10-04  3:37 [PATCH] kconfig: Document the 'menu' struct Ulf Magnusson
  2017-10-05  3:13 ` Ulf Magnusson
@ 2017-12-07 14:52 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2017-12-07 14:52 UTC (permalink / raw)
  To: Ulf Magnusson
  Cc: Yann E. MORIN, Linux Kbuild mailing list, Linux Kernel Mailing List

2017-10-04 12:37 GMT+09:00 Ulf Magnusson <ulfalizer@gmail.com>:
> Understanding what it represents helps a lot when reading the code, and
> it's not obvious, so document it.
>
> The ROOT_MENU flag is only set and tested by the gconf and qconf front
> ends, so leave it undocumented here. The obvious guess for what it means
> is correct.
>
> Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>


Applied to linux-kbuild/kconfig.
Thanks!

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-07 14:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-04  3:37 [PATCH] kconfig: Document the 'menu' struct Ulf Magnusson
2017-10-05  3:13 ` Ulf Magnusson
2017-12-07 14:52 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).