VirtualBox

Changeset 66698 in vbox


Ignore:
Timestamp:
Apr 27, 2017 3:48:29 PM (7 years ago)
Author:
vboxsync
Message:

fatvfs: readonly check and build fix

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/fsvfs.h

    r66689 r66698  
    114114 * @param   hVfsFile            The image.  Will be grown to 1.44MB if
    115115 *                              necessary.
     116 * @param   fQuick              Whether to quick format the floppy or not.
    116117 */
    117118RTDECL(int) RTFsFatVolFormat144(RTVFSFILE hVfsFile, bool fQuick);
  • trunk/src/VBox/Runtime/common/filesystem/fatvfs.cpp

    r66691 r66698  
    17491749{
    17501750    PRTFSFATFILE pThis = (PRTFSFATFILE)pvThis;
     1751    PRTFSFATVOL  pVol  = pThis->Core.pVol;
    17511752    AssertReturn(pSgBuf->cSegs != 0, VERR_INTERNAL_ERROR_3);
    17521753    RT_NOREF(fBlocking);
     1754
     1755    if (pVol->fReadOnly)
     1756        return VERR_WRITE_PROTECT;
    17531757
    17541758    if (off == -1)
     
    17901794
    17911795        /* Figure the disk offset. */
    1792         uint64_t offDisk = rtFsFatChain_FileOffsetToDiskOff(&pThis->Core.Clusters, (uint32_t)off, pThis->Core.pVol);
     1796        uint64_t offDisk = rtFsFatChain_FileOffsetToDiskOff(&pThis->Core.Clusters, (uint32_t)off, pVol);
    17931797        if (offDisk != UINT64_MAX)
    17941798        {
    1795             rc = RTVfsFileWriteAt(pThis->Core.pVol->hVfsBacking, offDisk, pbSrc, cbToWrite, NULL);
     1799            rc = RTVfsFileWriteAt(pVol->hVfsBacking, offDisk, pbSrc, cbToWrite, NULL);
    17961800            if (RT_SUCCESS(rc))
    17971801            {
     
    26502654                                        uint32_t *poffEntryInDir, uint32_t *pcFreeTail)
    26512655{
     2656    /* First try make gcc happy. */
     2657    *pcFreeTail     = 0;
     2658    *poffEntryInDir = UINT32_MAX;
     2659
     2660    /*
     2661     * Scan the whole directory, buffer by buffer.
     2662     */
    26522663    uint32_t            offStartFreeEntries = UINT32_MAX;
    26532664    uint32_t            cFreeEntries        = 0;
     
    27132724        rtFsFatDir_ReleaseBufferAfterReading(pThis, uBufferLock);
    27142725    }
    2715 
    2716     *pcFreeTail     = cFreeEntries;
    2717     *poffEntryInDir = UINT32_MAX;
     2726    *pcFreeTail = cFreeEntries;
    27182727    return VERR_DISK_FULL;
    27192728}
     
    28492858    PRTFSFATVOL pVol = pThis->Core.pVol;
    28502859    *poffEntryInDir = UINT32_MAX;
     2860    if (pVol->fReadOnly)
     2861        return VERR_WRITE_PROTECT;
    28512862
    28522863    /*
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