From: Vivek G. <vg...@re...> - 2013-07-15 18:10:43
|
On Mon, Jul 15, 2013 at 06:56:17PM +0300, Dmitry Kasatkin wrote: > On Fri, Jul 12, 2013 at 9:52 PM, Vivek Goyal <vg...@re...> wrote: > > Using macros for fixed values looks cleaner. Also I am planning to use > > version field in more places in next patch. So use macros intead of > > numbers like 1 and 2. > > > > Signed-off-by: Vivek Goyal <vg...@re...> > > --- > > src/evmctl.c | 7 +++++-- > > 1 files changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/src/evmctl.c b/src/evmctl.c > > index 08b2b81..03a81ae 100644 > > --- a/src/evmctl.c > > +++ b/src/evmctl.c > > @@ -90,6 +90,9 @@ > > #define FS_IOC32_GETFLAGS _IOR('f', 1, int) > > #define FS_IOC32_SETFLAGS _IOW('f', 2, int) > > > > +#define DIGSIG_VERSION_1 1 > > +#define DIGSIG_VERSION_2 2 > > + > > Why not enums? Hi Dmitry, Please find attached patch to use enum instead of macros. This should apply on top of next branch. Thanks Vivek evmctl: Use enum for signature version instead of macros Dmitry prefers using enums over macros. Signed-off-by: Vivek Goyal <vg...@re...> --- src/evmctl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) Index: ima-evm-utils/src/evmctl.c =================================================================== --- ima-evm-utils.orig/src/evmctl.c 2013-07-15 13:47:57.707341605 -0400 +++ ima-evm-utils/src/evmctl.c 2013-07-15 13:48:01.416384052 -0400 @@ -90,9 +90,6 @@ #define FS_IOC32_GETFLAGS _IOR('f', 1, int) #define FS_IOC32_SETFLAGS _IOW('f', 2, int) -#define DIGSIG_VERSION_1 1 -#define DIGSIG_VERSION_2 2 - struct h_misc { unsigned long ino; uint32_t generation; @@ -112,6 +109,11 @@ enum digest_algo { DIGEST_ALGO_MAX }; +enum digsig_version { + DIGSIG_VERSION_1 = 1, + DIGSIG_VERSION_2 +}; + struct pubkey_hdr { uint8_t version; /* key format version */ uint32_t timestamp; /* key made, always 0 for now */ |