From: VMware, Inc <> Date: Wed, 18 Sep 2013 03:17:19 +0000 (-0700) Subject: HGFS: Clean up server packet abstraction part VII X-Git-Tag: 2013.09.16-1328054~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffb568be68fae5f318b09fdf4b60da84a180f20e;p=thirdparty%2Fopen-vm-tools.git HGFS: Clean up server packet abstraction part VII Consolidate the HgfsPacket bool fields into a flags field. Make the names of the bool fields more accurate too in some cases. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c index fc34c277d..ebe09f3b6 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c @@ -3254,10 +3254,11 @@ HgfsServerSessionReceive(HgfsPacket *packet, // IN: Hgfs Packet (handlers[input->op].handler != NULL) && (input->requestSize >= handlers[input->op].minReqSize)) { /* Initial validation passed, process the client request now. */ - packet->processedAsync = (handlers[input->op].reqType == REQ_ASYNC) && - (transportSession->channelCapabilities.flags & HGFS_CHANNEL_ASYNC); - ; - if (packet->processedAsync) { + if ((handlers[input->op].reqType == REQ_ASYNC) && + (transportSession->channelCapabilities.flags & HGFS_CHANNEL_ASYNC)) { + packet->state |= HGFS_STATE_ASYNC_REQUEST; + } + if (0 != (packet->state & HGFS_STATE_ASYNC_REQUEST)) { LOG(4, ("%s: %d: @@Async\n", __FUNCTION__, __LINE__)); #ifndef VMX86_TOOLS /* @@ -4463,7 +4464,7 @@ HgfsServerSessionSendComplete(HgfsPacket *packet, // IN/OUT: Hgfs packet { HgfsTransportSessionInfo *transportSession = clientData; - if (packet->guestInitiated) { + if (0 != (packet->state & HGFS_STATE_CLIENT_REQUEST)) { HSPU_PutMetaPacket(packet, transportSession->channelCbTable); HSPU_PutReplyPacket(packet, transportSession->channelCbTable); HSPU_PutDataPacketBuf(packet, transportSession->channelCbTable); @@ -4575,7 +4576,8 @@ HgfsPacketSend(HgfsPacket *packet, // IN/OUT: Hgfs Packet HgfsSendFlags flags) // IN: flags for how to process { Bool result = FALSE; - Bool notificationNeeded = packet->guestInitiated && packet->processedAsync; + Bool notificationNeeded = (0 != (packet->state & HGFS_STATE_CLIENT_REQUEST) && + 0 != (packet->state & HGFS_STATE_ASYNC_REQUEST)); ASSERT(packet); ASSERT(transportSession); @@ -8396,7 +8398,7 @@ HgfsServerDirWatchEvent(HgfsSharedFolderHandle sharedFolder, // IN: shared folde packetHeader = Util_SafeCalloc(1, sizeNeeded); packet = Util_SafeCalloc(1, sizeof *packet); - packet->guestInitiated = FALSE; + packet->state &= ~HGFS_STATE_CLIENT_REQUEST; packet->metaPacketSize = sizeNeeded; packet->metaPacket = packetHeader; packet->dataPacketIsAllocated = TRUE; diff --git a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c index ce49573d1..fd3d0445e 100644 --- a/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c +++ b/open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c @@ -488,8 +488,7 @@ HgfsChannelGuestReceiveInternal(HgfsGuestConn *connData, // IN: connection packet.metaPacketSize = packetInSize; packet.replyPacket = packetOut; packet.replyPacketSize = *packetOutSize; - /* Misnomer to be fixed, guestInitiated really means client initiated */ - packet.guestInitiated = TRUE; + packet.state |= HGFS_STATE_CLIENT_REQUEST; /* The server will perform a synchronous processing of requests. */ connData->serverCbTable->receive(&packet, connData->serverSession); diff --git a/open-vm-tools/lib/include/hgfsServer.h b/open-vm-tools/lib/include/hgfsServer.h index 0786e133c..a1c3510e6 100644 --- a/open-vm-tools/lib/include/hgfsServer.h +++ b/open-vm-tools/lib/include/hgfsServer.h @@ -49,15 +49,14 @@ typedef enum { BUF_READWRITEABLE, /* Establish read-writeable mappings */ } MappingType; +typedef uint64 HgfsStateFlags; +#define HGFS_STATE_CLIENT_REQUEST (1 << 0) +#define HGFS_STATE_ASYNC_REQUEST (1 << 1) typedef struct HgfsPacket { uint64 id; - /* Does transport need to send Async reply ? */ - Bool processedAsync; - - /* Is the packet guest initiated ? */ - Bool guestInitiated; + HgfsStateFlags state; /* For metapacket we always establish writeable mappings */ void *metaPacket;