From: VMware, Inc <> Date: Mon, 20 Sep 2010 18:03:49 +0000 (-0700) Subject: Backing out all the stuff related Hgfs Over VMCI. X-Git-Tag: stable-8.6.0~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=08bc05699fc4b79d6671b34ae33ab50cbf9d149f;p=thirdparty%2Fopen-vm-tools.git Backing out all the stuff related Hgfs Over VMCI. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/modules/freebsd/vmhgfs/channel.h b/open-vm-tools/modules/freebsd/vmhgfs/channel.h index d31b30443..b568680da 100644 --- a/open-vm-tools/modules/freebsd/vmhgfs/channel.h +++ b/open-vm-tools/modules/freebsd/vmhgfs/channel.h @@ -54,7 +54,6 @@ typedef struct HgfsTransportChannel { void HgfsGetBdChannel(HgfsTransportChannel *channel); void HgfsGetVmciChannel(HgfsTransportChannel *channel); -Bool HgfsSetupNewChannel(void); extern HgfsTransportChannel *gHgfsChannel; #endif // _HGFS_CHANNEL_H_ diff --git a/open-vm-tools/modules/freebsd/vmhgfs/request.c b/open-vm-tools/modules/freebsd/vmhgfs/request.c index f3caae5bf..3769693b1 100644 --- a/open-vm-tools/modules/freebsd/vmhgfs/request.c +++ b/open-vm-tools/modules/freebsd/vmhgfs/request.c @@ -30,7 +30,6 @@ #include "hgfs_kernel.h" #include "requestInt.h" -#include "channel.h" /* * Macros @@ -387,26 +386,6 @@ HgfsKReq_AllocateRequest(HgfsKReqContainerHandle container) // IN ASSERT(container); - /* - * We may not have any channel currently. It so, try to - * establish channel once again. Most likely we will fail - * because user has probably disabled shared folders. This - * check is useful when user enables shared folders and they - * tries some operation. During that, we will come across this - * code path and user will be magically able to access stuff - * on host. - * - * Note that trying to establish new channel on send() path is - * broken because every channel has specific allocator function. - * Trying to allocate from one channel and then sending over - * another channel is sure asking for trouble. Don't do that. - */ - if (gHgfsChannel->status != HGFS_CHANNEL_CONNECTED) { - if (!HgfsSetupNewChannel()) { - return NULL; - } - } - req = os_zone_alloc(hgfsKReqZone, M_WAITOK); if (!req) { return NULL; diff --git a/open-vm-tools/modules/freebsd/vmhgfs/worker.c b/open-vm-tools/modules/freebsd/vmhgfs/worker.c index 81928f6bc..0cbd67836 100644 --- a/open-vm-tools/modules/freebsd/vmhgfs/worker.c +++ b/open-vm-tools/modules/freebsd/vmhgfs/worker.c @@ -49,7 +49,6 @@ HgfsKReqWState hgfsKReqWorkerState; /* Global pointer that handles channel abstraction */ HgfsTransportChannel *gHgfsChannel = NULL; -OS_MUTEX_T *gHgfsChannelLock = NULL; /* @@ -72,18 +71,11 @@ OS_MUTEX_T *gHgfsChannelLock = NULL; *---------------------------------------------------------------------- */ -Bool +static Bool HgfsSetupNewChannel(void) { Bool ret; - os_mutex_lock(gHgfsChannelLock); - - if (gHgfsChannel->status == HGFS_CHANNEL_CONNECTED) { - ret = TRUE; - goto exit; - } - HgfsGetVmciChannel(gHgfsChannel); if (gHgfsChannel->ops.open != NULL) { if ((ret = gHgfsChannel->ops.open(gHgfsChannel))) { @@ -100,16 +92,10 @@ HgfsSetupNewChannel(void) exit: if (ret) { gHgfsChannel->status = HGFS_CHANNEL_CONNECTED; - } else { - gHgfsChannel->status = HGFS_CHANNEL_NOTCONNECTED; } - - os_mutex_unlock(gHgfsChannelLock); - return ret; } - /* *----------------------------------------------------------------------------- * @@ -142,14 +128,10 @@ HgfsKReqWorker(void *arg) goto exit; } - gHgfsChannelLock = os_mutex_alloc_init(HGFS_FS_NAME "_channellck"); - if (!gHgfsChannelLock) { - goto exit; - } - ret = HgfsSetupNewChannel(); if (!ret) { - DEBUG(VM_DEBUG_INFO, "VMware hgfs: %s: ohoh no channel yet.\n", __func__); + DEBUG(VM_DEBUG_INFO, "VMware hgfs: %s: ohoh no channel.\n", __func__); + goto exit; } for (;;) { @@ -196,11 +178,13 @@ HgfsKReqWorker(void *arg) switch (req->state) { case HGFS_REQ_SUBMITTED: if (gHgfsChannel->status != HGFS_CHANNEL_CONNECTED) { - req->state = HGFS_REQ_ERROR; - os_cv_signal(&req->stateCv); - os_mutex_unlock(req->stateLock); - os_mutex_unlock(hgfsKReqWorkItemLock); - goto done; + if (!HgfsSetupNewChannel()) { + req->state = HGFS_REQ_ERROR; + os_cv_signal(&req->stateCv); + os_mutex_unlock(req->stateLock); + os_mutex_unlock(hgfsKReqWorkItemLock); + goto done; + } } break; case HGFS_REQ_ABANDONED: @@ -227,9 +211,7 @@ HgfsKReqWorker(void *arg) * now. We do this because subsequent requests deserve a chance to * reopen it. */ - os_mutex_lock(gHgfsChannelLock); gHgfsChannel->ops.close(gHgfsChannel); - os_mutex_unlock(gHgfsChannelLock); } done: @@ -266,15 +248,9 @@ done: ws->running = FALSE; - if (gHgfsChannel->status == HGFS_CHANNEL_CONNECTED) { - gHgfsChannel->ops.close(gHgfsChannel); - } + gHgfsChannel->ops.close(gHgfsChannel); exit: - if (gHgfsChannelLock) { - os_mutex_free(gHgfsChannelLock); - } - if (gHgfsChannel) { os_free(gHgfsChannel, sizeof (*gHgfsChannel)); }