diff mbox series

cmdline: replace FreeBSD ifdef for IP address parsing

Message ID 20191106120943.15967-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers show
Series cmdline: replace FreeBSD ifdef for IP address parsing | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon Nov. 6, 2019, 12:09 p.m. UTC
The constants like AF_INET are in sys/socket.h in FreeBSD.
The #ifdef macro __FreeBSD__ is replaced with RTE_EXEC_ENV_FREEBSD
in order to be consistent across DPDK files, and allow to grep
for EXEC_ENV among other benefits.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 app/test-pmd/cmdline.c                    | 2 +-
 app/test/test_cmdline_ipaddr.c            | 2 +-
 examples/cmdline/commands.c               | 2 +-
 lib/librte_cmdline/cmdline_parse_ipaddr.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

Comments

Anatoly Burakov Nov. 6, 2019, 12:11 p.m. UTC | #1
On 06-Nov-19 12:09 PM, Thomas Monjalon wrote:
> The constants like AF_INET are in sys/socket.h in FreeBSD.
> The #ifdef macro __FreeBSD__ is replaced with RTE_EXEC_ENV_FREEBSD
> in order to be consistent across DPDK files, and allow to grep
> for EXEC_ENV among other benefits.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Olivier Matz Nov. 8, 2019, 8:44 a.m. UTC | #2
On Wed, Nov 06, 2019 at 01:09:43PM +0100, Thomas Monjalon wrote:
> The constants like AF_INET are in sys/socket.h in FreeBSD.
> The #ifdef macro __FreeBSD__ is replaced with RTE_EXEC_ENV_FREEBSD
> in order to be consistent across DPDK files, and allow to grep
> for EXEC_ENV among other benefits.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Acked-by: Olivier Matz <olivier.matz@6wind.com>
David Marchand Nov. 8, 2019, 10:18 a.m. UTC | #3
On Fri, Nov 8, 2019 at 9:44 AM Olivier Matz <olivier.matz@6wind.com> wrote:
>
> On Wed, Nov 06, 2019 at 01:09:43PM +0100, Thomas Monjalon wrote:
> > The constants like AF_INET are in sys/socket.h in FreeBSD.
> > The #ifdef macro __FreeBSD__ is replaced with RTE_EXEC_ENV_FREEBSD
> > in order to be consistent across DPDK files, and allow to grep
> > for EXEC_ENV among other benefits.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
On 06-Nov-19 12:09 PM, Thomas Monjalon wrote:
> The constants like AF_INET are in sys/socket.h in FreeBSD.
> The #ifdef macro __FreeBSD__ is replaced with RTE_EXEC_ENV_FREEBSD
> in order to be consistent across DPDK files, and allow to grep
> for EXEC_ENV among other benefits.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks.



--
David Marchand
Stephen Hemminger Nov. 8, 2019, 4:15 p.m. UTC | #4
On Wed,  6 Nov 2019 13:09:43 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:

> The constants like AF_INET are in sys/socket.h in FreeBSD.
> The #ifdef macro __FreeBSD__ is replaced with RTE_EXEC_ENV_FREEBSD
> in order to be consistent across DPDK files, and allow to grep
> for EXEC_ENV among other benefits.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  app/test-pmd/cmdline.c                    | 2 +-
>  app/test/test_cmdline_ipaddr.c            | 2 +-
>  examples/cmdline/commands.c               | 2 +-
>  lib/librte_cmdline/cmdline_parse_ipaddr.c | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 4478069911..74e02d6813 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -11,7 +11,7 @@
>  #include <termios.h>
>  #include <unistd.h>
>  #include <inttypes.h>
> -#ifdef __FreeBSD__
> +#ifdef RTE_EXEC_ENV_FREEBSD
>  #include <sys/socket.h>
>  #endif
>  #include <netinet/in.h>
> diff --git a/app/test/test_cmdline_ipaddr.c b/app/test/test_cmdline_ipaddr.c
> index 2d11ce936c..315ac3a9f8 100644
> --- a/app/test/test_cmdline_ipaddr.c
> +++ b/app/test/test_cmdline_ipaddr.c
> @@ -6,7 +6,7 @@
>  #include <string.h>
>  #include <inttypes.h>
>  #include <netinet/in.h>
> -#ifdef __FreeBSD__
> +#ifdef RTE_EXEC_ENV_FREEBSD
>  #include <sys/socket.h>
>  #endif
>  
> diff --git a/examples/cmdline/commands.c b/examples/cmdline/commands.c
> index 1249ee7a8a..4badffc257 100644
> --- a/examples/cmdline/commands.c
> +++ b/examples/cmdline/commands.c
> @@ -12,7 +12,7 @@
>  #include <errno.h>
>  #include <netinet/in.h>
>  #include <termios.h>
> -#ifdef __FreeBSD__
> +#ifdef RTE_EXEC_ENV_FREEBSD
>  #include <sys/socket.h>
>  #endif
>  
> diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.c b/lib/librte_cmdline/cmdline_parse_ipaddr.c
> index 848c1eb07d..4de5ba35ae 100644
> --- a/lib/librte_cmdline/cmdline_parse_ipaddr.c
> +++ b/lib/librte_cmdline/cmdline_parse_ipaddr.c
> @@ -13,7 +13,7 @@
>  #include <errno.h>
>  #include <arpa/inet.h>
>  #include <netinet/in.h>
> -#ifdef __FreeBSD__
> +#ifdef RTE_EXEC_ENV_FREEBSD
>  #include <sys/socket.h>
>  #endif
>  

Why not always include sys/socket.h having an extra include
is much less of a nuisance than a silly #ifdef.
Thomas Monjalon Nov. 8, 2019, 4:28 p.m. UTC | #5
08/11/2019 17:15, Stephen Hemminger:
> On Wed,  6 Nov 2019 13:09:43 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > The constants like AF_INET are in sys/socket.h in FreeBSD.
> > The #ifdef macro __FreeBSD__ is replaced with RTE_EXEC_ENV_FREEBSD
> > in order to be consistent across DPDK files, and allow to grep
> > for EXEC_ENV among other benefits.
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> > -#ifdef __FreeBSD__
> > +#ifdef RTE_EXEC_ENV_FREEBSD
> >  #include <sys/socket.h>
> >  #endif
> 
> Why not always include sys/socket.h having an extra include
> is much less of a nuisance than a silly #ifdef.

Yes, good suggestion.

David already merged the patch.
Do you want to propose a patch on top?
diff mbox series

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 4478069911..74e02d6813 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -11,7 +11,7 @@ 
 #include <termios.h>
 #include <unistd.h>
 #include <inttypes.h>
-#ifdef __FreeBSD__
+#ifdef RTE_EXEC_ENV_FREEBSD
 #include <sys/socket.h>
 #endif
 #include <netinet/in.h>
diff --git a/app/test/test_cmdline_ipaddr.c b/app/test/test_cmdline_ipaddr.c
index 2d11ce936c..315ac3a9f8 100644
--- a/app/test/test_cmdline_ipaddr.c
+++ b/app/test/test_cmdline_ipaddr.c
@@ -6,7 +6,7 @@ 
 #include <string.h>
 #include <inttypes.h>
 #include <netinet/in.h>
-#ifdef __FreeBSD__
+#ifdef RTE_EXEC_ENV_FREEBSD
 #include <sys/socket.h>
 #endif
 
diff --git a/examples/cmdline/commands.c b/examples/cmdline/commands.c
index 1249ee7a8a..4badffc257 100644
--- a/examples/cmdline/commands.c
+++ b/examples/cmdline/commands.c
@@ -12,7 +12,7 @@ 
 #include <errno.h>
 #include <netinet/in.h>
 #include <termios.h>
-#ifdef __FreeBSD__
+#ifdef RTE_EXEC_ENV_FREEBSD
 #include <sys/socket.h>
 #endif
 
diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.c b/lib/librte_cmdline/cmdline_parse_ipaddr.c
index 848c1eb07d..4de5ba35ae 100644
--- a/lib/librte_cmdline/cmdline_parse_ipaddr.c
+++ b/lib/librte_cmdline/cmdline_parse_ipaddr.c
@@ -13,7 +13,7 @@ 
 #include <errno.h>
 #include <arpa/inet.h>
 #include <netinet/in.h>
-#ifdef __FreeBSD__
+#ifdef RTE_EXEC_ENV_FREEBSD
 #include <sys/socket.h>
 #endif