On Tue, Feb 7, 2023 at 5:19 PM Stephen Hemminger
<step...@networkplumber.org> wrote:
>
> On Tue, 7 Feb 2023 09:34:13 +0100
> David Marchand <david.march...@redhat.com> wrote:
>
> > Why do we need a new naming convention?
> > Please use RTE_LOG_REGISTER_DEFAULT.
>
> Should be use RTE_LOG_REGISTER_SUFFIX( ) with "mbuf"

RTE_LOG_REGISTER_DEFAULT() hooks the logtype handle you pass to an
automatic RTE_LOG_DEFAULT_LOGTYPE name based on location in the tree
(generated by the build framework).

#define RTE_LOG_REGISTER_IMPL(type, name, level)                            \
int type;                                                                   \
RTE_INIT(__##type)                                                          \
{                                                                           \
        type = rte_log_register_type_and_pick_level(name, RTE_LOG_##level); \
        if (type < 0)                                                       \
                type = RTE_LOGTYPE_EAL;                                     \
}

#define RTE_LOG_REGISTER_DEFAULT(type, level) \
        RTE_LOG_REGISTER_IMPL(type, RTE_STR(RTE_LOG_DEFAULT_LOGTYPE), level)


When compiling:

[4/5] ccache cc -Ilib/librte_mbuf.a.p -Ilib -I../lib -Ilib/mbuf
-I../lib/mbuf -I. -I.. -Iconfig -I../config -Ilib/eal/include
-I../lib/eal/include -Ilib/eal/linux/include
-I../lib/eal/linux/include -Ilib/eal/x86/include
-I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common
-Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/metrics
-I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/mempool
-I../lib/mempool -Ilib/ring -I../lib/ring -fdiagnostics-color=always
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -O2 -g
-include rte_config.h -Wcast-qual -Wdeprecated -Wformat
-Wformat-nonliteral -Wformat-security -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wold-style-definition
-Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef
-Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned
-Wno-missing-field-initializers -Wno-zero-length-bounds -D_GNU_SOURCE
-Wno-error=array-bounds -DRTE_LIBRTE_BBDEV_DEBUG
-DRTE_LIBRTE_EVENTDEV_DEBUG -DRTE_LIBRTE_IEEE1588 -fPIC -march=corei7
-DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation
-DRTE_LOG_DEFAULT_LOGTYPE=lib.mbuf -MD -MQ
lib/librte_mbuf.a.p/mbuf_rte_mbuf.c.o -MF
lib/librte_mbuf.a.p/mbuf_rte_mbuf.c.o.d -o
lib/librte_mbuf.a.p/mbuf_rte_mbuf.c.o -c ../lib/mbuf/rte_mbuf.c


RTE_LOG_REGISTER_SUFFIX() may be used to define "sub" logtypes, like
if you needed lib.mbuf.foo.


-- 
David Marchand

Reply via email to