From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:30 +0000 (-0700) Subject: Tools Hgfs Transport Logging: Migrate the to common tools conf logging X-Git-Tag: stable-10.2.0~299 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c02d20001fbfd06558891fe5cf87c9aae33765cb;p=thirdparty%2Fopen-vm-tools.git Tools Hgfs Transport Logging: Migrate the to common tools conf logging Migrate the tools implementations of the HGFS policy, server manager and transport channels to use the common tools conf logging with the "hgfsd" domain setting. This allows the HGFS server core and the server managerand transport components to be independently logged. Changes are: - Move the logging definitions into the server manager lib common header - Add some log statements into the server manager public APIs - Redefine the policy manager (share handling) logging to the general tools logging. --- diff --git a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuest.c b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuest.c index 0b709d7f6..baf2c0ae8 100644 --- a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuest.c +++ b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuest.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2010-2017 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 @@ -28,16 +28,6 @@ #include "vm_assert.h" #include "vm_atomic.h" #include "util.h" -#if defined(VMTOOLS_USE_GLIB) -#define G_LOG_DOMAIN "hgfsd" -#define Debug g_debug -#define Warning g_warning -#include "vmware/tools/guestrpc.h" -#include "vmware/tools/utils.h" -// #include -#else -#include "debug.h" -#endif #include "hgfsChannelGuestInt.h" #include "hgfsServer.h" #include "hgfsServerManager.h" diff --git a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c index 601d3e9a4..a9399f51c 100644 --- a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c +++ b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2010-2017 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 @@ -28,7 +28,6 @@ #include "vm_assert.h" #include "vm_atomic.h" #include "util.h" -#include "debug.h" #include "hgfsChannelGuestInt.h" #include "hgfsServer.h" #include "hgfsServerManager.h" diff --git a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestInt.h b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestInt.h index b47235cb9..6bf9a8a43 100644 --- a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestInt.h +++ b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestInt.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2009-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2009-2017 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 @@ -19,6 +19,13 @@ #ifndef _HGFSCHANNELGUESTINT_H_ #define _HGFSCHANNELGUESTINT_H_ +#if defined(VMTOOLS_USE_GLIB) +#define G_LOG_DOMAIN "hgfsd" +#define Debug g_debug +#define Warning g_warning +#else +#include "debug.h" +#endif #include "hgfsServer.h" #include "hgfsServerManager.h" diff --git a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsServerManagerGuest.c b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsServerManagerGuest.c index 029222877..033614e2d 100644 --- a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsServerManagerGuest.c +++ b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsServerManagerGuest.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2006,2014-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2006,2014-2017 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 @@ -66,6 +66,7 @@ Bool HgfsServerManager_ProcessPacket(HgfsServerMgrData *mgrData, // IN: hgfs mg char *packetOut, // OUT: rep size_t *packetOutSize) // IN/OUT: rep buf/data size { + Debug("%s: Processing Packet for %s.\n", __FUNCTION__, mgrData->appName); /* Pass to the channel to handle processing and the server. */ return HgfsChannelGuest_Receive(mgrData, packetIn, @@ -98,6 +99,8 @@ HgfsServerManager_Register(HgfsServerMgrData *data) // IN: RpcIn channel ASSERT(data); ASSERT(data->appName); + Debug("%s: Register %s.\n", __FUNCTION__, data->appName); + /* * Passing NULL here is safe because the shares maintained by the guest * policy server never change, invalidating the need for an invalidate @@ -141,6 +144,8 @@ HgfsServerManager_InvalidateInactiveSessions(HgfsServerMgrData *mgrData) // IN: { ASSERT(mgrData); + Debug("%s: Invalidate Inactive Sessions for %s.\n", __FUNCTION__, + mgrData->appName); return HgfsChannelGuest_InvalidateInactiveSessions(mgrData); } @@ -165,10 +170,11 @@ void HgfsServerManager_Unregister(HgfsServerMgrData *data) // IN: RpcIn channel { - ASSERT(data); ASSERT(data->appName != NULL); + Debug("%s: Unregister %s.\n", __FUNCTION__, data->appName); + HgfsChannelGuest_Exit(data); HgfsServerPolicy_Cleanup(); memset(&gHgfsServerManagerGuestData, 0, sizeof gHgfsServerManagerGuestData); diff --git a/open-vm-tools/lib/hgfsServerPolicyGuest/hgfsServerPolicyGuest.c b/open-vm-tools/lib/hgfsServerPolicyGuest/hgfsServerPolicyGuest.c index 2fe3fdd7b..c9ddde907 100644 --- a/open-vm-tools/lib/hgfsServerPolicyGuest/hgfsServerPolicyGuest.c +++ b/open-vm-tools/lib/hgfsServerPolicyGuest/hgfsServerPolicyGuest.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2016 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2017 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,15 +30,34 @@ # include #endif +#undef LOG + +#define LGLEVEL (10) +#define LGPFX_FMT "%s:%s:" +#define LGPFX "hgfsd" + +#if defined VMTOOLS_USE_GLIB +#define G_LOG_DOMAIN LGPFX +#define Debug g_debug +#define Warning g_warning +#else +#include "debug.h" +#endif + +#define DOLOG(_min) ((_min) <= LGLEVEL) + +#define LOG(_level, args) \ + do { \ + if (DOLOG(_level)) { \ + Debug(LGPFX_FMT, LGPFX, __FUNCTION__); \ + Debug args; \ + } \ + } while (0) + + #include "vmware.h" #include "hgfsServerPolicy.h" -/* - * XXX: Transitioning over to the general tools logging mechanism. - */ -#undef LOG -#define LOG(level, args) - typedef struct HgfsServerPolicyState { /*