From: VMware, Inc <> Date: Tue, 19 Oct 2010 18:47:51 +0000 (-0700) Subject: guest info: use common log domain. X-Git-Tag: 2010.10.18-313025~71 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cd0e17b119cf9ff9648527b1cbcd033a128a94b1;p=thirdparty%2Fopen-vm-tools.git guest info: use common log domain. 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 --- diff --git a/open-vm-tools/services/plugins/guestInfo/getlib/guestInfoInt.h b/open-vm-tools/services/plugins/guestInfo/getlib/getlibInt.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 b79274d1d..1422194c1 100644 --- a/open-vm-tools/services/plugins/guestInfo/getlib/guestInfoInt.h +++ b/open-vm-tools/services/plugins/guestInfo/getlib/getlibInt.h @@ -18,19 +18,16 @@ /* - * 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 // 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 diff --git a/open-vm-tools/services/plugins/guestInfo/getlib/guestInfo.c b/open-vm-tools/services/plugins/guestInfo/getlib/guestInfo.c index b263a5a0b..8bf69af1a 100644 --- a/open-vm-tools/services/plugins/guestInfo/getlib/guestInfo.c +++ b/open-vm-tools/services/plugins/guestInfo/getlib/guestInfo.c @@ -24,7 +24,6 @@ #include #include -#include #if defined _WIN32 # include @@ -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; } diff --git a/open-vm-tools/services/plugins/guestInfo/getlib/guestInfoPosix.c b/open-vm-tools/services/plugins/guestInfo/getlib/guestInfoPosix.c index 8ae4150d3..cd7dfe565 100644 --- a/open-vm-tools/services/plugins/guestInfo/getlib/guestInfoPosix.c +++ b/open-vm-tools/services/plugins/guestInfo/getlib/guestInfoPosix.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #ifdef sun # include @@ -100,7 +99,7 @@ #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; } diff --git a/open-vm-tools/services/plugins/guestInfo/guestInfoInt.h b/open-vm-tools/services/plugins/guestInfo/guestInfoInt.h index 8b2ac113b..6f9cd6684 100644 --- a/open-vm-tools/services/plugins/guestInfo/guestInfoInt.h +++ b/open-vm-tools/services/plugins/guestInfo/guestInfoInt.h @@ -16,17 +16,24 @@ * *********************************************************/ +#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 + +#include "guestInfoLib.h" extern int guestInfoPollInterval; Bool GuestInfo_PerfMon(struct GuestMemInfo *vmStats); +#endif /* _GUESTINFOINT_H_ */ +