mappings.cpp revision 8657e832440d81752b123c03be7d68fd4ec58cef
/** @file
* Shared Folders: Mappings support.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "mappings.h"
/*
*
* We are always executed from one specific HGCM thread. So thread safe.
*
*/
{
int i;
/* check for duplicates */
for (i=0;i<SHFL_MAX_MAPPINGS;i++)
{
if (FolderMapping[i].fValid == true)
{
{
return VERR_ALREADY_EXISTS;
}
}
}
for (i=0;i<SHFL_MAX_MAPPINGS;i++)
{
if (FolderMapping[i].fValid == false)
{
return VERR_NO_MEMORY;
return VERR_NO_MEMORY;
FolderMapping[i].fValid = true;
FolderMapping[i].cMappings = 0;
/* Check if the host file system is case sensitive */
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
}
}
break;
}
}
if (i == SHFL_MAX_MAPPINGS)
{
AssertMsgFailed(("vbsfMappingsAdd: no more room to add mapping %ls to %ls!!\n", pFolderName->String.ucs2, pMapName->String.ucs2));
return VERR_TOO_MUCH_DATA;
}
Log(("vbsfMappingsAdd: added mapping %ls to %ls\n", pFolderName->String.ucs2, pMapName->String.ucs2));
return VINF_SUCCESS;
}
{
int i;
for (i=0;i<SHFL_MAX_MAPPINGS;i++)
{
if (FolderMapping[i].fValid == true)
{
{
if (FolderMapping[i].cMappings != 0)
{
return VERR_PERMISSION_DENIED;
}
FolderMapping[i].fValid = false;
break;
}
}
}
if (i == SHFL_MAX_MAPPINGS)
{
return VERR_FILE_NOT_FOUND;
}
return VINF_SUCCESS;
}
{
if (root > SHFL_MAX_MAPPINGS)
{
AssertFailed();
return NULL;
}
}
{
if (root > SHFL_MAX_MAPPINGS)
{
AssertFailed();
return false;
}
}
{
if (root > SHFL_MAX_MAPPINGS)
{
AssertFailed();
return false;
}
}
{
int rc = VINF_SUCCESS;
LogFlow(("vbsfMappingsQuery: pClient = %p, pMappings = %p, pcMappings = %p, *pcMappings = %d\n",
*pcMappings = 0;
for (uint32_t i=0;i<cMaxMappings;i++)
{
if (FolderMapping[i].fValid == true)
{
}
}
return rc;
}
{
int rc = VINF_SUCCESS;
LogFlow(("vbsfMappingsQuery: pClient = %p, root = %d, *pString = %p\n",
if (root >= SHFL_MAX_MAPPINGS)
return VERR_INVALID_PARAMETER;
{
/* not implemented */
AssertFailed();
return VERR_INVALID_PARAMETER;
}
{
}
else
return rc;
}
{
int rc = VINF_SUCCESS;
LogFlow(("vbsfMappingsQueryWritable: pClient = %p, root = %d\n",
if (root >= SHFL_MAX_MAPPINGS)
return VERR_INVALID_PARAMETER;
else
return rc;
}
{
size_t i;
for (i=0;i<SHFL_MAX_MAPPINGS;i++)
{
if (FolderMapping[i].fValid == true)
{
{
*pIndex = i;
return 0;
}
}
}
return -1;
}
int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, bool fCaseSensitive, SHFLROOT *pRoot)
{
{
}
else
{
}
if (pClient->PathDelimiter == 0)
{
}
else
{
}
{
int rc;
if (VBOX_FAILURE (rc))
return rc;
if (rc)
{
// AssertMsgFailed(("vbsfMapFolder: map %s not found!!\n",
// pszMapName->String.utf8));
return VERR_FILE_NOT_FOUND;
}
}
else
{
{
// AssertMsgFailed(("vbsfMapFolder: map %ls not found!!\n",
// pszMapName->String.ucs2));
return VERR_FILE_NOT_FOUND;
}
}
Assert(FolderMapping[index].cMappings == 1 || FolderMapping[index].fGuestCaseSensitive == fCaseSensitive);
return VINF_SUCCESS;
}
{
int rc = VINF_SUCCESS;
if (root > SHFL_MAX_MAPPINGS)
{
AssertFailed();
return VERR_FILE_NOT_FOUND;
}
Log(("vbsfUnmapFolder\n"));
return rc;
}