VirtualBox

Changeset 54430 in vbox for trunk/src/VBox/Storage/RAW.cpp


Ignore:
Timestamp:
Feb 24, 2015 10:43:16 AM (10 years ago)
Author:
vboxsync
Message:

Storage/VD: make use of the image type (hdd/dvd/floppy) for sanity checking when creating disk images

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/RAW.cpp

    r54397 r54430  
    427427                   VDTYPE enmType, void **ppBackendData)
    428428{
    429     LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
     429    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
    430430    int rc;
    431431    PRAWIMAGE pImage;
     432
     433    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
    432434
    433435    /* Check open flags. All valid flags are supported. */
     
    482484                     unsigned uPercentStart, unsigned uPercentSpan,
    483485                     PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
    484                      PVDINTERFACE pVDIfsOperation, void **ppBackendData)
    485 {
    486     LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
     486                     PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
     487                     void **ppBackendData)
     488{
     489    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p",
     490                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
    487491    int rc;
    488492    PRAWIMAGE pImage;
     
    495499        pfnProgress = pIfProgress->pfnProgress;
    496500        pvUser = pIfProgress->Core.pvUser;
     501    }
     502
     503    /* Check the VD container type. Yes, hard disk must be allowed, otherwise
     504     * various tools using this backend for hard disk images will fail. */
     505    if (enmType != VDTYPE_HDD && enmType != VDTYPE_DVD && enmType != VDTYPE_FLOPPY)
     506    {
     507        rc = VERR_VD_INVALID_TYPE;
     508        goto out;
    497509    }
    498510
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