drivers/virtio: fix duplicate naming of include guard

Message ID 1553090259-30893-1-git-send-email-andrius.sirvys@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series drivers/virtio: fix duplicate naming of include guard |

Checks

Context Check Description
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Andrius Sirvys March 20, 2019, 1:57 p.m. UTC
  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.

Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
Cc: jianfeng.tan@intel.com
Signed-off-by: Andrius Sirvys <andrius.sirvys@intel.com>
---
 drivers/net/virtio/virtio_user/vhost.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Rami Rosen March 21, 2019, 6:19 a.m. UTC | #1
On Wed, Mar 20, 2019 at 3:58 PM Andrius Sirvys <andrius.sirvys@intel.com>
wrote:

> 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.
>
> Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
> Cc: jianfeng.tan@intel.com
> Signed-off-by: Andrius Sirvys <andrius.sirvys@intel.com>
> ---
>
>
Acked-by: Rami Rosen <ramirose@gmail.com>
  
Tiwei Bie March 21, 2019, 7:59 a.m. UTC | #2
On Wed, Mar 20, 2019 at 01:57:39PM +0000, Andrius Sirvys wrote:
> 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.

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.

> 
> Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
> Cc: jianfeng.tan@intel.com
> Signed-off-by: Andrius Sirvys <andrius.sirvys@intel.com>
> ---
>  drivers/net/virtio/virtio_user/vhost.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/virtio_user/vhost.h
> index 83a85cc..f8d26b6 100644
> --- a/drivers/net/virtio/virtio_user/vhost.h
> +++ b/drivers/net/virtio/virtio_user/vhost.h
> @@ -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

>  
>  #include <stdint.h>
>  #include <linux/types.h>
> -- 
> 2.7.4
>
  
Maxime Coquelin March 21, 2019, 9:26 a.m. UTC | #3
On 3/21/19 8:59 AM, Tiwei Bie wrote:
> On Wed, Mar 20, 2019 at 01:57:39PM +0000, Andrius Sirvys wrote:
>> 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.
> 
> 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.
> 
>>
>> Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
>> Cc: jianfeng.tan@intel.com
>> Signed-off-by: Andrius Sirvys <andrius.sirvys@intel.com>
>> ---
>>   drivers/net/virtio/virtio_user/vhost.h | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/virtio_user/vhost.h
>> index 83a85cc..f8d26b6 100644
>> --- a/drivers/net/virtio/virtio_user/vhost.h
>> +++ b/drivers/net/virtio/virtio_user/vhost.h
>> @@ -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.

+1 for _VIRTIO_USER_VHOST_H_

> 
> Thanks,
> Tiwei
> 
>>   
>>   #include <stdint.h>
>>   #include <linux/types.h>
>> -- 
>> 2.7.4
>>
  

Patch

diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/virtio_user/vhost.h
index 83a85cc..f8d26b6 100644
--- a/drivers/net/virtio/virtio_user/vhost.h
+++ b/drivers/net/virtio/virtio_user/vhost.h
@@ -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>