~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Devices/Storage/DrvBlock.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
514
514
    /*
515
515
     * Attach the media driver and query it's interface.
516
516
     */
 
517
    uint32_t fTachFlags = 0; /** @todo figure attachment flags for mount. */
517
518
    PPDMIBASE pBase;
518
 
    int rc = pThis->pDrvIns->pDrvHlp->pfnAttach(pThis->pDrvIns, &pBase);
 
519
    int rc = PDMDrvHlpAttach(pThis->pDrvIns, fTachFlags, &pBase);
519
520
    if (RT_FAILURE(rc))
520
521
    {
521
522
        Log(("drvblockMount: Attach failed rc=%Rrc\n", rc));
525
526
    pThis->pDrvMedia = (PPDMIMEDIA)pBase->pfnQueryInterface(pBase, PDMINTERFACE_MEDIA);
526
527
    if (pThis->pDrvMedia)
527
528
    {
 
529
        /** @todo r=klaus missing async handling, this is just a band aid to
 
530
         * avoid using stale information */
 
531
        pThis->pDrvMediaAsync = NULL;
 
532
 
528
533
        /*
529
534
         * Initialize state.
530
535
         */
554
559
     * Failed, detatch the media driver.
555
560
     */
556
561
    AssertMsgFailed(("No media interface!\n"));
557
 
    int rc2 = pThis->pDrvIns->pDrvHlp->pfnDetach(pThis->pDrvIns);
 
562
    int rc2 = pThis->pDrvIns->pDrvHlp->pfnDetach(pThis->pDrvIns, fTachFlags);
558
563
    AssertRC(rc2);
559
564
    pThis->pDrvMedia = NULL;
560
565
    return rc;
586
591
    /*
587
592
     * Detach the media driver and query it's interface.
588
593
     */
589
 
    int rc = pThis->pDrvIns->pDrvHlp->pfnDetach(pThis->pDrvIns);
 
594
    int rc = pThis->pDrvIns->pDrvHlp->pfnDetach(pThis->pDrvIns, 0 /*fFlags*/);
590
595
    if (RT_FAILURE(rc))
591
596
    {
592
597
        Log(("drvblockUnmount: Detach failed rc=%Rrc\n", rc));
667
672
/* -=-=-=-=- driver interface -=-=-=-=- */
668
673
 
669
674
/** @copydoc FNPDMDRVDETACH. */
670
 
static DECLCALLBACK(void)  drvblockDetach(PPDMDRVINS pDrvIns)
 
675
static DECLCALLBACK(void)  drvblockDetach(PPDMDRVINS pDrvIns, uint32_t fFlags)
671
676
{
672
677
    PDRVBLOCK pThis = PDMINS_2_DATA(pDrvIns, PDRVBLOCK);
673
678
    pThis->pDrvMedia = NULL;
674
679
    pThis->pDrvMediaAsync = NULL;
 
680
    NOREF(fFlags);
675
681
}
676
682
 
677
683
/**
690
696
/**
691
697
 * Construct a block driver instance.
692
698
 *
693
 
 * @returns VBox status.
694
 
 * @param   pDrvIns     The driver instance data.
695
 
 *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
696
 
 * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
697
 
 *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
698
 
 *                      iInstance it's expected to be used a bit in this function.
 
699
 * @copydoc FNPDMDRVCONSTRUCT
699
700
 */
700
 
static DECLCALLBACK(int) drvblockConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
 
701
static DECLCALLBACK(int) drvblockConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
701
702
{
702
703
    PDRVBLOCK pThis = PDMINS_2_DATA(pDrvIns, PDRVBLOCK);
703
704
    LogFlow(("drvblockConstruct: iInstance=%d\n", pDrvIns->iInstance));
866
867
     * Try attach driver below and query it's media interface.
867
868
     */
868
869
    PPDMIBASE pBase;
869
 
    rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBase);
 
870
    rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBase);
870
871
    if (    rc == VERR_PDM_NO_ATTACHED_DRIVER
871
872
        &&  pThis->enmType != PDMBLOCKTYPE_HARD_DISK)
872
873
        return VINF_SUCCESS;
925
926
    NULL,
926
927
    /* pfnResume */
927
928
    NULL,
 
929
    /* pfnAttach */
 
930
    NULL,
928
931
    /* pfnDetach */
929
 
    drvblockDetach
 
932
    drvblockDetach,
 
933
    /* pfnPowerOff */
 
934
    NULL,
 
935
    /* pfnSoftReset */
 
936
    NULL,
 
937
    /* u32EndVersion */
 
938
    PDM_DRVREG_VERSION
930
939
};
 
940