VirtualBox

Changeset 31776 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Aug 19, 2010 9:48:44 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64962
Message:

VBoxHDD: Resize stubs

Location:
trunk/src/VBox/Devices/Storage
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/ISCSIHDDCore.cpp

    r31714 r31776  
    55685568    iscsiComposeName,
    55695569    /* pfnCompact */
     5570    NULL,
     5571    /* pfnResize */
    55705572    NULL
    55715573};
  • trunk/src/VBox/Devices/Storage/ParallelsHDDCore.cpp

    r31184 r31776  
    14351435    genericFileComposeName,
    14361436    /* pfnCompact */
     1437    NULL,
     1438    /* pfnResize */
    14371439    NULL
    14381440};
  • trunk/src/VBox/Devices/Storage/RawHDDCore.cpp

    r30555 r31776  
    13431343    genericFileComposeName,
    13441344    /* pfnCompact */
     1345    NULL,
     1346    /* pfnResize */
    13451347    NULL
    13461348};
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r31586 r31776  
    49084908
    49094909/**
     4910 * Resizes the the given disk image to the given size.
     4911 *
     4912 * @return  VBox status
     4913 * @return  VERR_VD_IMAGE_READ_ONLY if image is not writable.
     4914 * @return  VERR_NOT_SUPPORTED if this kind of image can be compacted, but
     4915 *
     4916 * @param   pDisk           Pointer to the HDD container.
     4917 * @param   cbSize          New size of the image.
     4918 * @param   pPCHSGeometry   Pointer to the new physical disk geometry <= (16383,16,63). Not NULL.
     4919 * @param   pLCHSGeometry   Pointer to the new logical disk geometry <= (x,255,63). Not NULL.
     4920 * @param   pVDIfsOperation Pointer to the per-operation VD interface list.
     4921 */
     4922VBOXDDU_DECL(int) VDResize(PVBOXHDD pDisk, uint64_t cbSize,
     4923                           PCPDMMEDIAGEOMETRY pPCHSGeometry,
     4924                           PCPDMMEDIAGEOMETRY pLCHSGeometry,
     4925                           PVDINTERFACE pVDIfsOperation)
     4926{
     4927    int rc = VINF_SUCCESS;
     4928    int rc2;
     4929    bool fLockRead = false, fLockWrite = false;
     4930
     4931    LogFlowFunc(("pDisk=%#p cbSize=%llu pVDIfsOperation=%#p\n",
     4932                 pDisk, cbSize, pVDIfsOperation));
     4933
     4934    PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation,
     4935                                              VDINTERFACETYPE_PROGRESS);
     4936    PVDINTERFACEPROGRESS pCbProgress = NULL;
     4937    if (pIfProgress)
     4938        pCbProgress = VDGetInterfaceProgress(pIfProgress);
     4939
     4940    do {
     4941        /* Check arguments. */
     4942        AssertMsgBreakStmt(VALID_PTR(pDisk), ("pDisk=%#p\n", pDisk),
     4943                           rc = VERR_INVALID_PARAMETER);
     4944        AssertMsg(pDisk->u32Signature == VBOXHDDDISK_SIGNATURE,
     4945                  ("u32Signature=%08x\n", pDisk->u32Signature));
     4946
     4947        rc2 = vdThreadStartRead(pDisk);
     4948        AssertRC(rc2);
     4949        fLockRead = true;
     4950
     4951        /* Not supported if the disk has child images attached. */
     4952        AssertMsgBreakStmt(pDisk->cImages == 1, ("cImages=%u\n", pDisk->cImages),
     4953                           rc = VERR_NOT_SUPPORTED);
     4954
     4955        PVDIMAGE pImage = pDisk->pBase;
     4956
     4957        /* If there is no compact callback for not file based backends then
     4958         * the backend doesn't need compaction. No need to make much fuss about
     4959         * this. For file based ones signal this as not yet supported. */
     4960        if (!pImage->Backend->pfnResize)
     4961        {
     4962            if (pImage->Backend->uBackendCaps & VD_CAP_FILE)
     4963                rc = VERR_NOT_SUPPORTED;
     4964            else
     4965                rc = VINF_SUCCESS;
     4966            break;
     4967        }
     4968
     4969        rc2 = vdThreadFinishRead(pDisk);
     4970        AssertRC(rc2);
     4971        fLockRead = false;
     4972
     4973        rc2 = vdThreadStartWrite(pDisk);
     4974        AssertRC(rc2);
     4975        fLockWrite = true;
     4976
     4977        rc = pImage->Backend->pfnResize(pImage->pvBackendData,
     4978                                        cbSize,
     4979                                        pPCHSGeometry,
     4980                                        pLCHSGeometry,
     4981                                        0, 99,
     4982                                        pDisk->pVDIfsDisk,
     4983                                        pImage->pVDIfsImage,
     4984                                        pVDIfsOperation);
     4985    } while (0);
     4986
     4987    if (RT_UNLIKELY(fLockWrite))
     4988    {
     4989        rc2 = vdThreadFinishWrite(pDisk);
     4990        AssertRC(rc2);
     4991    }
     4992    else if (RT_UNLIKELY(fLockRead))
     4993    {
     4994        rc2 = vdThreadFinishRead(pDisk);
     4995        AssertRC(rc2);
     4996    }
     4997
     4998    if (RT_SUCCESS(rc))
     4999    {
     5000        if (pCbProgress && pCbProgress->pfnProgress)
     5001            pCbProgress->pfnProgress(pIfProgress->pvUser, 100);
     5002    }
     5003
     5004    LogFlowFunc(("returns %Rrc\n", rc));
     5005    return rc;
     5006}
     5007
     5008/**
    49105009 * Closes the last opened image file in HDD container.
    49115010 * If previous image file was opened in read-only mode (the normal case) and
  • trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp

    r31185 r31776  
    26152615    genericFileComposeName,
    26162616    /* pfnCompact */
    2617     vdiCompact
     2617    vdiCompact,
     2618    /* pfnResize */
     2619    NULL
    26182620};
    26192621
  • trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp

    r31379 r31776  
    27532753    genericFileComposeLocation,
    27542754    /* pfnComposeName */
    2755     genericFileComposeName
     2755    genericFileComposeName,
     2756    /* pfnCompact */
     2757    NULL,
     2758    /* pfnResize */
     2759    NULL
    27562760};
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r31380 r31776  
    68836883    genericFileComposeLocation,
    68846884    /* pfnComposeName */
    6885     genericFileComposeName
     6885    genericFileComposeName,
     6886    /* pfnCompact */
     6887    NULL,
     6888    /* pfnResize */
     6889    NULL
    68866890};
Note: See TracChangeset for help on using the changeset viewer.

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