cmdline: replace FreeBSD ifdef for IP address parsing
PATCH 1/1 cmdline: replace FreeBSD ifdef for IP address parsing
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.
--- 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(-)
app/test-pmd/cmdline.c +1 -1
@@ -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>
app/test/test_cmdline_ipaddr.c +1 -1
@@ -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
examples/cmdline/commands.c +1 -1
@@ -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
lib/librte_cmdline/cmdline_parse_ipaddr.c +1 -1
@@ -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
Signature · 1 line
2.23.0
Quoted 7 lines · Thomas Monjalon
The constants like
AF_INETare insys/socket.hin FreeBSD. The #ifdef macro__FreeBSD__is replaced withRTE_EXEC_ENV_FREEBSDin order to be consistent across DPDK files, and allow to grep forEXEC_ENVamong other benefits.Signed-off-by Thomas Monjalon <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
Quoted 6 lines · Thomas Monjalon
The constants like
AF_INETare insys/socket.hin FreeBSD. The #ifdef macro__FreeBSD__is replaced withRTE_EXEC_ENV_FREEBSDin order to be consistent across DPDK files, and allow to grep forEXEC_ENVamong other benefits.Signed-off-by Thomas Monjalon <[email protected]>
Quoted 8 lines · Olivier Matz
Quoted 6 lines · Thomas Monjalon
The constants like
AF_INETare insys/socket.hin FreeBSD. The #ifdef macro__FreeBSD__is replaced withRTE_EXEC_ENV_FREEBSDin order to be consistent across DPDK files, and allow to grep forEXEC_ENVamong other benefits.Signed-off-by Thomas Monjalon <[email protected]>
Quoted 6 lines · Thomas Monjalon
The constants like
AF_INETare insys/socket.hin FreeBSD. The #ifdef macro__FreeBSD__is replaced withRTE_EXEC_ENV_FREEBSDin order to be consistent across DPDK files, and allow to grep forEXEC_ENVamong other benefits.Signed-off-by Thomas Monjalon <[email protected]>
Quoted 1 line
Acked-by Olivier Matz <[email protected]>
Applied, thanks.
--
David Marchand
Quoted 57 lines · On Wed, 6 Nov 2019 13:09:43 +0100 Thomas Monjalon <[email protected]> wrote:
The constants like
AF_INETare insys/socket.hin FreeBSD. The #ifdef macro__FreeBSD__is replaced withRTE_EXEC_ENV_FREEBSDin order to be consistent across DPDK files, and allow to grep forEXEC_ENVamong other benefits.Signed-off-by Thomas Monjalon <[email protected]>--- 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(-)app/test-pmd/cmdline.c +1
-1@@ -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> app/test/test_cmdline_ipaddr.c +1
-1@@ -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 examples/cmdline/commands.c +1
-1@@ -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 lib/librte_cmdline/cmdline_parse_ipaddr.c +0
-0
lib/librte_cmdline/cmdline_parse_ipaddr.c line 19
Quoted 8 lines
lib/librte_cmdline/cmdline_parse_ipaddr.c +1
-1@@ -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.
08/11/2019 17:15, Stephen Hemminger:
Quoted 8 lines
Quoted 5 lines · On Wed, 6 Nov 2019 13:09:43 +0100 Thomas Monjalon <[email protected]> wrote:
The constants like
AF_INETare insys/socket.hin FreeBSD. The #ifdef macro__FreeBSD__is replaced withRTE_EXEC_ENV_FREEBSDin order to be consistent across DPDK files, and allow to grep forEXEC_ENVamong other benefits.
Quoted 9 lines
app/test-pmd/cmdline.c line 16
Quoted 6 lines
Signed-off-by Thomas Monjalon <[email protected]>---
app/test-pmd/cmdline.c +1
-1-#ifdef __FreeBSD__ +#ifdef RTE_EXEC_ENV_FREEBSD #include <sys/socket.h> #endif Why not always include
sys/socket.hhaving 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?
PATCH 1/1 cmdline: remove unnecessary #ifdef
In reply to Thomas MonjalonThe #ifdef to conditionally include <sys/socket.h> on BSD is unnecessary. It is harmless to include the header on other OS's. An extra include is better than an #ifdef.
--- app/test-pmd/cmdline.c | 2 -- app/test/test_cmdline_ipaddr.c | 2 -- lib/librte_cmdline/cmdline_parse_ipaddr.c | 2 -- 3 files changed, 6 deletions(-)
app/test-pmd/cmdline.c +0 -2
@@ -11,9 +11,7 @@#include <termios.h> #include <unistd.h> #include <inttypes.h> -#ifdef RTE_EXEC_ENV_FREEBSD #include <sys/socket.h> -#endif #include <netinet/in.h> #include <sys/queue.h>
app/test/test_cmdline_ipaddr.c +0 -2
@@ -6,9 +6,7 @@#include <string.h> #include <inttypes.h> #include <netinet/in.h> -#ifdef RTE_EXEC_ENV_FREEBSD #include <sys/socket.h> -#endif #include <rte_string_fns.h>
lib/librte_cmdline/cmdline_parse_ipaddr.c +0 -2
@@ -13,9 +13,7 @@#include <errno.h> #include <arpa/inet.h> #include <netinet/in.h> -#ifdef RTE_EXEC_ENV_FREEBSD #include <sys/socket.h> -#endif #include <rte_string_fns.h>
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH] cmdline: remove unnecessary #ifdef
Quoted 11 lines · Stephen Hemminger
The #ifdef to conditionally include <
sys/socket.h> on BSD is unnecessary. It is harmless to include the header on other OS's. An extra include is better than an #ifdef.Signed-off-by Stephen Hemminger <[email protected]>--- app/test-pmd/cmdline.c | 2 -- app/test/test_cmdline_ipaddr.c | 2 -- lib/librte_cmdline/cmdline_parse_ipaddr.c | 2 -- 3 files changed, 6 deletions(-)
Seems reasonable
Re: [dpdk-dev] [PATCH] cmdline: remove unnecessary #ifdef
In reply to Stephen HemmingerQuoted 5 lines · Stephen Hemminger
The #ifdef to conditionally include <
sys/socket.h> on BSD is unnecessary. It is harmless to include the header on other OS's. An extra include is better than an #ifdef.Signed-off-by Stephen Hemminger <[email protected]>
Thanks
David Marchand
AppliedRe: [dpdk-dev] [PATCH] cmdline: remove unnecessary #ifdef
Quoted 9 lines · Olivier Matz
Quoted 5 lines · Stephen Hemminger
The #ifdef to conditionally include <
sys/socket.h> on BSD is unnecessary. It is harmless to include the header on other OS's. An extra include is better than an #ifdef.Signed-off-by Stephen Hemminger <[email protected]>Acked-by Bruce Richardson <[email protected]>Acked-by Olivier Matz <[email protected]>
Applied, thanks.
--
David Marchand