drivers/virtio: fix duplicate naming of include guard
PATCH 1/1 drivers/virtio: fix duplicate naming of include guard
The LGTM static code analysis tool is reporting
"The macro name '_VHOST_NET_USER_H' of this include guard is used in 2 different header files."
lib/librte_vhost/vhost_user.h has the same include guard. Renamed the include guard in vhost.h to differentiate.
--- drivers/net/virtio/virtio_user/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_user/vhost.h +2 -2
@@ -2,8 +2,8 @@* Copyright(c) 2010-2016 Intel Corporation */ -#ifndef _VHOST_NET_USER_H -#define _VHOST_NET_USER_H +#ifndef ANOTHER_VHOST_NET_USER_H +#define ANOTHER_VHOST_NET_USER_H #include <stdint.h> #include <linux/types.h>
Signature · 1 line
2.7.4
Quoted 5 lines · Andrius Sirvys
The LGTM static code analysis tool is reporting
"The macro name '
_VHOST_NET_USER_H' of this include guard is used in 2 different header files."
Quoted 9 lines
lib/librte_vhost/vhost_user.hhas the same include guard. Renamed the include guard invhost.hto differentiate.Fixes 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")Signed-off-by Andrius Sirvys <[email protected]>---
Quoted 7 lines · Andrius Sirvys
The LGTM static code analysis tool is reporting
"The macro name '
_VHOST_NET_USER_H' of this include guard is used in 2 different header files."
lib/librte_vhost/vhost_user.hhas the same include guard. Renamed the include guard invhost.hto differentiate.
Above two files are private headers in two individual modules, there is no chance that they will be included by the same file. But I agree it's not a good name for any of them.
Quoted 13 lines
Fixes 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")Signed-off-by Andrius Sirvys <[email protected]>--- drivers/net/virtio/virtio_user/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_user/vhost.h +0
-0
drivers/net/virtio/virtio_user/vhost.h line 6
Quoted 7 lines
drivers/net/virtio/virtio_user/vhost.h +2
-2@@ -2,8 +2,8 @@* Copyright(c) 2010-2016 Intel Corporation */ -#ifndef _VHOST_NET_USER_H -#define _VHOST_NET_USER_H +#ifndef ANOTHER_VHOST_NET_USER_H +#define ANOTHER_VHOST_NET_USER_H
If we want to change it, I prefer to change it to _PATH_NAME_, e.g. _VIRTIO_USER_VHOST_H_ or similar.
Thanks,
Tiwei
Quoted 6 lines
drivers/net/virtio/virtio_user/vhost.h +0
-0#include <stdint.h> #include <linux/types.h> Signature · 1 line
2.7.4
Quoted 29 lines · Tiwei Bie
Quoted 7 lines · Andrius Sirvys
The LGTM static code analysis tool is reporting
"The macro name '
_VHOST_NET_USER_H' of this include guard is used in 2 different header files."
lib/librte_vhost/vhost_user.hhas the same include guard. Renamed the include guard invhost.hto differentiate.Above two files are private headers in two individual modules, there is no chance that they will be included by the same file. But I agree it's not a good name for any of them.
Quoted 16 lines
Fixes 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")Signed-off-by Andrius Sirvys <[email protected]>--- drivers/net/virtio/virtio_user/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_user/vhost.h +0
-0@@ -2,8 +2,8 @@* Copyright(c) 2010-2016 Intel Corporation */
Quoted 7 lines
drivers/net/virtio/virtio_user/vhost.h line 6
Quoted 4 lines
drivers/net/virtio/virtio_user/vhost.h +2
-2-#ifndef _VHOST_NET_USER_H -#define _VHOST_NET_USER_H +#ifndef ANOTHER_VHOST_NET_USER_H +#define ANOTHER_VHOST_NET_USER_H If we want to change it, I prefer to change it to _PATH_NAME_, e.g. _VIRTIO_USER_VHOST_H_ or similar.
+1 for _VIRTIO_USER_VHOST_H_
Quoted 10 lines
Thanks,
TiweiQuoted 6 lines
drivers/net/virtio/virtio_user/vhost.h +0
-0#include <stdint.h> #include <linux/types.h> Signature · 1 line
2.7.4
PATCH v2 1/1 drivers/virtio: fix duplicate naming of include guard
In reply to Andrius Sirvys"The macro name '_VHOST_NET_USER_H' of this include guard is used in 2 different header files."
lib/librte_vhost/vhost_user.h has the same include guard. Renamed the include guard in vhost.h to differentiate.
---
v2: changed the name of the variable
--- drivers/net/virtio/virtio_user/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_user/vhost.h +2 -2
@@ -2,8 +2,8 @@* Copyright(c) 2010-2016 Intel Corporation */ -#ifndef _VHOST_NET_USER_H -#define _VHOST_NET_USER_H +#ifndef _VIRTIO_USER_VHOST_H +#define _VIRTIO_USER_VHOST_H#include <stdint.h> #include <linux/types.h>
Signature · 1 line
2.7.4
Quoted 33 lines · Andrius Sirvys
"The macro name '
_VHOST_NET_USER_H' of this include guard is used in 2 different header files."
lib/librte_vhost/vhost_user.hhas the same include guard. Renamed the include guard invhost.hto differentiate.Fixes 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")Signed-off-by Andrius Sirvys <[email protected]>Acked-by Rami Rosen <[email protected]>---
v2: changed the name of the variable--- drivers/net/virtio/virtio_user/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_user/vhost.h +2
-2@@ -2,8 +2,8 @@* Copyright(c) 2010-2016 Intel Corporation */ -#ifndef _VHOST_NET_USER_H -#define _VHOST_NET_USER_H +#ifndef _VIRTIO_USER_VHOST_H +#define _VIRTIO_USER_VHOST_H#include <stdint.h> #include <linux/types.h> Signature · 1 line
2.7.4
Maxime Coquelin
AppliedQuoted 22 lines · Andrius Sirvys
"The macro name '
_VHOST_NET_USER_H' of this include guard is used in 2 different header files."
lib/librte_vhost/vhost_user.hhas the same include guard. Renamed the include guard invhost.hto differentiate.Fixes 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")Signed-off-by Andrius Sirvys <[email protected]>Acked-by Rami Rosen <[email protected]>---
v2: changed the name of the variable--- drivers/net/virtio/virtio_user/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_user/vhost.h +0
-0
drivers/net/virtio/virtio_user/vhost.h line 9
Quoted 10 lines
drivers/net/virtio/virtio_user/vhost.h +2
-2@@ -2,8 +2,8 @@* Copyright(c) 2010-2016 Intel Corporation */ -#ifndef _VHOST_NET_USER_H -#define _VHOST_NET_USER_H +#ifndef _VIRTIO_USER_VHOST_H +#define _VIRTIO_USER_VHOST_H#include <stdint.h> #include <linux/types.h>
Applied to dpdk-next-virtio/master.
Next time please run the check-git-log script before posting, I fixed the issues while applying.
Thanks,
Maxime