On 7/7/23 11:22, Konstantin Kostiuk wrote:
Signed-off-by: Konstantin Kostiuk <[email protected]>
---
  qga/vss-win32/meson.build   |  2 +-
  qga/vss-win32/vss-debug.cpp | 31 +++++++++++++++++++++++++++++++
  qga/vss-win32/vss-debug.h   | 25 +++++++++++++++++++++++++
  3 files changed, 57 insertions(+), 1 deletion(-)
  create mode 100644 qga/vss-win32/vss-debug.cpp
  create mode 100644 qga/vss-win32/vss-debug.h


diff --git a/qga/vss-win32/vss-debug.cpp b/qga/vss-win32/vss-debug.cpp
new file mode 100644
index 0000000000..5d6f37944b
--- /dev/null
+++ b/qga/vss-win32/vss-debug.cpp
@@ -0,0 +1,31 @@
+/*
+ * QEMU Guest Agent VSS debug declarations
+ *
+ * Copyright (C) 2023 Red Hat Inc
+ *
+ * Authors:
+ *  Konstantin Kostiuk <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "vss-debug.h"
+#include "vss-common.h"
+
+void qga_debug_internal(const char *funcname, const char *fmt, ...)  {
+    char user_sting[512] = {0};

"user_string"

+    char full_string[640] = {0};
+
+    va_list args;
+    va_start(args, fmt);
+    vsnprintf(user_sting, 512, fmt, args);

ARRAY_SIZE(user_string)

+    va_end(args);
+
+    snprintf(full_string, 640, QGA_PROVIDER_NAME "[%lu]: %s %s\n",
+             GetCurrentThreadId(), funcname, user_sting);

if (snprintf() <= 0) { return; }

+
+    OutputDebugString(full_string);
+    fprintf(stderr, "%s", full_string);

Format unused:

fputs(full_string, stderr);

+}

With the changes:
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>


Reply via email to