*
* HgfsNotify_Init --
*
- * One time initialization of the library.
+ * Initialization for the notification component.
*
* Results:
* Invalid value error.
/*
*-----------------------------------------------------------------------------
*
- * HgfsNotify_Shutdown --
+ * HgfsNotify_Exit --
*
- * Performs nesessary cleanup.
+ * Exit for the notification component.
*
* Results:
* None.
*/
void
-HgfsNotify_Shutdown(void)
+HgfsNotify_Exit(void)
{
}
/*
*-----------------------------------------------------------------------------
*
- * HgfsNotify_Suspend --
+ * HgfsNotify_Deactivate --
*
- * Suspends sending notifications.
+ * Deactivates generating file system change notifications.
*
* Results:
* None.
*/
void
-HgfsNotify_Suspend(void)
+HgfsNotify_Deactivate(HgfsNotifyActivateReason reason) // IN: reason unused
{
}
/*
*-----------------------------------------------------------------------------
*
- * HgfsNotify_Resume --
+ * HgfsNotify_Activate --
*
- * Resumes sending notifications.
+ * Activates generating file system change notifications.
*
* Results:
* None.
*/
void
-HgfsNotify_Resume(void)
+HgfsNotify_Activate(HgfsNotifyActivateReason reason) // IN: reason unused
{
}
/*
*-----------------------------------------------------------------------------
*
- * HgfsNotify_CleanupSession --
+ * HgfsNotify_RemoveSessionSubscribers --
*
* Removes all entries that are related to a particular session.
*
*/
void
-HgfsNotify_CleanupSession(struct HgfsSessionInfo *session) // IN
+HgfsNotify_RemoveSessionSubscribers(struct HgfsSessionInfo *session) // IN
{
}
HgfsSharedFolderHandle result = HGFS_INVALID_FOLDER_HANDLE;
if (!gHgfsDirNotifyActive) {
- return HGFS_INVALID_FOLDER_HANDLE;
+ LOG(8, ("%s: notification disabled\n", __FUNCTION__));
+ goto exit;
}
if (NULL == shareName) {
* Need to delete all shared folders that were marked for deletion.
*/
HgfsServerCleanupDeletedFolders();
- return HGFS_INVALID_FOLDER_HANDLE;
+ goto exit;
}
MXUser_AcquireExclLock(gHgfsSharedFoldersLock);
}
}
MXUser_ReleaseExclLock(gHgfsSharedFoldersLock);
+
+exit:
+ LOG(8, ("%s: %s, %s, %s exit %#x\n",__FUNCTION__,
+ (shareName ? shareName : "NULL"), (sharePath ? sharePath : "NULL"),
+ (addFolder ? "add" : "remove"), result));
return result;
}
*callbackTable = &hgfsServerSessionCBTable;
if (Config_GetBool(TRUE, "isolation.tools.hgfs.notify.enable")) {
gHgfsDirNotifyActive = HgfsNotify_Init() == HGFS_STATUS_SUCCESS;
+ Log("%s: initialized notification %s.\n", __FUNCTION__,
+ (gHgfsDirNotifyActive ? "active" : "inactive"));
}
gHgfsInitialized = TRUE;
} else {
gHgfsInitialized = FALSE;
if (gHgfsDirNotifyActive) {
- HgfsNotify_Shutdown();
+ HgfsNotify_Exit();
gHgfsDirNotifyActive = FALSE;
+ Log("%s: exit notification - inactive.\n", __FUNCTION__);
}
if (NULL != gHgfsSharedFoldersLock) {
int i;
HgfsSessionInfo *session;
+ LOG(8, ("%s: entered\n", __FUNCTION__));
+
ASSERT(transportSession);
session = Util_SafeCalloc(1, sizeof *session);
HgfsServerSetSessionCapability(HGFS_OP_REMOVE_WATCH_V4,
HGFS_REQUEST_NOT_SUPPORTED, session);
}
+ LOG(8, ("%s: session notify capability is %s\n", __FUNCTION__,
+ (session->activeNotification ? "enabled" : "disabled")));
}
HgfsServerSetSessionCapability(HGFS_OP_SEARCH_READ_V4,
HGFS_REQUEST_SUPPORTED, session);
*sessionData = session;
+ LOG(8, ("%s: exit TRUE\n", __FUNCTION__));
return TRUE;
}
ASSERT(session->nodeArray);
ASSERT(session->searchArray);
if (session->activeNotification) {
- HgfsNotify_CleanupSession(session);
+ HgfsNotify_RemoveSessionSubscribers(session);
}
}
HgfsTransportSessionInfo *transportSession = (HgfsTransportSessionInfo *)clientData;
DblLnkLst_Links *curr, *next;
+ LOG(8, ("%s: entered\n", __FUNCTION__));
+
ASSERT(transportSession);
MXUser_AcquireExclLock(transportSession->sessionArrayLock);
MXUser_ReleaseExclLock(transportSession->sessionArrayLock);
transportSession->state = HGFS_SESSION_STATE_CLOSED;
+ LOG(8, ("%s: exit\n", __FUNCTION__));
}
if (freeze) {
/* Suspend background activity. */
if (gHgfsDirNotifyActive) {
- HgfsNotify_Suspend();
+ HgfsNotify_Deactivate(HGFS_NOTIFY_REASON_SERVER_SYNC);
}
/* Wait for outstanding asynchronous requests to complete. */
MXUser_AcquireExclLock(gHgfsAsyncLock);
} else {
/* Resume background activity. */
if (gHgfsDirNotifyActive) {
- HgfsNotify_Resume();
+ HgfsNotify_Activate(HGFS_NOTIFY_REASON_SERVER_SYNC);
}
}
}
size_t fileNameSize;
HgfsSharedFolderHandle sharedFolder = HGFS_INVALID_FOLDER_HANDLE;
+ LOG(8, ("%s: entered\n", __FUNCTION__));
+
ASSERT(watchId != NULL);
if (HgfsHandle2NotifyInfo(dir, input->session, &fileName, &fileNameSize,
status = HGFS_ERROR_INTERNAL;
}
free(fileName);
+ LOG(8, ("%s: exit %u\n", __FUNCTION__, status));
return status;
}
ASSERT(cpName != NULL);
ASSERT(watchId != NULL);
+ LOG(8, ("%s: entered\n",__FUNCTION__));
+
nameStatus = HgfsServerGetShareInfo(cpName, cpNameSize, caseFlags, &shareInfo,
&utf8Name, &utf8NameLen);
if (HGFS_NAME_STATUS_COMPLETE == nameStatus) {
status = HgfsPlatformConvertFromNameStatus(nameStatus);
}
free(utf8Name);
+ LOG(8, ("%s: exit %u\n",__FUNCTION__, status));
return status;
}
HGFS_ASSERT_INPUT(input);
+ LOG(8, ("%s: entered\n", __FUNCTION__));
+
/*
* If the active session does not support directory change notification - bail out
* with an error immediately. Otherwise setting watch may succeed but no notification
}
HgfsServerCompleteRequest(status, replyPayloadSize, input);
+ LOG(8, ("%s: exit %u\n", __FUNCTION__, status));
}
HgfsInternalStatus status;
size_t replyPayloadSize = 0;
+ LOG(8, ("%s: entered\n", __FUNCTION__));
HGFS_ASSERT_INPUT(input);
if (HgfsUnpackRemoveWatchRequest(input->payload, input->payloadSize, input->op,
}
HgfsServerCompleteRequest(status, replyPayloadSize, input);
+ LOG(8, ("%s: exit result %u\n", __FUNCTION__, status));
}
*
* HgfsServerDirWatchEvent --
*
- * Callback which is called by directory notification package when in response
- * to a event.
+ * The callback is invoked by the file system change notification component
+ * in response to a change event when the client has set at least one watch
+ * on a directory.
*
* The function builds directory notification packet and queues it to be sent
* to the client. It processes one notification at a time. Any consolidation of
size_t sizeNeeded;
uint32 flags;
+ LOG(4, ("%s:Entered shr hnd %u hnd %"FMT64"x file %s mask %u\n",
+ __FUNCTION__, sharedFolder, subscriber, fileName, mask));
+
if (!HgfsServerGetShareName(sharedFolder, &shareNameLen, &shareName)) {
LOG(4, ("%s: failed to find shared folder for a handle %x\n",
__FUNCTION__, sharedFolder));
packet = NULL;
packetHeader = NULL;
- LOG(4, ("%s: notification for folder: %d index: %"FMT64"u file name %s mask %x\n",
+ LOG(4, ("%s: Sent notify for: %u index: %"FMT64"u file name %s mask %x\n",
__FUNCTION__, sharedFolder, subscriber, fileName, mask));
exit: