[dpdk-dev] [PATCH] vhost: fix remove macro name conflict

Maxime Coquelin maxime.coquelin at redhat.com
Wed Feb 21 08:55:44 CET 2018



On 02/09/2018 06:24 PM, Tomasz Kulasek wrote:
> LOG_DEBUG is a symbol defined by POSIX, so if sys/log.h is
> included the symbols conflict.
> 
> This patch changes LOG_DEBUG to VHOST_LOG_DEBUG.
> 
> Fixes: 1c01d52392d5 ("vhost: add debug print")
> Cc: huawei.xie at intel.com
> Cc: stable at dpdk.org
> 
> Signed-off-by: Ben Walker <benjamin.walker at intel.com>
> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek at intel.com>
> ---
>   lib/librte_vhost/vhost.h      | 13 +++++++------
>   lib/librte_vhost/vhost_user.c | 10 +++++-----
>   lib/librte_vhost/virtio_net.c | 16 ++++++++--------
>   3 files changed, 20 insertions(+), 19 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index d947bc9e3..319cc6620 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -296,8 +296,9 @@ vhost_log_used_vring(struct virtio_net *dev, struct vhost_virtqueue *vq,
>   
>   #ifdef RTE_LIBRTE_VHOST_DEBUG
>   #define VHOST_MAX_PRINT_BUFF 6072
> -#define LOG_LEVEL RTE_LOG_DEBUG
> -#define LOG_DEBUG(log_type, fmt, args...) RTE_LOG(DEBUG, log_type, fmt, ##args)
> +#define VHOST_LOG_LEVEL RTE_LOG_DEBUG
> +#define VHOST_LOG_DEBUG(log_type, fmt, args...) \
> +	RTE_LOG(DEBUG, log_type, fmt, ##args)
>   #define PRINT_PACKET(device, addr, size, header) do { \
>   	char *pkt_addr = (char *)(addr); \
>   	unsigned int index; \
> @@ -313,11 +314,11 @@ vhost_log_used_vring(struct virtio_net *dev, struct vhost_virtqueue *vq,
>   	} \
>   	snprintf(packet + strnlen(packet, VHOST_MAX_PRINT_BUFF), VHOST_MAX_PRINT_BUFF - strnlen(packet, VHOST_MAX_PRINT_BUFF), "\n"); \
>   	\
> -	LOG_DEBUG(VHOST_DATA, "%s", packet); \
> +	VHOST_LOG_DEBUG(VHOST_DATA, "%s", packet); \
>   } while (0)
>   #else
> -#define LOG_LEVEL RTE_LOG_INFO
> -#define LOG_DEBUG(log_type, fmt, args...) do {} while (0)
> +#define VHOST_LOG_LEVEL RTE_LOG_INFO
> +#define VHOST_LOG_DEBUG(log_type, fmt, args...) do {} while (0)
>   #define PRINT_PACKET(device, addr, size, header) do {} while (0)
>   #endif
>   
> @@ -411,7 +412,7 @@ vhost_vring_call(struct virtio_net *dev, struct vhost_virtqueue *vq)
>   		uint16_t old = vq->signalled_used;
>   		uint16_t new = vq->last_used_idx;
>   
> -		LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=%d, old=%d, new=%d\n",
> +		VHOST_LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=%d, old=%d, new=%d\n",
>   			__func__,
>   			vhost_used_event(vq),
>   			old, new);

Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>

And applied to dpdk-next-virtio/master with removing > +#define
VHOST_LOG_LEVEL RTE_LOG_DEBUG lines, as it conflicted with Jianfeng
change that removed LOG_LEVEL.

Thanks,
Maxime


More information about the dev mailing list