VirtualBox

Ignore:
Timestamp:
Mar 2, 2019 3:27:42 PM (6 years ago)
Author:
vboxsync
Message:

linux/vboxsf: Enabled new code for reading directories. This does not buffer the entire content and will have correct inode numbers for '.' and '..'. Also corrected the 6th parameter of VBoxSFParmList, it's meaning was accidentally inverted. bugref:9172

Location:
trunk/src/VBox/Additions/linux/sharedfolders
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/sharedfolders/dirops.c

    r77536 r77537  
    202202        sf_d->cbValid      = 0;
    203203        sf_d->pEntry       = NULL;
     204        sf_d->fNoMoreFiles = false;
    204205        if (sf_d->pBuf) {
    205206            kfree(sf_d->pBuf);
     
    251252
    252253    /*
     254     * Don't call the host again if we've reached the end of the
     255     * directory entries already.
     256     */
     257    if (sf_d->fNoMoreFiles) {
     258        if (!fRestart)
     259            return 0;
     260        sf_d->fNoMoreFiles = false;
     261    }
     262
     263
     264    /*
    253265     * Make sure we've got some kind of buffers.
    254266     */
     
    256268        /* Likely, except for the first time. */
    257269    } else {
    258         sf_d->pBuf = (PSHFLDIRINFO)kmalloc(_16K, GFP_KERNEL);
     270        sf_d->pBuf = (PSHFLDIRINFO)kmalloc(_64K, GFP_KERNEL);
    259271        if (sf_d->pBuf)
    260             sf_d->cbBuf = _16K;
     272            sf_d->cbBuf = _64K;
    261273        else {
    262274            sf_d->pBuf = (PSHFLDIRINFO)kmalloc(_4K, GFP_KERNEL);
     
    281293            sf_d->cbValid      = pReq->Parms.cb32Buffer.u.value32;
    282294            sf_d->cEntriesLeft = pReq->Parms.c32Entries.u.value32;
     295            sf_d->fNoMoreFiles = pReq->Parms.f32More.u.value32 == 0;
    283296        } else {
    284297            sf_d->pEntry       = sf_d->pBuf;
    285298            sf_d->cbValid      = 0;
    286299            sf_d->cEntriesLeft = 0;
    287             if (rc == VERR_NO_MORE_FILES)
     300            if (rc == VERR_NO_MORE_FILES) {
     301                sf_d->fNoMoreFiles = true;
    288302                rc = 0;
    289             else {
     303            } else {
    290304                /* In theory we could end up here with a buffer overflow, but
    291305                   with a 4KB minimum buffer size that's very unlikely with the
     
    558572             */
    559573            uintptr_t const offEntryInBuf = (uintptr_t)pEntry - (uintptr_t)pBuf;
    560             uint16_t cbSrcName;
    561             uint16_t cchSrcName;
     574            uint16_t        cbSrcName;
     575            uint16_t        cchSrcName;
    562576            AssertLogRelMsgBreak(offEntryInBuf + RT_UOFFSETOF(SHFLDIRINFO, name.String) <= cbValid,
    563577                                 ("%#llx + %#x vs %#x\n", offEntryInBuf, RT_UOFFSETOF(SHFLDIRINFO, name.String), cbValid));
     
    597611                    sf_d->cEntriesLeft = cEntriesLeft;
    598612                    sf_d->pEntry       = pEntry;
     613                    sf_d->offPos       = offPos;
    599614                    return 0;
    600615                }
     
    613628        } while (cEntriesLeft > 0);
    614629
    615         /* Reset the state. */
     630        /* Done with all available entries. */
     631        sf_d->offPos       = offPos + cEntriesLeft;
     632        sf_d->pEntry       = pBuf;
    616633        sf_d->cEntriesLeft = 0;
    617         sf_d->pEntry       = pBuf;
    618634    }
    619635
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h

    r77536 r77537  
    3939# define VBOX_STRICT
    4040#endif
    41 #define VBSF_BUFFER_DIRS /* till I've fully tested the other code */
    4241
    4342#define LOG_GROUP LOG_GROUP_SHARED_FOLDERS
     
    5554#include <iprt/asm.h>
    5655#include "vbsfmount.h"
    57 
    5856
    5957/*
     
    293291    /** The next entry. */
    294292    PSHFLDIRINFO        pEntry;
     293    /** Set if there are no more files.  */
     294    bool                fNoMoreFiles;
    295295#else
    296296    /** List of vbsf_dir_buf. */
Note: See TracChangeset for help on using the changeset viewer.

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