[ovs-dev] [PATCH] V2 windefs: common include for MSVC

Gurucharan Shetty shettyg at nicira.com
Tue Dec 17 15:49:45 UTC 2013


On Mon, Dec 16, 2013 at 6:02 PM, Alin Serdean
<aserdean at cloudbasesolutions.com> wrote:
> I added also syslog.h as you suggested(this will help us in the future patches).
>
> Regarding the warnings I will send a detailed list iwth their corespondence in another mail and we can discuss further if we want to add them or not.
>
> I hope everything is in order now :).
>
> Signed-off-by: Alin Serdean <aserdean at cloudbasesolutions>
> ---
One more thing. After I apply this patch, 'make' on linux fails.

make[3]: Entering directory `/root/git/openvswitch/datapath'
make[3]: Leaving directory `/root/git/openvswitch/datapath'
The distribution is missing the following files:
include/windows/syslog.h
include/windows/windefs.h

I think you will need to include the following incremental:
diff --git a/include/automake.mk b/include/automake.mk
index f34e5c9..37a6f77 100644
--- a/include/automake.mk
+++ b/include/automake.mk
@@ -2,3 +2,4 @@ include include/linux/automake.mk
 include include/openflow/automake.mk
 include include/openvswitch/automake.mk
 include include/sparse/automake.mk
+include include/windows/automake.mk
diff --git a/include/windows/automake.mk b/include/windows/automake.mk
new file mode 100644
index 0000000..677b2ed
--- /dev/null
+++ b/include/windows/automake.mk
@@ -0,0 +1,3 @@
+noinst_HEADERS += \
+        include/windows/windefs.h \
+        include/windows/syslog.h


Also,
For the files that you add, I think you can add your copyright instead
of the Nicira one.

> Makefile.am       |    5 +++++
>  m4/openvswitch.m4 |    3 +++
>  3 files changed, 36 insertions(+), 0 deletions(-)
>  include/windows/syslog.h  |   31 ++++++++++++++++++++
>  include/windows/windefs.h |   68 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 99 insertions(+), 0 deletions(-)
> diff --git a/Makefile.am b/Makefile.am
> index a6d985d..6d9899a 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -10,6 +10,11 @@ ACLOCAL_AMFLAGS = -I m4
>  SUBDIRS = datapath
>
>  AM_CPPFLAGS = $(SSL_CFLAGS)
> +
> +if WIN32
> +AM_CPPFLAGS += -I $(top_srcdir)/include/windows
> +endif
> +
>  AM_CPPFLAGS += -I $(top_srcdir)/include
>  AM_CPPFLAGS += -I $(top_srcdir)/lib
>  AM_CPPFLAGS += -I $(top_builddir)/lib
> diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
> index b8157c0..ee7e96a 100644
> --- a/m4/openvswitch.m4
> +++ b/m4/openvswitch.m4
> @@ -64,6 +64,9 @@ AC_DEFUN([OVS_CHECK_WIN32],
>     AM_CONDITIONAL([WIN32], [test "$WIN32" = yes])
>     if test "$WIN32" = yes; then
>        AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
> +      AH_BOTTOM([#ifdef WIN32
> +#include "include/windows/windefs.h"
> +#endif])
>     fi])
>
>  dnl Checks for Netlink support.
> diff --git a/include/windows/syslog.h b/include/windows/syslog.h
> new file mode 100644
> index 0000000..404705a
> --- /dev/null
> +++ b/include/windows/syslog.h
> @@ -0,0 +1,31 @@
> +/*
> + * Copyright (c) 2013 Nicira, Inc.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +#ifndef SYSLOG_H
> +#define SYSLOG_H 1
> +
> +#define LOG_EMERG       0       /* system is unusable */
> +#define LOG_ALERT       1       /* action must be taken immediately */
> +#define LOG_CRIT        2       /* critical conditions */
> +#define LOG_ERR         3       /* error conditions */
> +#define LOG_WARNING     4       /* warning conditions */
> +#define LOG_NOTICE      5       /* normal but significant condition */
> +#define LOG_INFO        6       /* informational */
> +#define LOG_DEBUG       7       /* debug-level messages */
> +#define LOG_NDELAY      8       /* don't delay open */
> +#define LOG_DAEMON      24      /* system daemons */
> +
> +#endif /* syslog.h */
> diff --git a/include/windows/windefs.h b/include/windows/windefs.h
> new file mode 100644
> index 0000000..0ea88bb
> --- /dev/null
> +++ b/include/windows/windefs.h
> @@ -0,0 +1,68 @@
> +/*
> + * Copyright (c) 2013 Nicira, Inc.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +#ifndef WINDEFS_H
> +#define WINDEFS_H 1
> +
> +#include <Winsock2.h>
> +#include <In6addr.h>
> +#include <WS2tcpip.h>
> +#include <windows.h>
> +#include <BaseTsd.h>
> +
> +#define ffs __lzcnt
> +#define inline __inline
> +#define strtok_r strtok_s
> +#define __func__ __FUNCTION__
> +#define snprintf _snprintf
> +#define strcasecmp _stricmp
> +#define strncasecmp _strnicmp
> +#define ssize_t SSIZE_T
> +#define u_int8_t uint8_t
> +#define u_int16_t uint16_t
> +#define u_int32_t uint32_t
> +#define u_int64_t uint64_t
> +
> +typedef unsigned char __u8;
> +typedef unsigned short __u16;
> +typedef unsigned int  __u32;
> +typedef unsigned long long __u64;
> +typedef unsigned short __le16;
> +typedef unsigned short __be16;
> +typedef unsigned int __le32;
> +typedef unsigned int __be32;
> +typedef unsigned long long __le64;
> +typedef unsigned long long __be64;
> +typedef unsigned long int sigset_t;
> +
> +#undef WCOREDUMP
> +#define WCOREDUMP(status) ((status) & 0x80)
> +#undef WEXITSTATUS
> +#define WEXITSTATUS(status) (((status)  & 0xff00) >> 8)
> +#undef WIFEXITED
> +#define WIFEXITED(status) (WTERMSIG(status) == 0)
> +#undef WIFSTOPPED
> +#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
> +#undef WIFSIGNALED
> +#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status))
> +#undef WSTOPSIG
> +#define WSTOPSIG(status) WEXITSTATUS(status)
> +#undef WTERMSIG
> +#define WTERMSIG(status) ((status) & 0x7f)
> +#undef WCOREDUMP
> +#define WCOREDUMP(status) ((status) & 0x80)
> +
> +#endif /* windefs.h */
> ---
>
>



More information about the dev mailing list