summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Debug.c
diff options
context:
space:
mode:
authorSamuel Ghinet <sghinet@cloudbasesolutions.com>2014-08-29 04:06:48 +0000
committerBen Pfaff <blp@nicira.com>2014-08-29 07:55:05 -0700
commitfa1324c92810c6b1e33b7e87caaaf2e6c4041040 (patch)
tree8e06f5d991d755215bb6839a997bc58721b2d754 /datapath-windows/ovsext/Debug.c
parentfd972eb87a888242fb1a8ec2394fa7b3030fbd7d (diff)
downloadopenvswitch-fa1324c92810c6b1e33b7e87caaaf2e6c4041040.tar.gz
datapath-windows: Rename files.
This patch includes the file renaming and accommodations needed for the file renaming to build the forwarding extension for Hyper-V. This patch is also a follow-up for the thread: http://openvswitch.org/pipermail/dev/2014-August/044005.html Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com> Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext/Debug.c')
-rw-r--r--datapath-windows/ovsext/Debug.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Debug.c b/datapath-windows/ovsext/Debug.c
new file mode 100644
index 000000000..a96d38d40
--- /dev/null
+++ b/datapath-windows/ovsext/Debug.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014 VMware, 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.
+ */
+
+#include "precomp.h"
+
+#include "Debug.h"
+#ifdef DBG
+#define OVS_DBG_DEFAULT OVS_DBG_INFO
+#else
+#define OVS_DBG_DEFAULT OVS_DBG_ERROR
+#endif
+
+UINT32 ovsLogFlags = 0xffffffff;
+UINT32 ovsLogLevel = OVS_DBG_DEFAULT;
+
+#define OVS_LOG_BUFFER_SIZE 384
+
+/*
+ * --------------------------------------------------------------------------
+ * OvsLog --
+ * Utility function to log to the Windows debug console.
+ * --------------------------------------------------------------------------
+ */
+VOID
+OvsLog(UINT32 level,
+ UINT32 flag,
+ CHAR *funcName,
+ UINT32 line,
+ CHAR *format,
+ ...)
+{
+ va_list args;
+ CHAR buf[OVS_LOG_BUFFER_SIZE];
+
+ if (level > ovsLogLevel || (ovsLogFlags & flag) == 0) {
+ return;
+ }
+
+ buf[0] = 0;
+ va_start(args, format);
+ RtlStringCbVPrintfA(buf, sizeof (buf), format, args);
+ va_end(args);
+
+ DbgPrintEx(DPFLTR_IHVNETWORK_ID, level, "%s:%lu %s\n", funcName, line, buf);
+}