From: Oliver Kurth Date: Tue, 12 Nov 2019 02:12:23 +0000 (-0800) Subject: More LOG() calls changed to variadic form - hgfsServer. X-Git-Tag: stable-11.1.0~149 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b7bb3226e6168bac11ef1d0362dccbc7a3d62f3;p=thirdparty%2Fopen-vm-tools.git More LOG() calls changed to variadic form - hgfsServer. --- diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c index e140e420a..962b370f0 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c @@ -76,7 +76,7 @@ #if 0 #define HGFS_ASSERT_CLIENT(op) \ do { \ - LOG(4, ("%s: op: %u.\n", __FUNCTION__, op)); \ + LOG(4, "%s: op: %u.\n", __FUNCTION__, op); \ ASSERT(status != HGFS_STATUS_PROTOCOL_ERROR); \ } while(0) #else @@ -101,7 +101,7 @@ #if 0 #define HGFS_ASSERT_MINIMUM_OP(op) \ do { \ - LOG(4, ("%s: op received - %u.\n", __FUNCTION__, op)); \ + LOG(4, "%s: op received - %u.\n", __FUNCTION__, op); \ ASSERT(op >= HGFS_OP_OPEN_V3); \ } while(0) #else @@ -1385,7 +1385,7 @@ HgfsServerCheckOpenFlagsForShare(HgfsFileOpenInfo *openInfo,// IN: Hgfs file han /* The share name is the first component of the cross-platform name. */ len = CPName_GetComponent(openInfo->cpName, inEnd, &next); if (len < 0) { - LOG(4, ("%s: get first component failed\n", __FUNCTION__)); + LOG(4, "%s: get first component failed\n", __FUNCTION__); status = FALSE; goto exit; } @@ -1491,7 +1491,7 @@ HgfsGetNewNode(HgfsSessionInfo *session) // IN: session info ASSERT(session); ASSERT(session->nodeArray); - LOG(4, ("%s: entered\n", __FUNCTION__)); + LOG(4, "%s: entered\n", __FUNCTION__); if (!DblLnkLst_IsLinked(&session->nodeFreeList)) { /* @@ -1510,7 +1510,7 @@ HgfsGetNewNode(HgfsSessionInfo *session) // IN: session info newMem = (HgfsFileNode *)realloc(session->nodeArray, newNumNodes * sizeof *(session->nodeArray)); if (!newMem) { - LOG(4, ("%s: can't realloc more nodes\n", __FUNCTION__)); + LOG(4, "%s: can't realloc more nodes\n", __FUNCTION__); return NULL; } @@ -1527,9 +1527,9 @@ HgfsGetNewNode(HgfsSessionInfo *session) // IN: session info * We'll need to lock this if we multithread. */ - LOG(4, ("Rebasing pointers, diff is %"FMTSZ"u, sizeof node is " - "%"FMTSZ"u\n", ptrDiff, sizeof(HgfsFileNode))); - LOG(4, ("old: %p new: %p\n", session->nodeArray, newMem)); + LOG(4, "Rebasing pointers, diff is %"FMTSZ"u, sizeof node is " + "%"FMTSZ"u\n", ptrDiff, sizeof(HgfsFileNode)); + LOG(4, "old: %p new: %p\n", session->nodeArray, newMem); ASSERT(newMem == (HgfsFileNode *)((char*)session->nodeArray + ptrDiff)); #define HgfsServerRebase(_ptr, _type) \ @@ -1558,7 +1558,7 @@ HgfsGetNewNode(HgfsSessionInfo *session) // IN: session info } /* Initialize the new nodes */ - LOG(4, ("numNodes was %u, now is %u\n", session->numNodes, newNumNodes)); + LOG(4, "numNodes was %u, now is %u\n", session->numNodes, newNumNodes); for (i = session->numNodes; i < newNumNodes; i++) { DblLnkLst_Init(&newMem[i].links); @@ -1613,8 +1613,8 @@ HgfsRemoveFileNode(HgfsFileNode *node, // IN: file node { ASSERT(node); - LOG(4, ("%s: handle %u, name %s, fileId %"FMT64"u\n", __FUNCTION__, - HgfsFileNode2Handle(node), node->utf8Name, node->localId.fileId)); + LOG(4, "%s: handle %u, name %s, fileId %"FMT64"u\n", __FUNCTION__, + HgfsFileNode2Handle(node), node->utf8Name, node->localId.fileId); if (node->shareName) { free(node->shareName); @@ -1741,7 +1741,7 @@ HgfsAddNewFileNode(HgfsFileOpenInfo *openInfo, // IN: open info struct /* Get an unused node */ newNode = HgfsGetNewNode(session); if (!newNode) { - LOG(4, ("%s: out of memory\n", __FUNCTION__)); + LOG(4, "%s: out of memory\n", __FUNCTION__); return NULL; } @@ -1758,7 +1758,7 @@ HgfsAddNewFileNode(HgfsFileOpenInfo *openInfo, // IN: open info struct */ newNode->shareName = malloc(shareNameLen + 1); if (newNode->shareName == NULL) { - LOG(4, ("%s: out of memory\n", __FUNCTION__)); + LOG(4, "%s: out of memory\n", __FUNCTION__); HgfsRemoveFileNode(newNode, session); return NULL; } @@ -1769,7 +1769,7 @@ HgfsAddNewFileNode(HgfsFileOpenInfo *openInfo, // IN: open info struct newNode->utf8NameLen = strlen(openInfo->utf8Name); newNode->utf8Name = malloc(newNode->utf8NameLen + 1); if (newNode->utf8Name == NULL) { - LOG(4, ("%s: out of memory\n", __FUNCTION__)); + LOG(4, "%s: out of memory\n", __FUNCTION__); HgfsRemoveFileNode(newNode, session); return NULL; } @@ -1779,7 +1779,7 @@ HgfsAddNewFileNode(HgfsFileOpenInfo *openInfo, // IN: open info struct newNode->shareInfo.rootDirLen = strlen(openInfo->shareInfo.rootDir); rootDir = malloc(newNode->shareInfo.rootDirLen + 1); if (rootDir == NULL) { - LOG(4, ("HgfsAddNewFileNode: out of memory\n")); + LOG(4, "HgfsAddNewFileNode: out of memory\n"); HgfsRemoveFileNode(newNode, session); return NULL; } @@ -1810,8 +1810,8 @@ HgfsAddNewFileNode(HgfsFileOpenInfo *openInfo, // IN: open info struct newNode->shareInfo.writePermissions = openInfo->shareInfo.writePermissions; newNode->shareInfo.handle = openInfo->shareInfo.handle; - LOG(4, ("%s: got new node, handle %u\n", __FUNCTION__, - HgfsFileNode2Handle(newNode))); + LOG(4, "%s: got new node, handle %u\n", __FUNCTION__, + HgfsFileNode2Handle(newNode)); return newNode; } @@ -1854,8 +1854,7 @@ HgfsAddToCacheInternal(HgfsHandle handle, // IN: HGFS file handle /* Remove the LRU node if the list is full. */ if (session->numCachedOpenNodes == gHgfsCfgSettings.maxCachedOpenNodes) { if (!HgfsRemoveLruNode(session)) { - LOG(4, ("%s: Unable to remove LRU node from cache.\n", - __FUNCTION__)); + LOG(4, "%s: Unable to remove LRU node from cache.\n", __FUNCTION__); return FALSE; } @@ -1920,7 +1919,7 @@ HgfsRemoveFromCacheInternal(HgfsHandle handle, // IN: Hgfs handle to the node = HgfsHandle2FileNode(handle, session); if (node == NULL) { - LOG(4, ("%s: invalid handle.\n", __FUNCTION__)); + LOG(4, "%s: invalid handle.\n", __FUNCTION__); return FALSE; } @@ -1930,9 +1929,9 @@ HgfsRemoveFromCacheInternal(HgfsHandle handle, // IN: Hgfs handle to the DblLnkLst_Unlink1(&node->links); node->state = FILENODE_STATE_IN_USE_NOT_CACHED; session->numCachedOpenNodes--; - LOG(4, ("%s: cache entries %u remove node %s id %"FMT64"u fd %u .\n", - __FUNCTION__, session->numCachedOpenNodes, node->utf8Name, - node->localId.fileId, node->fileDesc)); + LOG(4, "%s: cache entries %u remove node %s id %"FMT64"u fd %u .\n", + __FUNCTION__, session->numCachedOpenNodes, node->utf8Name, + node->localId.fileId, node->fileDesc); /* * XXX: From this point and up in the call chain (i.e. this function and @@ -1946,7 +1945,7 @@ HgfsRemoveFromCacheInternal(HgfsHandle handle, // IN: Hgfs handle to the * really fix this. */ if (HgfsPlatformCloseFile(node->fileDesc, node->fileCtx)) { - LOG(4, ("%s: Could not close fd %u\n", __FUNCTION__, node->fileDesc)); + LOG(4, "%s: Could not close fd %u\n", __FUNCTION__, node->fileDesc); return FALSE; } @@ -1998,7 +1997,7 @@ HgfsIsCachedInternal(HgfsHandle handle, // IN: Structure representing fi node = HgfsHandle2FileNode(handle, session); if (node == NULL) { - LOG(4, ("%s: invalid handle.\n", __FUNCTION__)); + LOG(4, "%s: invalid handle.\n", __FUNCTION__); return FALSE; } @@ -2086,7 +2085,7 @@ HgfsGetNewSearch(HgfsSessionInfo *session) // IN: session info ASSERT(session); ASSERT(session->searchArray); - LOG(4, ("%s: entered\n", __FUNCTION__)); + LOG(4, "%s: entered\n", __FUNCTION__); if (!DblLnkLst_IsLinked(&session->searchFreeList)) { /* @@ -2106,7 +2105,7 @@ HgfsGetNewSearch(HgfsSessionInfo *session) // IN: session info newMem = (HgfsSearch *)realloc(session->searchArray, newNumSearches * sizeof *(session->searchArray)); if (!newMem) { - LOG(4, ("%s: can't realloc more searches\n", __FUNCTION__)); + LOG(4, "%s: can't realloc more searches\n", __FUNCTION__); return NULL; } @@ -2121,9 +2120,9 @@ HgfsGetNewSearch(HgfsSessionInfo *session) // IN: session info * must be updated to point to the new portion of memory. */ - LOG(4, ("Rebasing pointers, diff is %"FMTSZ"u, sizeof search is " - "%"FMTSZ"u\n", ptrDiff, sizeof(HgfsSearch))); - LOG(4, ("old: %p new: %p\n", session->searchArray, newMem)); + LOG(4, "Rebasing pointers, diff is %"FMTSZ"u, sizeof search is " + "%"FMTSZ"u\n", ptrDiff, sizeof(HgfsSearch)); + LOG(4, "old: %p new: %p\n", session->searchArray, newMem); ASSERT(newMem == (HgfsSearch*)((char*)session->searchArray + ptrDiff)); #define HgfsServerRebase(_ptr, _type) \ @@ -2149,8 +2148,8 @@ HgfsGetNewSearch(HgfsSessionInfo *session) // IN: session info } /* Initialize the new searches */ - LOG(4, ("numSearches was %u, now is %u\n", session->numSearches, - newNumSearches)); + LOG(4, "numSearches was %u, now is %u\n", session->numSearches, + newNumSearches); for (i = session->numSearches; i < newNumSearches; i++) { DblLnkLst_Init(&newMem[i].links); @@ -2339,7 +2338,7 @@ HgfsAddNewSearch(char const *utf8Dir, // IN: UTF8 name of dir to search in /* Get an unused search */ newSearch = HgfsGetNewSearch(session); if (!newSearch) { - LOG(4, ("%s: out of memory\n", __FUNCTION__)); + LOG(4, "%s: out of memory\n", __FUNCTION__); return NULL; } @@ -2359,8 +2358,8 @@ HgfsAddNewSearch(char const *utf8Dir, // IN: UTF8 name of dir to search in newSearch->shareInfo.rootDirLen = strlen(rootDir); newSearch->shareInfo.rootDir = Util_SafeStrdup(rootDir); - LOG(4, ("%s: got new search, handle %u\n", __FUNCTION__, - HgfsSearch2SearchHandle(newSearch))); + LOG(4, "%s: got new search, handle %u\n", __FUNCTION__, + HgfsSearch2SearchHandle(newSearch)); return newSearch; } @@ -2424,8 +2423,8 @@ HgfsRemoveSearchInternal(HgfsSearch *search, // IN: search ASSERT(search); ASSERT(session); - LOG(4, ("%s: handle %u, dir %s\n", __FUNCTION__, - HgfsSearch2SearchHandle(search), search->utf8Dir)); + LOG(4, "%s: handle %u, dir %s\n", __FUNCTION__, + HgfsSearch2SearchHandle(search), search->utf8Dir); HgfsFreeSearchDirents(search); free(search->utf8Dir); @@ -2714,7 +2713,7 @@ HgfsUpdateNodeNames(const char *oldLocalName, // IN: Name of file to look for if (strcmp(fileNode->utf8Name, oldLocalName) == 0) { newBuffer = malloc(newBufferLen + 1); if (!newBuffer) { - LOG(4, ("%s: Failed to update a node name.\n", __FUNCTION__)); + LOG(4, "%s: Failed to update a node name.\n", __FUNCTION__); continue; } memcpy(newBuffer, newLocalName, newBufferLen); @@ -2759,10 +2758,10 @@ HgfsServerClose(HgfsInputParam *input) // IN: Input params if (HgfsUnpackCloseRequest(input->payload, input->payloadSize, input->op, &file)) { - LOG(4, ("%s: close fh %u\n", __FUNCTION__, file)); + LOG(4, "%s: close fh %u\n", __FUNCTION__, file); if (!HgfsRemoveFromCache(file, input->session)) { - LOG(4, ("%s: Could not remove the node from cache.\n", __FUNCTION__)); + LOG(4, "%s: Could not remove the node from cache.\n", __FUNCTION__); status = HGFS_ERROR_INVALID_HANDLE; } else { HgfsFreeFileNode(file, input->session); @@ -2807,7 +2806,7 @@ HgfsServerSearchClose(HgfsInputParam *input) // IN: Input params if (HgfsUnpackSearchCloseRequest(input->payload, input->payloadSize, input->op, &search)) { - LOG(4, ("%s: close search #%u\n", __FUNCTION__, search)); + LOG(4, "%s: close search #%u\n", __FUNCTION__, search); if (HgfsRemoveSearch(search, input->session)) { if (HgfsPackSearchCloseReply(input->packet, input->request, @@ -2819,7 +2818,7 @@ HgfsServerSearchClose(HgfsInputParam *input) // IN: Input params } } else { /* Invalid handle */ - LOG(4, ("%s: invalid handle %u\n", __FUNCTION__, search)); + LOG(4, "%s: invalid handle %u\n", __FUNCTION__, search); status = HGFS_ERROR_INVALID_HANDLE; } } else { @@ -3052,7 +3051,7 @@ HgfsServerGetRequest(HgfsPacket *packet, // IN: packet session = HgfsServerTransportGetSessionInfo(transportSession, sessionId); if (NULL == session || session->state != HGFS_SESSION_STATE_OPEN) { - LOG(4, ("%s: HGFS packet with invalid session id!\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet with invalid session id!\n", __FUNCTION__); parseStatus = HGFS_ERROR_STALE_SESSION; } } @@ -3328,8 +3327,8 @@ HgfsServerSessionReceive(HgfsPacket *packet, // IN: Hgfs Packet ASSERT(transportSession); if (transportSession->state == HGFS_SESSION_STATE_CLOSED) { - LOG(4, ("%s: %d: Received packet after disconnected.\n", __FUNCTION__, - __LINE__)); + LOG(4, "%s: %d: Received packet after disconnected.\n", __FUNCTION__, + __LINE__); return; } @@ -3337,8 +3336,8 @@ HgfsServerSessionReceive(HgfsPacket *packet, // IN: Hgfs Packet status = HgfsServerGetRequest(packet, transportSession, &input); if (HGFS_ERROR_INTERNAL == status) { - LOG(4, ("%s: %d: Error: packet invalid and cannot reply %d.\n ", - __FUNCTION__, __LINE__, status)); + LOG(4, "%s: %d: Error: packet invalid and cannot reply %d.\n ", + __FUNCTION__, __LINE__, status); HgfsServerTransportSessionPut(transportSession); return; } @@ -3357,7 +3356,7 @@ HgfsServerSessionReceive(HgfsPacket *packet, // IN: Hgfs Packet packet->state |= HGFS_STATE_ASYNC_REQUEST; } if (0 != (packet->state & HGFS_STATE_ASYNC_REQUEST)) { - LOG(4, ("%s: %d: @@Async\n", __FUNCTION__, __LINE__)); + LOG(4, "%s: %d: @@Async\n", __FUNCTION__, __LINE__); #ifndef VMX86_TOOLS /* * Asynchronous processing is supported by the transport. @@ -3380,7 +3379,7 @@ HgfsServerSessionReceive(HgfsPacket *packet, // IN: Hgfs Packet ASSERT(0); #endif } else { - LOG(4, ("%s: %d: ##Sync\n", __FUNCTION__, __LINE__)); + LOG(4, "%s: %d: ##Sync\n", __FUNCTION__, __LINE__); HgfsServerProcessRequest(input); } } else { @@ -3389,14 +3388,14 @@ HgfsServerSessionReceive(HgfsPacket *packet, // IN: Hgfs Packet * operation. */ status = HGFS_ERROR_PROTOCOL; - LOG(4, ("%s: %d: Possible BUG! Malformed packet.\n", __FUNCTION__, - __LINE__)); + LOG(4, "%s: %d: Possible BUG! Malformed packet.\n", __FUNCTION__, + __LINE__); } } /* Send error if we fail to process the op. */ if (HGFS_ERROR_SUCCESS != status) { - LOG(4, ("Error %d occurred parsing the packet\n", (uint32)status)); + LOG(4, "Error %d occurred parsing the packet\n", (uint32)status); HgfsServerCompleteRequest(status, 0, input); } @@ -3501,7 +3500,7 @@ HgfsServerTransportGetDefaultSession(HgfsTransportSessionInfo *transportSession, status = HgfsServerTransportAddSessionToList(transportSession, defaultSession); if (HGFS_ERROR_SUCCESS != status) { - LOG(4, ("%s: Could not add session to the list.\n", __FUNCTION__)); + LOG(4, "%s: Could not add session to the list.\n", __FUNCTION__); HgfsServerSessionPut(defaultSession); defaultSession = NULL; goto exit; @@ -3630,18 +3629,18 @@ HgfsServerSharesDeleteStale(DblLnkLst_Links *newSharesList) // IN: new list of ASSERT(newShare); if (strcmp(currentShare->name, newShare->name) == 0) { - LOG(4, ("%s: %s is still valid\n", __FUNCTION__, newShare->name)); + LOG(4, "%s: %s is still valid\n", __FUNCTION__, newShare->name); staleShare = FALSE; break; } } if (staleShare) { - LOG(8, ("%s: removing shared folder handle %#x\n", - __FUNCTION__, currentShare->notificationHandle)); + LOG(8, "%s: removing shared folder handle %#x\n", + __FUNCTION__, currentShare->notificationHandle); if (!HgfsNotify_RemoveSharedFolder(currentShare->notificationHandle)) { - LOG(4, ("%s: Error: removing %d shared folder handle\n", - __FUNCTION__, currentShare->notificationHandle)); + LOG(4, "%s: Error: removing %d shared folder handle\n", + __FUNCTION__, currentShare->notificationHandle); } DblLnkLst_Unlink1(link); free(currentShare->name); @@ -3683,7 +3682,7 @@ HgfsServerShareAddInternal(const char *shareName, // IN: shared folder name ASSERT(currentShare); if (strcmp(currentShare->name, shareName) == 0) { - LOG(8, ("%s: Share is not new\n", __FUNCTION__)); + LOG(8, "%s: Share is not new\n", __FUNCTION__); handle = currentShare->notificationHandle; break; } @@ -3702,10 +3701,10 @@ HgfsServerShareAddInternal(const char *shareName, // IN: shared folder name DblLnkLst_LinkLast(&gHgfsSharedFoldersList, &shareProps->links); } - LOG(8, ("%s: %s, %s, add hnd %#x\n",__FUNCTION__, - (shareName ? shareName : "NULL"), - (sharePath ? sharePath : "NULL"), - handle)); + LOG(8, "%s: %s, %s, add hnd %#x\n",__FUNCTION__, + (shareName ? shareName : "NULL"), + (sharePath ? sharePath : "NULL"), + handle); } return handle; } @@ -3735,10 +3734,10 @@ HgfsServerShareAdd(const char *shareName, // IN: shared folder name { HgfsSharedFolderHandle handle; - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); if (!gHgfsDirNotifyActive) { - LOG(8, ("%s: notification disabled\n", __FUNCTION__)); + LOG(8, "%s: notification disabled\n", __FUNCTION__); return HGFS_INVALID_FOLDER_HANDLE; } @@ -3746,7 +3745,7 @@ HgfsServerShareAdd(const char *shareName, // IN: shared folder name handle = HgfsServerShareAddInternal(shareName, sharePath); MXUser_ReleaseExclLock(gHgfsSharedFoldersLock); - LOG(8, ("%s: exit(%#x)\n", __FUNCTION__, handle)); + LOG(8, "%s: exit(%#x)\n", __FUNCTION__, handle); return handle; } @@ -3777,10 +3776,10 @@ HgfsServerSharesReset(DblLnkLst_Links *newSharesList) // IN: List of new shares { DblLnkLst_Links *linkNewShare, *nextNewShare; - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); if (!gHgfsDirNotifyActive) { - LOG(8, ("%s: notification disabled\n", __FUNCTION__)); + LOG(8, "%s: notification disabled\n", __FUNCTION__); return; } @@ -3806,7 +3805,7 @@ HgfsServerSharesReset(DblLnkLst_Links *newSharesList) // IN: List of new shares } MXUser_ReleaseExclLock(gHgfsSharedFoldersLock); - LOG(8, ("%s: exit\n", __FUNCTION__)); + LOG(8, "%s: exit\n", __FUNCTION__); } @@ -3940,7 +3939,7 @@ HgfsServer_InitState(const HgfsServerCallbacks **callbackTable, // IN/OUT: our RANK_hgfsSharedFolders); if (!HgfsPlatformInit()) { - LOG(4, ("Could not initialize server platform specific \n")); + LOG(4, "Could not initialize server platform specific \n"); result = FALSE; } @@ -4048,7 +4047,7 @@ HgfsServer_ShareAccessCheck(HgfsOpenMode accessMode, // IN: open mode to check switch (HGFS_OPEN_MODE_ACCMODE(accessMode)) { case HGFS_OPEN_MODE_READ_ONLY: if (!shareReadable) { - LOG(4, ("%s: Read access denied\n", __FUNCTION__)); + LOG(4, "%s: Read access denied\n", __FUNCTION__); return FALSE; } @@ -4056,7 +4055,7 @@ HgfsServer_ShareAccessCheck(HgfsOpenMode accessMode, // IN: open mode to check case HGFS_OPEN_MODE_WRITE_ONLY: if (!shareWriteable) { - LOG(4, ("%s: Write access denied\n", __FUNCTION__)); + LOG(4, "%s: Write access denied\n", __FUNCTION__); return FALSE; } @@ -4064,14 +4063,14 @@ HgfsServer_ShareAccessCheck(HgfsOpenMode accessMode, // IN: open mode to check case HGFS_OPEN_MODE_READ_WRITE: if (!shareReadable || !shareWriteable) { - LOG(4, ("%s: Read/write access denied\n", __FUNCTION__)); + LOG(4, "%s: Read/write access denied\n", __FUNCTION__); return FALSE; } break; default: - LOG(0, ("%s: Invalid mode %d\n", __FUNCTION__, accessMode)); + LOG(0, "%s: Invalid mode %d\n", __FUNCTION__, accessMode); ASSERT(FALSE); return FALSE; @@ -4135,8 +4134,8 @@ HgfsServerSetSessionCapability(HgfsOp op, // IN: operation code result = TRUE; } } - LOG(4, ("%s: Setting capability flags %x for op code %d %s\n", - __FUNCTION__, flags, op, result ? "succeeded" : "failed")); + LOG(4, "%s: Setting capability flags %x for op code %d %s\n", + __FUNCTION__, flags, op, result ? "succeeded" : "failed"); return result; } @@ -4261,7 +4260,7 @@ HgfsServerEnumerateSharedFolders(void) void *state; Bool success = FALSE; - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); state = HgfsServerResEnumInit(); if (NULL != state) { Bool done; @@ -4281,17 +4280,19 @@ HgfsServerEnumerateSharedFolders(void) HGFS_OPEN_MODE_READ_ONLY, &sharePathLen, &sharePath); if (HGFS_NAME_STATUS_COMPLETE == nameStatus) { - LOG(8, ("%s: registering share %s path %s\n", __FUNCTION__, shareName, sharePath)); + LOG(8, "%s: registering share %s path %s\n", __FUNCTION__, + shareName, sharePath); handle = HgfsServerShareAdd(shareName, sharePath); success = handle != HGFS_INVALID_FOLDER_HANDLE; - LOG(8, ("%s: registering share %s hnd %#x\n", __FUNCTION__, shareName, handle)); + LOG(8, "%s: registering share %s hnd %#x\n", __FUNCTION__, + shareName, handle); } } } while (!done && success); HgfsServerResEnumExit(state); } - LOG(8, ("%s: exit %d\n", __FUNCTION__, success)); + LOG(8, "%s: exit %d\n", __FUNCTION__, success); return success; } @@ -4322,7 +4323,7 @@ HgfsServerSessionConnect(void *transportData, // IN: tra { ASSERT(transportSessionData); - LOG(4, ("%s: initting.\n", __FUNCTION__)); + LOG(4, "%s: initting.\n", __FUNCTION__); *transportSessionData = HgfsServerTransportInit(transportData, channelCbTable, @@ -4608,7 +4609,7 @@ HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession, // IN: int i; HgfsSessionInfo *session; - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); ASSERT(transportSession); @@ -4690,7 +4691,7 @@ HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession, // IN: HgfsServerSetSessionCapability(HGFS_OP_WRITE_FAST_V4, HGFS_OP_CAPFLAG_IS_SUPPORTED, session); if (gHgfsDirNotifyActive) { - LOG(8, ("%s: notify is enabled\n", __FUNCTION__)); + LOG(8, "%s: notify is enabled\n", __FUNCTION__); if (HgfsServerEnumerateSharedFolders()) { HgfsServerSetSessionCapability(HGFS_OP_SET_WATCH_V4, HGFS_OP_CAPFLAG_IS_SUPPORTED, session); @@ -4703,9 +4704,9 @@ HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession, // IN: HgfsServerSetSessionCapability(HGFS_OP_REMOVE_WATCH_V4, HGFS_OP_CAPFLAG_NOT_SUPPORTED, session); } - LOG(8, ("%s: session notify capability is %s\n", __FUNCTION__, - (session->flags & HGFS_SESSION_CHANGENOTIFY_ENABLED ? "enabled" : - "disabled"))); + LOG(8, "%s: session notify capability is %s\n", __FUNCTION__, + (session->flags & HGFS_SESSION_CHANGENOTIFY_ENABLED ? "enabled" : + "disabled")); } HgfsServerSetSessionCapability(HGFS_OP_SEARCH_READ_V4, HGFS_OP_CAPFLAG_IS_SUPPORTED, session); @@ -4741,14 +4742,14 @@ HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession, // IN: static void HgfsDisconnectSessionInt(HgfsSessionInfo *session) // IN: session context { - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); ASSERT(session); ASSERT(session->nodeArray); ASSERT(session->searchArray); session->state = HGFS_SESSION_STATE_CLOSED; - LOG(8, ("%s: exit\n", __FUNCTION__)); + LOG(8, "%s: exit\n", __FUNCTION__); } @@ -4778,7 +4779,7 @@ HgfsServerSessionDisconnect(void *clientData) // IN: session context HgfsTransportSessionInfo *transportSession = clientData; DblLnkLst_Links *curr, *next; - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); ASSERT(transportSession); @@ -4793,7 +4794,7 @@ HgfsServerSessionDisconnect(void *clientData) // IN: session context MXUser_ReleaseExclLock(transportSession->sessionArrayLock); transportSession->state = HGFS_SESSION_STATE_CLOSED; - LOG(8, ("%s: exit\n", __FUNCTION__)); + LOG(8, "%s: exit\n", __FUNCTION__); } @@ -4821,14 +4822,14 @@ HgfsServerSessionClose(void *clientData) // IN: session context { HgfsTransportSessionInfo *transportSession = clientData; - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); ASSERT(transportSession); ASSERT(transportSession->state == HGFS_SESSION_STATE_CLOSED); /* Remove, typically, the last reference, will teardown everything. */ HgfsServerTransportSessionPut(transportSession); - LOG(8, ("%s: exit\n", __FUNCTION__)); + LOG(8, "%s: exit\n", __FUNCTION__); } @@ -4865,7 +4866,7 @@ HgfsServerExitSessionInternal(HgfsSessionInfo *session) // IN: session contex /* Check and remove any notification handles we have for this session. */ if (session->flags & HGFS_SESSION_CHANGENOTIFY_ENABLED) { - LOG(8, ("%s: calling notify component to disconnect\n", __FUNCTION__)); + LOG(8, "%s: calling notify component to disconnect\n", __FUNCTION__); /* * This routine will synchronize itself with notification generator. * Therefore, it will remove subscribers and prevent the event generator @@ -5040,7 +5041,7 @@ HgfsServerSessionQuiesce(void *clientData, // IN: transport and session HgfsTransportSessionInfo *transportSession = clientData; DblLnkLst_Links *curr; - LOG(4, ("%s: Beginning\n", __FUNCTION__)); + LOG(4, "%s: Beginning\n", __FUNCTION__); MXUser_AcquireExclLock(transportSession->sessionArrayLock); @@ -5050,8 +5051,8 @@ HgfsServerSessionQuiesce(void *clientData, // IN: transport and session switch(quiesceOp) { case HGFS_QUIESCE_FREEZE: /* Suspend background activity. */ - LOG(8, ("%s: Halt file system activity for session %p\n", - __FUNCTION__, session)); + LOG(8, "%s: Halt file system activity for session %p\n", + __FUNCTION__, session); if (gHgfsDirNotifyActive) { HgfsNotify_Deactivate(HGFS_NOTIFY_REASON_SERVER_SYNC, session); @@ -5062,8 +5063,8 @@ HgfsServerSessionQuiesce(void *clientData, // IN: transport and session case HGFS_QUIESCE_THAW: /* Resume background activity. */ - LOG(8, ("%s: Resume file system activity for session %p\n", - __FUNCTION__, session)); + LOG(8, "%s: Resume file system activity for session %p\n", + __FUNCTION__, session); if (gHgfsDirNotifyActive) { HgfsNotify_Activate(HGFS_NOTIFY_REASON_SERVER_SYNC, session); @@ -5076,7 +5077,7 @@ HgfsServerSessionQuiesce(void *clientData, // IN: transport and session } MXUser_ReleaseExclLock(transportSession->sessionArrayLock); - LOG(4, ("%s: Ending\n", __FUNCTION__)); + LOG(4, "%s: Ending\n", __FUNCTION__); } @@ -5151,7 +5152,7 @@ HgfsInvalidateSessionObjects(DblLnkLst_Links *shares, // IN: List of new shares ASSERT(session); ASSERT(session->nodeArray); ASSERT(session->searchArray); - LOG(4, ("%s: Beginning\n", __FUNCTION__)); + LOG(4, "%s: Beginning\n", __FUNCTION__); MXUser_AcquireExclLock(session->nodeArrayLock); @@ -5168,8 +5169,8 @@ HgfsInvalidateSessionObjects(DblLnkLst_Links *shares, // IN: List of new shares } handle = HgfsFileNode2Handle(&session->nodeArray[i]); - LOG(4, ("%s: Examining node with fd %d (%s)\n", __FUNCTION__, - handle, session->nodeArray[i].utf8Name)); + LOG(4, "%s: Examining node with fd %d (%s)\n", __FUNCTION__, + handle, session->nodeArray[i].utf8Name); /* For each share, is the node within the share? */ for (l = shares->next; l != shares; l = l->next) { @@ -5178,17 +5179,17 @@ HgfsInvalidateSessionObjects(DblLnkLst_Links *shares, // IN: List of new shares share = DblLnkLst_Container(l, HgfsSharedFolder, links); ASSERT(share); if (strcmp(session->nodeArray[i].shareInfo.rootDir, share->path) == 0) { - LOG(4, ("%s: Node is still valid\n", __FUNCTION__)); + LOG(4, "%s: Node is still valid\n", __FUNCTION__); break; } } /* If the node wasn't found in any share, remove it. */ if (l == shares) { - LOG(4, ("%s: Node is invalid, removing\n", __FUNCTION__)); + LOG(4, "%s: Node is invalid, removing\n", __FUNCTION__); if (!HgfsRemoveFromCacheInternal(handle, session)) { - LOG(4, ("%s: Could not remove node with " - "fh %d from the cache.\n", __FUNCTION__, handle)); + LOG(4, "%s: Could not remove node with " + "fh %d from the cache.\n", __FUNCTION__, handle); } else { HgfsFreeFileNodeInternal(handle, session); } @@ -5215,8 +5216,8 @@ HgfsInvalidateSessionObjects(DblLnkLst_Links *shares, // IN: List of new shares continue; } - LOG(4, ("%s: Examining search (%s)\n", __FUNCTION__, - session->searchArray[i].utf8Dir)); + LOG(4, "%s: Examining search (%s)\n", __FUNCTION__, + session->searchArray[i].utf8Dir); /* For each share, is the search within the share? */ for (l = shares->next; l != shares; l = l->next) { @@ -5225,21 +5226,21 @@ HgfsInvalidateSessionObjects(DblLnkLst_Links *shares, // IN: List of new shares share = DblLnkLst_Container(l, HgfsSharedFolder, links); ASSERT(share); if (strcmp(session->searchArray[i].shareInfo.rootDir, share->path) == 0) { - LOG(4, ("%s: Search is still valid\n", __FUNCTION__)); + LOG(4, "%s: Search is still valid\n", __FUNCTION__); break; } } /* If the node wasn't found in any share, remove it. */ if (l == shares) { - LOG(4, ("%s: Search is invalid, removing\n", __FUNCTION__)); + LOG(4, "%s: Search is invalid, removing\n", __FUNCTION__); HgfsRemoveSearchInternal(&session->searchArray[i], session); } } MXUser_ReleaseExclLock(session->searchArrayLock); - LOG(4, ("%s: Ending\n", __FUNCTION__)); + LOG(4, "%s: Ending\n", __FUNCTION__); } @@ -5270,7 +5271,7 @@ HgfsServerSessionInvalidateObjects(void *clientData, // IN: HgfsTransportSessionInfo *transportSession = clientData; DblLnkLst_Links *curr; - LOG(4, ("%s: Beginning\n", __FUNCTION__)); + LOG(4, "%s: Beginning\n", __FUNCTION__); ASSERT(transportSession); MXUser_AcquireExclLock(transportSession->sessionArrayLock); @@ -5286,7 +5287,7 @@ HgfsServerSessionInvalidateObjects(void *clientData, // IN: /* Now invalidate any stale shares and add any new ones. */ HgfsServerSharesReset(shares); - LOG(4, ("%s: Ending\n", __FUNCTION__)); + LOG(4, "%s: Ending\n", __FUNCTION__); } @@ -5344,8 +5345,8 @@ HgfsServerSessionInvalidateInactiveSessions(void *clientData) // IN: if (session->isInactive) { if (session->numInvalidationAttempts == MAX_SESSION_INVALIDATION_ATTEMPTS) { - LOG(4, ("%s: closing inactive session %"FMT64"x\n", __FUNCTION__, - session->sessionId)); + LOG(4, "%s: closing inactive session %"FMT64"x\n", __FUNCTION__, + session->sessionId); session->state = HGFS_SESSION_STATE_CLOSED; HgfsServerTransportRemoveSessionFromList(transportSession, session); @@ -5413,7 +5414,7 @@ HgfsServerStatFs(const char *pathName, // IN: Path we're interested in * work. */ if (pathLength >= sizeof p.mountPoint) { - LOG(4, ("%s: could not get the volume name\n", __FUNCTION__)); + LOG(4, "%s: could not get the volume name\n", __FUNCTION__); return FALSE; } @@ -5422,7 +5423,7 @@ HgfsServerStatFs(const char *pathName, // IN: Path we're interested in Str_Strcpy(p.mountPoint, pathName, sizeof p.mountPoint); wiperError = WiperSinglePartition_GetSpace(&p, NULL, freeBytes, totalBytes); if (strlen(wiperError) > 0) { - LOG(4, ("%s: error using wiper lib: %s\n", __FUNCTION__, wiperError)); + LOG(4, "%s: error using wiper lib: %s\n", __FUNCTION__, wiperError); return FALSE; } @@ -5483,7 +5484,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen inEnd = cpName + cpNameSize; if (!Unicode_IsBufferValid(cpName, cpNameSize, STRING_ENCODING_UTF8)) { - LOG(4, ("%s: invalid UTF8 string @ %p\n", __FUNCTION__, cpName)); + LOG(4, "%s: invalid UTF8 string @ %p\n", __FUNCTION__, cpName); return HGFS_NAME_STATUS_FAILURE; } @@ -5492,7 +5493,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen */ len = CPName_GetComponent(cpName, inEnd, &next); if (len < 0) { - LOG(4, ("%s: get first component failed\n", __FUNCTION__)); + LOG(4, "%s: get first component failed\n", __FUNCTION__); return HGFS_NAME_STATUS_FAILURE; } @@ -5510,7 +5511,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen &shareInfo->handle, // XXX: to be deleted. &shareInfo->rootDir); if (nameStatus != HGFS_NAME_STATUS_COMPLETE) { - LOG(4, ("%s: No such share (%s)\n", __FUNCTION__, cpName)); + LOG(4, "%s: No such share (%s)\n", __FUNCTION__, cpName); return nameStatus; } shareInfo->rootDirLen = strlen(shareInfo->rootDir); @@ -5527,7 +5528,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen /* Get the config options. */ nameStatus = HgfsServerPolicy_GetShareOptions(cpName, len, &shareOptions); if (nameStatus != HGFS_NAME_STATUS_COMPLETE) { - LOG(4, ("%s: no matching share: %s.\n", __FUNCTION__, cpName)); + LOG(4, "%s: no matching share: %s.\n", __FUNCTION__, cpName); return nameStatus; } @@ -5542,7 +5543,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen outSize = HGFS_PATH_MAX; myBufOut = (char *) malloc(outSize * sizeof *myBufOut); if (!myBufOut) { - LOG(4, ("%s: out of memory allocating string\n", __FUNCTION__)); + LOG(4, "%s: out of memory allocating string\n", __FUNCTION__); return HGFS_NAME_STATUS_OUT_OF_MEMORY; } @@ -5557,7 +5558,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen /* Are root shares allowed? If not, we exit with an error. */ if (0 == (gHgfsCfgSettings.flags & HGFS_CONFIG_SHARE_ALL_HOST_DRIVES_ENABLED)) { - LOG(4, ("%s: Root share being used\n", __FUNCTION__)); + LOG(4, "%s: Root share being used\n", __FUNCTION__); nameStatus = HGFS_NAME_STATUS_ACCESS_DENIED; goto error; } @@ -5573,7 +5574,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen nameStatus = CPName_ConvertFromRoot(&cpName, &cpNameSize, &tempSize, &tempPtr); if (nameStatus != HGFS_NAME_STATUS_COMPLETE) { - LOG(4, ("%s: ConvertFromRoot not complete\n", __FUNCTION__)); + LOG(4, "%s: ConvertFromRoot not complete\n", __FUNCTION__); goto error; } @@ -5595,7 +5596,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen * This is a regular share. Append the path to the out buffer. */ if (outSize < shareInfo->rootDirLen + 1) { - LOG(4, ("%s: share path too big\n", __FUNCTION__)); + LOG(4, "%s: share path too big\n", __FUNCTION__); nameStatus = HGFS_NAME_STATUS_TOO_LONG; goto error; } @@ -5612,7 +5613,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen if (CPName_ConvertFrom(&cpName, &cpNameSize, &tempSize, &tempPtr) < 0) { - LOG(4, ("%s: CP name conversion failed\n", __FUNCTION__)); + LOG(4, "%s: CP name conversion failed\n", __FUNCTION__); nameStatus = HGFS_NAME_STATUS_FAILURE; goto error; } @@ -5630,7 +5631,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen /* Copy UTF8 to the output buffer. */ if (pathNameLen >= outSize) { - LOG(4, ("%s: pathname too long\n", __FUNCTION__)); + LOG(4, "%s: pathname too long\n", __FUNCTION__); nameStatus = HGFS_NAME_STATUS_TOO_LONG; goto error; } @@ -5652,13 +5653,13 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen if (!CodeSet_Utf8FormCToUtf8FormD(myBufOut, myBufOutLen, &tempPtr, &nameLen)) { - LOG(4, ("%s: unicode conversion to form D failed.\n", __FUNCTION__)); + LOG(4, "%s: unicode conversion to form D failed.\n", __FUNCTION__); nameStatus = HGFS_NAME_STATUS_FAILURE; goto error; } free(myBufOut); - LOG(4, ("%s: name is \"%s\"\n", __FUNCTION__, tempPtr)); + LOG(4, "%s: name is \"%s\"\n", __FUNCTION__, tempPtr); /* Save returned pointers, update buffer length. */ myBufOut = tempPtr; @@ -5685,7 +5686,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen */ if (nameStatus != HGFS_NAME_STATUS_COMPLETE) { - LOG(4, ("%s: HgfsPlatformFilenameLookup failed.\n", __FUNCTION__)); + LOG(4, "%s: HgfsPlatformFilenameLookup failed.\n", __FUNCTION__); goto error; } @@ -5710,8 +5711,8 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen nameStatus = HgfsPlatformPathHasSymlink(myBufOut, myBufOutLen, shareInfo->rootDir, shareInfo->rootDirLen); if (nameStatus != HGFS_NAME_STATUS_COMPLETE) { - LOG(4, ("%s: parent path failed to be resolved: %d\n", - __FUNCTION__, nameStatus)); + LOG(4, "%s: parent path failed to be resolved: %d\n", + __FUNCTION__, nameStatus); goto error; } } @@ -5724,7 +5725,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen /* Enough space for resulting string + NUL termination */ p = realloc(myBufOut, (myBufOutLen + 1) * sizeof *p); if (!p) { - LOG(4, ("%s: failed to trim memory\n", __FUNCTION__)); + LOG(4, "%s: failed to trim memory\n", __FUNCTION__); } else { myBufOut = p; } @@ -5734,7 +5735,7 @@ HgfsServerGetLocalNameInfo(const char *cpName, // IN: Cross-platform filen } } - LOG(4, ("%s: name is \"%s\"\n", __FUNCTION__, myBufOut)); + LOG(4, "%s: name is \"%s\"\n", __FUNCTION__, myBufOut); *bufOut = myBufOut; @@ -5869,7 +5870,7 @@ HgfsServerSearchRealDir(char const *baseDir, // IN: Directory to search search = HgfsAddNewSearch(baseDir, DIRECTORY_SEARCH_TYPE_DIR, shareName, rootDir, session); if (!search) { - LOG(4, ("%s: failed to get new search\n", __FUNCTION__)); + LOG(4, "%s: failed to get new search\n", __FUNCTION__); status = HGFS_ERROR_INTERNAL; goto out; } @@ -5878,7 +5879,7 @@ HgfsServerSearchRealDir(char const *baseDir, // IN: Directory to search nameStatus = HgfsServerPolicy_GetShareOptions(shareName, strlen(shareName), &configOptions); if (nameStatus != HGFS_NAME_STATUS_COMPLETE) { - LOG(4, ("%s: no matching share: %s.\n", __FUNCTION__, shareName)); + LOG(4, "%s: no matching share: %s.\n", __FUNCTION__, shareName); status = HGFS_ERROR_INTERNAL; HgfsRemoveSearchInternal(search, session); goto out; @@ -5890,7 +5891,7 @@ HgfsServerSearchRealDir(char const *baseDir, // IN: Directory to search status = HgfsPlatformScandir(baseDir, baseDirLen, followSymlinks, &search->dents, &search->numDents); if (HGFS_ERROR_SUCCESS != status) { - LOG(4, ("%s: couldn't scandir\n", __FUNCTION__)); + LOG(4, "%s: couldn't scandir\n", __FUNCTION__); HgfsRemoveSearchInternal(search, session); goto out; } @@ -5944,7 +5945,7 @@ HgfsServerSearchVirtualDir(HgfsServerResEnumGetFunc getName, // IN: Name en search = HgfsAddNewSearch("", type, "", "", session); if (!search) { - LOG(4, ("%s: failed to get new search\n", __FUNCTION__)); + LOG(4, "%s: failed to get new search\n", __FUNCTION__); status = HGFS_ERROR_INTERNAL; goto out; } @@ -5956,7 +5957,7 @@ HgfsServerSearchVirtualDir(HgfsServerResEnumGetFunc getName, // IN: Name en &search->dents, &search->numDents); if (HGFS_ERROR_SUCCESS != status) { - LOG(4, ("%s: couldn't get dents\n", __FUNCTION__)); + LOG(4, "%s: couldn't get dents\n", __FUNCTION__); HgfsRemoveSearchInternal(search, session); goto out; } @@ -6024,7 +6025,7 @@ HgfsServerRestartSearchVirtualDir(HgfsServerResEnumGetFunc getName, // IN: &vdirSearch->dents, &vdirSearch->numDents); if (HGFS_ERROR_SUCCESS != status) { - LOG(4, ("%s: couldn't get root dents %u\n", __FUNCTION__, status)); + LOG(4, "%s: couldn't get root dents %u\n", __FUNCTION__, status); goto exit; } @@ -6034,7 +6035,7 @@ HgfsServerRestartSearchVirtualDir(HgfsServerResEnumGetFunc getName, // IN: exit: MXUser_ReleaseExclLock(session->searchArrayLock); - LOG(4, ("%s: refreshing dents return %d\n", __FUNCTION__, status)); + LOG(4, "%s: refreshing dents return %d\n", __FUNCTION__, status); return status; } @@ -6171,11 +6172,11 @@ HgfsRemoveLruNode(HgfsSessionInfo *session) // IN: session info if (found) { handle = HgfsFileNode2Handle(lruNode); if (!HgfsRemoveFromCacheInternal(handle, session)) { - LOG(4, ("%s: Could not remove the node from cache.\n", __FUNCTION__)); + LOG(4, "%s: Could not remove the node from cache.\n", __FUNCTION__); return FALSE; } } else { - LOG(4, ("%s: Could not find a node to remove from cache.\n", __FUNCTION__)); + LOG(4, "%s: Could not find a node to remove from cache.\n", __FUNCTION__); return FALSE; } @@ -6257,7 +6258,7 @@ HgfsCreateAndCacheFileNode(HgfsFileOpenInfo *openInfo, // IN: Open info struct len = CPName_GetComponent(openInfo->cpName, inEnd, &next); if (len < 0) { - LOG(4, ("%s: get first component failed\n", __FUNCTION__)); + LOG(4, "%s: get first component failed\n", __FUNCTION__); HgfsPlatformCloseFile(fileDesc, NULL); return FALSE; } @@ -6278,7 +6279,7 @@ HgfsCreateAndCacheFileNode(HgfsFileOpenInfo *openInfo, // IN: Open info struct openInfo->cpName, sharedFolderOpen, session); if (node == NULL) { - LOG(4, ("%s: Failed to add new node.\n", __FUNCTION__)); + LOG(4, "%s: Failed to add new node.\n", __FUNCTION__); MXUser_ReleaseExclLock(session->nodeArrayLock); HgfsPlatformCloseFile(fileDesc, NULL); @@ -6290,7 +6291,7 @@ HgfsCreateAndCacheFileNode(HgfsFileOpenInfo *openInfo, // IN: Open info struct HgfsFreeFileNodeInternal(handle, session); HgfsPlatformCloseFile(fileDesc, NULL); - LOG(4, ("%s: Failed to add node to the cache.\n", __FUNCTION__)); + LOG(4, "%s: Failed to add node to the cache.\n", __FUNCTION__); MXUser_ReleaseExclLock(session->nodeArrayLock); return FALSE; @@ -6424,8 +6425,8 @@ HgfsServerValidateRead(HgfsInputParam *input, // IN: Input params break; default: status = HGFS_ERROR_PROTOCOL; - LOG(4, ("%s: Unsupported protocol version passed %d -> PROTOCOL_ERROR.\n", - __FUNCTION__, input->op)); + LOG(4, "%s: Unsupported protocol version passed %d -> PROTOCOL_ERROR.\n", + __FUNCTION__, input->op); NOT_IMPLEMENTED(); goto exit; } @@ -6437,16 +6438,16 @@ HgfsServerValidateRead(HgfsInputParam *input, // IN: Input params replyReadResultDataSize, useMappedBuffer)) { status = HGFS_ERROR_INVALID_PARAMETER; - LOG(4, ("%s: Error: arg validation read size -> %d.\n", - __FUNCTION__, status)); + LOG(4, "%s: Error: arg validation read size -> %d.\n", + __FUNCTION__, status); goto exit; } /* Validate the file handle by retrieving it possibly from the cache. */ status = HgfsPlatformGetFd(readHandle, input->session, FALSE, &readFileDesc); if (status != HGFS_ERROR_SUCCESS) { - LOG(4, ("%s: Error: arg validation handle -> %d.\n", - __FUNCTION__, status)); + LOG(4, "%s: Error: arg validation handle -> %d.\n", + __FUNCTION__, status); goto exit; } @@ -6454,8 +6455,8 @@ exit: *readDataSize = replyReadDataSize; *readReplySize = replyReadResultSize + replyReadResultDataSize; *readfd = readFileDesc; - LOG(4, ("%s: arg validation check return (%"FMTSZ"u) %d.\n", - __FUNCTION__, replyReadDataSize, status)); + LOG(4, "%s: arg validation check return (%"FMTSZ"u) %d.\n", + __FUNCTION__, replyReadDataSize, status); return status; } @@ -6494,7 +6495,8 @@ HgfsServerRead(HgfsInputParam *input) // IN: Input params if (!HgfsUnpackReadRequest(input->payload, input->payloadSize, input->op, &file, &offset, &requiredSize)) { - LOG(4, ("%s: Failed to unpack a valid packet -> PROTOCOL_ERROR.\n", __FUNCTION__)); + LOG(4, "%s: Failed to unpack a valid packet -> PROTOCOL_ERROR.\n", + __FUNCTION__); status = HGFS_ERROR_PROTOCOL; goto exit; } @@ -6512,7 +6514,7 @@ HgfsServerRead(HgfsInputParam *input) // IN: Input params &replyReadSize, &replyReadDataSize); if (status != HGFS_ERROR_SUCCESS) { - LOG(4, ("%s: Error: validate args %u.\n", __FUNCTION__, status)); + LOG(4, "%s: Error: validate args %u.\n", __FUNCTION__, status); goto exit; } @@ -6557,7 +6559,8 @@ HgfsServerRead(HgfsInputParam *input) // IN: Input params } } else { status = HGFS_ERROR_PROTOCOL; - LOG(4, ("%s: V3/V4 Failed to get payload -> PROTOCOL_ERROR.\n", __FUNCTION__)); + LOG(4, "%s: V3/V4 Failed to get payload -> PROTOCOL_ERROR.\n", + __FUNCTION__); } break; } @@ -6571,7 +6574,7 @@ HgfsServerRead(HgfsInputParam *input) // IN: Input params reply->actualSize = actualSize; replyPayloadSize = sizeof *reply + reply->actualSize; } else { - LOG(4, ("%s: V1 Failed to read-> %d.\n", __FUNCTION__, status)); + LOG(4, "%s: V1 Failed to read-> %d.\n", __FUNCTION__, status); } break; } @@ -6685,8 +6688,8 @@ HgfsServerValidateWrite(HgfsInputParam *input, // IN: Input params break; default: status = HGFS_ERROR_PROTOCOL; - LOG(4, ("%s: Unsupported protocol version passed %d -> PROTOCOL_ERROR.\n", - __FUNCTION__, input->op)); + LOG(4, "%s: Unsupported protocol version passed %d -> PROTOCOL_ERROR.\n", + __FUNCTION__, input->op); NOT_IMPLEMENTED(); goto exit; } @@ -6700,8 +6703,8 @@ HgfsServerValidateWrite(HgfsInputParam *input, // IN: Input params requestWritePacketSize, requestWritePacketDataSize)) { status = HGFS_ERROR_INVALID_PARAMETER; - LOG(4, ("%s: Error: write data size pkt %"FMTSZ"u data %"FMTSZ"u\n", - __FUNCTION__, requestWritePacketDataSize, requestWriteDataSize)); + LOG(4, "%s: Error: write data size pkt %"FMTSZ"u data %"FMTSZ"u\n", + __FUNCTION__, requestWritePacketDataSize, requestWriteDataSize); goto exit; } @@ -6715,21 +6718,20 @@ HgfsServerValidateWrite(HgfsInputParam *input, // IN: Input params ((flags & HGFS_WRITE_APPEND) ? TRUE : FALSE), &writeFileDesc); if (status != HGFS_ERROR_SUCCESS) { - LOG(4, ("%s: Error: arg validation handle -> %d.\n", - __FUNCTION__, status)); + LOG(4, "%s: Error: arg validation handle -> %d.\n", __FUNCTION__, status); goto exit; } if (!HgfsHandleIsSequentialOpen(writeHandle, input->session, &sequentialHandle)) { status = HGFS_ERROR_INVALID_HANDLE; - LOG(4, ("%s: Could not get sequential open status\n", __FUNCTION__)); + LOG(4, "%s: Could not get sequential open status\n", __FUNCTION__); goto exit; } #if defined(__APPLE__) if (!HgfsHandle2AppendFlag(writeHandle, input->session, &appendHandle)) { status = HGFS_ERROR_INVALID_HANDLE; - LOG(4, ("%s: Could not get append mode\n", __FUNCTION__)); + LOG(4, "%s: Could not get append mode\n", __FUNCTION__); goto exit; } #endif @@ -6738,8 +6740,8 @@ exit: *writefd = writeFileDesc; *writeSequential = sequentialHandle; *writeAppend = appendHandle; - LOG(4, ("%s: arg validation check return (file %u data size %u) %u.\n", - __FUNCTION__, writeHandle, writeSize, status)); + LOG(4, "%s: arg validation check return (file %u data size %u) %u.\n", + __FUNCTION__, writeHandle, writeSize, status); return status; } @@ -6780,7 +6782,8 @@ HgfsServerWrite(HgfsInputParam *input) // IN: Input params if (!HgfsUnpackWriteRequest(input->payload, input->payloadSize, input->op, &writeFile, &writeOffset, &writeSize, &writeFlags, &writeData)) { - LOG(4, ("%s: Error: Op %d unpack write request arguments\n", __FUNCTION__, input->op)); + LOG(4, "%s: Error: Op %d unpack write request arguments\n", __FUNCTION__, + input->op); status = HGFS_ERROR_PROTOCOL; goto exit; } @@ -6798,7 +6801,7 @@ HgfsServerWrite(HgfsInputParam *input) // IN: Input params &writeSequential, &writeAppend); if (status != HGFS_ERROR_SUCCESS) { - LOG(4, ("%s: Error: validate args %u.\n", __FUNCTION__, status)); + LOG(4, "%s: Error: validate args %u.\n", __FUNCTION__, status); goto exit; } @@ -6809,7 +6812,8 @@ HgfsServerWrite(HgfsInputParam *input) // IN: Input params writeData = HSPU_GetDataPacketBuf(input->packet, BUF_READABLE, input->transportSession->channelCbTable); if (NULL == writeData) { - LOG(4, ("%s: Error: Op %d mapping write data buffer\n", __FUNCTION__, input->op)); + LOG(4, "%s: Error: Op %d mapping write data buffer\n", + __FUNCTION__, input->op); status = HGFS_ERROR_PROTOCOL; goto exit; } @@ -6893,12 +6897,12 @@ HgfsServerQueryVolInt(HgfsSessionInfo *session, // IN: session info Bool success; ASSERT(utf8Name); - LOG(4,("%s: querying path %s\n", __FUNCTION__, utf8Name)); + LOG(4, "%s: querying path %s\n", __FUNCTION__, utf8Name); success = HgfsServerStatFs(utf8Name, utf8NameLen, &outFreeBytes, &outTotalBytes); free(utf8Name); if (!success) { - LOG(4, ("%s: error getting volume information\n", __FUNCTION__)); + LOG(4, "%s: error getting volume information\n", __FUNCTION__); status = HGFS_ERROR_IO; } goto exit; @@ -6924,8 +6928,8 @@ HgfsServerQueryVolInt(HgfsSessionInfo *session, // IN: session info exit: *freeBytes = outFreeBytes; *totalBytes = outTotalBytes; - LOG(4, ("%s: return %"FMT64"u bytes Free %"FMT64"u bytes\n", __FUNCTION__, - outTotalBytes, outFreeBytes)); + LOG(4, "%s: return %"FMT64"u bytes Free %"FMT64"u bytes\n", __FUNCTION__, + outTotalBytes, outFreeBytes); return status; } @@ -6978,7 +6982,7 @@ HgfsServerQueryVolume(HgfsInputParam *input) // IN: Input params * Clients should retry using the file name. */ if (useHandle) { - LOG(4, ("%s: Doesn't support file handle.\n", __FUNCTION__)); + LOG(4, "%s: Doesn't support file handle.\n", __FUNCTION__); status = HGFS_ERROR_INVALID_PARAMETER; } else { status = HgfsServerQueryVolInt(input->session, @@ -7061,7 +7065,7 @@ HgfsSymlinkCreate(HgfsSessionInfo *session, // IN: session info, status = HGFS_ERROR_ACCESS_DENIED; } } else { - LOG(4, ("%s: no matching share: %s.\n", __FUNCTION__, srcFileName)); + LOG(4, "%s: no matching share: %s.\n", __FUNCTION__, srcFileName); status = HgfsPlatformConvertFromNameStatus(nameStatus); } } else { @@ -7073,10 +7077,10 @@ HgfsSymlinkCreate(HgfsSessionInfo *session, // IN: session info, } else { status = HGFS_ERROR_FILE_EXIST; } - LOG(4, ("%s: failed access check, error %d\n", __FUNCTION__, status)); + LOG(4, "%s: failed access check, error %d\n", __FUNCTION__, status); } } else { - LOG(4, ("%s: symlink name access check failed\n", __FUNCTION__)); + LOG(4, "%s: symlink name access check failed\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } if (HGFS_ERROR_SUCCESS == status) { @@ -7137,7 +7141,7 @@ HgfsServerSymlinkCreate(HgfsInputParam *input) // IN: Input params * Clients should retry using the file name. */ if (srcUseHandle || trgUseHandle) { - LOG(4, ("%s: Doesn't support file handle.\n", __FUNCTION__)); + LOG(4, "%s: Doesn't support file handle.\n", __FUNCTION__); status = HGFS_ERROR_INVALID_PARAMETER; } else { status = HgfsSymlinkCreate(input->session, srcFileName, srcFileNameLength, @@ -7252,8 +7256,8 @@ HgfsValidateRenameFile(Bool useHandle, // IN: status = HgfsPlatformGetFd(fileHandle, session, FALSE, descr); if (HGFS_ERROR_SUCCESS != status) { - LOG(4, ("%s: could not map cached handle %d, error %u\n", - __FUNCTION__, fileHandle, status)); + LOG(4, "%s: could not map cached handle %d, error %u\n", + __FUNCTION__, fileHandle, status); } else if (!HgfsHandle2FileNameMode(fileHandle, session, &shareInfo->readPermissions, &shareInfo->writePermissions, localFileName, localNameLength)) { @@ -7263,12 +7267,11 @@ HgfsValidateRenameFile(Bool useHandle, // IN: * Also the name will be required to update the nodes on a successful * rename operation. */ - LOG(4, ("%s: could not get file name for fd %d\n", __FUNCTION__, - *descr)); + LOG(4, "%s: could not get file name for fd %d\n", __FUNCTION__, *descr); status = HGFS_ERROR_INVALID_HANDLE; } else if (HgfsHandleIsSharedFolderOpen(fileHandle, session, &sharedFolderOpen) && sharedFolderOpen) { - LOG(4, ("%s: Cannot rename shared folder\n", __FUNCTION__)); + LOG(4, "%s: Cannot rename shared folder\n", __FUNCTION__); status = HGFS_ERROR_ACCESS_DENIED; } } else { @@ -7279,11 +7282,11 @@ HgfsValidateRenameFile(Bool useHandle, // IN: localFileName, localNameLength); if (HGFS_NAME_STATUS_COMPLETE != nameStatus) { - LOG(4, ("%s: access check failed\n", __FUNCTION__)); + LOG(4, "%s: access check failed\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } else if (HgfsServerIsSharedFolderOnly(cpName, cpNameLength)) { /* Guest OS is not allowed to rename shared folder. */ - LOG(4, ("%s: Cannot rename shared folder\n", __FUNCTION__)); + LOG(4, "%s: Cannot rename shared folder\n", __FUNCTION__); status = HGFS_ERROR_ACCESS_DENIED; } else { status = HGFS_ERROR_SUCCESS; @@ -7303,8 +7306,8 @@ HgfsValidateRenameFile(Bool useHandle, // IN: * an error. */ - LOG (4, ("%s: File has an outstanding oplock. Client " - "should remove this oplock and try again.\n", __FUNCTION__)); + LOG (4, "%s: File has an outstanding oplock. Client " + "should remove this oplock and try again.\n", __FUNCTION__); status = HGFS_ERROR_PATH_BUSY; } } @@ -7388,7 +7391,7 @@ HgfsServerRename(HgfsInputParam *input) // IN: Input params if (HGFS_ERROR_SUCCESS == status) { status = HGFS_ERROR_ACCESS_DENIED; } - LOG(4, ("HgfsServerRename: failed access check, error %d\n", status)); + LOG(4, "HgfsServerRename: failed access check, error %d\n", status); } else { status = HgfsValidateRenameFile((hints & HGFS_RENAME_HINT_USE_TARGETFILE_DESC) != 0, @@ -7416,7 +7419,7 @@ HgfsServerRename(HgfsInputParam *input) // IN: Input params HGFS_ERROR_FILE_NOT_FOUND == status) { status = HGFS_ERROR_ACCESS_DENIED; } - LOG(4, ("HgfsServerRename: failed access check, error %d\n", status)); + LOG(4, "HgfsServerRename: failed access check, error %d\n", status); } } } @@ -7499,7 +7502,8 @@ HgfsServerCreateDir(HgfsInputParam *input) // IN: Input params */ if (HgfsServerIsSharedFolderOnly(info.cpName, info.cpNameSize)) { /* Disallow creating a subfolder matching the share in the virtual folder. */ - LOG(4, ("%s: Collision: cannot create a folder which is a share\n", __FUNCTION__)); + LOG(4, "%s: Collision: cannot create a folder which is a share\n", + __FUNCTION__); status = HGFS_ERROR_FILE_EXIST; goto exit; } @@ -7537,13 +7541,13 @@ HgfsServerCreateDir(HgfsInputParam *input) // IN: Input params if (HgfsServerIsSharedFolderOnly(info.cpName, info.cpNameSize)) { nameStatus = HGFS_NAME_STATUS_ACCESS_DENIED; - LOG(4, ("%s: disallow new folder creation in virtual share root.\n", - __FUNCTION__)); + LOG(4, "%s: disallow new folder creation in virtual share root.\n", + __FUNCTION__); } else { - LOG(4, ("%s: Shared folder not found\n", __FUNCTION__)); + LOG(4, "%s: Shared folder not found\n", __FUNCTION__); } } else { - LOG(4, ("%s: Shared folder access error %u\n", __FUNCTION__, nameStatus)); + LOG(4, "%s: Shared folder access error %u\n", __FUNCTION__, nameStatus); } status = HgfsPlatformConvertFromNameStatus(nameStatus); @@ -7615,23 +7619,23 @@ HgfsServerDeleteFile(HgfsInputParam *input) // IN: Input params if (HGFS_ERROR_SUCCESS == status) { status = HGFS_ERROR_ACCESS_DENIED; } - LOG(4, ("HgfsServerDeleteFile: failed access check, error %d\n", status)); + LOG(4, "HgfsServerDeleteFile: failed access check, error %d\n", status); } else if (HgfsFileHasServerLock(utf8Name, input->session, &serverLock, &fileDesc)) { /* * XXX: If the file has an oplock, the client should have broken it on * its own by now. Sorry! */ - LOG (4, ("%s: File has an outstanding oplock. Client should " - "remove this oplock and try again.\n", __FUNCTION__)); + LOG (4, "%s: File has an outstanding oplock. Client should " + "remove this oplock and try again.\n", __FUNCTION__); status = HGFS_ERROR_PATH_BUSY; } else { - LOG(4, ("%s: deleting \"%s\"\n", __FUNCTION__, utf8Name)); + LOG(4, "%s: deleting \"%s\"\n", __FUNCTION__, utf8Name); status = HgfsPlatformDeleteFileByName(utf8Name); } free(utf8Name); } else { - LOG(4, ("%s: Shared folder does not exist.\n", __FUNCTION__)); + LOG(4, "%s: Shared folder does not exist.\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } } @@ -7695,18 +7699,18 @@ HgfsServerDeleteDir(HgfsInputParam *input) // IN: Input params if (HGFS_ERROR_SUCCESS == status) { if (HgfsHandleIsSharedFolderOpen(file, input->session, &sharedFolderOpen) && sharedFolderOpen) { - LOG(4, ("%s: Cannot delete shared folder\n", __FUNCTION__)); + LOG(4, "%s: Cannot delete shared folder\n", __FUNCTION__); status = HGFS_ERROR_ACCESS_DENIED; } else { status = HgfsPlatformDeleteDirByHandle(file, input->session); if (HGFS_ERROR_SUCCESS != status) { - LOG(4, ("%s: error deleting directory %d: %d\n", __FUNCTION__, - file, status)); + LOG(4, "%s: error deleting directory %d: %d\n", __FUNCTION__, + file, status); } } } else { - LOG(4, ("%s: could not map cached handle %u, error %u\n", - __FUNCTION__, file, status)); + LOG(4, "%s: could not map cached handle %u, error %u\n", + __FUNCTION__, file, status); } } else { char *utf8Name = NULL; @@ -7718,7 +7722,7 @@ HgfsServerDeleteDir(HgfsInputParam *input) // IN: Input params ASSERT(utf8Name); /* Guest OS is not allowed to delete shared folder. */ if (HgfsServerIsSharedFolderOnly(cpName, cpNameSize)){ - LOG(4, ("%s: Cannot delete shared folder\n", __FUNCTION__)); + LOG(4, "%s: Cannot delete shared folder\n", __FUNCTION__); status = HGFS_ERROR_ACCESS_DENIED; } else if (!shareInfo.writePermissions || !shareInfo.readPermissions) { /* @@ -7730,14 +7734,14 @@ HgfsServerDeleteDir(HgfsInputParam *input) // IN: Input params if (HGFS_ERROR_SUCCESS == status) { status = HGFS_ERROR_ACCESS_DENIED; } - LOG(4, ("HgfsServerDeleteDir: failed access check, error %d\n", status)); + LOG(4, "HgfsServerDeleteDir: failed access check, error %d\n", status); } else { - LOG(4, ("%s: removing \"%s\"\n", __FUNCTION__, utf8Name)); + LOG(4, "%s: removing \"%s\"\n", __FUNCTION__, utf8Name); status = HgfsPlatformDeleteDirByName(utf8Name); } free(utf8Name); } else { - LOG(4, ("%s: access check failed\n", __FUNCTION__)); + LOG(4, "%s: access check failed\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } } @@ -7859,25 +7863,25 @@ HgfsServerSetDirWatchByHandle(HgfsInputParam *input, // IN: Input params size_t fileNameSize; HgfsSharedFolderHandle sharedFolder = HGFS_INVALID_FOLDER_HANDLE; - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); ASSERT(watchId != NULL); if (HgfsHandle2NotifyInfo(dir, input->session, &fileName, &fileNameSize, &sharedFolder)) { - LOG(4, ("%s: adding a subscriber on shared folder handle %#x\n", __FUNCTION__, - sharedFolder)); + LOG(4, "%s: adding a subscriber on shared folder handle %#x\n", + __FUNCTION__, sharedFolder); *watchId = HgfsNotify_AddSubscriber(sharedFolder, fileName, events, watchTree, input->session); status = (HGFS_INVALID_SUBSCRIBER_HANDLE == *watchId) ? HGFS_ERROR_INTERNAL : HGFS_ERROR_SUCCESS; - LOG(4, ("%s: result of add subscriber id %"FMT64"x status %u\n", __FUNCTION__, - *watchId, status)); + LOG(4, "%s: result of add subscriber id %"FMT64"x status %u\n", + __FUNCTION__, *watchId, status); } else { status = HGFS_ERROR_INTERNAL; } free(fileName); - LOG(8, ("%s: exit %u\n", __FUNCTION__, status)); + LOG(8, "%s: exit %u\n", __FUNCTION__, status); return status; } @@ -7917,7 +7921,7 @@ HgfsServerSetDirWatchByName(HgfsInputParam *input, // IN: Input params ASSERT(cpName != NULL); ASSERT(watchId != NULL); - LOG(8, ("%s: entered\n",__FUNCTION__)); + LOG(8, "%s: entered\n",__FUNCTION__); nameStatus = HgfsServerGetLocalNameInfo(cpName, cpNameSize, caseFlags, &shareInfo, &utf8Name, &utf8NameLen); @@ -7932,7 +7936,7 @@ HgfsServerSetDirWatchByName(HgfsInputParam *input, // IN: Input params */ len = CPName_GetComponent(cpName, inEnd, (char const **) &next); if (len < 0) { - LOG(4, ("%s: get first component failed\n", __FUNCTION__)); + LOG(4, "%s: get first component failed\n", __FUNCTION__); nameStatus = HGFS_NAME_STATUS_FAILURE; } else if (0 == len) { /* See if we are dealing with the base of the namespace */ @@ -7952,43 +7956,45 @@ HgfsServerSetDirWatchByName(HgfsInputParam *input, // IN: Input params nameStatus = CPName_ConvertFrom((char const **) &next, &nameSize, &tempSize, &tempPtr); if (HGFS_NAME_STATUS_COMPLETE == nameStatus) { - LOG(8, ("%s: session %p id %"FMT64"x on share hnd %#x\n", __FUNCTION__, - input->session, input->session->sessionId, sharedFolder)); + LOG(8, "%s: session %p id %"FMT64"x on share hnd %#x\n", + __FUNCTION__, input->session, input->session->sessionId, + sharedFolder); *watchId = HgfsNotify_AddSubscriber(sharedFolder, tempBuf, events, watchTree, input->session); status = (HGFS_INVALID_SUBSCRIBER_HANDLE == *watchId) ? HGFS_ERROR_INTERNAL : HGFS_ERROR_SUCCESS; - LOG(8, ("%s: watchId %"FMT64"x result %u\n", __FUNCTION__, - *watchId, status)); + LOG(8, "%s: watchId %"FMT64"x result %u\n", __FUNCTION__, + *watchId, status); } else { - LOG(4, ("%s: Conversion to platform specific name failed\n", - __FUNCTION__)); + LOG(4, "%s: Conversion to platform specific name failed\n", + __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } } else { - LOG(8, ("%s: adding subscriber on share hnd %#x\n", __FUNCTION__, sharedFolder)); + LOG(8, "%s: adding subscriber on share hnd %#x\n", __FUNCTION__, + sharedFolder); *watchId = HgfsNotify_AddSubscriber(sharedFolder, "", events, watchTree, input->session); status = (HGFS_INVALID_SUBSCRIBER_HANDLE == *watchId) ? HGFS_ERROR_INTERNAL : HGFS_ERROR_SUCCESS; - LOG(8, ("%s: adding subscriber on share hnd %#x watchId %"FMT64"x result %u\n", - __FUNCTION__, sharedFolder, *watchId, status)); + LOG(8, "%s: adding subscriber on share hnd %#x watchId %"FMT64"x result %u\n", + __FUNCTION__, sharedFolder, *watchId, status); } } else if (HGFS_NAME_STATUS_INCOMPLETE_BASE == nameStatus) { - LOG(4, ("%s: Notification for root share is not supported yet\n", - __FUNCTION__)); + LOG(4, "%s: Notification for root share is not supported yet\n", + __FUNCTION__); status = HGFS_ERROR_INVALID_PARAMETER; } else { - LOG(4, ("%s: file not found.\n", __FUNCTION__)); + LOG(4, "%s: file not found.\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } } else { - LOG(4, ("%s: file not found.\n", __FUNCTION__)); + LOG(4, "%s: file not found.\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } free(utf8Name); - LOG(8, ("%s: exit %u\n",__FUNCTION__, status)); + LOG(8, "%s: exit %u\n",__FUNCTION__, status); return status; } @@ -8025,7 +8031,7 @@ HgfsServerSetDirNotifyWatch(HgfsInputParam *input) // IN: Input params HGFS_ASSERT_INPUT(input); - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); /* * If the active session does not support directory change notification - bail out @@ -8059,7 +8065,7 @@ HgfsServerSetDirNotifyWatch(HgfsInputParam *input) // IN: Input params } HgfsServerCompleteRequest(status, replyPayloadSize, input); - LOG(8, ("%s: exit %u\n", __FUNCTION__, status)); + LOG(8, "%s: exit %u\n", __FUNCTION__, status); } @@ -8086,7 +8092,7 @@ HgfsServerRemoveDirNotifyWatch(HgfsInputParam *input) // IN: Input params HgfsInternalStatus status; size_t replyPayloadSize = 0; - LOG(8, ("%s: entered\n", __FUNCTION__)); + LOG(8, "%s: entered\n", __FUNCTION__); HGFS_ASSERT_INPUT(input); /* @@ -8102,14 +8108,15 @@ HgfsServerRemoveDirNotifyWatch(HgfsInputParam *input) // IN: Input params if (HgfsUnpackRemoveWatchRequest(input->payload, input->payloadSize, input->op, &watchId)) { - LOG(8, ("%s: remove subscriber on subscr id %"FMT64"x\n", __FUNCTION__, watchId)); + LOG(8, "%s: remove subscriber on subscr id %"FMT64"x\n", __FUNCTION__, + watchId); if (HgfsNotify_RemoveSubscriber(watchId)) { status = HGFS_ERROR_SUCCESS; } else { status = HGFS_ERROR_INTERNAL; } - LOG(8, ("%s: remove subscriber on subscr id %"FMT64"x result %u\n", __FUNCTION__, - watchId, status)); + LOG(8, "%s: remove subscriber on subscr id %"FMT64"x result %u\n", + __FUNCTION__, watchId, status); } else { status = HGFS_ERROR_PROTOCOL; } @@ -8121,7 +8128,7 @@ HgfsServerRemoveDirNotifyWatch(HgfsInputParam *input) // IN: Input params } HgfsServerCompleteRequest(status, replyPayloadSize, input); - LOG(8, ("%s: exit result %u\n", __FUNCTION__, status)); + LOG(8, "%s: exit result %u\n", __FUNCTION__, status); } @@ -8173,7 +8180,7 @@ HgfsServerGetattr(HgfsInputParam *input) // IN: Input params if (HGFS_ERROR_SUCCESS == status) { status = HgfsPlatformGetattrFromFd(fd, input->session, &attr); } else { - LOG(4, ("%s: Could not get file descriptor\n", __FUNCTION__)); + LOG(4, "%s: Could not get file descriptor\n", __FUNCTION__); } } else { @@ -8190,7 +8197,7 @@ HgfsServerGetattr(HgfsInputParam *input) // IN: Input params * this directory. */ - LOG(4, ("%s: getting attrs for base dir\n", __FUNCTION__)); + LOG(4, "%s: getting attrs for base dir\n", __FUNCTION__); HgfsPlatformGetDefaultDirAttrs(&attr); break; @@ -8205,7 +8212,7 @@ HgfsServerGetattr(HgfsInputParam *input) // IN: Input params status = HgfsPlatformGetattrFromName(localName, configOptions, (char *)cpName, &attr, &targetName); } else { - LOG(4, ("%s: no matching share: %s.\n", __FUNCTION__, cpName)); + LOG(4, "%s: no matching share: %s.\n", __FUNCTION__, cpName); status = HGFS_ERROR_FILE_NOT_FOUND; } @@ -8303,8 +8310,7 @@ HgfsServerSetattr(HgfsInputParam *input) // IN: Input params status = HGFS_ERROR_ACCESS_DENIED; } } else { - LOG(4, ("%s: could not get share mode fd %d\n", __FUNCTION__, - file)); + LOG(4, "%s: could not get share mode fd %d\n", __FUNCTION__, file); status = HGFS_ERROR_INVALID_HANDLE; } } else { /* Client wants us to open a new handle for this operation. */ @@ -8334,12 +8340,12 @@ HgfsServerSetattr(HgfsInputParam *input) // IN: Input params } else if (HGFS_NAME_STATUS_COMPLETE != HgfsServerPolicy_GetShareOptions(cpName, cpNameSize, &configOptions)) { - LOG(4, ("%s: no matching share: %s.\n", __FUNCTION__, cpName)); + LOG(4, "%s: no matching share: %s.\n", __FUNCTION__, cpName); status = HGFS_ERROR_FILE_NOT_FOUND; } else if (HgfsFileHasServerLock(utf8Name, input->session, &serverLock, &hFile)) { - LOG(4, ("%s: An open, oplocked handle exists for " - "this file. The client should retry with that handle\n", - __FUNCTION__)); + LOG(4, "%s: An open, oplocked handle exists for " + "this file. The client should retry with that handle\n", + __FUNCTION__); status = HGFS_ERROR_PATH_BUSY; } else { status = HgfsPlatformSetattrFromName(utf8Name, @@ -8350,7 +8356,7 @@ HgfsServerSetattr(HgfsInputParam *input) // IN: Input params } free(utf8Name); } else { - LOG(4, ("%s: file not found.\n", __FUNCTION__)); + LOG(4, "%s: file not found.\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } } @@ -8424,7 +8430,8 @@ HgfsServerValidateOpenParameters(HgfsFileOpenInfo *openInfo, // IN/OUT: openfile *denyCreatingFile = savedOpenFlags != openInfo->flags; status = HGFS_ERROR_SUCCESS; } else { - LOG(4, ("%s: no matching share: %s.\n", __FUNCTION__, openInfo->cpName)); + LOG(4, "%s: no matching share: %s.\n", __FUNCTION__, + openInfo->cpName); *denyCreatingFile = TRUE; status = HGFS_ERROR_FILE_NOT_FOUND; } @@ -8452,17 +8459,19 @@ HgfsServerValidateOpenParameters(HgfsFileOpenInfo *openInfo, // IN/OUT: openfile HgfsServerIsSharedFolderOnly(openInfo->cpName, openInfo->cpNameSize)) { nameStatus = HGFS_NAME_STATUS_ACCESS_DENIED; - LOG(4, ("%s: New file creation in share root not allowed\n", __FUNCTION__)); + LOG(4, "%s: New file creation in share root not allowed\n", + __FUNCTION__); } else { - LOG(4, ("%s: Shared folder not found\n", __FUNCTION__)); + LOG(4, "%s: Shared folder not found\n", __FUNCTION__); } } else { - LOG(4, ("%s: Shared folder access error %u\n", __FUNCTION__, nameStatus)); + LOG(4, "%s: Shared folder access error %u\n", __FUNCTION__, + nameStatus); } status = HgfsPlatformConvertFromNameStatus(nameStatus); } } else { - LOG(4, ("%s: filename or mode not provided\n", __FUNCTION__)); + LOG(4, "%s: filename or mode not provided\n", __FUNCTION__); status = HGFS_ERROR_PROTOCOL; } return status; @@ -8506,7 +8515,7 @@ HgfsServerOpen(HgfsInputParam *input) // IN: Input params &followSymlinks); if (HGFS_ERROR_SUCCESS == status) { ASSERT(openInfo.utf8Name); - LOG(4, ("%s: opening \"%s\", mode %u, flags %u, perms %u%u%u%u attr %u\n", + LOG(4, "%s: opening \"%s\", mode %u, flags %u, perms %u%u%u%u attr %u\n", __FUNCTION__, openInfo.utf8Name, openInfo.mode, openInfo.mask & HGFS_OPEN_VALID_FLAGS ? openInfo.flags : 0, (openInfo.mask & HGFS_OPEN_VALID_SPECIAL_PERMS) ? @@ -8517,7 +8526,7 @@ HgfsServerOpen(HgfsInputParam *input) // IN: Input params openInfo.groupPerms : 0, (openInfo.mask & HGFS_OPEN_VALID_OTHER_PERMS) ? openInfo.otherPerms : 0, - openInfo.mask & HGFS_OPEN_VALID_FILE_ATTR ? (uint32)openInfo.attr : 0)); + openInfo.mask & HGFS_OPEN_VALID_FILE_ATTR ? (uint32)openInfo.attr : 0); /* * XXX: Before opening the file, see if we already have this file opened on * the server with an oplock on it. If we do, we must fail the new open @@ -8907,8 +8916,8 @@ HgfsServerSearchRead(HgfsInputParam *input) // IN: Input params &info, &baseReplySize, &inlineDataSize, &hgfsSearchHandle)) { - LOG(4, ("%s: read search #%u, offset %u\n", __FUNCTION__, - hgfsSearchHandle, info.startIndex)); + LOG(4, "%s: read search #%u, offset %u\n", __FUNCTION__, + hgfsSearchHandle, info.startIndex); info.reply = HgfsAllocInitReply(input->packet, input->request, baseReplySize + inlineDataSize, @@ -8922,7 +8931,7 @@ HgfsServerSearchRead(HgfsInputParam *input) // IN: Input params } if (info.replyPayload == NULL) { - LOG(4, ("%s: Op %d reply buffer failure\n", __FUNCTION__, input->op)); + LOG(4, "%s: Op %d reply buffer failure\n", __FUNCTION__, input->op); status = HGFS_ERROR_PROTOCOL; } else { @@ -8933,8 +8942,8 @@ HgfsServerSearchRead(HgfsInputParam *input) // IN: Input params search.utf8ShareNameLen, &configOptions); if (nameStatus != HGFS_NAME_STATUS_COMPLETE) { - LOG(4, ("%s: no matching share: %s.\n", __FUNCTION__, - search.utf8ShareName)); + LOG(4, "%s: no matching share: %s.\n", __FUNCTION__, + search.utf8ShareName); status = HGFS_ERROR_FILE_NOT_FOUND; } } else if (0 == info.startIndex) { @@ -8991,7 +9000,8 @@ HgfsServerSearchRead(HgfsInputParam *input) // IN: Input params free(search.utf8ShareName); } else { - LOG(4, ("%s: handle %u is invalid\n", __FUNCTION__, hgfsSearchHandle)); + LOG(4, "%s: handle %u is invalid\n", __FUNCTION__, + hgfsSearchHandle); status = HGFS_ERROR_INVALID_HANDLE; } } @@ -9031,7 +9041,7 @@ HgfsServerCreateSession(HgfsInputParam *input) // IN: Input params if (HgfsUnpackCreateSessionRequest(input->payload, input->payloadSize, input->op, &info)) { HgfsSessionInfo *session; - LOG(4, ("%s: create session\n", __FUNCTION__)); + LOG(4, "%s: create session\n", __FUNCTION__); if (!HgfsServerAllocateSession(input->transportSession, &session)) { @@ -9041,7 +9051,7 @@ HgfsServerCreateSession(HgfsInputParam *input) // IN: Input params status = HgfsServerTransportAddSessionToList(input->transportSession, session); if (HGFS_ERROR_SUCCESS != status) { - LOG(4, ("%s: Could not add session to the list.\n", __FUNCTION__)); + LOG(4, "%s: Could not add session to the list.\n", __FUNCTION__); HgfsServerSessionPut(session); goto abort; } @@ -9266,18 +9276,18 @@ HgfsServerNotifyReceiveEventCb(HgfsSharedFolderHandle sharedFolder, // IN: share size_t sizeNeeded; uint32 notifyFlags; - LOG(4, ("%s:Entered shr hnd %u hnd %"FMT64"x file %s mask %u\n", - __FUNCTION__, sharedFolder, subscriber, fileName, mask)); + LOG(4, "%s:Entered shr hnd %u hnd %"FMT64"x file %s mask %u\n", + __FUNCTION__, sharedFolder, subscriber, fileName, mask); if (session->state == HGFS_SESSION_STATE_CLOSED) { - LOG(4, ("%s: session has been closed drop the notification %"FMT64"x\n", - __FUNCTION__, session->sessionId)); + LOG(4, "%s: session has been closed drop the notification %"FMT64"x\n", + __FUNCTION__, session->sessionId); goto exit; } if (!HgfsServerGetShareName(sharedFolder, &shareNameLen, &shareName)) { - LOG(4, ("%s: failed to find shared folder for a handle %x\n", - __FUNCTION__, sharedFolder)); + LOG(4, "%s: failed to find shared folder for a handle %x\n", + __FUNCTION__, sharedFolder); goto exit; } @@ -9304,7 +9314,7 @@ HgfsServerNotifyReceiveEventCb(HgfsSharedFolderHandle sharedFolder, // IN: share if (!HgfsPackChangeNotificationRequest(packetHeader, subscriber, shareName, fileName, mask, notifyFlags, session, &sizeNeeded)) { - LOG(4, ("%s: failed to pack notification request\n", __FUNCTION__)); + LOG(4, "%s: failed to pack notification request\n", __FUNCTION__); goto exit; } @@ -9312,15 +9322,15 @@ HgfsServerNotifyReceiveEventCb(HgfsSharedFolderHandle sharedFolder, // IN: share session->transportSession, session, 0)) { - LOG(4, ("%s: failed to send notification to the host\n", __FUNCTION__)); + LOG(4, "%s: failed to send notification to the host\n", __FUNCTION__); goto exit; } /* The transport will call the server send complete callback to release the packets. */ packet = NULL; - LOG(4, ("%s: Sent notify for: %u index: %"FMT64"u file name %s mask %x\n", - __FUNCTION__, sharedFolder, subscriber, fileName, mask)); + LOG(4, "%s: Sent notify for: %u index: %"FMT64"u file name %s mask %x\n", + __FUNCTION__, sharedFolder, subscriber, fileName, mask); exit: if (shareName) { diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerInt.h b/open-vm-tools/lib/hgfsServer/hgfsServerInt.h index 4bce63d4e..2b322d2f8 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerInt.h +++ b/open-vm-tools/lib/hgfsServer/hgfsServerInt.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2018 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -44,6 +44,7 @@ struct DirectoryEntry; #ifndef VMX86_TOOLS #define LOGLEVEL_MODULE hgfsServer +#define LOGLEVEL_VARIADIC #include "loglevel_user.h" #else // VMX86_TOOLS @@ -81,13 +82,22 @@ struct DirectoryEntry; #define DOLOG(_min) ((_min) <= LGLEVEL) -#define LOG(_level, args) \ - do { \ - if (DOLOG(_level)) { \ - Debug(LGPFX_FMT, LGPFX, __FUNCTION__); \ - Debug args; \ - } \ +/* gcc needs special syntax to handle zero-length variadic arguments */ +#if defined(_MSC_VER) +#define LOG(_level, fmt, ...) \ + do { \ + if (DOLOG(_level)) { \ + Debug(LGPFX_FMT fmt, LGPFX , __FUNCTION__, __VA_ARGS__); \ + } \ } while (0) +#else +#define LOG(_level, fmt, ...) \ + do { \ + if (DOLOG(_level)) { \ + Debug(LGPFX_FMT fmt, LGPFX, __FUNCTION__, ##__VA_ARGS__); \ + } \ + } while (0) +#endif #endif // VNMX86_TOOLS diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c index 880d4b8ec..8cbc0e153 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c @@ -661,8 +661,8 @@ HgfsPlatformCloseFile(fileDesc fileDesc, // IN: File descriptor if (close(fileDesc) != 0) { int error = errno; - LOG(4, ("%s: Could not close fd %d: %s\n", __FUNCTION__, fileDesc, - Err_Errno2String(error))); + LOG(4, "%s: Could not close fd %d: %s\n", __FUNCTION__, fileDesc, + Err_Errno2String(error)); return error; } @@ -713,14 +713,14 @@ HgfsCheckFileNode(char const *localName, // IN #endif int error = errno; - LOG(4, ("%s: couldn't stat local file \"%s\": %s\n", __FUNCTION__, - localName, Err_Errno2String(error))); + LOG(4, "%s: couldn't stat local file \"%s\": %s\n", __FUNCTION__, + localName, Err_Errno2String(error)); return error; } if (nodeStat.st_dev != localId->volumeId || nodeStat.st_ino != localId->fileId) { - LOG(4, ("%s: local Id mismatch\n", __FUNCTION__)); + LOG(4, "%s: local Id mismatch\n", __FUNCTION__); return ENOENT; } @@ -775,7 +775,7 @@ HgfsPlatformGetFd(HgfsHandle hgfsHandle, // IN: HGFS file handle node.utf8Name = NULL; if (!HgfsGetNodeCopy(hgfsHandle, session, TRUE, &node)) { /* XXX: Technically, this can also fail if we're out of memory. */ - LOG(4, ("%s: Invalid hgfs handle.\n", __FUNCTION__)); + LOG(4, "%s: Invalid hgfs handle.\n", __FUNCTION__); status = EBADF; goto exit; } @@ -790,8 +790,8 @@ HgfsPlatformGetFd(HgfsHandle hgfsHandle, // IN: HGFS file handle if (append && !(node.flags & HGFS_FILE_NODE_APPEND_FL)) { status = HgfsPlatformCloseFile(node.fileDesc, node.fileCtx); if (status != 0) { - LOG(4, ("%s: Couldn't close file \"%s\" for reopening\n", - __FUNCTION__, node.utf8Name)); + LOG(4, "%s: Couldn't close file \"%s\" for reopening\n", + __FUNCTION__, node.utf8Name); goto exit; } @@ -800,8 +800,8 @@ HgfsPlatformGetFd(HgfsHandle hgfsHandle, // IN: HGFS file handle * flag. */ if (!HgfsUpdateNodeAppendFlag(hgfsHandle, session, TRUE)) { - LOG(4, ("%s: Could not update the node in the cache\n", - __FUNCTION__)); + LOG(4, "%s: Could not update the node in the cache\n", + __FUNCTION__); status = EBADF; goto exit; } @@ -839,8 +839,8 @@ HgfsPlatformGetFd(HgfsHandle hgfsHandle, // IN: HGFS file handle if (newFd < 0) { int error = errno; - LOG(4, ("%s: Couldn't open file \"%s\": %s\n", __FUNCTION__, - node.utf8Name, Err_Errno2String(errno))); + LOG(4, "%s: Couldn't open file \"%s\": %s\n", __FUNCTION__, + node.utf8Name, Err_Errno2String(errno)); status = error; goto exit; } @@ -850,15 +850,15 @@ HgfsPlatformGetFd(HgfsHandle hgfsHandle, // IN: HGFS file handle * This call might fail if the node is not used anymore. */ if (!HgfsUpdateNodeFileDesc(hgfsHandle, session, newFd, NULL)) { - LOG(4, ("%s: Could not update the node -- node is not used.\n", - __FUNCTION__)); + LOG(4, "%s: Could not update the node -- node is not used.\n", + __FUNCTION__); status = EBADF; goto exit; } /* Add the node to the cache. */ if (!HgfsAddToCache(hgfsHandle, session)) { - LOG(4, ("%s: Could not add node to the cache\n", __FUNCTION__)); + LOG(4, "%s: Could not add node to the cache\n", __FUNCTION__); status = EBADF; goto exit; } @@ -993,9 +993,9 @@ HgfsPlatformValidateOpen(HgfsFileOpenInfo *openInfo, // IN: Open info struct } } if (status != 0) { - LOG(4, ("%s: Error: Unwritable share mode %u flags %u file \"%s\": %d %s\n", - __FUNCTION__, openMode, openFlags, openInfo->utf8Name, - status, Err_Errno2String(status))); + LOG(4, "%s: Error: Unwritable share mode %u flags %u file \"%s\": %d %s\n", + __FUNCTION__, openMode, openFlags, openInfo->utf8Name, + status, Err_Errno2String(status)); goto exit; } } @@ -1015,9 +1015,9 @@ HgfsPlatformValidateOpen(HgfsFileOpenInfo *openInfo, // IN: Open info struct status = EACCES; } if (status != 0) { - LOG(4, ("%s: Error: Unreadable share flags %u file \"%s\": %d %s\n", - __FUNCTION__, openFlags, openInfo->utf8Name, status, - Err_Errno2String(status))); + LOG(4, "%s: Error: Unreadable share flags %u file \"%s\": %d %s\n", + __FUNCTION__, openFlags, openInfo->utf8Name, status, + Err_Errno2String(status)); goto exit; } } @@ -1055,16 +1055,16 @@ HgfsPlatformValidateOpen(HgfsFileOpenInfo *openInfo, // IN: Open info struct */ status = EACCES; } - LOG(4, ("%s: Error: open file \"%s\": %d %s\n", __FUNCTION__, - openInfo->utf8Name, status, Err_Errno2String(status))); + LOG(4, "%s: Error: open file \"%s\": %d %s\n", __FUNCTION__, + openInfo->utf8Name, status, Err_Errno2String(status)); goto exit; } /* Stat file to get its volume and file info */ if (fstat(fd, &fileStat) < 0) { status = errno; - LOG(4, ("%s: Error: stat file\"%s\": %d %s\n", __FUNCTION__, - openInfo->utf8Name, status, Err_Errno2String(status))); + LOG(4, "%s: Error: stat file\"%s\": %d %s\n", __FUNCTION__, + openInfo->utf8Name, status, Err_Errno2String(status)); close(fd); goto exit; } @@ -1165,11 +1165,11 @@ HgfsGetattrResolveAlias(char const *fileName, // IN: Input filename } if (!CFBooleanGetValue(isAlias)) { status = 0; - LOG(4, ("%s: file was not an alias\n", __FUNCTION__)); + LOG(4, "%s: file was not an alias\n", __FUNCTION__); goto newExit; } - LOG(4, ("%s: file was an alias\n", __FUNCTION__)); + LOG(4, "%s: file was an alias\n", __FUNCTION__); bookmarkData = CFURLCreateBookmarkDataFromFile(NULL, fileURL, NULL); if (!bookmarkData) { @@ -1240,11 +1240,11 @@ newExit: if (!isAlias) { status = 0; - LOG(4, ("%s: file was not an alias\n", __FUNCTION__)); + LOG(4, "%s: file was not an alias\n", __FUNCTION__); goto oldExit; } - LOG(4, ("%s: file was an alias\n", __FUNCTION__)); + LOG(4, "%s: file was an alias\n", __FUNCTION__); /* * Create and resolve an FSRef of the desired path. We pass FALSE to @@ -1498,8 +1498,8 @@ HgfsConvertComponentCase(char *currentComponent, // IN myConvertedComponent = malloc(myConvertedComponentSize); if (myConvertedComponent == NULL) { ret = errno; - LOG(4, ("%s: failed to malloc myConvertedComponent.\n", - __FUNCTION__)); + LOG(4, "%s: failed to malloc myConvertedComponent.\n", + __FUNCTION__); goto exit; } Str_Strcpy(myConvertedComponent, dentryName, myConvertedComponentSize); @@ -1561,7 +1561,7 @@ HgfsConstructConvertedPath(char **path, // IN/OUT p = realloc(*path, *pathSize + convertedPathLen + sizeof (DIRSEPC)); if (!p) { int error = errno; - LOG(4, ("%s: failed to realloc.\n", __FUNCTION__)); + LOG(4, "%s: failed to realloc.\n", __FUNCTION__); return error; } @@ -1624,7 +1624,7 @@ HgfsCaseInsensitiveLookup(const char *sharePath, // IN curDir = malloc(curDirSize); if (!curDir) { error = errno; - LOG(4, ("%s: failed to allocate for curDir\n", __FUNCTION__)); + LOG(4, "%s: failed to allocate for curDir\n", __FUNCTION__); goto exit; } Str_Strcpy(curDir, sharePath, curDirSize); @@ -1779,8 +1779,8 @@ HgfsPlatformFilenameLookup(const char *sharePath, // IN if (caseFlags == HGFS_FILE_NAME_CASE_INSENSITIVE && Posix_Access(fileName, F_OK) == -1) { - LOG(4, ("%s: Case insensitive lookup, fileName: %s, flags: %u.\n", - __FUNCTION__, fileName, caseFlags)); + LOG(4, "%s: Case insensitive lookup, fileName: %s, flags: %u.\n", + __FUNCTION__, fileName, caseFlags); error = HgfsCaseInsensitiveLookup(sharePath, sharePathLength, fileName, fileNameLength, convertedFileName, @@ -1811,7 +1811,7 @@ HgfsPlatformFilenameLookup(const char *sharePath, // IN *convertedFileName = strdup(fileName); if (!*convertedFileName) { nameStatus = HGFS_NAME_STATUS_OUT_OF_MEMORY; - LOG(4, ("%s: strdup on fileName failed.\n", __FUNCTION__)); + LOG(4, "%s: strdup on fileName failed.\n", __FUNCTION__); } else { *convertedFileNameLength = fileNameLength; } @@ -2086,7 +2086,7 @@ HgfsGetSequentialOnlyFlagFromName(const char *fileName, // IN */ fd = Posix_Open(fileName, openFlags | O_RDONLY); if (fd < 0) { - LOG(4, ("%s: Couldn't open the file \"%s\"\n", __FUNCTION__, fileName)); + LOG(4, "%s: Couldn't open the file \"%s\"\n", __FUNCTION__, fileName); return; } HgfsGetSequentialOnlyFlagFromFd(fd, attr); @@ -2143,9 +2143,9 @@ HgfsGetSequentialOnlyFlagFromFd(int fd, // IN * reading any data, we can call pread with size specified as 0. */ error = pread(fd, buffer, 0, 0); - LOG(4, ("%s: pread returned %d, errno %d\n", __FUNCTION__, error, errno)); + LOG(4, "%s: pread returned %d, errno %d\n", __FUNCTION__, error, errno); if ((-1 == error) && (ESPIPE == errno)) { - LOG(4, ("%s: Marking the file as 'Sequential only' file\n", __FUNCTION__)); + LOG(4, "%s: Marking the file as 'Sequential only' file\n", __FUNCTION__); attr->flags |= HGFS_ATTR_SEQUENTIAL_ONLY; } @@ -2198,7 +2198,7 @@ HgfsPlatformGetattrFromName(char *fileName, // IN/OUT: Input fi ASSERT(fileName); ASSERT(attr); - LOG(4, ("%s: getting attrs for \"%s\"\n", __FUNCTION__, fileName)); + LOG(4, "%s: getting attrs for \"%s\"\n", __FUNCTION__, fileName); followSymlinks = HgfsServerPolicy_IsShareOptionSet(configOptions, HGFS_SHARE_FOLLOW_SYMLINKS), @@ -2208,8 +2208,8 @@ HgfsPlatformGetattrFromName(char *fileName, // IN/OUT: Input fi &creationTime); if (error) { status = errno; - LOG(4, ("%s: error stating file: %s\n", __FUNCTION__, - Err_Errno2String(status))); + LOG(4, "%s: error stating file: %s\n", __FUNCTION__, + Err_Errno2String(status)); goto exit; } @@ -2220,10 +2220,10 @@ HgfsPlatformGetattrFromName(char *fileName, // IN/OUT: Input fi */ if (S_ISDIR(stats.st_mode)) { attr->type = HGFS_FILE_TYPE_DIRECTORY; - LOG(4, ("%s: is a directory\n", __FUNCTION__)); + LOG(4, "%s: is a directory\n", __FUNCTION__); } else if (S_ISLNK(stats.st_mode)) { attr->type = HGFS_FILE_TYPE_SYMLINK; - LOG(4, ("%s: is a symlink\n", __FUNCTION__)); + LOG(4, "%s: is a symlink\n", __FUNCTION__); /* * In the case of a symlink, we should populate targetName if the @@ -2234,7 +2234,7 @@ HgfsPlatformGetattrFromName(char *fileName, // IN/OUT: Input fi myTargetName = Posix_ReadLink(fileName); if (myTargetName == NULL) { error = errno; - LOG(4, ("%s: readlink returned wrong size\n", __FUNCTION__)); + LOG(4, "%s: readlink returned wrong size\n", __FUNCTION__); /* * Because of an unavoidable race between the lstat(2) and the @@ -2260,9 +2260,9 @@ HgfsPlatformGetattrFromName(char *fileName, // IN/OUT: Input fi * http://lists.apple.com/archives/carbon-development/2001/Nov/msg00007.html */ - LOG(4, ("%s: NOT a directory or symlink\n", __FUNCTION__)); + LOG(4, "%s: NOT a directory or symlink\n", __FUNCTION__); if (HgfsGetattrResolveAlias(fileName, &myTargetName)) { - LOG(4, ("%s: could not resolve file aliases\n", __FUNCTION__)); + LOG(4, "%s: could not resolve file aliases\n", __FUNCTION__); } attr->type = HGFS_FILE_TYPE_REGULAR; if (myTargetName != NULL) { @@ -2302,11 +2302,11 @@ HgfsPlatformGetattrFromName(char *fileName, // IN/OUT: Input fi stats.st_mode |= ACCESSPERMS; attr->type = HGFS_FILE_TYPE_SYMLINK; } else { - LOG(4, ("%s: out of memory\n", __FUNCTION__)); + LOG(4, "%s: out of memory\n", __FUNCTION__); } } else { - LOG(4, ("%s: alias target is outside shared folder\n", - __FUNCTION__)); + LOG(4, "%s: alias target is outside shared folder\n", + __FUNCTION__); } } } @@ -2321,8 +2321,8 @@ HgfsPlatformGetattrFromName(char *fileName, // IN/OUT: Input fi if (!CodeSet_Utf8FormDToUtf8FormC(myTargetName, strlen(myTargetName), targetName, NULL)) { - LOG(4, ("%s: Unable to normalize form C \"%s\"\n", - __FUNCTION__, myTargetName)); + LOG(4, "%s: Unable to normalize form C \"%s\"\n", + __FUNCTION__, myTargetName); status = HgfsPlatformConvertFromNameStatus(HGFS_NAME_STATUS_FAILURE); goto exit; } @@ -2330,7 +2330,7 @@ HgfsPlatformGetattrFromName(char *fileName, // IN/OUT: Input fi *targetName = myTargetName; myTargetName = NULL; #endif - LOG(4, ("%s: symlink target \"%s\"\n", __FUNCTION__, *targetName)); + LOG(4, "%s: symlink target \"%s\"\n", __FUNCTION__, *targetName); } HgfsStatToFileAttr(&stats, &creationTime, attr); @@ -2400,12 +2400,12 @@ HgfsPlatformGetattrFromFd(fileDesc fileDesc, // IN: file descriptor ASSERT(attr); ASSERT(session); - LOG(4, ("%s: getting attrs for %u\n", __FUNCTION__, fileDesc)); + LOG(4, "%s: getting attrs for %u\n", __FUNCTION__, fileDesc); error = HgfsFStat(fileDesc, &stats, &creationTime); if (error) { - LOG(4, ("%s: error stating file: %s\n", __FUNCTION__, - Err_Errno2String(error))); + LOG(4, "%s: error stating file: %s\n", __FUNCTION__, + Err_Errno2String(error)); status = error; goto exit; } @@ -2416,14 +2416,14 @@ HgfsPlatformGetattrFromFd(fileDesc fileDesc, // IN: file descriptor */ if (S_ISDIR(stats.st_mode)) { attr->type = HGFS_FILE_TYPE_DIRECTORY; - LOG(4, ("%s: is a directory\n", __FUNCTION__)); + LOG(4, "%s: is a directory\n", __FUNCTION__); } else if (S_ISLNK(stats.st_mode)) { attr->type = HGFS_FILE_TYPE_SYMLINK; - LOG(4, ("%s: is a symlink\n", __FUNCTION__)); + LOG(4, "%s: is a symlink\n", __FUNCTION__); } else { attr->type = HGFS_FILE_TYPE_REGULAR; - LOG(4, ("%s: NOT a directory or symlink\n", __FUNCTION__)); + LOG(4, "%s: NOT a directory or symlink\n", __FUNCTION__); } HgfsStatToFileAttr(&stats, &creationTime, attr); @@ -2439,20 +2439,21 @@ HgfsPlatformGetattrFromFd(fileDesc fileDesc, // IN: file descriptor */ if (!HgfsFileDesc2Handle(fileDesc, session, &handle)) { - LOG(4, ("%s: could not get HGFS handle for fd %u\n", __FUNCTION__, fileDesc)); + LOG(4, "%s: could not get HGFS handle for fd %u\n", __FUNCTION__, + fileDesc); status = EBADF; goto exit; } if (!HgfsHandle2ShareMode(handle, session, &shareMode)) { - LOG(4, ("%s: could not get share mode fd %u\n", __FUNCTION__, fileDesc)); + LOG(4, "%s: could not get share mode fd %u\n", __FUNCTION__, fileDesc); status = EBADF; goto exit; } if (!HgfsHandle2FileName(handle, session, &fileName, &fileNameLen)) { - LOG(4, ("%s: could not map cached target file handle %u\n", - __FUNCTION__, handle)); + LOG(4, "%s: could not map cached target file handle %u\n", + __FUNCTION__, handle); status = EBADF; goto exit; } @@ -2556,9 +2557,9 @@ HgfsStatToFileAttr(struct stat *stats, // IN: stat information attr->ownerPerms = (stats->st_mode & S_IRWXU) >> 6; attr->groupPerms = (stats->st_mode & S_IRWXG) >> 3; attr->otherPerms = stats->st_mode & S_IRWXO; - LOG(4, ("%s: done, permissions %o%o%o%o, size %"FMT64"u\n", __FUNCTION__, - attr->specialPerms, attr->ownerPerms, attr->groupPerms, - attr->otherPerms, attr->size)); + LOG(4, "%s: done, permissions %o%o%o%o, size %"FMT64"u\n", __FUNCTION__, + attr->specialPerms, attr->ownerPerms, attr->groupPerms, + attr->otherPerms, attr->size); #ifdef __FreeBSD__ # if !defined(VM_X86_64) && __FreeBSD_version >= 500043 # define FMTTIMET "" @@ -2568,10 +2569,10 @@ HgfsStatToFileAttr(struct stat *stats, // IN: stat information #else # define FMTTIMET "l" #endif - LOG(4, ("access: %"FMTTIMET"d/%"FMT64"u \nwrite: %"FMTTIMET"d/%"FMT64"u \n" - "attr: %"FMTTIMET"d/%"FMT64"u\n", - stats->st_atime, attr->accessTime, stats->st_mtime, attr->writeTime, - stats->st_ctime, attr->attrChangeTime)); + LOG(4, "access: %"FMTTIMET"d/%"FMT64"u \nwrite: %"FMTTIMET"d/%"FMT64"u \n" + "attr: %"FMTTIMET"d/%"FMT64"u\n", + stats->st_atime, attr->accessTime, stats->st_mtime, attr->writeTime, + stats->st_ctime, attr->attrChangeTime); #undef FMTTIMET attr->userId = stats->st_uid; @@ -2786,8 +2787,8 @@ HgfsSetattrTimes(struct stat *statBuf, // IN: stat info if (gettimeofday(&tv, NULL) != 0) { error = errno; - LOG(4, ("%s: gettimeofday error: %s\n", __FUNCTION__, - Err_Errno2String(error))); + LOG(4, "%s: gettimeofday error: %s\n", __FUNCTION__, + Err_Errno2String(error)); status = error; goto exit; } @@ -2809,8 +2810,8 @@ HgfsSetattrTimes(struct stat *statBuf, // IN: stat info if (gettimeofday(&tv, NULL) != 0) { error = errno; - LOG(4, ("%s: gettimeofday error: %s\n", __FUNCTION__, - Err_Errno2String(error))); + LOG(4, "%s: gettimeofday error: %s\n", __FUNCTION__, + Err_Errno2String(error)); status = error; goto exit; } @@ -2869,15 +2870,15 @@ HgfsPlatformSetattrFromFd(HgfsHandle file, // IN: file descriptor status = HgfsPlatformGetFd(file, session, FALSE, &fd); if (status != 0) { - LOG(4, ("%s: Could not get file descriptor\n", __FUNCTION__)); + LOG(4, "%s: Could not get file descriptor\n", __FUNCTION__); goto exit; } /* We need the old stats so that we can preserve times. */ if (fstat(fd, &statBuf) == -1) { error = errno; - LOG(4, ("%s: error stating file %u: %s\n", __FUNCTION__, - fd, Err_Errno2String(error))); + LOG(4, "%s: error stating file %u: %s\n", __FUNCTION__, + fd, Err_Errno2String(error)); status = error; goto exit; } @@ -2891,12 +2892,12 @@ HgfsPlatformSetattrFromFd(HgfsHandle file, // IN: file descriptor idChanged = HgfsSetattrOwnership(attr, &newUid, &newGid); if (idChanged) { - LOG(4, ("%s: set uid %"FMTUID" and gid %"FMTUID"\n", __FUNCTION__, - newUid, newGid)); + LOG(4, "%s: set uid %"FMTUID" and gid %"FMTUID"\n", __FUNCTION__, + newUid, newGid); if (fchown(fd, newUid, newGid) < 0) { error = errno; - LOG(4, ("%s: error chowning file %u: %s\n", __FUNCTION__, - fd, Err_Errno2String(error))); + LOG(4, "%s: error chowning file %u: %s\n", __FUNCTION__, + fd, Err_Errno2String(error)); status = error; } } @@ -2912,12 +2913,12 @@ HgfsPlatformSetattrFromFd(HgfsHandle file, // IN: file descriptor */ permsChanged = HgfsSetattrMode(&statBuf, attr, &newPermissions); if (permsChanged) { - LOG(4, ("%s: set mode %o\n", __FUNCTION__, (unsigned)newPermissions)); + LOG(4, "%s: set mode %o\n", __FUNCTION__, (unsigned)newPermissions); if (fchmod(fd, newPermissions) < 0) { error = errno; - LOG(4, ("%s: error chmoding file %u: %s\n", __FUNCTION__, - fd, Err_Errno2String(error))); + LOG(4, "%s: error chmoding file %u: %s\n", __FUNCTION__, + fd, Err_Errno2String(error)); status = error; } } @@ -2930,19 +2931,19 @@ HgfsPlatformSetattrFromFd(HgfsHandle file, // IN: file descriptor * against deadlock. */ if (!HgfsHandle2ServerLock(file, session, &serverLock)) { - LOG(4, ("%s: File handle is no longer valid.\n", __FUNCTION__)); + LOG(4, "%s: File handle is no longer valid.\n", __FUNCTION__); status = EBADF; } else if (serverLock != HGFS_LOCK_NONE) { - LOG(4, ("%s: Client attempted to truncate an oplocked file\n", - __FUNCTION__)); + LOG(4, "%s: Client attempted to truncate an oplocked file\n", + __FUNCTION__); status = EBUSY; } else if (ftruncate(fd, attr->size) < 0) { error = errno; - LOG(4, ("%s: error truncating file %u: %s\n", __FUNCTION__, - fd, Err_Errno2String(error))); + LOG(4, "%s: error truncating file %u: %s\n", __FUNCTION__, + fd, Err_Errno2String(error)); status = error; } else { - LOG(4, ("%s: set size %"FMT64"u\n", __FUNCTION__, attr->size)); + LOG(4, "%s: set size %"FMT64"u\n", __FUNCTION__, attr->size); } } @@ -2964,7 +2965,7 @@ HgfsPlatformSetattrFromFd(HgfsHandle file, // IN: file descriptor uid_t uid = (uid_t)-1; Bool switchToSuperUser = FALSE; - LOG(4, ("%s: setting new times\n", __FUNCTION__)); + LOG(4, "%s: setting new times\n", __FUNCTION__); /* * If the VMX is neither the file owner nor running as root, return an error. @@ -2975,8 +2976,8 @@ HgfsPlatformSetattrFromFd(HgfsHandle file, // IN: file descriptor if (geteuid() != statBuf.st_uid) { /* We are not the file owner. Check if we are running as root. */ if (!Id_IsSuperUser()) { - LOG(4, ("%s: only owner of file %u or root can call futimes\n", - __FUNCTION__, fd)); + LOG(4, "%s: only owner of file %u or root can call futimes\n", + __FUNCTION__, fd); /* XXX: Linux kernel says both EPERM and EACCES are valid here. */ status = EPERM; goto exit; @@ -2999,16 +3000,16 @@ HgfsPlatformSetattrFromFd(HgfsHandle file, // IN: file descriptor switchToSuperUser = TRUE; if (futimes(fd, times) < 0) { error = errno; - LOG(4, ("%s: Executing futimes as owner on file: %u " - "failed with error: %s\n", __FUNCTION__, - fd, Err_Errno2String(error))); + LOG(4, "%s: Executing futimes as owner on file: %u " + "failed with error: %s\n", __FUNCTION__, + fd, Err_Errno2String(error)); status = error; } } else { error = errno; - LOG(4, ("%s: Executing futimes as superuser on file: %u " - "failed with error: %s\n", __FUNCTION__, - fd, Err_Errno2String(error))); + LOG(4, "%s: Executing futimes as superuser on file: %u " + "failed with error: %s\n", __FUNCTION__, + fd, Err_Errno2String(error)); status = error; } } @@ -3073,19 +3074,19 @@ HgfsPlatformSetattrFromName(char *localName, // IN: Name * have sent us a Setattr packet with a valid HGFS handle. */ if (File_IsSymLink(localName)) { - LOG(4, ("%s: pathname contains a symlink\n", __FUNCTION__)); + LOG(4, "%s: pathname contains a symlink\n", __FUNCTION__); status = EINVAL; goto exit; } } - LOG(4, ("%s: setting attrs for \"%s\"\n", __FUNCTION__, localName)); + LOG(4, "%s: setting attrs for \"%s\"\n", __FUNCTION__, localName); /* We need the old stats so that we can preserve times. */ if (Posix_Lstat(localName, &statBuf) == -1) { error = errno; - LOG(4, ("%s: error stating file \"%s\": %s\n", __FUNCTION__, - localName, Err_Errno2String(error))); + LOG(4, "%s: error stating file \"%s\": %s\n", __FUNCTION__, + localName, Err_Errno2String(error)); status = error; goto exit; } @@ -3105,8 +3106,8 @@ HgfsPlatformSetattrFromName(char *localName, // IN: Name if (idChanged) { if (Posix_Lchown(localName, newUid, newGid) < 0) { error = errno; - LOG(4, ("%s: error chowning file \"%s\": %s\n", __FUNCTION__, - localName, Err_Errno2String(error))); + LOG(4, "%s: error chowning file \"%s\": %s\n", __FUNCTION__, + localName, Err_Errno2String(error)); status = error; } } @@ -3122,12 +3123,12 @@ HgfsPlatformSetattrFromName(char *localName, // IN: Name */ permsChanged = HgfsSetattrMode(&statBuf, attr, &newPermissions); if (permsChanged) { - LOG(4, ("%s: set mode %o\n", __FUNCTION__, (unsigned)newPermissions)); + LOG(4, "%s: set mode %o\n", __FUNCTION__, (unsigned)newPermissions); if (Posix_Chmod(localName, newPermissions) < 0) { error = errno; - LOG(4, ("%s: error chmoding file \"%s\": %s\n", __FUNCTION__, - localName, Err_Errno2String(error))); + LOG(4, "%s: error chmoding file \"%s\": %s\n", __FUNCTION__, + localName, Err_Errno2String(error)); status = error; } } @@ -3135,11 +3136,11 @@ HgfsPlatformSetattrFromName(char *localName, // IN: Name if (attr->mask & HGFS_ATTR_VALID_SIZE) { if (Posix_Truncate(localName, attr->size) < 0) { error = errno; - LOG(4, ("%s: error truncating file \"%s\": %s\n", __FUNCTION__, - localName, Err_Errno2String(error))); + LOG(4, "%s: error truncating file \"%s\": %s\n", __FUNCTION__, + localName, Err_Errno2String(error)); status = error; } else { - LOG(4, ("%s: set size %"FMT64"u\n", __FUNCTION__, attr->size)); + LOG(4, "%s: set size %"FMT64"u\n", __FUNCTION__, attr->size); } } @@ -3159,8 +3160,8 @@ HgfsPlatformSetattrFromName(char *localName, // IN: Name if (Posix_Utimes(localName, times) < 0) { error = errno; - LOG(4, ("%s: utimes error on file \"%s\": %s\n", __FUNCTION__, - localName, Err_Errno2String(error))); + LOG(4, "%s: utimes error on file \"%s\": %s\n", __FUNCTION__, + localName, Err_Errno2String(error)); status = error; } } else if (timesStatus != 0) { @@ -3225,7 +3226,7 @@ HgfsPlatformVDirStatsFs(HgfsSessionInfo *session, // IN: session info * any pathname. */ - LOG(4,("%s: opened search on base\n", __FUNCTION__)); + LOG(4, "%s: opened search on base\n", __FUNCTION__); status = HgfsServerSearchVirtualDir(HgfsServerResEnumGet, HgfsServerResEnumInit, HgfsServerResEnumExit, @@ -3260,8 +3261,7 @@ HgfsPlatformVDirStatsFs(HgfsSessionInfo *session, // IN: session info * should be ignored within QueryVolume, as they're not real shares. */ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) { - LOG(4, ("%s: Skipping fake share %s\n", __FUNCTION__, - dent->d_name)); + LOG(4, "%s: Skipping fake share %s\n", __FUNCTION__, dent->d_name); free(dent); continue; } @@ -3286,7 +3286,7 @@ HgfsPlatformVDirStatsFs(HgfsSessionInfo *session, // IN: session info &sharePath); free(dent); if (nameStatus != HGFS_NAME_STATUS_COMPLETE) { - LOG(4, ("%s: No such share or access denied\n", __FUNCTION__)); + LOG(4, "%s: No such share or access denied\n", __FUNCTION__); if (0 == firstErr) { firstErr = HgfsPlatformConvertFromNameStatus(nameStatus); } @@ -3302,8 +3302,8 @@ HgfsPlatformVDirStatsFs(HgfsSessionInfo *session, // IN: session info if (!HgfsServerStatFs(sharePath, sharePathLen, ¤tFreeBytes, ¤tTotalBytes)) { - LOG(4, ("%s: error getting volume information\n", - __FUNCTION__)); + LOG(4, "%s: error getting volume information\n", + __FUNCTION__); if (0 == firstErr) { firstErr = HGFS_ERROR_IO; } @@ -3334,7 +3334,7 @@ HgfsPlatformVDirStatsFs(HgfsSessionInfo *session, // IN: session info } } if (!HgfsRemoveSearch(handle, session)) { - LOG(4, ("%s: could not close search on base\n", __FUNCTION__)); + LOG(4, "%s: could not close search on base\n", __FUNCTION__); } if (shares == failed) { if (firstErr != 0) { @@ -3348,7 +3348,7 @@ HgfsPlatformVDirStatsFs(HgfsSessionInfo *session, // IN: session info } break; default: - LOG(4,("%s: file access check failed\n", __FUNCTION__)); + LOG(4, "%s: file access check failed\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } @@ -3433,7 +3433,7 @@ HgfsConvertToUtf8FormC(char *buffer, // IN/OUT: name to normalize } free(entryName); } else { - LOG(4, ("%s: Unable to normalize form C \"%s\"\n", __FUNCTION__, buffer)); + LOG(4, "%s: Unable to normalize form C \"%s\"\n", __FUNCTION__, buffer); result = FALSE; } @@ -3597,7 +3597,7 @@ HgfsPlatformSetDirEntry(HgfsSearch *search, // IN: partially valid fullName[search->utf8DirLen] = DIRSEPC; memcpy(&fullName[search->utf8DirLen + 1], dirEntry->d_name, length + 1); - LOG(4, ("%s: about to stat \"%s\"\n", __FUNCTION__, fullName)); + LOG(4, "%s: about to stat \"%s\"\n", __FUNCTION__, fullName); /* Do we need to query the attributes information? */ if (getAttr) { @@ -3617,8 +3617,8 @@ HgfsPlatformSetDirEntry(HgfsSearch *search, // IN: partially valid * But isn't this handle sharing always desirable? */ if (HgfsFileHasServerLock(fullName, session, &serverLock, &fileDesc)) { - LOG(4, ("%s: Reusing existing oplocked handle " - "to avoid oplock break deadlock\n", __FUNCTION__)); + LOG(4, "%s: Reusing existing oplocked handle " + "to avoid oplock break deadlock\n", __FUNCTION__); status = HgfsPlatformGetattrFromFd(fileDesc, session, entryAttr); } else { status = HgfsPlatformGetattrFromName(fullName, configOptions, @@ -3628,7 +3628,8 @@ HgfsPlatformSetDirEntry(HgfsSearch *search, // IN: partially valid if (HGFS_ERROR_SUCCESS != status) { HgfsOp savedOp = entryAttr->requestType; - LOG(4, ("%s: stat FAILED %s (%d)\n", __FUNCTION__, fullName, status)); + LOG(4, "%s: stat FAILED %s (%d)\n", __FUNCTION__, fullName, + status); memset(entryAttr, 0, sizeof *entryAttr); entryAttr->requestType = savedOp; entryAttr->type = HGFS_FILE_TYPE_REGULAR; @@ -3639,8 +3640,8 @@ HgfsPlatformSetDirEntry(HgfsSearch *search, // IN: partially valid free(fullName); } else { - LOG(4, ("%s: could not allocate space for \"%s\\%s\"\n", - __FUNCTION__, search->utf8Dir, dirEntry->d_name)); + LOG(4, "%s: could not allocate space for \"%s\\%s\"\n", + __FUNCTION__, search->utf8Dir, dirEntry->d_name); status = HGFS_ERROR_NOT_ENOUGH_MEMORY; } break; @@ -3662,8 +3663,8 @@ HgfsPlatformSetDirEntry(HgfsSearch *search, // IN: partially valid */ if (strcmp(dirEntry->d_name, ".") == 0 || strcmp(dirEntry->d_name, "..") == 0) { - LOG(4, ("%s: assigning %s default attributes\n", - __FUNCTION__, dirEntry->d_name)); + LOG(4, "%s: assigning %s default attributes\n", + __FUNCTION__, dirEntry->d_name); HgfsPlatformGetDefaultDirAttrs(entryAttr); } else { HgfsNameStatus nameStatus; @@ -3695,11 +3696,11 @@ HgfsPlatformSetDirEntry(HgfsSearch *search, // IN: partially valid * The dent no longer exists. Log the event. */ - LOG(4, ("%s: stat FAILED\n", __FUNCTION__)); + LOG(4, "%s: stat FAILED\n", __FUNCTION__); status = HGFS_ERROR_SUCCESS; } } else { - LOG(4, ("%s: No such share or access denied\n", __FUNCTION__)); + LOG(4, "%s: No such share or access denied\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } } @@ -3721,12 +3722,12 @@ HgfsPlatformSetDirEntry(HgfsSearch *search, // IN: partially valid } else { *entryNameLength = length; } - LOG(4, ("%s: dent name is \"%s\" len = %u\n", __FUNCTION__, - *entryName, *entryNameLength)); + LOG(4, "%s: dent name is \"%s\" len = %u\n", __FUNCTION__, + *entryName, *entryNameLength); } else { *entryName = NULL; *entryNameLength = 0; - LOG(4, ("%s: error %d getting dent\n", __FUNCTION__, status)); + LOG(4, "%s: error %d getting dent\n", __FUNCTION__, status); } return status; @@ -3792,21 +3793,21 @@ HgfsPlatformScandir(char const *baseDir, // IN: Directory to search i struct stat st; if (lstat(baseDir, &st) == -1) { status = errno; - LOG(4, ("%s: error in lstat: %d (%s)\n", __FUNCTION__, status, - Err_Errno2String(status))); + LOG(4, "%s: error in lstat: %d (%s)\n", __FUNCTION__, status, + Err_Errno2String(status)); goto exit; } if (S_ISLNK(st.st_mode)) { status = EACCES; - LOG(4, ("%s: do not follow symlink\n", __FUNCTION__)); + LOG(4, "%s: do not follow symlink\n", __FUNCTION__); goto exit; } } fd = Posix_OpenDir(baseDir); if (NULL == fd) { status = errno; - LOG(4, ("%s: error in opendir: %d (%s)\n", __FUNCTION__, status, - Err_Errno2String(status))); + LOG(4, "%s: error in opendir: %d (%s)\n", __FUNCTION__, status, + Err_Errno2String(status)); goto exit; } #else @@ -3819,8 +3820,8 @@ HgfsPlatformScandir(char const *baseDir, // IN: Directory to search i result = Posix_Open(baseDir, openFlags); if (result < 0) { status = errno; - LOG(4, ("%s: error in open: %d (%s)\n", __FUNCTION__, status, - Err_Errno2String(status))); + LOG(4, "%s: error in open: %d (%s)\n", __FUNCTION__, status, + Err_Errno2String(status)); goto exit; } fd = result; @@ -3883,8 +3884,8 @@ HgfsPlatformScandir(char const *baseDir, // IN: Directory to search i if (result == -1) { status = errno; - LOG(4, ("%s: error in getdents: %d (%s)\n", __FUNCTION__, status, - Err_Errno2String(status))); + LOG(4, "%s: error in getdents: %d (%s)\n", __FUNCTION__, status, + Err_Errno2String(status)); goto exit; } @@ -3895,8 +3896,8 @@ HgfsPlatformScandir(char const *baseDir, // IN: Directory to search i if (fd != -1 && close(fd) < 0) { #endif status = errno; - LOG(4, ("%s: error in close: %d (%s)\n", __FUNCTION__, status, - Err_Errno2String(status))); + LOG(4, "%s: error in close: %d (%s)\n", __FUNCTION__, status, + Err_Errno2String(status)); } /* @@ -3959,7 +3960,7 @@ HgfsPlatformScanvdir(HgfsServerResEnumGetFunc enumNamesGet, // IN: Function to enumNamesHandle = enumNamesInit(); if (NULL == enumNamesHandle) { status = HGFS_ERROR_NOT_ENOUGH_MEMORY; - LOG(4, ("%s: Error: init state ret %u\n", __FUNCTION__, status)); + LOG(4, "%s: Error: init state ret %u\n", __FUNCTION__, status); goto exit; } @@ -3981,13 +3982,14 @@ HgfsPlatformScanvdir(HgfsServerResEnumGetFunc enumNamesGet, // IN: Function to } else { if (!enumNamesGet(enumNamesHandle, ¤tEntryName, ¤tEntryNameLen, &done)) { status = HGFS_ERROR_INVALID_PARAMETER; - LOG(4, ("%s: Error: get next entry name ret %u\n", __FUNCTION__, status)); + LOG(4, "%s: Error: get next entry name ret %u\n", __FUNCTION__, + status); goto exit; } } if (done) { - LOG(4, ("%s: No more names\n", __FUNCTION__)); + LOG(4, "%s: No more names\n", __FUNCTION__); break; } @@ -4019,14 +4021,15 @@ HgfsPlatformScanvdir(HgfsServerResEnumGetFunc enumNamesGet, // IN: Function to p = realloc(myDents, totalDents * sizeof *myDents); if (NULL == p) { status = HGFS_ERROR_NOT_ENOUGH_MEMORY; - LOG(4, ("%s: Error: realloc growing array memory ret %u\n", __FUNCTION__, status)); + LOG(4, "%s: Error: realloc growing array memory ret %u\n", + __FUNCTION__, status); goto exit; } myDents = p; } /* This file/directory can be added to the list. */ - LOG(4, ("%s: Nextfilename = \"%s\"\n", __FUNCTION__, currentEntryName)); + LOG(4, "%s: Nextfilename = \"%s\"\n", __FUNCTION__, currentEntryName); /* * Start with the size of the DirectoryEntry struct, subtract the static @@ -4038,7 +4041,8 @@ HgfsPlatformScanvdir(HgfsServerResEnumGetFunc enumNamesGet, // IN: Function to currentEntry = malloc(currentEntryLen); if (NULL == currentEntry) { status = HGFS_ERROR_NOT_ENOUGH_MEMORY; - LOG(4, ("%s: Error: allocate dentry memory ret %u\n", __FUNCTION__, status)); + LOG(4, "%s: Error: allocate dentry memory ret %u\n", __FUNCTION__, + status); goto exit; } currentEntry->d_reclen = (unsigned short)currentEntryLen; @@ -4057,7 +4061,7 @@ HgfsPlatformScanvdir(HgfsServerResEnumGetFunc enumNamesGet, // IN: Function to if (NULL != p) { myDents = p; } else { - LOG(4, ("%s: Error: realloc trimming array memory\n", __FUNCTION__)); + LOG(4, "%s: Error: realloc trimming array memory\n", __FUNCTION__); } } @@ -4068,7 +4072,7 @@ exit: if (NULL != enumNamesHandle) { /* Call the exit callback to teardown any state. */ if (!enumNamesExit(enumNamesHandle)) { - LOG(4, ("%s: Error cleanup failed\n", __FUNCTION__)); + LOG(4, "%s: Error cleanup failed\n", __FUNCTION__); } } @@ -4162,16 +4166,16 @@ HgfsPlatformReadFile(fileDesc file, // IN: file descriptor ASSERT(session); - LOG(4, ("%s: read fh %u, offset %"FMT64"u, count %u\n", __FUNCTION__, - file, offset, requiredSize)); + LOG(4, "%s: read fh %u, offset %"FMT64"u, count %u\n", __FUNCTION__, + file, offset, requiredSize); if (!HgfsFileDesc2Handle(file, session, &handle)) { - LOG(4, ("%s: Could not get file handle\n", __FUNCTION__)); + LOG(4, "%s: Could not get file handle\n", __FUNCTION__); return EBADF; } if (!HgfsHandleIsSequentialOpen(handle, session, &sequentialOpen)) { - LOG(4, ("%s: Could not get sequenial open status\n", __FUNCTION__)); + LOG(4, "%s: Could not get sequenial open status\n", __FUNCTION__); return EBADF; } @@ -4210,18 +4214,18 @@ HgfsPlatformReadFile(fileDesc file, // IN: file descriptor if (error >= 0) { error = read(file, payload, requiredSize); } else { - LOG(4, ("%s: could not seek to %"FMT64"u: %s\n", __FUNCTION__, - offset, Err_Errno2String(status))); + LOG(4, "%s: could not seek to %"FMT64"u: %s\n", __FUNCTION__, + offset, Err_Errno2String(status)); } MXUser_ReleaseExclLock(session->fileIOLock); #endif if (error < 0) { status = errno; - LOG(4, ("%s: error reading from file: %s\n", __FUNCTION__, - Err_Errno2String(status))); + LOG(4, "%s: error reading from file: %s\n", __FUNCTION__, + Err_Errno2String(status)); } else { - LOG(4, ("%s: read %d bytes\n", __FUNCTION__, error)); + LOG(4, "%s: read %d bytes\n", __FUNCTION__, error); *actualSize = error; } @@ -4260,8 +4264,8 @@ HgfsPlatformWriteFile(fileDesc writeFd, // IN: file descriptor HgfsInternalStatus status = 0; int error = 0; - LOG(4, ("%s: write fh %u offset %"FMT64"u, count %u\n", - __FUNCTION__, writeFd, writeOffset, writeDataSize)); + LOG(4, "%s: write fh %u offset %"FMT64"u, count %u\n", + __FUNCTION__, writeFd, writeOffset, writeDataSize); #if !defined(sun) if (!writeSequential) { @@ -4312,8 +4316,8 @@ HgfsPlatformWriteFile(fileDesc writeFd, // IN: file descriptor } if (error < 0) { - LOG(4, ("%s: could not seek to %"FMT64"u: %s\n", __FUNCTION__, - writeOffset, Err_Errno2String(errno))); + LOG(4, "%s: could not seek to %"FMT64"u: %s\n", __FUNCTION__, + writeOffset, Err_Errno2String(errno)); } else { error = write(writeFd, writeData, writeDataSize); } @@ -4326,11 +4330,11 @@ HgfsPlatformWriteFile(fileDesc writeFd, // IN: file descriptor if (error < 0) { status = errno; - LOG(4, ("%s: error writing to file: %s\n", __FUNCTION__, - Err_Errno2String(status))); + LOG(4, "%s: error writing to file: %s\n", __FUNCTION__, + Err_Errno2String(status)); } else { *writtenSize = error; - LOG(4, ("%s: wrote %d bytes\n", __FUNCTION__, *writtenSize)); + LOG(4, "%s: wrote %d bytes\n", __FUNCTION__, *writtenSize); } return status; } @@ -4373,8 +4377,7 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus, // IN: name status int len; ASSERT(baseDir); - LOG(4, ("%s: searching in \"%s\", %s.\n", __FUNCTION__, baseDir, - dirName)); + LOG(4, "%s: searching in \"%s\", %s.\n", __FUNCTION__, baseDir, dirName); inEnd = dirName + dirNameLength; @@ -4382,7 +4385,7 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus, // IN: name status len = CPName_GetComponent(dirName, inEnd, &next); if (len >= 0) { if (*inEnd != '\0') { - LOG(4, ("%s: dir name not nul-terminated!\n", __FUNCTION__)); + LOG(4, "%s: dir name not nul-terminated!\n", __FUNCTION__); /* * NT4 clients can send the name without a nul-terminator. * The space for the nul is included and tested for in the size @@ -4392,7 +4395,7 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus, // IN: name status *(char *)inEnd = '\0'; } - LOG(4, ("%s: dirName: %s.\n", __FUNCTION__, dirName)); + LOG(4, "%s: dirName: %s.\n", __FUNCTION__, dirName); status = HgfsServerSearchRealDir(baseDir, baseDirLen, dirName, @@ -4400,7 +4403,7 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus, // IN: name status session, handle); } else { - LOG(4, ("%s: get first component failed\n", __FUNCTION__)); + LOG(4, "%s: get first component failed\n", __FUNCTION__); status = ENOENT; } /* @@ -4412,7 +4415,7 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus, // IN: name status status = HGFS_NAME_STATUS_ACCESS_DENIED; } if (status != 0) { - LOG(4, ("%s: couldn't scandir\n", __FUNCTION__)); + LOG(4, "%s: couldn't scandir\n", __FUNCTION__); } break; } @@ -4423,7 +4426,7 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus, // IN: name status * shares. [bac] */ - LOG(4, ("%s: opened search on base\n", __FUNCTION__)); + LOG(4, "%s: opened search on base\n", __FUNCTION__); status = HgfsServerSearchVirtualDir(HgfsServerResEnumGet, HgfsServerResEnumInit, HgfsServerResEnumExit, @@ -4431,12 +4434,12 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus, // IN: name status session, handle); if (status != 0) { - LOG(4, ("%s: couldn't enumerate shares\n", __FUNCTION__)); + LOG(4, "%s: couldn't enumerate shares\n", __FUNCTION__); } break; default: - LOG(4, ("%s: access check failed\n", __FUNCTION__)); + LOG(4, "%s: access check failed\n", __FUNCTION__); status = HgfsPlatformConvertFromNameStatus(nameStatus); } @@ -4542,11 +4545,11 @@ HgfsPlatformDeleteFileByName(char const *utf8Name) // IN: full file path in uf8 { HgfsInternalStatus status; - LOG(4, ("%s: unlinking \"%s\"\n", __FUNCTION__, utf8Name)); + LOG(4, "%s: unlinking \"%s\"\n", __FUNCTION__, utf8Name); status = Posix_Unlink(utf8Name); if (status) { status = errno; - LOG(4, ("%s: error: %s\n", __FUNCTION__, Err_Errno2String(status))); + LOG(4, "%s: error: %s\n", __FUNCTION__, Err_Errno2String(status)); } return status; } @@ -4592,7 +4595,7 @@ HgfsPlatformDeleteFileByHandle(HgfsHandle file, // IN: File being delet } free(localName); } else { - LOG(4, ("%s: could not map cached file handle %u\n", __FUNCTION__, file)); + LOG(4, "%s: could not map cached file handle %u\n", __FUNCTION__, file); status = EBADF; } return status; @@ -4624,11 +4627,11 @@ HgfsPlatformDeleteDirByName(char const *utf8Name) // IN: full file path in uf8 e { HgfsInternalStatus status; - LOG(4, ("%s: removing \"%s\"\n", __FUNCTION__, utf8Name)); + LOG(4, "%s: removing \"%s\"\n", __FUNCTION__, utf8Name); status = Posix_Rmdir(utf8Name); if (status) { status = errno; - LOG(4, ("%s: error: %s\n", __FUNCTION__, Err_Errno2String(status))); + LOG(4, "%s: error: %s\n", __FUNCTION__, Err_Errno2String(status)); } return status; } @@ -4674,7 +4677,7 @@ HgfsPlatformDeleteDirByHandle(HgfsHandle file, // IN: File being delete } free(localName); } else { - LOG(4, ("%s: could not map cached file handle %u\n", __FUNCTION__, file)); + LOG(4, "%s: could not map cached file handle %u\n", __FUNCTION__, file); status = EBADF; } return status; @@ -4742,12 +4745,12 @@ HgfsPlatformRename(char *localSrcName, // IN: local path to source file } } - LOG(4, ("%s: renaming \"%s\" to \"%s\"\n", __FUNCTION__, - localSrcName, localTargetName)); + LOG(4, "%s: renaming \"%s\" to \"%s\"\n", __FUNCTION__, + localSrcName, localTargetName); status = Posix_Rename(localSrcName, localTargetName); if (status) { status = errno; - LOG(4, ("%s: error: %s\n", __FUNCTION__, Err_Errno2String(status))); + LOG(4, "%s: error: %s\n", __FUNCTION__, Err_Errno2String(status)); } exit: @@ -4803,8 +4806,8 @@ HgfsPlatformCreateDir(HgfsCreateDirInfo *info, // IN: direcotry properties permissions |= info->mask & HGFS_CREATE_DIR_VALID_OTHER_PERMS ? info->otherPerms : (permissions & S_IRWXU) >> 6; - LOG(4, ("%s: making dir \"%s\", mode %"FMTMODE"\n", __FUNCTION__, - utf8Name, permissions)); + LOG(4, "%s: making dir \"%s\", mode %"FMTMODE"\n", __FUNCTION__, + utf8Name, permissions); status = Posix_Mkdir(utf8Name, permissions); if ((info->mask & HGFS_CREATE_DIR_VALID_FILE_ATTR) && @@ -4818,7 +4821,7 @@ HgfsPlatformCreateDir(HgfsCreateDirInfo *info, // IN: direcotry properties if (status) { status = errno; - LOG(4, ("%s: error: %s\n", __FUNCTION__, Err_Errno2String(status))); + LOG(4, "%s: error: %s\n", __FUNCTION__, Err_Errno2String(status)); } return status; } @@ -4848,13 +4851,13 @@ HgfsPlatformSymlinkCreate(char *localSymlinkName, // IN: symbolic link file na HgfsInternalStatus status = 0; int error; - LOG(4, ("%s: %s -> %s\n", __FUNCTION__, localSymlinkName, localTargetName)); + LOG(4, "%s: %s -> %s\n", __FUNCTION__, localSymlinkName, localTargetName); /* XXX: Should make use of targetNameP->flags? */ error = Posix_Symlink(localTargetName, localSymlinkName); if (error) { status = errno; - LOG(4, ("%s: error: %s\n", __FUNCTION__, Err_Errno2String(errno))); + LOG(4, "%s: error: %s\n", __FUNCTION__, Err_Errno2String(errno)); } return status; } @@ -4919,8 +4922,8 @@ HgfsPlatformPathHasSymlink(const char *fileName, // IN ASSERT(sharePath); ASSERT(sharePathLength <= fileNameLength); - LOG(4, ("%s: fileName: %s, sharePath: %s#\n", __FUNCTION__, - fileName, sharePath)); + LOG(4, "%s: fileName: %s, sharePath: %s#\n", __FUNCTION__, + fileName, sharePath); /* * Return success if: @@ -4948,7 +4951,7 @@ HgfsPlatformPathHasSymlink(const char *fileName, // IN p = realloc(fileDirName, sizeof (DIRSEPS)); if (p == NULL) { nameStatus = HGFS_NAME_STATUS_OUT_OF_MEMORY; - LOG(4, ("%s: failed to realloc fileDirName.\n", __FUNCTION__)); + LOG(4, "%s: failed to realloc fileDirName.\n", __FUNCTION__); goto exit; } else { fileDirName = p; @@ -4975,16 +4978,16 @@ HgfsPlatformPathHasSymlink(const char *fileName, // IN nameStatus = HGFS_NAME_STATUS_FAILURE; break; } - LOG(4, ("%s: realpath failed: fileDirName: %s: %s\n", - __FUNCTION__, fileDirName, Err_Errno2String(errno))); + LOG(4, "%s: realpath failed: fileDirName: %s: %s\n", + __FUNCTION__, fileDirName, Err_Errno2String(errno)); goto exit; } /* Resolved parent should match with the shareName. */ if (Str_Strncmp(sharePath, resolvedFileDirPath, sharePathLength) != 0) { nameStatus = HGFS_NAME_STATUS_ACCESS_DENIED; - LOG(4, ("%s: resolved parent do not match, parent: %s, resolved: %s#\n", - __FUNCTION__, fileDirName, resolvedFileDirPath)); + LOG(4, "%s: resolved parent do not match, parent: %s, resolved: %s#\n", + __FUNCTION__, fileDirName, resolvedFileDirPath); goto exit; } @@ -5071,12 +5074,12 @@ HgfsGetHiddenXAttr(char const *fileName, // IN: File name break; } default: - LOG(4, ("%s: Unrecognized object type %d\n", __FUNCTION__, - attrBuf.objType)); + LOG(4, "%s: Unrecognized object type %d\n", __FUNCTION__, + attrBuf.objType); err = EINVAL; } } else { - LOG(4, ("%s: Error %d when getting attributes\n", __FUNCTION__, err)); + LOG(4, "%s: Error %d when getting attributes\n", __FUNCTION__, err); } return err; } @@ -5173,8 +5176,8 @@ HgfsSetHiddenXAttr(char const *fileName, // IN: path to the file break; } default: - LOG(4, ("%s: Unrecognized object type %d\n", __FUNCTION__, - attrBuf.objType)); + LOG(4, "%s: Unrecognized object type %d\n", __FUNCTION__, + attrBuf.objType); err = EINVAL; } } else { @@ -5288,20 +5291,20 @@ HgfsWriteCheckIORange(off_t offset, // IN: if (getrlimit(RLIMIT_FSIZE, &fileSize) < 0) { status = errno; - LOG(4, ("%s: Could not get file size limit\n", __FUNCTION__)); + LOG(4, "%s: Could not get file size limit\n", __FUNCTION__); goto exit; } - LOG(6, ("%s: File Size limits: 0x%"FMT64"x 0x%"FMT64"x\n", - __FUNCTION__, fileSize.rlim_cur, fileSize.rlim_max)); + LOG(6, "%s: File Size limits: 0x%"FMT64"x 0x%"FMT64"x\n", + __FUNCTION__, fileSize.rlim_cur, fileSize.rlim_max); /* * Check the offset is within the file size range. */ if (fileSize.rlim_cur < offset) { status = EFBIG; - LOG(4, ("%s: Write offset exceeds max file size limit - 0x%"FMT64"x\n", - __FUNCTION__, offset)); + LOG(4, "%s: Write offset exceeds max file size limit - 0x%"FMT64"x\n", + __FUNCTION__, offset); goto exit; } @@ -5310,14 +5313,14 @@ HgfsWriteCheckIORange(off_t offset, // IN: */ if (fileSize.rlim_cur - offset < bytesToWrite) { status = EFBIG; - LOG(4, ("%s: Write data 0x%x bytes @ 0x%"FMT64"x size exceeds max file size\n", - __FUNCTION__, bytesToWrite, offset)); + LOG(4, "%s: Write data 0x%x bytes @ 0x%"FMT64"x size exceeds max file size\n", + __FUNCTION__, bytesToWrite, offset); goto exit; } exit: - LOG(6, ("%s: Write data 0x%x bytes @ 0x%"FMT64"x returns %d\n", - __FUNCTION__, bytesToWrite, offset, status)); + LOG(6, "%s: Write data 0x%x bytes @ 0x%"FMT64"x returns %d\n", + __FUNCTION__, bytesToWrite, offset, status); return status; } #endif diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerOplock.c b/open-vm-tools/lib/hgfsServer/hgfsServerOplock.c index f5d4b4fcb..6f01caa31 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerOplock.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerOplock.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2012-2016,2019 VMware, Inc. All rights reserved. + * Copyright (C) 2012-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -200,7 +200,7 @@ HgfsFileHasServerLock(const char *utf8Name, // IN: Name in UTF8 if ((existingFileNode->state == FILENODE_STATE_IN_USE_CACHED) && (existingFileNode->serverLock != HGFS_LOCK_NONE) && (!stricmp(existingFileNode->utf8Name, utf8Name))) { - LOG(4, ("Found file with a lock: %s\n", utf8Name)); + LOG(4, "Found file with a lock: %s\n", utf8Name); *serverLock = existingFileNode->serverLock; *fileDesc = existingFileNode->fileDesc; found = TRUE; @@ -299,7 +299,7 @@ HgfsServerOplockBreak(ServerLockData *lockData) HgfsRequestServerLockChange *request; HgfsLockType lock; - LOG(4, ("%s: entered\n", __FUNCTION__)); + LOG(4, "%s: entered\n", __FUNCTION__); /* * XXX: Just because the file in not in the cache on the server, @@ -315,17 +315,17 @@ HgfsServerOplockBreak(ServerLockData *lockData) */ if (!HgfsFileDesc2Handle(lockData->fileDesc, &hgfsHandle)) { - LOG(4, ("%s: file is not in the cache\n", __FUNCTION__)); + LOG(4, "%s: file is not in the cache\n", __FUNCTION__); goto free_and_exit; } if (!HgfsHandle2ServerLock(hgfsHandle, &lock)) { - LOG(4, ("%s: could not retrieve node's lock info.\n", __FUNCTION__)); + LOG(4, "%s: could not retrieve node's lock info.\n", __FUNCTION__); goto free_and_exit; } if (lock == HGFS_LOCK_NONE) { - LOG(4, ("%s: the file does not have a server lock.\n", __FUNCTION__)); + LOG(4, "%s: the file does not have a server lock.\n", __FUNCTION__); goto free_and_exit; } @@ -339,7 +339,7 @@ HgfsServerOplockBreak(ServerLockData *lockData) requestBuffer = malloc(sizeof *request + HGFS_CLIENT_CMD_LEN); if (requestBuffer == NULL) { - LOG(4, ("%s: could not allocate memory.\n", __FUNCTION__)); + LOG(4, "%s: could not allocate memory.\n", __FUNCTION__); goto ack_and_exit; } diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerOplockLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerOplockLinux.c index 7ffbfeb7a..90098052f 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerOplockLinux.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerOplockLinux.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2012-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2012-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -183,7 +183,7 @@ HgfsAcquireServerLock(fileDesc fileDesc, // IN: OS handle } else if (desiredLock == HGFS_LOCK_SHARED) { leaseType = F_RDLCK; } else { - LOG(4, ("%s: Unknown server lock\n", __FUNCTION__)); + LOG(4, "%s: Unknown server lock\n", __FUNCTION__); return FALSE; } @@ -198,24 +198,24 @@ HgfsAcquireServerLock(fileDesc fileDesc, // IN: OS handle leaseType = F_RDLCK; if (fcntl(fileDesc, F_SETLEASE, leaseType)) { error = errno; - LOG(4, ("%s: Could not get any opportunistic lease for fd %d: %s\n", - __FUNCTION__, fileDesc, Err_Errno2String(error))); + LOG(4, "%s: Could not get any opportunistic lease for fd %d: %s\n", + __FUNCTION__, fileDesc, Err_Errno2String(error)); return FALSE; } } else { error = errno; - LOG(4, ("%s: Could not get %s lease for fd %d: %s\n", - __FUNCTION__, leaseType == F_WRLCK ? "write" : "read", - fileDesc, Err_Errno2String(errno))); + LOG(4, "%s: Could not get %s lease for fd %d: %s\n", + __FUNCTION__, leaseType == F_WRLCK ? "write" : "read", + fileDesc, Err_Errno2String(errno)); return FALSE; } } /* Got a lease of some kind. */ - LOG(4, ("%s: Got %s lease for fd %d\n", __FUNCTION__, - leaseType == F_WRLCK ? "write" : "read", fileDesc)); + LOG(4, "%s: Got %s lease for fd %d\n", __FUNCTION__, + leaseType == F_WRLCK ? "write" : "read", fileDesc); *serverLock = leaseType == F_WRLCK ? HGFS_LOCK_EXCLUSIVE : HGFS_LOCK_SHARED; return TRUE; #else @@ -255,7 +255,7 @@ HgfsAckOplockBreak(ServerLockData *lockData, // IN: server lock info ASSERT(lockData); fileDesc = lockData->fileDesc; - LOG(4, ("%s: Acknowledging break on fd %d\n", __FUNCTION__, fileDesc)); + LOG(4, "%s: Acknowledging break on fd %d\n", __FUNCTION__, fileDesc); /* * The Linux server supports lock downgrading. We only downgrade to a shared @@ -317,7 +317,7 @@ HgfsServerSigOplockBreak(int sigNum, // IN: Signal number ASSERT(clientData == NULL); fd = info->si_fd; - LOG(4, ("%s: Received SIGIO for fd %d\n", __FUNCTION__, fd)); + LOG(4, "%s: Received SIGIO for fd %d\n", __FUNCTION__, fd); /* * We've got all we need from the signal handler, let it continue handling diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerPacketUtil.c b/open-vm-tools/lib/hgfsServer/hgfsServerPacketUtil.c index 230a6f933..4ac8591f1 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerPacketUtil.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerPacketUtil.c @@ -210,8 +210,8 @@ HSPU_GetReplyPacket(HgfsPacket *packet, // IN/OUT: Hgfs Packet * is a static buffer. Backdoor should always return from here. */ packet->replyPacketDataSize = replyDataSize; - LOG(4, ("Existing reply packet %s %"FMTSZ"u %"FMTSZ"u\n", __FUNCTION__, - replyDataSize, packet->replyPacketSize)); + LOG(4, "Existing reply packet %s %"FMTSZ"u %"FMTSZ"u\n", __FUNCTION__, + replyDataSize, packet->replyPacketSize); ASSERT(replyDataSize <= packet->replyPacketSize); } else if (chanCb != NULL && chanCb->getWriteVa != NULL) { /* Can we write directly into guest memory? */ @@ -224,7 +224,7 @@ HSPU_GetReplyPacket(HgfsPacket *packet, // IN/OUT: Hgfs Packet * This will change as it is grossly inefficient as the maximum size * is always mapped and copied no matter how much data it really contains. */ - LOG(10, ("%s Using meta packet for reply packet\n", __FUNCTION__)); + LOG(10, "%s Using meta packet for reply packet\n", __FUNCTION__); ASSERT(BUF_READWRITEABLE == packet->metaMappingType); ASSERT(replyDataSize <= packet->metaPacketSize); @@ -245,7 +245,7 @@ HSPU_GetReplyPacket(HgfsPacket *packet, // IN/OUT: Hgfs Packet } } else { /* For sockets channel we always need to allocate buffer */ - LOG(10, ("%s Allocating reply packet\n", __FUNCTION__)); + LOG(10, "%s Allocating reply packet\n", __FUNCTION__); packet->replyPacket = Util_SafeMalloc(replyDataSize); packet->replyPacketIsAllocated = TRUE; packet->replyPacketDataSize = replyDataSize; @@ -282,7 +282,7 @@ HSPU_PutReplyPacket(HgfsPacket *packet, // IN/OUT: Hgfs Packet * put on the metapacket. */ if (packet->replyPacketIsAllocated) { - LOG(10, ("%s Freeing reply packet", __FUNCTION__)); + LOG(10, "%s Freeing reply packet", __FUNCTION__); free(packet->replyPacket); packet->replyPacketIsAllocated = FALSE; packet->replyPacket = NULL; @@ -479,7 +479,7 @@ HSPUGetBuf(HgfsServerChannelCallbacks *chanCb, // IN: Channel callbacks /* More than one page was mapped. */ ASSERT(iov[startIndex].len < bufSize); - LOG(10, ("%s: Hgfs Allocating buffer \n", __FUNCTION__)); + LOG(10, "%s: Hgfs Allocating buffer \n", __FUNCTION__); *buf = Util_SafeMalloc(bufSize); *isAllocated = TRUE; @@ -524,7 +524,7 @@ HSPU_PutMetaPacket(HgfsPacket *packet, // IN/OUT: Hgfs Packet return; } - LOG(4, ("%s Hgfs Putting Meta packet\n", __FUNCTION__)); + LOG(4, "%s Hgfs Putting Meta packet\n", __FUNCTION__); HSPUPutBuf(chanCb, packet->metaMappingType, packet->iov, @@ -586,7 +586,7 @@ HSPU_PutDataPacketBuf(HgfsPacket *packet, // IN/OUT: Hgfs Pack return; } - LOG(4, ("%s Hgfs Putting Data packet\n", __FUNCTION__)); + LOG(4, "%s Hgfs Putting Data packet\n", __FUNCTION__); HSPUPutBuf(chanCb, packet->dataMappingType, packet->iov, @@ -658,7 +658,7 @@ HSPUPutBuf(HgfsServerChannelCallbacks *chanCb, // IN: Channel callbacks exit: if (*isAllocated) { - LOG(10, ("%s: Hgfs Freeing buffer \n", __FUNCTION__)); + LOG(10, "%s: Hgfs Freeing buffer \n", __FUNCTION__); free(*buf); *isAllocated = FALSE; } diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerParameters.c b/open-vm-tools/lib/hgfsServer/hgfsServerParameters.c index e5686b473..8b601829c 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerParameters.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerParameters.c @@ -157,7 +157,7 @@ HgfsValidateReplySize(char const *packetIn, result = TRUE; } if (!result) { - LOG(4, ("%s: Reply exceeded maximum support size!\n", __FUNCTION__)); + LOG(4, "%s: Reply exceeded maximum support size!\n", __FUNCTION__); } return result; } @@ -307,23 +307,23 @@ HgfsUnpackHeaderV4(const HgfsHeader *requestHeader, // IN: request header HgfsInternalStatus status = HGFS_ERROR_SUCCESS; if (requestSize < sizeof *requestHeader) { - LOG(4, ("%s: Malformed HGFS packet received - header is too small!\n", - __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - header is too small!\n", + __FUNCTION__); status = HGFS_ERROR_PROTOCOL; goto exit; } if (requestSize < requestHeader->packetSize || requestHeader->packetSize < requestHeader->headerSize) { - LOG(4, ("%s: Malformed HGFS packet received - inconsistent header" - " and packet sizes!\n", __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - inconsistent header " + "and packet sizes!\n", __FUNCTION__); status = HGFS_ERROR_PROTOCOL; goto exit; } if (HGFS_HEADER_VERSION_1 > requestHeader->version) { - LOG(4, ("%s: Malformed HGFS packet received - invalid header version!\n", - __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - invalid header version!\n", + __FUNCTION__); status = HGFS_ERROR_PROTOCOL; goto exit; } @@ -399,15 +399,15 @@ HgfsUnpackPacketParams(const void *packet, // IN: HGFS packet ASSERT(NULL != packet); request = packet; - LOG(4, ("%s: Received a request with opcode %d.\n", __FUNCTION__, request->op)); + LOG(4, "%s: Received a request with opcode %d.\n", __FUNCTION__, request->op); /* * Error out if less than HgfsRequest size. * We cannot continue any further with this packet. */ if (packetSize < sizeof *request) { - LOG(4, ("%s: Received a request with opcode %"FMTSZ"u.\n", - __FUNCTION__, packetSize)); + LOG(4, "%s: Received a request with opcode %"FMTSZ"u.\n", + __FUNCTION__, packetSize); unpackStatus = HGFS_ERROR_INTERNAL; goto exit; } @@ -457,14 +457,14 @@ HgfsUnpackPacketParams(const void *packet, // IN: HGFS packet } } else { - LOG(4, ("%s: HGFS packet - unknown opcode == newer client or malformed!\n", - __FUNCTION__)); + LOG(4, "%s: HGFS packet - unknown opcode == newer client or malformed!\n", + __FUNCTION__); unpackStatus = HGFS_ERROR_INTERNAL; } exit: - LOG(4, ("%s: unpacked request(op %d, id %u) -> %u.\n", __FUNCTION__, - request->op, *requestId, unpackStatus)); + LOG(4, "%s: unpacked request(op %d, id %u) -> %u.\n", __FUNCTION__, + request->op, *requestId, unpackStatus); return unpackStatus; } @@ -496,7 +496,8 @@ HgfsUnpackOpenPayloadV1(const HgfsRequestOpen *requestV1, // IN: request payload /* Enforced by the dispatch function. */ if (payloadSize < sizeof *requestV1) { - LOG(4, ("%s: Malformed HGFS packet received - payload too small\n", __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - payload too small\n", + __FUNCTION__); return FALSE; } @@ -508,7 +509,8 @@ HgfsUnpackOpenPayloadV1(const HgfsRequestOpen *requestV1, // IN: request payload */ if (requestV1->fileName.length > extra) { /* The input packet is smaller than the request. */ - LOG(4, ("%s: Malformed HGFS packet received - payload too small to hold file name\n", __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - payload too small to hold file name\n", + __FUNCTION__); return FALSE; } @@ -553,7 +555,8 @@ HgfsUnpackOpenPayloadV2(const HgfsRequestOpenV2 *requestV2, // IN: request paylo /* Enforced by the dispatch function. */ if (payloadSize < sizeof *requestV2) { - LOG(4, ("%s: Malformed HGFS packet received - payload too small\n", __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - payload too small\n", + __FUNCTION__); return FALSE; } @@ -561,7 +564,8 @@ HgfsUnpackOpenPayloadV2(const HgfsRequestOpenV2 *requestV2, // IN: request paylo if (!(requestV2->mask & HGFS_OPEN_VALID_FILE_NAME)) { /* We do not support open requests without a valid file name. */ - LOG(4, ("%s: Malformed HGFS packet received - invalid mask\n", __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - invalid mask\n", + __FUNCTION__); return FALSE; } @@ -571,7 +575,8 @@ HgfsUnpackOpenPayloadV2(const HgfsRequestOpenV2 *requestV2, // IN: request paylo */ if (requestV2->fileName.length > extra) { /* The input packet is smaller than the request. */ - LOG(4, ("%s: Malformed HGFS packet received - payload too small to hold file name\n", __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - payload too small to hold file name\n", + __FUNCTION__); return FALSE; } @@ -626,7 +631,8 @@ HgfsUnpackOpenPayloadV3(const HgfsRequestOpenV3 *requestV3, // IN: request paylo /* Enforced by the dispatch function. */ if (payloadSize < sizeof *requestV3) { - LOG(4, ("%s: Malformed HGFS packet received - payload too small\n", __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - payload too small\n", + __FUNCTION__); return FALSE; } @@ -634,7 +640,8 @@ HgfsUnpackOpenPayloadV3(const HgfsRequestOpenV3 *requestV3, // IN: request paylo if (!(requestV3->mask & HGFS_OPEN_VALID_FILE_NAME)) { /* We do not support open requests without a valid file name. */ - LOG(4, ("%s: Malformed HGFS packet received - incorrect mask\n", __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - incorrect mask\n", + __FUNCTION__); return FALSE; } @@ -644,7 +651,8 @@ HgfsUnpackOpenPayloadV3(const HgfsRequestOpenV3 *requestV3, // IN: request paylo */ if (requestV3->fileName.length > extra) { /* The input packet is smaller than the request. */ - LOG(4, ("%s: Malformed HGFS packet received - payload too small to hold file name\n", __FUNCTION__)); + LOG(4, "%s: Malformed HGFS packet received - payload too small to hold file name\n", + __FUNCTION__); return FALSE; } @@ -707,21 +715,21 @@ HgfsUnpackOpenRequest(const void *packet, // IN: HGFS packet switch (op) { case HGFS_OP_OPEN_V3: { const HgfsRequestOpenV3 *requestV3 = packet; - LOG(4, ("%s: HGFS_OP_OPEN_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_OPEN_V3\n", __FUNCTION__); result = HgfsUnpackOpenPayloadV3(requestV3, packetSize, openInfo); break; } case HGFS_OP_OPEN_V2: { const HgfsRequestOpenV2 *requestV2 = packet; - LOG(4, ("%s: HGFS_OP_OPEN_V2\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_OPEN_V2\n", __FUNCTION__); result = HgfsUnpackOpenPayloadV2(requestV2, packetSize, openInfo); break; } case HGFS_OP_OPEN: { const HgfsRequestOpen *requestV1 = packet; - LOG(4, ("%s: HGFS_OP_OPEN\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_OPEN\n", __FUNCTION__); result = HgfsUnpackOpenPayloadV1(requestV1, packetSize, openInfo); break; @@ -732,7 +740,7 @@ HgfsUnpackOpenRequest(const void *packet, // IN: HGFS packet } if (!result) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); } return result; } @@ -1043,7 +1051,7 @@ HgfsUnpackClosePayload(const HgfsRequestClose *request, // IN: payload size_t payloadSize, // IN: payload size HgfsHandle* file) // OUT: HGFS handle to close { - LOG(4, ("%s: HGFS_OP_CLOSE\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_CLOSE\n", __FUNCTION__); if (payloadSize >= sizeof *request) { *file = request->file; return TRUE; @@ -1074,12 +1082,12 @@ HgfsUnpackClosePayloadV3(const HgfsRequestCloseV3 *requestV3, // IN: payload size_t payloadSize, // IN: payload size HgfsHandle* file) // OUT: HGFS handle to close { - LOG(4, ("%s: HGFS_OP_CLOSE_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_CLOSE_V3\n", __FUNCTION__); if (payloadSize >= sizeof *requestV3) { *file = requestV3->file; return TRUE; } - LOG(4, ("%s: Too small HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Too small HGFS packet\n", __FUNCTION__); return FALSE; } @@ -1114,7 +1122,7 @@ HgfsUnpackCloseRequest(const void *packet, // IN: request packet const HgfsRequestCloseV3 *requestV3 = packet; if (!HgfsUnpackClosePayloadV3(requestV3, packetSize, file)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -1123,7 +1131,7 @@ HgfsUnpackCloseRequest(const void *packet, // IN: request packet const HgfsRequestClose *requestV1 = packet; if (!HgfsUnpackClosePayload(requestV1, packetSize, file)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -1216,12 +1224,12 @@ HgfsUnpackSearchClosePayload(const HgfsRequestSearchClose *request, // IN: paylo size_t payloadSize, // IN: payload size HgfsHandle* search) // OUT: search to close { - LOG(4, ("%s: HGFS_OP_SEARCH_CLOSE\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_SEARCH_CLOSE\n", __FUNCTION__); if (payloadSize >= sizeof *request) { *search = request->search; return TRUE; } - LOG(4, ("%s: Too small HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Too small HGFS packet\n", __FUNCTION__); return FALSE; } @@ -1249,12 +1257,12 @@ HgfsUnpackSearchClosePayloadV3(const HgfsRequestSearchCloseV3 *requestV3, // IN: size_t payloadSize, // IN: payload size HgfsHandle* search) // OUT: search { - LOG(4, ("%s: HGFS_OP_SEARCH_CLOSE_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_SEARCH_CLOSE_V3\n", __FUNCTION__); if (payloadSize >= sizeof *requestV3) { *search = requestV3->search; return TRUE; } - LOG(4, ("%s: Too small HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Too small HGFS packet\n", __FUNCTION__); return FALSE; } @@ -1289,7 +1297,7 @@ HgfsUnpackSearchCloseRequest(const void *packet, // IN: request packet const HgfsRequestSearchCloseV3 *requestV3 = packet; if (!HgfsUnpackSearchClosePayloadV3(requestV3, packetSize, search)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -1298,7 +1306,7 @@ HgfsUnpackSearchCloseRequest(const void *packet, // IN: request packet const HgfsRequestSearchClose *requestV1 = packet; if (!HgfsUnpackSearchClosePayload(requestV1, packetSize, search)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -1454,7 +1462,8 @@ HgfsUnpackFileNameV3(const HgfsFileNameV3 *name, // IN: file name */ if (name->length > maxNameSize) { /* The input packet is smaller than the request */ - LOG(4, ("%s: Error unpacking file name - buffer too small\n", __FUNCTION__)); + LOG(4, "%s: Error unpacking file name - buffer too small\n", + __FUNCTION__); return FALSE; } *cpName = name->name; @@ -1524,7 +1533,8 @@ HgfsUnpackDeletePayloadV3(const HgfsRequestDeleteV3 *requestV3, // IN: request p } exit: - LOG(8, ("%s: unpacking HGFS_OP_DELETE_DIR/FILE_V3 -> %d\n", __FUNCTION__, result)); + LOG(8, "%s: unpacking HGFS_OP_DELETE_DIR/FILE_V3 -> %d\n", __FUNCTION__, + result); return result; } @@ -1680,7 +1690,7 @@ HgfsUnpackDeleteRequest(const void *packet, // IN: HGFS packet hints, file, caseFlags)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -1695,7 +1705,7 @@ HgfsUnpackDeleteRequest(const void *packet, // IN: HGFS packet cpNameSize, hints, file)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -1708,14 +1718,14 @@ HgfsUnpackDeleteRequest(const void *packet, // IN: HGFS packet packetSize, cpName, cpNameSize)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; } default: NOT_REACHED(); - LOG(4, ("%s: Invalid opcode\n", __FUNCTION__)); + LOG(4, "%s: Invalid opcode\n", __FUNCTION__); return FALSE; } @@ -1779,7 +1789,7 @@ HgfsPackDeleteReply(HgfsPacket *packet, // IN/OUT: Hgfs Packet break; } default: - LOG(4, ("%s: invalid op code %d\n", __FUNCTION__, op)); + LOG(4, "%s: invalid op code %d\n", __FUNCTION__, op); result = FALSE; NOT_REACHED(); } @@ -1825,7 +1835,7 @@ HgfsUnpackRenamePayloadV3(const HgfsRequestRenameV3 *requestV3, // IN: request p const HgfsFileNameV3 *newName; Bool useHandle; - LOG(4, ("%s: HGFS_OP_RENAME_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_RENAME_V3\n", __FUNCTION__); if (payloadSize < sizeof *requestV3) { return FALSE; @@ -1857,7 +1867,7 @@ HgfsUnpackRenamePayloadV3(const HgfsRequestRenameV3 *requestV3, // IN: request p cpOldNameLen, srcFile, oldCaseFlags)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } if (useHandle) { @@ -1874,14 +1884,14 @@ HgfsUnpackRenamePayloadV3(const HgfsRequestRenameV3 *requestV3, // IN: request p cpNewNameLen, targetFile, newCaseFlags)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } if (useHandle) { *hints |= HGFS_RENAME_HINT_USE_TARGETFILE_DESC; } - LOG(8, ("%s: unpacking HGFS_OP_RENAME_V3 -> success\n", __FUNCTION__)); + LOG(8, "%s: unpacking HGFS_OP_RENAME_V3 -> success\n", __FUNCTION__); return TRUE; } @@ -1922,7 +1932,7 @@ HgfsUnpackRenamePayloadV2(const HgfsRequestRenameV2 *requestV2, // IN: request p /* Enforced by the dispatch function. */ if (payloadSize < sizeof *requestV2) { - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } extra = payloadSize - sizeof *requestV2; @@ -1944,7 +1954,8 @@ HgfsUnpackRenamePayloadV2(const HgfsRequestRenameV2 *requestV2, // IN: request p extra, cpOldName, cpOldNameLen)) { - LOG(4, ("%s: Error decoding HGFS packet - not enough room for file name\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet - not enough room for file name\n", + __FUNCTION__); return FALSE; } extra -= *cpOldNameLen; @@ -1961,7 +1972,8 @@ HgfsUnpackRenamePayloadV2(const HgfsRequestRenameV2 *requestV2, // IN: request p extra, cpNewName, cpNewNameLen)) { - LOG(4, ("%s: Error decoding HGFS packet - not enough room for file name\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet - not enough room for file name\n", + __FUNCTION__); return FALSE; } } @@ -2008,7 +2020,8 @@ HgfsUnpackRenamePayloadV1(const HgfsRequestRename *requestV1, // IN: request pay extra, cpOldName, cpOldNameLen)) { - LOG(4, ("%s: Error decoding HGFS packet - not enough room for file name\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet - not enough room for file name\n", + __FUNCTION__); return FALSE; } @@ -2085,7 +2098,7 @@ HgfsUnpackRenameRequest(const void *packet, // IN: HGFS packet targetFile, oldCaseFlags, newCaseFlags)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -2102,7 +2115,7 @@ HgfsUnpackRenameRequest(const void *packet, // IN: HGFS packet hints, srcFile, targetFile)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -2117,14 +2130,14 @@ HgfsUnpackRenameRequest(const void *packet, // IN: HGFS packet cpOldNameLen, cpNewName, cpNewNameLen)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; } default: - LOG(4, ("%s: Invalid opcode %d\n", __FUNCTION__, op)); + LOG(4, "%s: Invalid opcode %d\n", __FUNCTION__, op); NOT_REACHED(); return FALSE; } @@ -2187,7 +2200,7 @@ HgfsPackRenameReply(HgfsPacket *packet, // IN/OUT: Hgfs Packet break; } default: - LOG(4, ("%s: invalid op code %d\n", __FUNCTION__, op)); + LOG(4, "%s: invalid op code %d\n", __FUNCTION__, op); result = FALSE; NOT_REACHED(); } @@ -2251,7 +2264,7 @@ HgfsUnpackGetattrPayloadV3(const HgfsRequestGetattrV3 *requestV3,// IN: request } exit: - LOG(8, ("%s: unpacking HGFS_OP_GETATTR_V3 -> %d\n", __FUNCTION__, result)); + LOG(8, "%s: unpacking HGFS_OP_GETATTR_V3 -> %d\n", __FUNCTION__, result); return result; } @@ -2477,7 +2490,7 @@ HgfsPackGetattrReplyPayloadV3(HgfsFileAttrInfo *attr, // IN: attr stucture uint32 utf8TargetNameLen, // IN: file name length HgfsReplyGetattrV3 *reply) // OUT: payload { - LOG(4, ("%s: attr type: %u\n", __FUNCTION__, attr->type)); + LOG(4, "%s: attr type: %u\n", __FUNCTION__, attr->type); HgfsPackAttrV2(attr, &reply->attr); reply->reserved = 0; @@ -2629,10 +2642,10 @@ HgfsUnpackGetattrRequest(const void *packet, // IN: HGFS packet hints, file, caseType)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } - LOG(4, ("%s: HGFS_OP_GETATTR_V3: %u\n", __FUNCTION__, *caseType)); + LOG(4, "%s: HGFS_OP_GETATTR_V3: %u\n", __FUNCTION__, *caseType); break; } @@ -2645,7 +2658,7 @@ HgfsUnpackGetattrRequest(const void *packet, // IN: HGFS packet cpNameSize, hints, file)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -2655,7 +2668,7 @@ HgfsUnpackGetattrRequest(const void *packet, // IN: HGFS packet const HgfsRequestGetattr *requestV1 = packet; if (!HgfsUnpackGetattrPayloadV1(requestV1, packetSize, cpName, cpNameSize)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -2736,7 +2749,7 @@ HgfsPackGetattrReply(HgfsPacket *packet, // IN/OUT: Hgfs Packet } default: - LOG(4, ("%s: Invalid GetAttr op.\n", __FUNCTION__)); + LOG(4, "%s: Invalid GetAttr op.\n", __FUNCTION__); NOT_REACHED(); result = FALSE; @@ -3137,7 +3150,7 @@ HgfsUnpackSearchReadRequest(const void *packet, // IN: request packet *inlineReplyDataSize = 0; ASSERT(*replyPayloadSize > 0); - LOG(4, ("%s: HGFS_OP_SEARCH_READ_V4\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_SEARCH_READ_V4\n", __FUNCTION__); break; } @@ -3160,7 +3173,7 @@ HgfsUnpackSearchReadRequest(const void *packet, // IN: request packet *replyPayloadSize = HGFS_PACKET_MAX - *baseReplySize; *inlineReplyDataSize = *replyPayloadSize; - LOG(4, ("%s: HGFS_OP_SEARCH_READ_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_SEARCH_READ_V3\n", __FUNCTION__); break; } @@ -3385,7 +3398,7 @@ HgfsPackSearchReadReplyHeader(HgfsSearchReadInfo *info, // IN: request info } default: { - LOG(4, ("%s: Invalid SearchRead Op.", __FUNCTION__)); + LOG(4, "%s: Invalid SearchRead Op.", __FUNCTION__); NOT_REACHED(); result = FALSE; } @@ -3453,7 +3466,7 @@ HgfsUnpackSetattrPayloadV3(const HgfsRequestSetattrV3 *requestV3,// IN: request } exit: - LOG(8, ("%s: unpacking HGFS_OP_SETATTR_V3 -> %d\n", __FUNCTION__, result)); + LOG(8, "%s: unpacking HGFS_OP_SETATTR_V3 -> %d\n", __FUNCTION__, result); return result; } @@ -3494,7 +3507,7 @@ HgfsUnpackSetattrPayloadV2(const HgfsRequestSetattrV2 *requestV2,// IN: request return FALSE; } - LOG(4, ("%s: unpacking HGFS_OP_SETATTR_V2\n", __FUNCTION__)); + LOG(4, "%s: unpacking HGFS_OP_SETATTR_V2\n", __FUNCTION__); *file = HGFS_INVALID_HANDLE; *hints = requestV2->hints; @@ -3541,7 +3554,7 @@ HgfsUnpackSetattrPayloadV1(const HgfsRequestSetattr *requestV1, // IN: request size_t *cpNameSize, // OUT: cpName size HgfsAttrHint *hints) // OUT: setattr hints { - LOG(4, ("%s: unpacking HGFS_OP_SETATTR\n", __FUNCTION__)); + LOG(4, "%s: unpacking HGFS_OP_SETATTR\n", __FUNCTION__); attr->mask = 0; attr->mask |= requestV1->update & HGFS_ATTR_SIZE ? HGFS_ATTR_VALID_SIZE : 0; @@ -3629,7 +3642,7 @@ HgfsUnpackSetattrRequest(const void *packet, // IN: HGFS packet hints, file, caseType)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -3644,7 +3657,7 @@ HgfsUnpackSetattrRequest(const void *packet, // IN: HGFS packet cpNameSize, hints, file)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -3657,13 +3670,13 @@ HgfsUnpackSetattrRequest(const void *packet, // IN: HGFS packet cpName, cpNameSize, hints)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; } default: - LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, op)); + LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, op); NOT_REACHED(); return FALSE; } @@ -3725,7 +3738,7 @@ HgfsPackSetattrReply(HgfsPacket *packet, // IN/OUT: Hgfs Packet } default: result = FALSE; - LOG(4, ("%s: invalid op code %d\n", __FUNCTION__, op)); + LOG(4, "%s: invalid op code %d\n", __FUNCTION__, op); NOT_REACHED(); } @@ -3761,7 +3774,7 @@ HgfsUnpackCreateDirPayloadV3(const HgfsRequestCreateDirV3 *requestV3, // IN: req * carefully written to prevent wraparounds. */ - LOG(4, ("%s: HGFS_OP_CREATE_DIR_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_CREATE_DIR_V3\n", __FUNCTION__); ASSERT(payloadSize >= sizeof *requestV3); if (requestV3->fileName.length > payloadSize - sizeof *requestV3) { /* The input packet is smaller than the request. */ @@ -3769,7 +3782,7 @@ HgfsUnpackCreateDirPayloadV3(const HgfsRequestCreateDirV3 *requestV3, // IN: req } if (!(requestV3->mask & HGFS_CREATE_DIR_VALID_FILE_NAME)) { /* We do not support requests without a valid file name. */ - LOG(4, ("%s: Incorrect mask %x\n", __FUNCTION__, (uint32)requestV3->mask)); + LOG(4, "%s: Incorrect mask %x\n", __FUNCTION__, (uint32)requestV3->mask); return FALSE; } @@ -3820,7 +3833,7 @@ HgfsUnpackCreateDirPayloadV2(const HgfsRequestCreateDirV2 *requestV2, // IN: req * carefully written to prevent wraparounds. */ - LOG(4, ("%s: HGFS_OP_CREATE_DIR_V2\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_CREATE_DIR_V2\n", __FUNCTION__); ASSERT(payloadSize >= sizeof *requestV2); if (requestV2->fileName.length > payloadSize - sizeof *requestV2) { /* The input packet is smaller than the request. */ @@ -3828,7 +3841,7 @@ HgfsUnpackCreateDirPayloadV2(const HgfsRequestCreateDirV2 *requestV2, // IN: req } if (!(requestV2->mask & HGFS_CREATE_DIR_VALID_FILE_NAME)) { /* We do not support requests without a valid file name. */ - LOG(4, ("%s: Incorrect mask %x\n", __FUNCTION__, (uint32)requestV2->mask)); + LOG(4, "%s: Incorrect mask %x\n", __FUNCTION__, (uint32)requestV2->mask); return FALSE; } @@ -3878,11 +3891,11 @@ HgfsUnpackCreateDirPayloadV1(const HgfsRequestCreateDir *requestV1, // IN: reque * carefully written to prevent wraparounds. */ - LOG(4, ("%s: HGFS_OP_CREATE_DIR_V1\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_CREATE_DIR_V1\n", __FUNCTION__); ASSERT(payloadSize >= sizeof *requestV1); if (requestV1->fileName.length > payloadSize - sizeof *requestV1) { /* The input packet is smaller than the request. */ - LOG(4, ("%s: HGFS packet too small for the file name\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small for the file name\n", __FUNCTION__); return FALSE; } @@ -3934,7 +3947,7 @@ HgfsUnpackCreateDirRequest(const void *packet, // IN: incoming packet if (!HgfsUnpackCreateDirPayloadV3(requestV3, packetSize, info)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -3945,7 +3958,7 @@ HgfsUnpackCreateDirRequest(const void *packet, // IN: incoming packet if (!HgfsUnpackCreateDirPayloadV2(requestV2, packetSize, info)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -3955,13 +3968,13 @@ HgfsUnpackCreateDirRequest(const void *packet, // IN: incoming packet if (!HgfsUnpackCreateDirPayloadV1(requestV1, packetSize, info)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; } default: - LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, op)); + LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, op); NOT_REACHED(); return FALSE; } @@ -4026,7 +4039,7 @@ HgfsPackCreateDirReply(HgfsPacket *packet, // IN/OUT: Hgfs Packet } default: result = FALSE; - LOG(4, ("%s: invalid op code %d\n", __FUNCTION__, op)); + LOG(4, "%s: invalid op code %d\n", __FUNCTION__, op); NOT_REACHED(); } @@ -4060,9 +4073,9 @@ HgfsUnpackWriteWin32StreamPayloadV3(const HgfsRequestWriteWin32StreamV3 *request size_t *dataSize, // OUT: Bool *doSecurity) // OUT: { - LOG(4, ("%s: HGFS_OP_WRITE_WIN32_STREAM_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_WRITE_WIN32_STREAM_V3\n", __FUNCTION__); if (payloadSize < sizeof *requestV3) { - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } @@ -4074,7 +4087,7 @@ HgfsUnpackWriteWin32StreamPayloadV3(const HgfsRequestWriteWin32StreamV3 *request return TRUE; } - LOG(4, ("%s: HGFS packet too small - user data do not fit\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small - user data do not fit\n", __FUNCTION__); return FALSE; } @@ -4113,7 +4126,7 @@ HgfsUnpackWriteWin32StreamRequest(const void *packet, // IN: incoming packet if (op != HGFS_OP_WRITE_WIN32_STREAM_V3) { /* The only supported version for the moment is V3. */ - LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, op)); + LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, op); NOT_REACHED(); return FALSE; } @@ -4164,7 +4177,7 @@ HgfsPackWriteWin32StreamReply(HgfsPacket *packet, // IN/OUT: Hgfs Packet reply->actualSize = actualSize; *payloadSize = sizeof *reply; } else { - LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, op)); + LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, op); NOT_REACHED(); result = FALSE; } @@ -4198,14 +4211,14 @@ HgfsUnpackReadPayload(const HgfsRequestRead *request, // IN: payload uint64 *offset, // OUT: offset to read from uint32 *length) // OUT: length of data to read { - LOG(4, ("%s: HGFS_OP_READ\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_READ\n", __FUNCTION__); if (payloadSize >= sizeof *request) { *file = request->file; *offset = request->offset; *length = request->requiredSize; return TRUE; } - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } @@ -4234,14 +4247,14 @@ HgfsUnpackReadPayloadV3(const HgfsRequestReadV3 *requestV3, // IN: payload uint64 *offset, // OUT: offset to read from uint32 *length) // OUT: length of data to read { - LOG(4, ("%s: HGFS_OP_READ_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_READ_V3\n", __FUNCTION__); if (payloadSize >= sizeof *requestV3) { *file = requestV3->file; *offset = requestV3->offset; *length = requestV3->requiredSize; return TRUE; } - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } @@ -4295,7 +4308,7 @@ HgfsUnpackReadRequest(const void *packet, // IN: HGFS request } if (!result) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); } return result; @@ -4329,7 +4342,7 @@ HgfsUnpackWritePayload(const HgfsRequestWrite *request, // IN: request payloa HgfsWriteFlags *flags, // OUT: write flags const void **data) // OUT: data to be written { - LOG(4, ("%s: HGFS_OP_WRITE\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_WRITE\n", __FUNCTION__); if (payloadSize >= sizeof *request) { if (sizeof *request + request->requiredSize - 1 <= payloadSize) { *file = request->file; @@ -4340,7 +4353,7 @@ HgfsUnpackWritePayload(const HgfsRequestWrite *request, // IN: request payloa return TRUE; } } - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } @@ -4371,7 +4384,7 @@ HgfsUnpackWritePayloadV3(const HgfsRequestWriteV3 *requestV3, // IN: payload HgfsWriteFlags *flags, // OUT: write flags const void **data) // OUT: data to be written { - LOG(4, ("%s: HGFS_OP_WRITE_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_WRITE_V3\n", __FUNCTION__); if (payloadSize >= sizeof *requestV3) { if (sizeof *requestV3 + requestV3->requiredSize - 1 <= payloadSize) { *file = requestV3->file; @@ -4382,7 +4395,7 @@ HgfsUnpackWritePayloadV3(const HgfsRequestWriteV3 *requestV3, // IN: payload return TRUE; } } - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } @@ -4414,7 +4427,7 @@ HgfsUnpackWriteFastPayloadV4(const HgfsRequestWriteV3 *requestV3, // IN: payload uint32 *length, // OUT: size of data to write HgfsWriteFlags *flags) // OUT: write flags { - LOG(4, ("%s: HGFS_OP_WRITE_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_WRITE_V3\n", __FUNCTION__); if (payloadSize >= sizeof *requestV3) { *file = requestV3->file; *flags = requestV3->flags; @@ -4422,7 +4435,7 @@ HgfsUnpackWriteFastPayloadV4(const HgfsRequestWriteV3 *requestV3, // IN: payload *length = requestV3->requiredSize; return TRUE; } - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } @@ -4480,13 +4493,13 @@ HgfsUnpackWriteRequest(const void *writeRequest,// IN: write request params break; } default: - LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, writeOp)); + LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, writeOp); NOT_REACHED(); result = FALSE; } if (!result) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); } return result; @@ -4575,14 +4588,14 @@ HgfsUnpackQueryVolumePayload(const HgfsRequestQueryVolume *request, // IN: reque const char **fileName, // OUT: volume name size_t *nameLength) // OUT: volume name length { - LOG(4, ("%s: HGFS_OP_QUERY_VOLUME_INFO\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_QUERY_VOLUME_INFO\n", __FUNCTION__); if (payloadSize >= sizeof *request) { return HgfsUnpackFileName(&request->fileName, payloadSize - sizeof *request + 1, fileName, nameLength); } - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } @@ -4613,7 +4626,7 @@ HgfsUnpackQueryVolumePayloadV3(const HgfsRequestQueryVolumeV3 *requestV3, // IN: size_t *nameLength, // OUT: name length uint32 * caseFlags) // OUT: case flags { - LOG(4, ("%s: HGFS_OP_QUERY_VOLUME_INFO_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_QUERY_VOLUME_INFO_V3\n", __FUNCTION__); if (payloadSize >= sizeof *requestV3) { return HgfsUnpackFileNameV3(&requestV3->fileName, payloadSize - sizeof *requestV3 + 1, @@ -4623,7 +4636,7 @@ HgfsUnpackQueryVolumePayloadV3(const HgfsRequestQueryVolumeV3 *requestV3, // IN: file, caseFlags); } - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } @@ -4664,7 +4677,7 @@ HgfsUnpackQueryVolumeRequest(const void *packet, // IN: HGFS packet if (!HgfsUnpackQueryVolumePayloadV3(requestV3, packetSize, useHandle, file, fileName, fileNameLength, caseFlags)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -4674,7 +4687,7 @@ HgfsUnpackQueryVolumeRequest(const void *packet, // IN: HGFS packet if (!HgfsUnpackQueryVolumePayload(requestV1, packetSize, fileName, fileNameLength)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } *file = HGFS_INVALID_HANDLE; @@ -4683,7 +4696,7 @@ HgfsUnpackQueryVolumeRequest(const void *packet, // IN: HGFS packet break; } default: - LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, op)); + LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, op); NOT_REACHED(); return FALSE; } @@ -4745,7 +4758,7 @@ HgfsPackQueryVolumeReply(HgfsPacket *packet, // IN/OUT: Hgfs Packet } default: result = FALSE; - LOG(4, ("%s: invalid op code %d\n", __FUNCTION__, op)); + LOG(4, "%s: invalid op code %d\n", __FUNCTION__, op); NOT_REACHED(); } @@ -4781,7 +4794,7 @@ HgfsUnpackSymlinkCreatePayload(const HgfsRequestSymlinkCreate *request, // IN: r { uint32 prefixSize; - LOG(4, ("%s: HGFS_OP_CREATE_SYMLINK_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_CREATE_SYMLINK_V3\n", __FUNCTION__); prefixSize = offsetof(HgfsRequestSymlinkCreate, symlinkName.name); if (payloadSize >= prefixSize) { if (HgfsUnpackFileName(&request->symlinkName, @@ -4835,7 +4848,7 @@ HgfsUnpackSymlinkCreatePayloadV3(const HgfsRequestSymlinkCreateV3 *requestV3, // { uint32 prefixSize; - LOG(4, ("%s: HGFS_OP_CREATE_SYMLINK_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_CREATE_SYMLINK_V3\n", __FUNCTION__); prefixSize = offsetof(HgfsRequestSymlinkCreateV3, symlinkName.name); if (payloadSize >= prefixSize) { if (HgfsUnpackFileNameV3(&requestV3->symlinkName, @@ -4913,7 +4926,7 @@ HgfsUnpackSymlinkCreateRequest(const void *packet, // IN: HGFS packet srcFileName, srcFileNameLength, srcCaseFlags, tgUseHandle, tgFile, tgFileName, tgFileNameLength, tgCaseFlags)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -4923,7 +4936,7 @@ HgfsUnpackSymlinkCreateRequest(const void *packet, // IN: HGFS packet if (!HgfsUnpackSymlinkCreatePayload(requestV1, packetSize, srcFileName, srcFileNameLength, tgFileName, tgFileNameLength)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } *srcFile = HGFS_INVALID_HANDLE; @@ -4935,7 +4948,7 @@ HgfsUnpackSymlinkCreateRequest(const void *packet, // IN: HGFS packet break; } default: - LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, op)); + LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, op); NOT_REACHED(); return FALSE; } @@ -4994,7 +5007,7 @@ HgfsPackSymlinkCreateReply(HgfsPacket *packet, // IN/OUT: Hgfs Packet } default: result = FALSE; - LOG(4, ("%s: invalid op code %d\n", __FUNCTION__, op)); + LOG(4, "%s: invalid op code %d\n", __FUNCTION__, op); NOT_REACHED(); } @@ -5025,7 +5038,7 @@ HgfsUnpackSearchOpenPayload(const HgfsRequestSearchOpen *request, // IN: payload const char **dirName, // OUT: directory name size_t *dirNameLength) // OUT: name length { - LOG(4, ("%s: HGFS_OP_SEARCH_OPEN\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_SEARCH_OPEN\n", __FUNCTION__); if (payloadSize >= sizeof *request) { if (sizeof *request + request->dirName.length - 1 <= payloadSize) { *dirName = request->dirName.name; @@ -5033,7 +5046,7 @@ HgfsUnpackSearchOpenPayload(const HgfsRequestSearchOpen *request, // IN: payload return TRUE; } } - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } @@ -5064,7 +5077,7 @@ HgfsUnpackSearchOpenPayloadV3(const HgfsRequestSearchOpenV3 *requestV3, // IN: p uint32 *caseFlags) // OUT: case flags { Bool result = FALSE; - LOG(4, ("%s: HGFS_OP_SEARCH_OPEN_V3\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_SEARCH_OPEN_V3\n", __FUNCTION__); if (payloadSize >= sizeof *requestV3) { uint32 prefixSize = offsetof(HgfsRequestSearchOpenV3, dirName.name); Bool useDirHandle; @@ -5078,11 +5091,11 @@ HgfsUnpackSearchOpenPayloadV3(const HgfsRequestSearchOpenV3 *requestV3, // IN: p &dirHandle, caseFlags); if (useDirHandle) { - LOG(4, ("%s: client is trying to a handle %u\n", __FUNCTION__, dirHandle)); + LOG(4, "%s: client is trying to a handle %u\n", __FUNCTION__, dirHandle); result = FALSE; } } - LOG(4, ("%s: returns %d\n", __FUNCTION__, result)); + LOG(4, "%s: returns %d\n", __FUNCTION__, result); return result; } @@ -5120,7 +5133,7 @@ HgfsUnpackSearchOpenRequest(const void *packet, // IN: HGFS packet if (!HgfsUnpackSearchOpenPayloadV3(requestV3, packetSize, dirName, dirNameLength, caseFlags)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } break; @@ -5130,14 +5143,14 @@ HgfsUnpackSearchOpenRequest(const void *packet, // IN: HGFS packet if (!HgfsUnpackSearchOpenPayload(requestV1, packetSize, dirName, dirNameLength)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } *caseFlags = HGFS_FILE_NAME_DEFAULT_CASE; break; } default: - LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, op)); + LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, op); NOT_REACHED(); return FALSE; } @@ -5226,7 +5239,7 @@ HgfsUnpackCreateSessionPayloadV4(const HgfsRequestCreateSessionV4 *requestV4, // size_t payloadSize, // IN: HgfsCreateSessionInfo *info) // IN/OUT: info { - LOG(4, ("%s: HGFS_OP_CREATE_SESSION_V4\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_CREATE_SESSION_V4\n", __FUNCTION__); if (payloadSize < offsetof(HgfsRequestCreateSessionV4, reserved)) { /* The input packet is smaller than the request. */ return FALSE; @@ -5235,7 +5248,7 @@ HgfsUnpackCreateSessionPayloadV4(const HgfsRequestCreateSessionV4 *requestV4, // if (requestV4->numCapabilities) { if (payloadSize < offsetof(HgfsRequestCreateSessionV4, capabilities) + requestV4->numCapabilities * sizeof(HgfsOpCapability)) { - LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__)); + LOG(4, "%s: HGFS packet too small\n", __FUNCTION__); return FALSE; } } @@ -5280,7 +5293,7 @@ HgfsUnpackCreateSessionRequest(const void *packet, // IN: HGFS packet requestV4 = packet; if (!HgfsUnpackCreateSessionPayloadV4(requestV4, packetSize, info)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } @@ -5557,13 +5570,13 @@ HgfsUnpackSetWatchRequest(const void *packet, // IN: HGFS packet NOT_REACHED(); result = FALSE; } else { - LOG(4, ("%s: HGFS_OP_SET_WATCH_V4\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_SET_WATCH_V4\n", __FUNCTION__); result = HgfsUnpackSetWatchPayloadV4(requestV4, packetSize, useHandle, flags, events, cpName, cpNameSize, dir, caseFlags); } if (!result) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); } return result; } @@ -5676,7 +5689,7 @@ HgfsUnpackRemoveWatchRequest(const void *packet, // IN: HGFS packet if (HGFS_OP_REMOVE_WATCH_V4 != op) { return FALSE; } else if (!HgfsUnpackRemoveWatchPayloadV4(requestV4, packetSize, watchId)) { - LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__)); + LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__); return FALSE; } @@ -5915,7 +5928,8 @@ HgfsUnpackOplockBreakAckReply(const void *packet, // IN: HGFS packet } if (!result) { - LOG(4, ("%s: Error unpacking HGFS_OP_OPLOCK_BREAK_V4 packet\n", __FUNCTION__)); + LOG(4, "%s: Error unpacking HGFS_OP_OPLOCK_BREAK_V4 packet\n", + __FUNCTION__); } return result; } @@ -6096,8 +6110,8 @@ HgfsPackChangeNotifyRequestV4(HgfsSubscriberHandle watchId, // IN: watch size_t notificationOffset; if (bufferSize < sizeof *reply) { - LOG(4, ("%s: Error HGFS_OP_NOTIFY_V4 buf size %"FMTSZ"u reply size %"FMTSZ"u\n", - __FUNCTION__, bufferSize, sizeof *reply)); + LOG(4, "%s: Error HGFS_OP_NOTIFY_V4 buf size %"FMTSZ"u reply size %"FMTSZ"u\n", + __FUNCTION__, bufferSize, sizeof *reply); goto exit; } reply->watchId = watchId; @@ -6174,11 +6188,11 @@ HgfsPackChangeNotificationRequest(void *packet, // IN/OUT: Hg ASSERT(session); ASSERT(bufferSize); - LOG(4, ("%s: HGFS_OP_NOTIFY_V4\n", __FUNCTION__)); + LOG(4, "%s: HGFS_OP_NOTIFY_V4\n", __FUNCTION__); if (*bufferSize < sizeof *header) { - LOG(4, ("%s: Error HGFS_OP_NOTIFY_V4 buf size %"FMTSZ"u min %"FMTSZ"u\n", - __FUNCTION__, *bufferSize, sizeof *header)); + LOG(4, "%s: Error HGFS_OP_NOTIFY_V4 buf size %"FMTSZ"u min %"FMTSZ"u\n", + __FUNCTION__, *bufferSize, sizeof *header); goto exit; }