#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
#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
/* 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;
}
ASSERT(session);
ASSERT(session->nodeArray);
- LOG(4, ("%s: entered\n", __FUNCTION__));
+ LOG(4, "%s: entered\n", __FUNCTION__);
if (!DblLnkLst_IsLinked(&session->nodeFreeList)) {
/*
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;
}
* 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) \
}
/* 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);
{
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);
/* 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;
}
*/
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;
}
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;
}
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;
}
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;
}
/* 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;
}
node = HgfsHandle2FileNode(handle, session);
if (node == NULL) {
- LOG(4, ("%s: invalid handle.\n", __FUNCTION__));
+ LOG(4, "%s: invalid handle.\n", __FUNCTION__);
return FALSE;
}
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
* 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;
}
node = HgfsHandle2FileNode(handle, session);
if (node == NULL) {
- LOG(4, ("%s: invalid handle.\n", __FUNCTION__));
+ LOG(4, "%s: invalid handle.\n", __FUNCTION__);
return FALSE;
}
ASSERT(session);
ASSERT(session->searchArray);
- LOG(4, ("%s: entered\n", __FUNCTION__));
+ LOG(4, "%s: entered\n", __FUNCTION__);
if (!DblLnkLst_IsLinked(&session->searchFreeList)) {
/*
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;
}
* 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) \
}
/* 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);
/* 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;
}
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;
}
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);
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);
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);
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,
}
} 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 {
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;
}
}
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;
}
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;
}
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.
ASSERT(0);
#endif
} else {
- LOG(4, ("%s: %d: ##Sync\n", __FUNCTION__, __LINE__));
+ LOG(4, "%s: %d: ##Sync\n", __FUNCTION__, __LINE__);
HgfsServerProcessRequest(input);
}
} else {
* 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);
}
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;
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);
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;
}
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;
}
{
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;
}
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;
}
{
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;
}
}
MXUser_ReleaseExclLock(gHgfsSharedFoldersLock);
- LOG(8, ("%s: exit\n", __FUNCTION__));
+ LOG(8, "%s: exit\n", __FUNCTION__);
}
RANK_hgfsSharedFolders);
if (!HgfsPlatformInit()) {
- LOG(4, ("Could not initialize server platform specific \n"));
+ LOG(4, "Could not initialize server platform specific \n");
result = FALSE;
}
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;
}
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;
}
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;
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;
}
void *state;
Bool success = FALSE;
- LOG(8, ("%s: entered\n", __FUNCTION__));
+ LOG(8, "%s: entered\n", __FUNCTION__);
state = HgfsServerResEnumInit();
if (NULL != state) {
Bool done;
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;
}
{
ASSERT(transportSessionData);
- LOG(4, ("%s: initting.\n", __FUNCTION__));
+ LOG(4, "%s: initting.\n", __FUNCTION__);
*transportSessionData = HgfsServerTransportInit(transportData,
channelCbTable,
int i;
HgfsSessionInfo *session;
- LOG(8, ("%s: entered\n", __FUNCTION__));
+ LOG(8, "%s: entered\n", __FUNCTION__);
ASSERT(transportSession);
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);
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);
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__);
}
HgfsTransportSessionInfo *transportSession = clientData;
DblLnkLst_Links *curr, *next;
- LOG(8, ("%s: entered\n", __FUNCTION__));
+ LOG(8, "%s: entered\n", __FUNCTION__);
ASSERT(transportSession);
MXUser_ReleaseExclLock(transportSession->sessionArrayLock);
transportSession->state = HGFS_SESSION_STATE_CLOSED;
- LOG(8, ("%s: exit\n", __FUNCTION__));
+ LOG(8, "%s: exit\n", __FUNCTION__);
}
{
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__);
}
/* 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
HgfsTransportSessionInfo *transportSession = clientData;
DblLnkLst_Links *curr;
- LOG(4, ("%s: Beginning\n", __FUNCTION__));
+ LOG(4, "%s: Beginning\n", __FUNCTION__);
MXUser_AcquireExclLock(transportSession->sessionArrayLock);
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);
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);
}
MXUser_ReleaseExclLock(transportSession->sessionArrayLock);
- LOG(4, ("%s: Ending\n", __FUNCTION__));
+ LOG(4, "%s: Ending\n", __FUNCTION__);
}
ASSERT(session);
ASSERT(session->nodeArray);
ASSERT(session->searchArray);
- LOG(4, ("%s: Beginning\n", __FUNCTION__));
+ LOG(4, "%s: Beginning\n", __FUNCTION__);
MXUser_AcquireExclLock(session->nodeArrayLock);
}
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) {
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);
}
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) {
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__);
}
HgfsTransportSessionInfo *transportSession = clientData;
DblLnkLst_Links *curr;
- LOG(4, ("%s: Beginning\n", __FUNCTION__));
+ LOG(4, "%s: Beginning\n", __FUNCTION__);
ASSERT(transportSession);
MXUser_AcquireExclLock(transportSession->sessionArrayLock);
/* Now invalidate any stale shares and add any new ones. */
HgfsServerSharesReset(shares);
- LOG(4, ("%s: Ending\n", __FUNCTION__));
+ LOG(4, "%s: Ending\n", __FUNCTION__);
}
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);
* 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;
}
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;
}
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;
}
*/
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;
}
&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);
/* 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;
}
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;
}
/* 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;
}
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;
}
* 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;
}
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;
}
/* 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;
}
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;
*/
if (nameStatus != HGFS_NAME_STATUS_COMPLETE) {
- LOG(4, ("%s: HgfsPlatformFilenameLookup failed.\n", __FUNCTION__));
+ LOG(4, "%s: HgfsPlatformFilenameLookup failed.\n", __FUNCTION__);
goto error;
}
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;
}
}
/* 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;
}
}
}
- LOG(4, ("%s: name is \"%s\"\n", __FUNCTION__, myBufOut));
+ LOG(4, "%s: name is \"%s\"\n", __FUNCTION__, myBufOut);
*bufOut = myBufOut;
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;
}
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;
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;
}
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;
}
&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;
}
&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;
}
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;
}
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;
}
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;
}
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);
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;
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;
}
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;
}
*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;
}
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;
}
&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;
}
}
} 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;
}
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;
}
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;
}
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;
}
((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
*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;
}
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;
}
&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;
}
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;
}
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;
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;
}
* 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,
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 {
} 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) {
* 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,
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)) {
* 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 {
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;
* 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;
}
}
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,
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);
}
}
}
*/
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;
}
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);
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);
}
}
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;
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) {
/*
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);
}
}
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;
}
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);
*/
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 */
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;
}
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
}
HgfsServerCompleteRequest(status, replyPayloadSize, input);
- LOG(8, ("%s: exit %u\n", __FUNCTION__, status));
+ LOG(8, "%s: exit %u\n", __FUNCTION__, status);
}
HgfsInternalStatus status;
size_t replyPayloadSize = 0;
- LOG(8, ("%s: entered\n", __FUNCTION__));
+ LOG(8, "%s: entered\n", __FUNCTION__);
HGFS_ASSERT_INPUT(input);
/*
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;
}
}
HgfsServerCompleteRequest(status, replyPayloadSize, input);
- LOG(8, ("%s: exit result %u\n", __FUNCTION__, status));
+ LOG(8, "%s: exit result %u\n", __FUNCTION__, status);
}
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 {
* 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;
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;
}
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. */
} 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,
}
free(utf8Name);
} else {
- LOG(4, ("%s: file not found.\n", __FUNCTION__));
+ LOG(4, "%s: file not found.\n", __FUNCTION__);
status = HgfsPlatformConvertFromNameStatus(nameStatus);
}
}
*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;
}
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;
&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) ?
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
&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,
}
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 {
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) {
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;
}
}
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)) {
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;
}
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;
}
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;
}
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) {
/*********************************************************
- * 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
#ifndef VMX86_TOOLS
#define LOGLEVEL_MODULE hgfsServer
+#define LOGLEVEL_VARIADIC
#include "loglevel_user.h"
#else // VMX86_TOOLS
#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
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;
}
#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;
}
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;
}
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;
}
* 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;
}
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;
}
* 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;
}
}
}
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;
}
}
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;
}
}
*/
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;
}
}
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) {
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
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);
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;
}
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);
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,
*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;
}
*/
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);
* 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;
}
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),
&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;
}
*/
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
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
* 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) {
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__);
}
}
}
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;
}
*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);
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;
}
*/
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);
*/
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;
}
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 ""
#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;
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;
}
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;
}
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;
}
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;
}
}
*/
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;
}
}
* 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);
}
}
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.
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;
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;
}
}
* 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;
}
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;
}
}
*/
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;
}
}
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);
}
}
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) {
* 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,
* 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;
}
&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);
}
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;
}
}
}
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) {
}
break;
default:
- LOG(4,("%s: file access check failed\n", __FUNCTION__));
+ LOG(4, "%s: file access check failed\n", __FUNCTION__);
status = HgfsPlatformConvertFromNameStatus(nameStatus);
}
}
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;
}
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) {
* 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,
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;
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;
*/
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;
* 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);
}
}
} 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;
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
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;
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;
}
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));
}
/*
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;
}
} 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;
}
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
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;
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__);
}
}
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__);
}
}
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;
}
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;
}
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) {
}
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);
}
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;
}
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;
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
*(char *)inEnd = '\0';
}
- LOG(4, ("%s: dirName: %s.\n", __FUNCTION__, dirName));
+ LOG(4, "%s: dirName: %s.\n", __FUNCTION__, dirName);
status = HgfsServerSearchRealDir(baseDir,
baseDirLen,
dirName,
session,
handle);
} else {
- LOG(4, ("%s: get first component failed\n", __FUNCTION__));
+ LOG(4, "%s: get first component failed\n", __FUNCTION__);
status = ENOENT;
}
/*
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;
}
* 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,
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);
}
{
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;
}
}
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;
{
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;
}
}
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;
}
}
- 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:
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) &&
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;
}
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;
}
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:
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;
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;
}
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;
}
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 {
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;
}
*/
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
/*********************************************************
- * 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
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;
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,
*/
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;
}
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;
}
/*********************************************************
- * 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
} 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;
}
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
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
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
* 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? */
* 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);
}
} 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;
* 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;
/* 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;
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,
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,
exit:
if (*isAllocated) {
- LOG(10, ("%s: Hgfs Freeing buffer \n", __FUNCTION__));
+ LOG(10, "%s: Hgfs Freeing buffer \n", __FUNCTION__);
free(*buf);
*isAllocated = FALSE;
}
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;
}
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;
}
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;
}
}
} 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;
}
/* 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;
}
*/
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;
}
/* 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;
}
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;
}
*/
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;
}
/* 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;
}
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;
}
*/
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;
}
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;
}
if (!result) {
- LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__));
+ LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__);
}
return result;
}
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;
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;
}
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;
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;
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;
}
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;
}
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;
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;
*/
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;
}
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;
}
hints,
file,
caseFlags)) {
- LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__));
+ LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__);
return FALSE;
}
break;
cpNameSize,
hints,
file)) {
- LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__));
+ LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__);
return FALSE;
}
break;
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;
}
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();
}
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;
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) {
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;
}
/* 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;
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;
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;
}
}
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;
}
targetFile,
oldCaseFlags,
newCaseFlags)) {
- LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__));
+ LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__);
return FALSE;
}
break;
hints,
srcFile,
targetFile)) {
- LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__));
+ LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__);
return FALSE;
}
break;
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;
}
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();
}
}
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;
}
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;
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;
}
cpNameSize,
hints,
file)) {
- LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__));
+ LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__);
return FALSE;
}
break;
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;
}
default:
- LOG(4, ("%s: Invalid GetAttr op.\n", __FUNCTION__));
+ LOG(4, "%s: Invalid GetAttr op.\n", __FUNCTION__);
NOT_REACHED();
result = FALSE;
*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;
}
*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;
}
}
default: {
- LOG(4, ("%s: Invalid SearchRead Op.", __FUNCTION__));
+ LOG(4, "%s: Invalid SearchRead Op.", __FUNCTION__);
NOT_REACHED();
result = FALSE;
}
}
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;
}
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;
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;
hints,
file,
caseType)) {
- LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__));
+ LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__);
return FALSE;
}
break;
cpNameSize,
hints,
file)) {
- LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__));
+ LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__);
return FALSE;
}
break;
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;
}
}
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();
}
* 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. */
}
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;
}
* 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. */
}
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;
}
* 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;
}
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;
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;
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;
}
}
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();
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
if (!result) {
- LOG(4, ("%s: Error decoding HGFS packet\n", __FUNCTION__));
+ LOG(4, "%s: Error decoding HGFS packet\n", __FUNCTION__);
}
return result;
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;
return TRUE;
}
}
- LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__));
+ LOG(4, "%s: HGFS packet too small\n", __FUNCTION__);
return FALSE;
}
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;
return TRUE;
}
}
- LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__));
+ LOG(4, "%s: HGFS packet too small\n", __FUNCTION__);
return FALSE;
}
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;
*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;
}
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;
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;
}
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,
file,
caseFlags);
}
- LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__));
+ LOG(4, "%s: HGFS packet too small\n", __FUNCTION__);
return FALSE;
}
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;
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;
break;
}
default:
- LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, op));
+ LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, op);
NOT_REACHED();
return FALSE;
}
}
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();
}
{
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,
{
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,
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;
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;
break;
}
default:
- LOG(4, ("%s: Incorrect opcode %d\n", __FUNCTION__, op));
+ LOG(4, "%s: Incorrect opcode %d\n", __FUNCTION__, op);
NOT_REACHED();
return FALSE;
}
}
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();
}
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;
return TRUE;
}
}
- LOG(4, ("%s: HGFS packet too small\n", __FUNCTION__));
+ LOG(4, "%s: HGFS packet too small\n", __FUNCTION__);
return FALSE;
}
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;
&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;
}
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;
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;
}
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;
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;
}
}
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;
}
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;
}
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;
}
}
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;
}
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;
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;
}