]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
guest info: use common log domain.
authorVMware, Inc <>
Tue, 19 Oct 2010 18:47:51 +0000 (11:47 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 19 Oct 2010 18:47:51 +0000 (11:47 -0700)
Modify the log calls in the guest info plugin to use the glib functions,
and make sure G_LOG_DOMAIN is set appropriately everywhere by including
the shared header file where it's defined.

The duplicate guestInfoInt.h header was renamed to getlibInt.h, and a
couple of things in it were cleaned up in the process.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/services/plugins/guestInfo/getlib/getlibInt.h [moved from open-vm-tools/services/plugins/guestInfo/getlib/guestInfoInt.h with 90% similarity]
open-vm-tools/services/plugins/guestInfo/getlib/guestInfo.c
open-vm-tools/services/plugins/guestInfo/getlib/guestInfoPosix.c
open-vm-tools/services/plugins/guestInfo/guestInfoInt.h

similarity index 90%
rename from open-vm-tools/services/plugins/guestInfo/getlib/guestInfoInt.h
rename to open-vm-tools/services/plugins/guestInfo/getlib/getlibInt.h
index b79274d1d1566b3adeb45c0fa60ddf5568c986d9..1422194c1956daf4d5cd3c88cc600496fdffbb6c 100644 (file)
 
 
 /*
- * guestInfoInt.h --
+ * getlibInt.h --
  *
  *    Functions used to communicate guest information to the host.
  *
  */
 
-#ifndef GUEST_INFO_INT_H
-#define GUEST_INFO_INT_H
+#ifndef GETLIB_INT_H
+#define GETLIB_INT_H
 
-
-#include "guestInfo.h"
-#include "guestInfoLib.h"
-#include "guestrpc/nicinfo.h"
+#include "guestInfoInt.h"
 
 #if defined __FreeBSD__ || defined __sun__ || defined __APPLE__
 #   include <sys/socket.h>      // struct sockaddr
@@ -39,8 +36,6 @@
 Bool GuestInfoGetFqdn(int outBufLen, char fqdn[]);
 GuestDiskInfo *GuestInfoGetDiskInfoWiper(void);
 Bool GuestInfoGetNicInfo(NicInfoV3 *nicInfo);
-void GuestInfoMemset(void * mem, int value, unsigned int size);
-Bool GuestInfo_PerfMon(struct GuestMemInfo *vmStats);
 
 GuestNicV3 *GuestInfoAddNicEntry(NicInfoV3 *nicInfo,                    // IN/OUT
                                  const char macAddress[NICINFO_MAC_LEN], // IN
index b263a5a0b2619c1772e075a29bbfe7e5adaa2dc1..8bf69af1a46ed3a8a6a75887a0be7aac6441246e 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <glib.h>
 
 #if defined _WIN32
 #   include <ws2tcpip.h>
@@ -32,7 +31,7 @@
 
 #include "vm_assert.h"
 #include "debug.h"
-#include "guestInfoInt.h"
+#include "getlibInt.h"
 #include "str.h"
 #include "util.h"
 #include "xdrutil.h"
@@ -190,7 +189,7 @@ GuestInfoGetDiskInfoWiper(void)
 
    /* Get partition list. */
    if (!WiperPartition_Open(&pl)) {
-      Debug("GetDiskInfo: ERROR: could not get partition list\n");
+      g_debug("GetDiskInfo: ERROR: could not get partition list\n");
       return FALSE;
    }
 
@@ -207,13 +206,13 @@ GuestInfoGetDiskInfoWiper(void)
 
          error = WiperSinglePartition_GetSpace(part, &freeBytes, &totalBytes);
          if (strlen(error)) {
-            Debug("GetDiskInfo: ERROR: could not get space for partition %s: %s\n",
-                  part->mountPoint, error);
+            g_debug("GetDiskInfo: ERROR: could not get space for partition %s: %s\n",
+                    part->mountPoint, error);
             goto out;
          }
 
          if (strlen(part->mountPoint) + 1 > partNameSize) {
-            Debug("GetDiskInfo: ERROR: Partition name buffer too small\n");
+            g_debug("GetDiskInfo: ERROR: Partition name buffer too small\n");
             goto out;
          }
 
index 8ae4150d38e519d2090d55fb44b80f2ab68d4f40..cd7dfe5659b6ae4d69f36e643bf22bd030c41a4d 100644 (file)
@@ -25,7 +25,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <glib.h>
 #include <fcntl.h>
 #ifdef sun
 # include <sys/systeminfo.h>
 #include "sys/ioctl.h"
 #include "vmware.h"
 #include "hostinfo.h"
-#include "guestInfoInt.h"
+#include "getlibInt.h"
 #include "debug.h"
 #include "str.h"
 #include "guest_os.h"
@@ -143,7 +142,7 @@ GuestInfoGetFqdn(int outBufLen,    // IN: length of output buffer
 {
    ASSERT(fqdn);
    if (gethostname(fqdn, outBufLen) < 0) {
-      Debug("Error, gethostname failed\n");
+      g_debug("Error, gethostname failed\n");
       return FALSE;
    }
 
@@ -168,13 +167,13 @@ GuestInfoGetNicInfo(NicInfoV3 *nicInfo) // OUT
 
    /* Get a handle to read the network interface configuration details. */
    if ((intf = intf_open()) == NULL) {
-      Debug("GuestInfo: Error, failed NULL result from intf_open()\n");
+      g_debug("Error, failed NULL result from intf_open()\n");
       return FALSE;
    }
 
    if (intf_loop(intf, ReadInterfaceDetails, nicInfo) < 0) {
       intf_close(intf);
-      Debug("GuestInfo: Error, negative result from intf_loop\n");
+      g_debug("Error, negative result from intf_loop\n");
       return FALSE;
    }
 
@@ -414,7 +413,7 @@ RecordResolverNS(DnsConfigInfo *dnsConfigInfo) // IN
       union res_sockaddr_union *ns;
       ns = Util_SafeCalloc(_res.nscount, sizeof *ns);
       if (res_getservers(&_res, ns, _res.nscount) != _res.nscount) {
-         Warning("%s: res_getservers failed.\n", __func__);
+         g_warning("%s: res_getservers failed.\n", __func__);
          return;
       }
       for (i = 0; i < _res.nscount; i++) {
@@ -687,12 +686,12 @@ RecordRoutingInfo(NicInfoV3 *nicInfo)
    Bool ret = TRUE;
 
    if (File_Exists("/proc/net/route") && !RecordRoutingInfoIPv4(nicInfo)) {
-      Warning("%s: Unable to collect IPv4 routing table.\n", __func__);
+      g_warning("%s: Unable to collect IPv4 routing table.\n", __func__);
       ret = FALSE;
    }
 
    if (File_Exists("/proc/net/ipv6_route") && !RecordRoutingInfoIPv6(nicInfo)) {
-      Warning("%s: Unable to collect IPv6 routing table.\n", __func__);
+      g_warning("%s: Unable to collect IPv6 routing table.\n", __func__);
       ret = FALSE;
    }
 
index 8b2ac113bca3936a8ccea5824650dd673211d1b6..6f9cd6684107834d4adecb8bce1f5f372e5f4a0f 100644 (file)
  *
  *********************************************************/
 
+#ifndef _GUESTINFOINT_H_
+#define _GUESTINFOINT_H_
+
 /**
  * @file guestInfoInt.h
  *
  * Declares internal functions of the guestInfo plugin.
  */
 
-#include "guestInfoLib.h"
 #define G_LOG_DOMAIN "guestinfo"
+#include <glib.h>
+
+#include "guestInfoLib.h"
 
 extern int guestInfoPollInterval;
 
 Bool
 GuestInfo_PerfMon(struct GuestMemInfo *vmStats);
 
+#endif /* _GUESTINFOINT_H_ */
+