VirtualBox

Ignore:
Timestamp:
Apr 28, 2019 11:38:32 AM (6 years ago)
Author:
vboxsync
Message:

winnt/vboxsf: Contiuing cleaning up VBoxMRxSetFileInfo; moving stuff to improve locality somewhat. bugref:9172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/SharedFolders/driver/file.cpp

    r78338 r78339  
    260260         ByteCount, ByteOffset, FileSize));
    261261
    262     /** @todo check if this is necessary. */
     262/** @todo r=bird: This check is incorrect as we must let the host do these
     263 * checks with up-to-date end-of-file data.  What we've got cached here is
     264 * potentially out of date.  (This code is here because someone saw it in some
     265 * sample, I suspect and didn't quite understand what it was all about.  The
     266 * thing is that when FCB_STATE_READCACHING_ENABLED is set, the caller
     267 * already checks and the sample probably wanted to cover its bases.  We,
     268 * don't want to do that as already explained earlier.) */
    263269#ifdef FCB_STATE_READCACHING_ENABLED    /* Correct spelling for Vista 6001 SDK. */
    264270    if (!FlagOn(capFcb->FcbState, FCB_STATE_READCACHING_ENABLED))
     
    267273#endif
    268274    {
    269 /** @todo r=bird: How is this file size accurate given that the file resides
    270  *        on the host and be grown/shrunk independently there?   Why is this
    271  *        only done when FCB_STATE_READCACHEING_ENABLED is clear? */
    272275        if (ByteOffset >= FileSize)
    273276        {
     
    313316    RxContext->InformationToReturn = ByteCount;
    314317
     318/** @todo if we read past the end-of-file as we know it, or if we reached
     319 * end-of-file earlier than we though, update the file size.  The
     320 * RxLowIoReadShellCompletion() routine does not seem to do this for is and
     321 * I (bird) couldn't find anyone else doing it either. */
     322
    315323    Log(("VBOXSF: vbsfReadInternal: Status = 0x%08X, ByteCount = 0x%X\n",
    316324         Status, ByteCount));
     
    554562}
    555563
    556 NTSTATUS vbsfNtSetEndOfFile(IN OUT struct _RX_CONTEXT * RxContext,
    557                             IN uint64_t cbNewFileSize)
    558 {
    559     NTSTATUS Status = STATUS_SUCCESS;
    560 
    561     RxCaptureFcb;
    562     RxCaptureFobx;
    563 
    564     PMRX_VBOX_NETROOT_EXTENSION pNetRootExtension = VBoxMRxGetNetRootExtension(capFcb->pNetRoot);
    565     PMRX_VBOX_FOBX pVBoxFobx = VBoxMRxGetFileObjectExtension(capFobx);
    566 
    567     PSHFLFSOBJINFO pObjInfo;
    568     uint32_t cbBuffer;
    569     int vrc;
    570 
    571     Log(("VBOXSF: vbsfNtSetEndOfFile: New size = %RX64\n",
    572          cbNewFileSize));
    573 
    574     Assert(pVBoxFobx && pNetRootExtension);
    575 
    576     cbBuffer = sizeof(SHFLFSOBJINFO);
    577     pObjInfo = (SHFLFSOBJINFO *)vbsfNtAllocNonPagedMem(cbBuffer);
    578     if (!pObjInfo)
    579     {
    580         AssertFailed();
    581         return STATUS_INSUFFICIENT_RESOURCES;
    582     }
    583 
    584     RtlZeroMemory(pObjInfo, cbBuffer);
    585     pObjInfo->cbObject = cbNewFileSize;
    586 
    587     vrc = VbglR0SfFsInfo(&g_SfClient, &pNetRootExtension->map, pVBoxFobx->hFile,
    588                          SHFL_INFO_SET | SHFL_INFO_SIZE, &cbBuffer, (PSHFLDIRINFO)pObjInfo);
    589 
    590     Log(("VBOXSF: vbsfNtSetEndOfFile: VbglR0SfFsInfo returned %Rrc\n", vrc));
    591 
    592     Status = vbsfNtVBoxStatusToNt(vrc);
    593     if (Status == STATUS_SUCCESS)
    594     {
    595         Log(("VBOXSF: vbsfNtSetEndOfFile: VbglR0SfFsInfo new allocation size = %RX64\n",
    596              pObjInfo->cbAllocated));
    597 
    598         /** @todo update the file stats! */
    599     }
    600 
    601     if (pObjInfo)
    602         vbsfNtFreeNonPagedMem(pObjInfo);
    603 
    604     Log(("VBOXSF: vbsfNtSetEndOfFile: Returned 0x%08X\n", Status));
    605     return Status;
    606 }
    607 
    608564/** See PMRX_EXTENDFILE_CALLDOWN in ddk/mrx.h
    609565 *
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