From: VMware, Inc <> Date: Wed, 18 Sep 2013 03:11:25 +0000 (-0700) Subject: HGFS: Clean up the VMCI transport request and reply headers part I X-Git-Tag: 2013.09.16-1328054~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=065f236104ab12a89cd4b2e73597aeba203e0e0b;p=thirdparty%2Fopen-vm-tools.git HGFS: Clean up the VMCI transport request and reply headers part I This is the first part of cleaning up the HGFS VMCI transport request and reply headers. This deals with the reply header only which is almost identical to the client request VMCI header but not quite - frustratingly. It really is not ideal to use a reply header that is different from the request header and has fields that require corresponding information from the request header which are missing. Consequently, the request header is going to be ramped up to a version 2 which includes all the information for both request and reply and be extensible. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/include/hgfsTransport.h b/open-vm-tools/lib/include/hgfsTransport.h index 896ddda91..223c3bc1b 100644 --- a/open-vm-tools/lib/include/hgfsTransport.h +++ b/open-vm-tools/lib/include/hgfsTransport.h @@ -57,13 +57,13 @@ typedef enum { HGFS_ASYNC_IOREQ_SHMEM, HGFS_ASYNC_IOREQ_GET_PAGES, HGFS_ASYNC_IOREP, -} HgfsAsyncReplyFlags; +} HgfsTransportReplyType; typedef enum { HGFS_TH_REP_GET_PAGES, HGFS_TH_REQUEST, HGFS_TH_TERMINATE_SESSION, -} HgfsTransportPacketType; +} HgfsTransportRequestType; #define HGFS_VMCI_TRANSPORT_ERROR (VMCI_ERROR_CLIENT_MIN - 1) #define HGFS_VMCI_VERSION_MISMATCH (VMCI_ERROR_CLIENT_MIN - 2) @@ -115,7 +115,10 @@ typedef #include "vmware_pack_begin.h" struct HgfsVmciHeaderNode { uint32 version; /* Version number */ - HgfsTransportPacketType pktType; /* Type of packet */ + union { + HgfsTransportRequestType pktType; /* Type of packet for client to server */ + HgfsTransportReplyType replyType; /* Type of packet for server to client */ + }; } #include "vmware_pack_end.h" HgfsVmciHeaderNode; @@ -169,8 +172,7 @@ HgfsVmciAsyncShmem; typedef #include "vmware_pack_begin.h" struct HgfsVmciAsyncReply { - uint32 version; - HgfsAsyncReplyFlags pktType; + HgfsVmciHeaderNode node; /* Node: version, type etc. */ union { HgfsVmciAsyncResponse response; HgfsVmciAsyncShmem shmem; diff --git a/open-vm-tools/modules/linux/vmhgfs/vmci.c b/open-vm-tools/modules/linux/vmhgfs/vmci.c index 38fa09fc1..027fec775 100644 --- a/open-vm-tools/modules/linux/vmhgfs/vmci.c +++ b/open-vm-tools/modules/linux/vmhgfs/vmci.c @@ -379,15 +379,16 @@ static int HgfsVmciChannelCallback(void *data, // IN: unused VMCIDatagram *dg) // IN: datagram { HgfsVmciAsyncReply *reply = (HgfsVmciAsyncReply *)VMCI_DG_PAYLOAD(dg); + HgfsVmciHeaderNode *replyNode = &reply->node; HgfsTransportChannel *channel; LOG(10, (KERN_WARNING "Received VMCI channel Callback \n")); - if (reply->version != HGFS_VMCI_VERSION_1) { + if (replyNode->version != HGFS_VMCI_VERSION_1) { return HGFS_VMCI_VERSION_MISMATCH; } - switch (reply->pktType) { + switch (replyNode->pktType) { case HGFS_ASYNC_IOREP: LOG(10, (KERN_WARNING "Received ID%"FMT64"x \n", reply->response.id));