VirtualBox

Changeset 91330 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Sep 22, 2021 3:17:10 PM (3 years ago)
Author:
vboxsync
Message:

Runtime/common/vfs/vfsmemory.cpp: Quick and dirty implementation for the SetSize callback when the caller wants to grow the file. Used for bugref:10098

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/vfs/vfsmemory.cpp

    r91095 r91330  
    692692static DECLCALLBACK(int) rtVfsMemFile_SetSize(void *pvThis, uint64_t cbFile, uint32_t fFlags)
    693693{
    694     NOREF(pvThis); NOREF(cbFile); NOREF(fFlags);
     694    AssertReturn(RTVFSFILE_SIZE_F_IS_VALID(fFlags), VERR_INVALID_PARAMETER);
     695
     696    PRTVFSMEMFILE pThis = (PRTVFSMEMFILE)pvThis;
     697    if (   (fFlags & RTVFSFILE_SIZE_F_ACTION_MASK) == RTVFSFILE_SIZE_F_NORMAL
     698        && (RTFOFF)cbFile >= pThis->Base.ObjInfo.cbObject)
     699    {
     700        /* Growing is just a matter of increasing the size of the object. */
     701        pThis->Base.ObjInfo.cbObject = cbFile;
     702        return VINF_SUCCESS;
     703    }
     704
    695705    AssertMsgFailed(("Lucky you! You get to implement this (or bug bird about it).\n"));
    696706    return VERR_NOT_IMPLEMENTED;
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