VirtualBox

Changeset 31052 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Jul 23, 2010 12:10:41 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63977
Message:

Shared Folders/AutoMount: Update.

Location:
trunk/src/VBox/HostServices/SharedFolders
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/mappings.cpp

    r31002 r31052  
    3737}
    3838
    39 int vbsfMappingLoaded (const MAPPING *pLoadedMapping, SHFLROOT root)
     39int vbsfMappingLoaded(const PMAPPING pLoadedMapping, SHFLROOT root)
    4040{
    4141    /* Mapping loaded from the saved state with the index. Which means
     
    173173 * We are always executed from one specific HGCM thread. So thread safe.
    174174 */
    175 int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName,
    176                      uint32_t    fWritable,   uint32_t    fAutoMount)
     175int vbsfMappingsAdd(PSHFLSTRING pFolderName, PSHFLSTRING pMapName,
     176                    uint32_t fWritable, uint32_t fAutoMount)
    177177{
    178178    unsigned i;
     
    255255}
    256256
    257 int vbsfMappingsRemove (PSHFLSTRING pMapName)
     257int vbsfMappingsRemove(PSHFLSTRING pMapName)
    258258{
    259259    unsigned i;
     
    294294}
    295295
    296 PCRTUTF16 vbsfMappingsQueryHostRoot (SHFLROOT root, uint32_t *pcbRoot)
     296PCRTUTF16 vbsfMappingsQueryHostRoot(SHFLROOT root, uint32_t *pcbRoot)
    297297{
    298298    MAPPING *pFolderMapping = vbsfMappingGetByRoot(root);
     
    307307}
    308308
    309 bool vbsfIsGuestMappingCaseSensitive (SHFLROOT root)
     309bool vbsfIsGuestMappingCaseSensitive(SHFLROOT root)
    310310{
    311311    MAPPING *pFolderMapping = vbsfMappingGetByRoot(root);
     
    319319}
    320320
    321 bool vbsfIsHostMappingCaseSensitive (SHFLROOT root)
     321bool vbsfIsHostMappingCaseSensitive(SHFLROOT root)
    322322{
    323323    MAPPING *pFolderMapping = vbsfMappingGetByRoot(root);
     
    331331}
    332332
    333 int vbsfMappingsQuery (SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings)
     333/**
     334 * Note: If pMappings/*pcMappings is smaller than the actual amount of mappings
     335 *       that *could* have been returned *pcMappings contains the required buffer size
     336 *       so that the caller can retry the operation if wanted.
     337 */
     338int vbsfMappingsQuery(PSHFLCLIENTDATA pClient, PSHFLMAPPING pMappings, uint32_t *pcMappings)
    334339{
    335340    int rc = VINF_SUCCESS;
    336     uint32_t cMaxMappings = RT_MIN(*pcMappings, SHFL_MAX_MAPPINGS);
     341
     342    uint32_t cMappings = 0; /* Will contain actual valid mappings. */
     343    uint32_t idx = 0;       /* Current index in mappings buffer. */
    337344
    338345    LogFlow(("vbsfMappingsQuery: pClient = %p, pMappings = %p, pcMappings = %p, *pcMappings = %d\n",
    339346             pClient, pMappings, pcMappings, *pcMappings));
    340347
    341     *pcMappings = 0;
    342     for (uint32_t i=0;i<cMaxMappings;i++)
     348    for (uint32_t i = 0; i < SHFL_MAX_MAPPINGS; i++)
    343349    {
    344350        MAPPING *pFolderMapping = vbsfMappingGetByRoot(i);
     
    346352            && pFolderMapping->fValid == true)
    347353        {
    348             /* Skip mappings which are not marked for auto-mounting if
    349              * the SHFL_MF_AUTOMOUNT flag ist set. */
    350             if (   (pClient->fu32Flags & SHFL_MF_AUTOMOUNT)
    351                 && !pFolderMapping->fAutoMount)
    352                 continue;
    353 
    354             pMappings[*pcMappings].u32Status = SHFL_MS_NEW;
    355             pMappings[*pcMappings].root = i;
    356             *pcMappings = *pcMappings + 1;
    357         }
    358     }
     354            if (idx < *pcMappings)
     355            {
     356                /* Skip mappings which are not marked for auto-mounting if
     357                 * the SHFL_MF_AUTOMOUNT flag ist set. */
     358                if (   (pClient->fu32Flags & SHFL_MF_AUTOMOUNT)
     359                    && !pFolderMapping->fAutoMount)
     360                    continue;
     361
     362                pMappings[idx].u32Status = SHFL_MS_NEW;
     363                pMappings[idx].root = i;
     364                idx++;
     365            }
     366            cMappings++;
     367        }
     368    }
     369
     370    /* Return actual number of mappings, regardless whether the handed in
     371     * mapping buffer was big enough. */
     372    *pcMappings = cMappings;
     373
    359374    LogFlow(("vbsfMappingsQuery: return rc = %Rrc\n", rc));
    360375    return rc;
    361376}
    362377
    363 int vbsfMappingsQueryName (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pString)
     378int vbsfMappingsQueryName(PSHFLCLIENTDATA pClient, SHFLROOT root, SHFLSTRING *pString)
    364379{
    365380    int rc = VINF_SUCCESS;
     
    394409}
    395410
    396 int vbsfMappingsQueryWritable (SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fWritable)
     411int vbsfMappingsQueryWritable(PSHFLCLIENTDATA pClient, SHFLROOT root, bool *fWritable)
    397412{
    398413    int rc = VINF_SUCCESS;
     
    417432}
    418433
    419 int vbsfMappingsQueryAutoMount (SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fAutoMount)
     434int vbsfMappingsQueryAutoMount(PSHFLCLIENTDATA pClient, SHFLROOT root, bool *fAutoMount)
    420435{
    421436    int rc = VINF_SUCCESS;
     
    440455}
    441456
    442 int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot)
     457int vbsfMapFolder(PSHFLCLIENTDATA pClient, PSHFLSTRING pszMapName,
     458                  RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot)
    443459{
    444460    MAPPING *pFolderMapping = NULL;
     
    490506}
    491507
    492 int vbsfUnmapFolder (SHFLCLIENTDATA *pClient, SHFLROOT root)
     508int vbsfUnmapFolder(PSHFLCLIENTDATA pClient, SHFLROOT root)
    493509{
    494510    int rc = VINF_SUCCESS;
  • trunk/src/VBox/HostServices/SharedFolders/mappings.h

    r31002 r31052  
    3131    bool        fWritable;
    3232    bool        fAutoMount;
    33 } MAPPING, *PMAPPING;
     33} MAPPING;
     34/** Pointer to a MAPPING structure. */
     35typedef MAPPING *PMAPPING;
    3436
    3537void vbsfMappingInit(void);
     
    4042int vbsfMappingsRemove(PSHFLSTRING pMapName);
    4143
    42 int vbsfMappingsQuery(SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings);
    43 int vbsfMappingsQueryName(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pString);
    44 int vbsfMappingsQueryWritable(SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fWritable);
     44int vbsfMappingsQuery(PSHFLCLIENTDATA pClient, PSHFLMAPPING pMappings, uint32_t *pcMappings);
     45int vbsfMappingsQueryName(PSHFLCLIENTDATA pClient, SHFLROOT root, SHFLSTRING *pString);
     46int vbsfMappingsQueryWritable(PSHFLCLIENTDATA pClient, SHFLROOT root, bool *fWritable);
    4547
    46 int vbsfMapFolder(SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot);
    47 int vbsfUnmapFolder(SHFLCLIENTDATA *pClient, SHFLROOT root);
     48int vbsfMapFolder(PSHFLCLIENTDATA pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot);
     49int vbsfUnmapFolder(PSHFLCLIENTDATA pClient, SHFLROOT root);
    4850
    49 PCRTUTF16 vbsfMappingsQueryHostRoot (SHFLROOT root, uint32_t *pcbRoot);
    50 bool vbsfIsGuestMappingCaseSensitive (SHFLROOT root);
    51 bool vbsfIsHostMappingCaseSensitive (SHFLROOT root);
     51PCRTUTF16 vbsfMappingsQueryHostRoot(SHFLROOT root, uint32_t *pcbRoot);
     52bool vbsfIsGuestMappingCaseSensitive(SHFLROOT root);
     53bool vbsfIsHostMappingCaseSensitive(SHFLROOT root);
    5254
    53 int vbsfMappingLoaded (const MAPPING *pLoadedMapping, SHFLROOT root);
    54 MAPPING *vbsfMappingGetByRoot(SHFLROOT root);
     55int vbsfMappingLoaded(const PMAPPING pLoadedMapping, SHFLROOT root);
     56PMAPPING vbsfMappingGetByRoot(SHFLROOT root);
    5557
    5658#endif /* !___MAPPINGS_H */
  • trunk/src/VBox/HostServices/SharedFolders/service.cpp

    r31002 r31052  
    44
    55/*
    6  * Copyright (C) 2006-2007 Oracle Corporation
     6 * Copyright (C) 2006-2010 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    327327                    if (RT_SUCCESS(rc))
    328328                    {
     329                        /* Report that there are more mappings to get if
     330                         * handed in buffer is too small. */
     331                        if (paParms[1].u.uint32 < cMappings)
     332                            rc = VINF_BUFFER_OVERFLOW;
     333
    329334                        /* Update parameters. */
    330335                        paParms[1].u.uint32 = cMappings;
  • trunk/src/VBox/HostServices/SharedFolders/shfl.h

    r28800 r31052  
    44
    55/*
    6  * Copyright (C) 2006-2007 Oracle Corporation
     6 * Copyright (C) 2006-2010 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4646    /** Client flags */
    4747    uint32_t fu32Flags;
    48 
     48    /** Path delimiter. */
    4949    RTUTF16  PathDelimiter;
    5050} SHFLCLIENTDATA;
    51 
     51/** Pointer to a SHFLCLIENTDATA structure. */
     52typedef SHFLCLIENTDATA *PSHFLCLIENTDATA;
    5253
    5354#endif /* !___SHFL_H */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette