[PATCH 1/4] drmgr/common: introduce action to string table

4 views
Skip to first unread message

Laurent Dufour

<ldufour@linux.ibm.com>
unread,
Mar 7, 2023, 8:22:18 AM3/7/23
to powerpc-utils-devel@googlegroups.com, tyreld@linux.ibm.com, nathanl@linux.ibm.com
This will be used to convert action into environment variable when running
hooks.

Signed-off-by: Laurent Dufour <ldu...@linux.ibm.com>
---
src/drmgr/common.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/src/drmgr/common.c b/src/drmgr/common.c
index 9cd91d1d627a..b80d01e5c75f 100644
--- a/src/drmgr/common.c
+++ b/src/drmgr/common.c
@@ -76,6 +76,17 @@ static char *hook_phase_name[] = {
[HOOK_POST] = "post",
};

+static char *hook_action_name[] = {
+ [NONE] = "none",
+ [ADD] = "add",
+ [REMOVE] = "remove",
+ [QUERY] = "query",
+ [REPLACE] = "replace",
+ [IDENTIFY] = "identify",
+ [MIGRATE] = "migrate",
+ [HIBERNATE] = "hibernate",
+};
+
/**
* set_output level
* @brief Common routine to set the output level
--
2.39.2

Nathan Lynch

<nathanl@linux.ibm.com>
unread,
Mar 7, 2023, 10:14:05 PM3/7/23
to Laurent Dufour, tyreld@linux.ibm.com, powerpc-utils-devel@googlegroups.com
Laurent Dufour <ldu...@linux.ibm.com> writes:
> This will be used to convert action into environment variable when running
> hooks.
>
> Signed-off-by: Laurent Dufour <ldu...@linux.ibm.com>
> ---
> src/drmgr/common.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/src/drmgr/common.c b/src/drmgr/common.c
> index 9cd91d1d627a..b80d01e5c75f 100644
> --- a/src/drmgr/common.c
> +++ b/src/drmgr/common.c
> @@ -76,6 +76,17 @@ static char *hook_phase_name[] = {
> [HOOK_POST] = "post",
> };
>
> +static char *hook_action_name[] = {
> + [NONE] = "none",
> + [ADD] = "add",
> + [REMOVE] = "remove",
> + [QUERY] = "query",
> + [REPLACE] = "replace",
> + [IDENTIFY] = "identify",
> + [MIGRATE] = "migrate",
> + [HIBERNATE] = "hibernate",
> +};

Could use some const qualifiers.

I assume the following patches actually use hook_action_name, but I
would expect this patch on its own to introduce a defined-but-not-used
compiler warning.

Laurent Dufour

<ldufour@linux.ibm.com>
unread,
Mar 8, 2023, 4:35:32 AM3/8/23
to Nathan Lynch, tyreld@linux.ibm.com, powerpc-utils-devel@googlegroups.com
Yes

> I assume the following patches actually use hook_action_name, but I
> would expect this patch on its own to introduce a defined-but-not-used
> compiler warning.

Fair enough, I can squash it into the next one.

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
Mar 8, 2023, 2:14:41 PM3/8/23
to Laurent Dufour, Nathan Lynch, powerpc-utils-devel@googlegroups.com
Yes, this needs to be const, as should the previous two declarations of
drc_type_str[] and hook_phase_name[] which was missed in the previous hook
patchset. Please send a follow up patch to fix those as well.

-Tyrel
Reply all
Reply to author
Forward
0 new messages