]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Hgfs VMCI Transport: Part I fix the shared memory interface to not assert
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:29 +0000 (11:23 -0700)
THe HGFS VMCI transport uses the shared memory access functions to extract
HGFS protocol packets for the HGFS server processing and for returning results.
This interface recently changed to add thread tracking for these operations with
the addition of register and unregister functions.

The HGFS transport interface was missed on the initial change and hence now triggers
an assert as the register function call has not been made.

This is the first part of a change which addresses the assertion failure by adding the
register and unregister calls for the HGFS VMCI transport interface which uses this
shared memory.
The calls are part of a set of callbacks provided by the supported transports to the
HGFS server code for the VMX and tools. Since the backdoor transport does not make
use of the shared memory and access calls it just sets the function callbacks to NULL.
This is done for both the VMX backdoor channel and tools backdoor channel for packets
routed into the HGFS server.

This change does the following:
- Adds the register and unregister callbacks to the channel callback table.
- Modified the VMX VMCI channel to add the register and unregister callbacks and initialize
the callback table with these new functions which are then passed to the HGFS server.
- Modified the VMX and tools backdoor channels to NULL out the function pointers for the
register and unregister callback functions.
- Add the Hgfs server directory notification callbacks for register and unregister which are
termporarily protected by  ifdef statements as they are not yet called from the directory
notification component. These simply callback to the channel register and unregister functions
to do the real work if present for the channel in use. (Only VMCI will use this.)

open-vm-tools/lib/hgfsServer/hgfsServer.c
open-vm-tools/lib/hgfsServerManagerGuest/hgfsChannelGuestBd.c
open-vm-tools/lib/include/hgfsServer.h

index 214fa42b9cb8e0c941c0ca3da03041f64cdfc4d3..33d7ec52f552b4e6c8b307244ee21cd9f721f670 100644 (file)
@@ -8887,6 +8887,74 @@ HgfsServerGetTargetRelativePath(const char* source,    // IN: source file name
 }
 
 
+#ifdef HGFS_NOTIFY_THREAD_REGISTER_SUPPORTED
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * HgfsServerNotifyRegisterThreadCb --
+ *
+ *    The callback is invoked by the file system change notification component
+ *    thread for generating change notification events.
+ *    This simply calls back to the channel's register thread function, if present,
+ *    which does the actual work.
+ *
+ * Results:
+ *    None.
+ *
+ * Side effects:
+ *    None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static void
+HgfsServerNotifyRegisterThreadCb(struct HgfsSessionInfo *session)     // IN: session info
+{
+   HgfsTransportSessionInfo *transportSession;
+
+   ASSERT(session);
+   transportSession = session->transportSession;
+
+   if (transportSession->channelCbTable->registerThread != NULL) {
+      transportSession->channelCbTable->registerThread();
+   }
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * HgfsServerNotifyUnregisterThreadCb --
+ *
+ *    The callback is invoked by the file system change notification component
+ *    thread for generating change notification events.
+ *    This simply calls back to the channel's unregister thread function, if present,
+ *    which does the actual work.
+ *
+ * Results:
+ *    None.
+ *
+ * Side effects:
+ *    None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static void
+HgfsServerNotifyUnregisterThreadCb(struct HgfsSessionInfo *session)     // IN: session info
+{
+   HgfsTransportSessionInfo *transportSession;
+
+   ASSERT(session);
+   transportSession = session->transportSession;
+
+   if (transportSession->channelCbTable->unregisterThread != NULL) {
+      transportSession->channelCbTable->unregisterThread();
+   }
+}
+#endif // HGFS_NOTIFY_THREAD_REGISTER_SUPPORTED
+
+
 /*
  *-----------------------------------------------------------------------------
  *
index 93579602d14bef9388ff8eb3dcfb0fdd8951789f..601d3e9a4567bf73a846294d6cc12ba84b6776ea 100644 (file)
@@ -348,6 +348,8 @@ HgfsChannelGuestConnConnect(HgfsGuestConn *connData)  // IN: our connection data
       HGFS_LARGE_PACKET_MAX
    };
 
+   connData->channelCbTable.registerThread = NULL;
+   connData->channelCbTable.unregisterThread = NULL;
    connData->channelCbTable.getWriteVa = NULL;
    connData->channelCbTable.getReadVa = NULL;
    connData->channelCbTable.putVa = NULL;
index abf69c64a5b0d01aa9f6064e9b1cc972a8f3d617..4901c255befd2ca0430755d5c44b25ea94557857 100644 (file)
@@ -175,12 +175,16 @@ typedef Bool (*HgfsChannelSendFunc)(void *opaqueSession,
                                     HgfsSendFlags flags);
 typedef void * (*HgfsChannelMapVirtAddrFunc)(uint64 pa, uint32 size, void **context);
 typedef void (*HgfsChannelUnmapVirtAddrFunc)(void **context);
+typedef void (*HgfsChannelRegisterThreadFunc)(void);
+typedef void (*HgfsChannelUnregisterThreadFunc)(void);
 
 typedef struct HgfsServerChannelCallbacks {
-    HgfsChannelMapVirtAddrFunc getReadVa;
-    HgfsChannelMapVirtAddrFunc getWriteVa;
-    HgfsChannelUnmapVirtAddrFunc putVa;
-    HgfsChannelSendFunc send;
+   HgfsChannelRegisterThreadFunc registerThread;
+   HgfsChannelUnregisterThreadFunc unregisterThread;
+   HgfsChannelMapVirtAddrFunc getReadVa;
+   HgfsChannelMapVirtAddrFunc getWriteVa;
+   HgfsChannelUnmapVirtAddrFunc putVa;
+   HgfsChannelSendFunc send;
 }HgfsServerChannelCallbacks;
 
 typedef struct HgfsServerSessionCallbacks {