[v13,02/10] eal/windows: add necessary macros

Message ID 1620241931-28435-3-git-send-email-jizh@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers
Series app/testpmd: enable testpmd on Windows |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jie Zhou May 5, 2021, 7:12 p.m. UTC
  Add required macros by testpmd on Windows in rte_os_shim.h

Signed-off-by: Jie Zhou <jizh@microsoft.com>
Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
Acked-by: Tal Shnaiderman <talshn@nvidia.com>
---
 lib/eal/windows/include/rte_os_shim.h | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Dmitry Kozlyuk June 20, 2021, 11:28 p.m. UTC | #1
2021-05-05 12:12 (UTC-0700), Jie Zhou:
> Add required macros by testpmd on Windows in rte_os_shim.h
> 
> Signed-off-by: Jie Zhou <jizh@microsoft.com>
> Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
> Acked-by: Tal Shnaiderman <talshn@nvidia.com>
> ---
>  lib/eal/windows/include/rte_os_shim.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/lib/eal/windows/include/rte_os_shim.h b/lib/eal/windows/include/rte_os_shim.h
> index 1b314733b..3763cae62 100644
> --- a/lib/eal/windows/include/rte_os_shim.h
> +++ b/lib/eal/windows/include/rte_os_shim.h
> @@ -21,6 +21,7 @@
>  #define strdup(str) _strdup(str)
>  #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
>  #ifndef RTE_TOOLCHAIN_GCC
> +#define strcasecmp _stricmp
>  #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
>  #endif

Please use macros with arguments, like in the next line.
This provides better error messages at call site
and IDE display a nice hint knowing the parameters.

>  
> @@ -38,6 +39,14 @@
>  #define IPPROTO_SCTP	132
>  #endif
>  
> +#ifndef IPDEFTTL
> +#define IPDEFTTL 64
> +#endif
> +
> +#ifndef S_ISREG
> +#define S_ISREG(mode)  (((mode)&S_IFMT) == S_IFREG)
> +#endif
> +

Missing spaces around `&`.

>  #ifdef RTE_TOOLCHAIN_GCC
>  
>  #define TIME_UTC 1
  
Jie Zhou June 23, 2021, 8:51 p.m. UTC | #2
On Mon, Jun 21, 2021 at 02:28:27AM +0300, Dmitry Kozlyuk wrote:
> 2021-05-05 12:12 (UTC-0700), Jie Zhou:
> > Add required macros by testpmd on Windows in rte_os_shim.h
> > 
> > Signed-off-by: Jie Zhou <jizh@microsoft.com>
> > Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
> > Acked-by: Tal Shnaiderman <talshn@nvidia.com>
> > ---
> >  lib/eal/windows/include/rte_os_shim.h | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/lib/eal/windows/include/rte_os_shim.h b/lib/eal/windows/include/rte_os_shim.h
> > index 1b314733b..3763cae62 100644
> > --- a/lib/eal/windows/include/rte_os_shim.h
> > +++ b/lib/eal/windows/include/rte_os_shim.h
> > @@ -21,6 +21,7 @@
> >  #define strdup(str) _strdup(str)
> >  #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
> >  #ifndef RTE_TOOLCHAIN_GCC
> > +#define strcasecmp _stricmp
> >  #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
> >  #endif
> 
> Please use macros with arguments, like in the next line.
> This provides better error messages at call site
> and IDE display a nice hint knowing the parameters.
> 
> >  
> > @@ -38,6 +39,14 @@
> >  #define IPPROTO_SCTP	132
> >  #endif
> >  
> > +#ifndef IPDEFTTL
> > +#define IPDEFTTL 64
> > +#endif
> > +
> > +#ifndef S_ISREG
> > +#define S_ISREG(mode)  (((mode)&S_IFMT) == S_IFREG)
> > +#endif
> > +
> 
> Missing spaces around `&`.

Thanks Dmitry. Will fix both in V14.
  

Patch

diff --git a/lib/eal/windows/include/rte_os_shim.h b/lib/eal/windows/include/rte_os_shim.h
index 1b314733b..3763cae62 100644
--- a/lib/eal/windows/include/rte_os_shim.h
+++ b/lib/eal/windows/include/rte_os_shim.h
@@ -21,6 +21,7 @@ 
 #define strdup(str) _strdup(str)
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
 #ifndef RTE_TOOLCHAIN_GCC
+#define strcasecmp _stricmp
 #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
 #endif
 
@@ -38,6 +39,14 @@ 
 #define IPPROTO_SCTP	132
 #endif
 
+#ifndef IPDEFTTL
+#define IPDEFTTL 64
+#endif
+
+#ifndef S_ISREG
+#define S_ISREG(mode)  (((mode)&S_IFMT) == S_IFREG)
+#endif
+
 #ifdef RTE_TOOLCHAIN_GCC
 
 #define TIME_UTC 1