Re: [PATCH 3/6] ima: Simplify policy_func_show.

From: Thiago Jung Bauermann
Date: Thu Apr 20 2017 - 16:41:20 EST


Am Donnerstag, 20. April 2017, 08:13:23 BRT schrieb Mimi Zohar:
> On Tue, 2017-04-18 at 17:17 -0300, Thiago Jung Bauermann wrote:
> > If the func_tokens array uses the same indices as enum ima_hooks,
> > policy_func_show can be a lot simpler, and the func_* enum becomes
> > unnecessary.
>
> My main concern with separating the enumeration from the string
> definition is that they might become out of sync. Perhaps using
> macros, similar to those used for kernel_read_file_id_str(), would be
> better?

I agree that it would be better. Is the patch below what you had in mind?

I also noticed that policy_func_show can be even simpler if we stop using the
printf format string from the policy_tokens table. What do you think?

--
Thiago Jung Bauermann
IBM Linux Technology Center