]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
HGFS: Clean up the VMCI transport request and reply headers part I
authorVMware, Inc <>
Wed, 18 Sep 2013 03:11:25 +0000 (20:11 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 21 Sep 2013 22:55:50 +0000 (15:55 -0700)
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 <dtor@vmware.com>
open-vm-tools/lib/include/hgfsTransport.h
open-vm-tools/modules/linux/vmhgfs/vmci.c

index 896ddda91c8923fa8b0063625f3174a345bcae74..223c3bc1b4c3eca88f21e92b5dcc8c658d605bf1 100644 (file)
@@ -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;
index 38fa09fc1a64bae9257b8f58cc750e074bcc2c79..027fec77586bbdfd6bf60de0db7ac3e858b19fee 100644 (file)
@@ -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));