> -----Original Message----- > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Olivier MATZ > Sent: Wednesday, April 19, 2017 1:15 PM > To: De Lara Guarch, Pablo > Cc: tho...@monjalon.net; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v4] eal: redefine logtype values > > Hi Pablo, > > On Wed, 19 Apr 2017 12:24:04 +0100, Pablo de Lara > <pablo.de.lara.gua...@intel.com> wrote: > > After the changes in commit c1b5fa94a46f > > ("eal: support dynamic log types"), logtype is not treated as a > > bitmask, but a decimal value. Therefore, values have to be > > converted. > > > > Fixes: c1b5fa94a46f ("eal: support dynamic log types") > > > > Signed-off-by: Pablo de Lara <pablo.de.lara.gua...@intel.com> > > --- > > > > Changes in v4: > > - Moved log type strings to eal_common_log.c > > > > Changes in v3: > > - Created array of structures containing logtype id and string > > - Added left shift to convert new decimal values to bitmask for backward > compatibility > > > > Changes in v2: > > - Used new RTE_LOGTYPE values in rte_log_init() > > > > lib/librte_eal/common/eal_common_log.c | 73 > ++++++++++++++++++++------------- > > lib/librte_eal/common/include/rte_log.h | 58 +++++++++++++------------- > > 2 files changed, 73 insertions(+), 58 deletions(-) > > > > diff --git a/lib/librte_eal/common/eal_common_log.c > b/lib/librte_eal/common/eal_common_log.c > > index dd4d30c..fd76612 100644 > > --- a/lib/librte_eal/common/eal_common_log.c > > +++ b/lib/librte_eal/common/eal_common_log.c > > @@ -118,9 +118,9 @@ rte_set_log_type(uint32_t type, int enable) > > { > > if (type < RTE_LOGTYPE_FIRST_EXT_ID) { > > if (enable) > > - rte_logs.type |= type; > > + rte_logs.type |= 1 << type; > > else > > - rte_logs.type &= ~type; > > + rte_logs.type &= ~(1 << type); > > } > > > > if (enable) > > @@ -240,42 +240,57 @@ rte_log_register(const char *name) > > return ret; > > } > > > > +struct logtype { > > + uint32_t log_id; > > + char logtype[32]; > > +}; > > Sorry I missed it in the previous review, but what do you think of > using "const char *" instead of "char[32]"?
Right, I thought I needed to reserve the memory in the structure definition, but sure, that works too :) v5 on the way...