]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
GuestSDK and vmtoolslib cleanup.
authorOliver Kurth <okurth@vmware.com>
Tue, 26 May 2020 22:32:56 +0000 (15:32 -0700)
committerOliver Kurth <okurth@vmware.com>
Tue, 26 May 2020 22:32:56 +0000 (15:32 -0700)
* Removed the vmtools dependency for guestsdk.  This has been already
  done for tar tools build/target.  The same is being done for OVT
  builds.

* Used various static libraries for building guestlib in OVT instead of
  depending on vmtoolslib.  Similar thing has already been done for
  appmonitor library in OVT.

* GuestSDK_{Panic|Debug|Warning|Log} functions in vmtoolslib are not used
  anywhere and hence they are completely removed from the code.

open-vm-tools/lib/include/vmware/tools/utils.h
open-vm-tools/libguestlib/Makefile.am
open-vm-tools/libguestlib/guestSDKLog.c [moved from open-vm-tools/libvmtools/guestSDKLog.c with 89% similarity]
open-vm-tools/libvmtools/Makefile.am
open-vm-tools/libvmtools/vmtoolsInt.h
open-vm-tools/libvmtools/vmtoolsLog.c

index a3292d5c09499f6921a9214e9599302a08ccaaff..cfa35019bce4c91aa2ae9b3c83e976a65ec53f6a 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2008-2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2020 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -158,9 +158,6 @@ VMTools_GetLibdir(void);
 GSource *
 VMTools_CreateTimer(gint timeout);
 
-void
-VMTools_SetGuestSDKMode(void);
-
 void
 VMTools_AcquireLogStateLock(void);
 
index 5181409f3473c914803a01b5d9fba233495c401f..d2cfb80a5588c9c4566cccf448c14065095a8086 100644 (file)
@@ -1,5 +1,5 @@
 ################################################################################
-### Copyright (C) 2007-2018 VMware, Inc.  All rights reserved.
+### Copyright (C) 2007-2018,2020 VMware, Inc.  All rights reserved.
 ###
 ### This program is free software; you can redistribute it and/or modify
 ### it under the terms of version 2 of the GNU General Public License as
@@ -21,15 +21,38 @@ AM_CFLAGS =
 AM_CFLAGS += -I$(top_srcdir)/include
 
 libguestlib_la_LIBADD =
-libguestlib_la_LIBADD += @VMTOOLS_LIBS@
+libguestlib_la_LIBADD += ../lib/backdoor/libBackdoor.la
+libguestlib_la_LIBADD += ../lib/dataMap/libDataMap.la
+libguestlib_la_LIBADD += ../lib/dynxdr/libDynxdr.la
+libguestlib_la_LIBADD += ../lib/err/libErr.la
+libguestlib_la_LIBADD += ../lib/hashMap/libHashMap.la
+libguestlib_la_LIBADD += ../lib/message/libMessage.la
+libguestlib_la_LIBADD += ../lib/misc/libMisc.la
+libguestlib_la_LIBADD += ../lib/rpcOut/libRpcOut.la
+libguestlib_la_LIBADD += ../lib/string/libString.la
+libguestlib_la_LIBADD += ../lib/unicode/libUnicode.la
+libguestlib_la_LIBADD += ../lib/vmCheck/libVmCheck.la
+libguestlib_la_LIBADD += ../lib/vmSignal/libVmSignal.la
 libguestlib_la_LIBADD += @XDR_LIBS@
 
+libguestlib_rpcchanneldir = $(top_srcdir)/lib/rpcChannel
+
 libguestlib_la_SOURCES =
 libguestlib_la_SOURCES += guestlibV3_xdr.c
 libguestlib_la_SOURCES += guestlibIoctl_xdr.c
+libguestlib_la_SOURCES += guestSDKLog.c
 libguestlib_la_SOURCES += vmGuestLib.c
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/bdoorChannel.c
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/rpcChannel.c
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/glib_stubs.c
+if HAVE_VSOCK
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/vsockChannel.c
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/simpleSocket.c
+endif
 
 libguestlib_la_LDFLAGS =
+libguestlib_la_LDFLAGS += -Wl,-ldl
+libguestlib_la_LDFLAGS += -Wl,-lrt
 # We require GCC, so we're fine passing compiler-specific flags.
 # Needed for OS's that don't link shared libraries against libc by default, e.g. FreeBSD
 libguestlib_la_LDFLAGS += -Wl,-lc
@@ -56,6 +79,7 @@ CFLAGS += -Wno-unused
 
 libguestlib_la_CPPFLAGS =
 libguestlib_la_CPPFLAGS += -DVMTOOLS_USE_GLIB
+libguestlib_la_CPPFLAGS += -DUSE_RPCI_ONLY
 libguestlib_la_CPPFLAGS += @GLIB2_CPPFLAGS@
 libguestlib_la_CPPFLAGS += @XDR_CPPFLAGS@
 
similarity index 89%
rename from open-vm-tools/libvmtools/guestSDKLog.c
rename to open-vm-tools/libguestlib/guestSDKLog.c
index 39119d3fb9ded4056d8bcbc67b2d138ccc1c9c09..a8c797bc0c4b494b5dd6fe2317a57752e95c9281 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2013-2016,2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013-2015,2020 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -30,7 +30,7 @@
 /*
  *-----------------------------------------------------------------------------
  *
- * GuestSDK_Debug --
+ * Debug --
  *
  *    Log debug messages.
  *
  *    None.
  *
  * Side effects:
- *    Death.
+ *    Stderr.
  *
  *-----------------------------------------------------------------------------
  */
 
 void
-GuestSDK_Debug(const char *fmt, ...)
+Debug(const char *fmt, ...)
 {
 #ifdef VMX86_LOG /* only do logging on OBJ builds */
    va_list args;
@@ -59,7 +59,7 @@ GuestSDK_Debug(const char *fmt, ...)
 /*
  *-----------------------------------------------------------------------------
  *
- * GuestSDK_Log --
+ * Log --
  *
  *    Log messages.
  *
@@ -67,13 +67,13 @@ GuestSDK_Debug(const char *fmt, ...)
  *    None.
  *
  * Side effects:
- *    Death.
+ *    Stderr.
  *
  *-----------------------------------------------------------------------------
  */
 
 void
-GuestSDK_Log(const char *fmt, ...)
+Log(const char *fmt, ...)
 {
 #ifdef VMX86_LOG /* only do logging on OBJ builds */
    va_list args;
@@ -88,7 +88,7 @@ GuestSDK_Log(const char *fmt, ...)
 /*
  *-----------------------------------------------------------------------------
  *
- * GuestSDK_Warning --
+ * Warning --
  *
  *    Log warning messages.
  *
@@ -96,13 +96,13 @@ GuestSDK_Log(const char *fmt, ...)
  *    None.
  *
  * Side effects:
- *    Death.
+ *    Stderr.
  *
  *-----------------------------------------------------------------------------
  */
 
 void
-GuestSDK_Warning(const char *fmt, ...)
+Warning(const char *fmt, ...)
 {
 #ifdef VMX86_LOG /* only do logging on OBJ builds */
    va_list args;
@@ -117,7 +117,7 @@ GuestSDK_Warning(const char *fmt, ...)
 /*
  *-----------------------------------------------------------------------------
  *
- * GuestSDK_Panic --
+ * Panic --
  *
  *    Panic.  Apps have to implement this for themselves.
  *
@@ -131,7 +131,7 @@ GuestSDK_Warning(const char *fmt, ...)
  */
 
 void
-GuestSDK_Panic(const char *fmt, ...) // IN
+Panic(const char *fmt, ...) // IN
 {
    va_list args;
    char buffer[1024];
index 347b8c7d9df6069956350e42d89fc765424db048..290e87d61c671cf7e32be3017cdf38e7368b634f 100644 (file)
@@ -1,5 +1,5 @@
 ################################################################################
-### Copyright (C) 2008-2019 VMware, Inc.  All rights reserved.
+### Copyright (C) 2008-2020 VMware, Inc.  All rights reserved.
 ###
 ### This program is free software; you can redistribute it and/or modify
 ### it under the terms of version 2 of the GNU General Public License as
@@ -70,7 +70,6 @@ libvmtools_la_SOURCES += vmtools.c
 libvmtools_la_SOURCES += vmtoolsConfig.c
 libvmtools_la_SOURCES += vmtoolsLog.c
 libvmtools_la_SOURCES += vmxLogger.c
-libvmtools_la_SOURCES += guestSDKLog.c
 
 # Recompile the stub for Log_* functions, but not Log() itself (see -DNO_LOG_STUB).
 libvmtools_la_SOURCES += $(top_srcdir)/lib/stubs/stub-log.c
index daa09176c05d8984009022737083b4bce58f5750..eed25cc66c72fec6a2f85bf3a92aed1260c9971b 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2010-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2016,2020 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -52,17 +52,5 @@ VMToolsAsprintf(gchar **string,
                 gchar const *format,
                 ...)  PRINTF_DECL(2, 3);
 
-void
-GuestSDK_Debug(const char *fmt, ...);
-
-void
-GuestSDK_Log(const char *fmt, ...);
-
-void
-GuestSDK_Warning(const char *fmt, ...);
-
-void
-GuestSDK_Panic(const char *fmt, ...);
-
 #endif /* _VMTOOLSINT_H_ */
 
index 6b8154408ac27c0271f2c18eba3cd7ad9ea8b7a5..780c0e1e7053d00e4ff9e6ef8c66e48313dd0a0a 100644 (file)
@@ -157,7 +157,6 @@ static guint gDroppedLogCount = 0;
 static gint gMaxCacheEntries = DEFAULT_MAX_CACHE_ENTRIES;
 static gboolean gEnableCoreDump = TRUE;
 static gboolean gLogEnabled = FALSE;
-static gboolean gGuestSDKMode = FALSE;
 static guint gPanicCount = 0;
 static LogHandler *gDefaultData;
 static LogHandler *gErrorData;
@@ -2107,17 +2106,6 @@ VMTools_ResumeLogIO()
 }
 
 
-/**
- * Called if vmtools lib is used along with Guestlib SDK.
- */
-
-void
-VMTools_SetGuestSDKMode(void)
-{
-   gGuestSDKMode = TRUE;
-}
-
-
 /**
  * Logs a message using the G_LOG_LEVEL_DEBUG level.
  *
@@ -2129,16 +2117,12 @@ Debug(const char *fmt, ...)
 {
    va_list args;
    va_start(args, fmt);
-   if (gGuestSDKMode) {
-      GuestSDK_Debug(fmt, args);
-   } else {
-      /*
-       * Preserve errno/lastError.
-       * This keeps compatibility with bora/lib Log(), preventing
-       * Log() calls in bora/lib code from clobbering errno/lastError.
-       */
-      WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_DEBUG, fmt, args));
-   }
+   /*
+    * Preserve errno/lastError.
+    * This keeps compatibility with bora/lib Log(), preventing
+    * Log() calls in bora/lib code from clobbering errno/lastError.
+    */
+   WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_DEBUG, fmt, args));
    va_end(args);
 }
 
@@ -2154,16 +2138,12 @@ Log(const char *fmt, ...)
 {
    va_list args;
    va_start(args, fmt);
-   if (gGuestSDKMode) {
-      GuestSDK_Log(fmt, args);
-   } else {
-      /*
-       * Preserve errno/lastError.
-       * This keeps compatibility with bora/lib Log(), preventing
-       * Log() calls in bora/lib code from clobbering errno/lastError.
-       */
-      WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_INFO, fmt, args));
-   }
+   /*
+    * Preserve errno/lastError.
+    * This keeps compatibility with bora/lib Log(), preventing
+    * Log() calls in bora/lib code from clobbering errno/lastError.
+    */
+    WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_INFO, fmt, args));
    va_end(args);
 }
 
@@ -2240,33 +2220,29 @@ Panic(const char *fmt, ...)
 
    va_start(args, fmt);
 
-   if (gGuestSDKMode) {
-      GuestSDK_Panic(fmt, args);
-   } else {
-      if (gPanicCount == 0) {
-         char *msg = Str_Vasprintf(NULL, fmt, args);
-         if (msg != NULL) {
-            g_log(gLogDomain, G_LOG_LEVEL_ERROR, "%s", msg);
-            free(msg);
-         }
-         /*
-          * In case an user-installed custom handler doesn't panic on error,
-          * force a core dump. Also force a dump in the recursive case.
-          */
-         VMToolsLogPanic();
-      } else if (gPanicCount == 1) {
-         /*
-          * Use a stack allocated string since we're in a recursive panic, so
-          * probably already in a weird state.
-          */
-         gchar msg[1024];
-         Str_Vsnprintf(msg, sizeof msg, fmt, args);
-         fprintf(stderr, "Recursive panic: %s\n", msg);
-         VMToolsLogPanic();
-      } else {
-         fprintf(stderr, "Recursive panic, giving up.\n");
-         exit(-1);
+   if (gPanicCount == 0) {
+      char *msg = Str_Vasprintf(NULL, fmt, args);
+      if (msg != NULL) {
+         g_log(gLogDomain, G_LOG_LEVEL_ERROR, "%s", msg);
+         free(msg);
       }
+      /*
+       * In case an user-installed custom handler doesn't panic on error,
+       * force a core dump. Also force a dump in the recursive case.
+       */
+      VMToolsLogPanic();
+   } else if (gPanicCount == 1) {
+      /*
+       * Use a stack allocated string since we're in a recursive panic, so
+       * probably already in a weird state.
+       */
+      gchar msg[1024];
+      Str_Vsnprintf(msg, sizeof msg, fmt, args);
+      fprintf(stderr, "Recursive panic: %s\n", msg);
+      VMToolsLogPanic();
+   } else {
+      fprintf(stderr, "Recursive panic, giving up.\n");
+      exit(-1);
    }
    va_end(args);
    while (1) ; // avoid compiler warning
@@ -2289,16 +2265,12 @@ Warning(const char *fmt, ...)
 {
    va_list args;
    va_start(args, fmt);
-   if (gGuestSDKMode) {
-      GuestSDK_Warning(fmt, args);
-   } else {
-      /*
-       * Preserve errno/lastError.
-       * This keeps compatibility with bora/lib Log(), preventing
-       * Log() calls in bora/lib code from clobbering errno/lastError.
-       */
-      WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_WARNING, fmt, args));
-   }
+   /*
+    * Preserve errno/lastError.
+    * This keeps compatibility with bora/lib Log(), preventing
+    * Log() calls in bora/lib code from clobbering errno/lastError.
+    */
+   WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_WARNING, fmt, args));
    va_end(args);
 }
 
@@ -2357,12 +2329,8 @@ WarningToHost(const char *fmt, ...)
 {
    va_list args;
    va_start(args, fmt);
-   if (gGuestSDKMode) {
-      GuestSDK_Warning(fmt, args);
-   } else {
-      WITH_ERRNO(err,
-         VmwareLogWrapper(TO_HOST, G_LOG_LEVEL_WARNING, fmt, args));
-   }
+   WITH_ERRNO(err,
+      VmwareLogWrapper(TO_HOST, G_LOG_LEVEL_WARNING, fmt, args));
    va_end(args);
 }
 
@@ -2383,12 +2351,8 @@ WarningToGuest(const char *fmt, ...)
 {
    va_list args;
    va_start(args, fmt);
-   if (gGuestSDKMode) {
-      GuestSDK_Warning(fmt, args);
-   } else {
-      WITH_ERRNO(err,
-         VmwareLogWrapper(IN_GUEST, G_LOG_LEVEL_WARNING, fmt, args));
-   }
+   WITH_ERRNO(err,
+      VmwareLogWrapper(IN_GUEST, G_LOG_LEVEL_WARNING, fmt, args));
    va_end(args);
 }