VirtualBox

Changeset 22277 in vbox


Ignore:
Timestamp:
Aug 16, 2009 9:12:50 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
51119
Message:

PDMDRVREG change (big changeset).

Location:
trunk
Files:
1 added
59 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r21927 r22277  
    10011001 * The PDMDEVREG::pfnAttach callback function is NULL. */
    10021002#define VERR_PDM_DEVICE_NO_RT_ATTACH                (-2853)
    1003 /** The device doesn't support runtime driver detaching.
    1004  * The PDMDEVREG::pfnDetach callback function is NULL. */
    1005 #define VERR_PDM_DEVICE_NO_RT_DETACH                (-2854)
     1003
    10061004/** Invalid host interface version. */
    10071005#define VERR_PDM_HIF_INVALID_VERSION                (-2855)
  • trunk/include/VBox/pdmapi.h

    r21217 r22277  
    107107VMMR3DECL(int)  PDMR3QueryDeviceLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
    108108VMMR3DECL(int)  PDMR3QueryLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
    109 VMMR3DECL(int)  PDMR3DeviceAttach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase, uint32_t fFlags);
     109VMMR3DECL(int)  PDMR3DeviceAttach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags, PPDMIBASE *ppBase);
    110110VMMR3DECL(int)  PDMR3DeviceDetach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags);
     111VMMR3DECL(int)  PDMR3DriverAttach(PVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
     112                                  const char *pszDriver, unsigned iOccurance, uint32_t fFlags, PPPDMIBASE ppBase);
     113VMMR3DECL(int)  PDMR3DriverDetach(PVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
     114                                  const char *pszDriver, unsigned iOccurance, uint32_t fFlags);
    111115VMMR3DECL(void) PDMR3DmaRun(PVM pVM);
    112116VMMR3DECL(int)  PDMR3LockCall(PVM pVM);
  • trunk/include/VBox/pdmdev.h

    r21820 r22277  
    3636#include <VBox/pdmifs.h>
    3737#include <VBox/pdmins.h>
     38#include <VBox/pdmdevdrv.h>
    3839#include <VBox/iom.h>
    3940#include <VBox/tm.h>
     
    174175typedef FNPDMDEVPOWEROFF *PFNPDMDEVPOWEROFF;
    175176
    176 /** PDM Device attach/detach callback Flags.
    177  * @{ */
    178 /** The attach/detach command is not a hotplug event. */
    179 #define PDMDEVATT_FLAGS_NOT_HOT_PLUG RT_BIT_32(0)
    180 /* @} */
    181 
    182177/**
    183178 * Attach command.
     
    192187 * @param   pDevIns     The device instance.
    193188 * @param   iLUN        The logical unit which is being detached.
    194  * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
     189 * @param   fFlags      Flags, combination of the PDM_TACH_FLAGS_* \#defines.
    195190 */
    196191typedef DECLCALLBACK(int)  FNPDMDEVATTACH(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags);
  • trunk/include/VBox/pdmdrv.h

    r21363 r22277  
    3636#include <VBox/pdmifs.h>
    3737#include <VBox/pdmins.h>
     38#include <VBox/pdmdevdrv.h>
    3839#include <VBox/tm.h>
    3940#include <VBox/ssm.h>
     
    6465 *                      of the driver instance. It's also found in pDrvIns->pCfgHandle as it's expected
    6566 *                      to be used frequently in this function.
    66  */
    67 typedef DECLCALLBACK(int)   FNPDMDRVCONSTRUCT(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     67 * @param   fFlags      Flags, combination of the PDM_TACH_FLAGS_* \#defines.
     68 */
     69typedef DECLCALLBACK(int)   FNPDMDRVCONSTRUCT(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    6870/** Pointer to a FNPDMDRVCONSTRUCT() function. */
    6971typedef FNPDMDRVCONSTRUCT *PFNPDMDRVCONSTRUCT;
     
    152154
    153155/**
     156 * Attach command.
     157 *
     158 * This is called to let the drive attach to a driver at runtime.  This is not
     159 * called during VM construction, the driver constructor have to do this by
     160 * calling PDMDrvHlpAttach.
     161 *
     162 * This is like plugging in the keyboard or mouse after turning on the PC.
     163 *
     164 * @returns VBox status code.
     165 * @param   pDrvIns     The driver instance.
     166 * @param   fFlags      Flags, combination of the PDM_TACH_FLAGS_* \#defines.
     167 */
     168typedef DECLCALLBACK(int)  FNPDMDRVATTACH(PPDMDRVINS pDrvIns, uint32_t fFlags);
     169/** Pointer to a FNPDMDRVATTACH() function. */
     170typedef FNPDMDRVATTACH *PFNPDMDRVATTACH;
     171
     172/**
    154173 * Detach notification.
    155174 *
     
    159178 * This is like ejecting a cdrom or floppy.
    160179 *
    161  * @param   pDrvIns     The driver instance.
    162  */
    163 typedef DECLCALLBACK(void)  FNPDMDRVDETACH(PPDMDRVINS pDrvIns);
     180 * @param   pDrvIns     The driver instance.
     181 * @param   fFlags      PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
     182 */
     183typedef DECLCALLBACK(void)  FNPDMDRVDETACH(PPDMDRVINS pDrvIns, uint32_t fFlags);
    164184/** Pointer to a FNPDMDRVDETACH() function. */
    165185typedef FNPDMDRVDETACH *PFNPDMDRVDETACH;
     
    205225    /** Resume notification - optional. */
    206226    PFNPDMDRVRESUME     pfnResume;
     227    /** Attach command - optional. */
     228    PFNPDMDRVATTACH     pfnAttach;
    207229    /** Detach notification - optional. */
    208230    PFNPDMDRVDETACH     pfnDetach;
    209231    /** Power off notification - optional. */
    210232    PFNPDMDRVPOWEROFF   pfnPowerOff;
    211 
     233    /** @todo */
     234    PFNRT               pfnSoftReset;
     235    /** Initialization safty marker. */
     236    uint32_t            u32VersionEnd;
    212237} PDMDRVREG;
    213238/** Pointer to a PDM Driver Structure. */
     
    217242
    218243/** Current DRVREG version number. */
    219 #define PDM_DRVREG_VERSION  0x80010000
    220 
    221 /** PDM Device Flags.
     244#define PDM_DRVREG_VERSION  0x80020000
     245
     246/** PDM Driver Flags.
    222247 * @{ */
    223248/** @def PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT
     
    364389     * @returns VBox status code.
    365390     * @param   pDrvIns             Driver instance.
     391     * @param   fFlags              PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
    366392     * @param   ppBaseInterface     Where to store the pointer to the base interface.
    367393     */
    368     DECLR3CALLBACKMEMBER(int, pfnAttach,(PPDMDRVINS pDrvIns, PPDMIBASE *ppBaseInterface));
     394    DECLR3CALLBACKMEMBER(int, pfnAttach,(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface));
    369395
    370396    /**
     
    372398     *
    373399     * @returns VBox status code.
    374      * @param   pDrvIns             Driver instance.
    375      */
    376     DECLR3CALLBACKMEMBER(int, pfnDetach,(PPDMDRVINS pDrvIns));
     400     * @param   pDrvIns             Driver instance.
     401     * @param   fFlags              PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
     402     */
     403    DECLR3CALLBACKMEMBER(int, pfnDetach,(PPDMDRVINS pDrvIns, uint32_t fFlags));
    377404
    378405    /**
     
    382409     * @returns VBox status code.
    383410     * @param   pDrvIns             Driver instance.
    384      */
    385     DECLR3CALLBACKMEMBER(int, pfnDetachSelf,(PPDMDRVINS pDrvIns));
     411     * @param   fFlags              PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
     412     */
     413    DECLR3CALLBACKMEMBER(int, pfnDetachSelf,(PPDMDRVINS pDrvIns, uint32_t fFlags));
    386414
    387415    /**
     
    816844
    817845/**
     846 * @copydoc PDMDRVHLP::pfnAttach
     847 */
     848DECLINLINE(int) PDMDrvHlpAttach(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface)
     849{
     850    return pDrvIns->pDrvHlp->pfnAttach(pDrvIns, fFlags, ppBaseInterface);
     851}
     852
     853/**
     854 * Check that there is no driver below the us that we should attach to.
     855 * 
     856 * @returns VERR_PDM_NO_ATTACHED_DRIVER if there is no driver.
     857 * @param   pDrvIns     The driver instance.
     858 */
     859DECLINLINE(int) PDMDrvHlpNoAttach(PPDMDRVINS pDrvIns)
     860{
     861    return pDrvIns->pDrvHlp->pfnAttach(pDrvIns, 0, NULL);
     862}
     863
     864/**
     865 * @copydoc PDMDRVHLP::pfnDetach
     866 */
     867DECLINLINE(int) PDMDrvHlpDetach(PPDMDRVINS pDrvIns, uint32_t fFlags)
     868{
     869    return pDrvIns->pDrvHlp->pfnDetach(pDrvIns, fFlags);
     870}
     871
     872/**
     873 * @copydoc PDMDRVHLP::pfnDetachSelf
     874 */
     875DECLINLINE(int) PDMDrvHlpDetachSelf(PPDMDRVINS pDrvIns, uint32_t fFlags)
     876{
     877    return pDrvIns->pDrvHlp->pfnDetachSelf(pDrvIns, fFlags);
     878}
     879
     880/**
    818881 * @copydoc PDMDRVHLP::pfnPDMQueueCreate
    819882 */
  • trunk/src/VBox/Devices/Audio/audio.c

    r20501 r22277  
    19711971/**
    19721972 * Construct an AUDIO driver instance.
    1973  *
    1974  * @returns VBox status.
    1975  * @param   pDrvIns     The driver instance data.
    1976  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    1977  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    1978  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    1979  *                      iInstance it's expected to be used a bit in this function.
     1973 * 
     1974 * @copydoc FNPDMDRVCONSTRUCT
    19801975 */
    1981 static DECLCALLBACK(int) drvAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
    1982 {
    1983     int rc;
    1984     PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
    1985     char *drvname;
     1976static DECLCALLBACK(int) drvAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
     1977{
     1978    PDRVAUDIO   pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
     1979    char       *drvname;
     1980    int         rc;
    19861981
    19871982    LogFlow(("drvAUDIOConstruct:\n"));
     1983
    19881984    /*
    19891985     * Validate the config.
     
    20772073    /* pfnResume */
    20782074    audioResume,
     2075    /* pfnAttach */
     2076    NULL,
    20792077    /* pfnDetach */
    20802078    NULL,
    20812079    /* pfnPowerOff */
    2082     drvAudioPowerOff
     2080    drvAudioPowerOff,
     2081    /* pfnSoftReset */
     2082    NULL,
     2083    /* u32EndVersion */
     2084    PDM_DRVREG_VERSION
    20832085};
     2086
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r22274 r22277  
    55355535    PVGASTATE   pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
    55365536
    5537     AssertMsgReturn(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     5537    AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    55385538                    ("VGA device does not support hotplugging\n"),
    55395539                    VERR_INVALID_PARAMETER);
     
    56155615    PVGASTATE   pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
    56165616
    5617     AssertMsg(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     5617    AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    56185618              ("VGA device does not support hotplugging\n"));
    56195619
     
    59895989     * Attach to the display.
    59905990     */
    5991     rc = vgaAttach(pDevIns, 0 /* display LUN # */, PDMDEVATT_FLAGS_NOT_HOT_PLUG);
     5991    rc = vgaAttach(pDevIns, 0 /* display LUN # */, PDM_TACH_FLAGS_NOT_HOT_PLUG);
    59925992    if (RT_FAILURE(rc))
    59935993        return rc;
  • trunk/src/VBox/Devices/Input/DevPS2.cpp

    r21188 r22277  
    15371537    KBDState   *pThis = PDMINS_2_DATA(pDevIns, KBDState *);
    15381538
    1539     AssertMsgReturn(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     1539    AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    15401540                    ("PS/2 device does not support hotplugging\n"),
    15411541                    VERR_INVALID_PARAMETER);
     
    17301730     * Attach to the keyboard and mouse drivers.
    17311731     */
    1732     rc = kbdAttach(pDevIns, 0 /* keyboard LUN # */, PDMDEVATT_FLAGS_NOT_HOT_PLUG);
     1732    rc = kbdAttach(pDevIns, 0 /* keyboard LUN # */, PDM_TACH_FLAGS_NOT_HOT_PLUG);
    17331733    if (RT_FAILURE(rc))
    17341734        return rc;
    1735     rc = kbdAttach(pDevIns, 1 /* aux/mouse LUN # */, PDMDEVATT_FLAGS_NOT_HOT_PLUG);
     1735    rc = kbdAttach(pDevIns, 1 /* aux/mouse LUN # */, PDM_TACH_FLAGS_NOT_HOT_PLUG);
    17361736    if (RT_FAILURE(rc))
    17371737        return rc;
  • trunk/src/VBox/Devices/Input/DrvKeyboardQueue.cpp

    r21363 r22277  
    240240 * Construct a keyboard driver instance.
    241241 *
    242  * @returns VBox status.
    243  * @param   pDrvIns     The driver instance data.
    244  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    245  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    246  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    247  *                      iInstance it's expected to be used a bit in this function.
    248  */
    249 static DECLCALLBACK(int) drvKbdQueueConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     242 * @copydoc FNPDMDRVCONSTRUCT
     243 */
     244static DECLCALLBACK(int) drvKbdQueueConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    250245{
    251246    PDRVKBDQUEUE pDrv = PDMINS_2_DATA(pDrvIns, PDRVKBDQUEUE);
     
    283278     */
    284279    PPDMIBASE pDownBase;
    285     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pDownBase);
     280    int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pDownBase);
    286281    if (RT_FAILURE(rc))
    287282    {
     
    363358    /* pfnResume */
    364359    drvKbdQueueResume,
     360    /* pfnAttach */
     361    NULL,
    365362    /* pfnDetach */
    366363    NULL,
    367     /** pfnPowerOff */
    368     drvKbdQueuePowerOff
     364    /* pfnPowerOff */
     365    drvKbdQueuePowerOff,
     366    /* pfnSoftReset */
     367    NULL,
     368    /* u32EndVersion */
     369    PDM_DRVREG_VERSION
    369370};
    370371
  • trunk/src/VBox/Devices/Input/DrvMouseQueue.cpp

    r21363 r22277  
    226226
    227227/**
    228  * Construct a mouse driver instance.
    229  *
    230  * @returns VBox status.
    231  * @param   pDrvIns     The driver instance data.
    232  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    233  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    234  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    235  *                      iInstance it's expected to be used a bit in this function.
    236  */
    237 static DECLCALLBACK(int) drvMouseQueueConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     228 * Construct a mouse driver instance.
     229 * 
     230 * @copydoc FNPDMDRVCONSTRUCT
     231 */
     232static DECLCALLBACK(int) drvMouseQueueConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    238233{
    239234    PDRVMOUSEQUEUE pDrv = PDMINS_2_DATA(pDrvIns, PDRVMOUSEQUEUE);
     
    269264     */
    270265    PPDMIBASE pDownBase;
    271     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pDownBase);
     266    int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pDownBase);
    272267    if (RT_FAILURE(rc))
    273268    {
     
    349344    /* pfnResume */
    350345    drvMouseQueueResume,
     346    /* pfnAttach */
     347    NULL,
    351348    /* pfnDetach */
    352349    NULL,
    353     /** pfnPowerOff */
    354     drvMouseQueuePowerOff
     350    /* pfnPowerOff */
     351    drvMouseQueuePowerOff,
     352    /* pfnSoftReset */
     353    NULL,
     354    /* u32EndVersion */
     355    PDM_DRVREG_VERSION
    355356};
    356357
    357 
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r20708 r22277  
    743743 * Construct a TAP network transport driver instance.
    744744 *
    745  * @returns VBox status.
    746  * @param   pDrvIns     The driver instance data.
    747  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    748  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    749  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    750  *                      iInstance it's expected to be used a bit in this function.
    751  */
    752 static DECLCALLBACK(int) drvIntNetConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     745 * @copydoc FNPDMDRVCONSTRUCT
     746 */
     747static DECLCALLBACK(int) drvIntNetConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    753748{
    754749    PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
     
    796791     * Check that no-one is attached to us.
    797792     */
    798     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, NULL);
    799     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    800     {
    801         AssertMsgFailed(("Configuration error: Cannot attach drivers to the TAP driver!\n"));
    802         return VERR_PDM_DRVINS_NO_ATTACH;
    803     }
     793    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     794                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     795                    VERR_PDM_DRVINS_NO_ATTACH);
    804796
    805797    /*
     
    826818     * The name of the internal network to connect to.
    827819     */
    828     rc = CFGMR3QueryString(pCfgHandle, "Network", OpenReq.szNetwork, sizeof(OpenReq.szNetwork));
     820    int rc = CFGMR3QueryString(pCfgHandle, "Network", OpenReq.szNetwork, sizeof(OpenReq.szNetwork));
    829821    if (RT_FAILURE(rc))
    830822        return PDMDRV_SET_ERROR(pDrvIns, rc,
     
    11411133    /* pfnResume */
    11421134    drvIntNetResume,
     1135    /* pfnAttach */
     1136    NULL,
    11431137    /* pfnDetach */
    11441138    NULL,
    11451139    /* pfnPowerOff */
    1146     drvIntNetPowerOff
     1140    drvIntNetPowerOff,
     1141    /* pfnSoftReset */
     1142    NULL,
     1143    /* u32EndVersion */
     1144    PDM_DRVREG_VERSION
    11471145};
    11481146
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r22252 r22277  
    855855 * Construct a NAT network transport driver instance.
    856856 *
    857  * @returns VBox status.
    858  * @param   pDrvIns     The driver instance data.
    859  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    860  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    861  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    862  *                      iInstance it's expected to be used a bit in this function.
    863  */
    864 static DECLCALLBACK(int) drvNATConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     857 * @copydoc FNPDMDRVCONSTRUCT
     858 */
     859static DECLCALLBACK(int) drvNATConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    865860{
    866861    PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT);
    867     char szNetAddr[16];
    868     char szNetwork[32]; /* xxx.xxx.xxx.xxx/yy */
    869862
    870863    LogFlow(("drvNATConstruct:\n"));
     
    873866     * Validate the config.
    874867     */
    875     if (!CFGMR3AreValuesValid(pCfgHandle, "PassDomain\0TFTPPrefix\0BootFile\0Network"
    876         "\0NextServer\0DNSProxy\0BindIP\0"
    877         "SocketRcvBuf\0SocketSndBuf\0TcpRcvSpace\0TcpSndSpace\0"))
     868    if (!CFGMR3AreValuesValid(pCfgHandle,
     869                              "PassDomain\0TFTPPrefix\0BootFile\0Network"
     870                              "\0NextServer\0DNSProxy\0BindIP\0"
     871                              "SocketRcvBuf\0SocketSndBuf\0TcpRcvSpace\0TcpSndSpace\0"))
    878872        return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,
    879873                                N_("Unknown NAT configuration option, only supports PassDomain,"
     
    928922
    929923    /* Generate a network address for this network card. */
     924    char szNetwork[32]; /* xxx.xxx.xxx.xxx/yy */
    930925    GET_STRING(rc, pThis, pCfgHandle, "Network", szNetwork[0], sizeof(szNetwork));
    931926    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     
    940935                                   pDrvIns->iInstance, szNetwork);
    941936
     937    char szNetAddr[16];
    942938    RTStrPrintf(szNetAddr, sizeof(szNetAddr), "%d.%d.%d.%d",
    943939               (Network & 0xFF000000) >> 24, (Network & 0xFF0000) >> 16,
     
    979975#ifdef VBOX_WITH_STATISTICS
    980976        PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatQueuePktSent,    STAMTYPE_COUNTER,
    981                               STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "counting packet sent viai "
    982                               "PDM queue", "/Drivers/NAT%u/QueuePacketSent", pDrvIns->iInstance);
     977                               STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "counting packet sent viai "
     978                               "PDM queue", "/Drivers/NAT%u/QueuePacketSent", pDrvIns->iInstance);
    983979        PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatQueuePktDropped, STAMTYPE_COUNTER,
    984                               STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "counting packet sent via PDM"
    985                               " queue", "/Drivers/NAT%u/QueuePacketDropped", pDrvIns->iInstance);
     980                               STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "counting packet sent via PDM"
     981                               " queue", "/Drivers/NAT%u/QueuePacketDropped", pDrvIns->iInstance);
    986982        PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatConsumerFalse, STAMTYPE_COUNTER,
    987                               STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "counting PDM consumer false"
    988                               " queue", "/Drivers/NAT%u/PDMConsumerFalse", pDrvIns->iInstance);
     983                               STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "counting PDM consumer false"
     984                               " queue", "/Drivers/NAT%u/PDMConsumerFalse", pDrvIns->iInstance);
    989985# ifdef SLIRP_SPLIT_CAN_OUTPUT
    990986        PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatNATRxWakeups, STAMTYPE_COUNTER,
    991                               STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "counting wakeups of NATRX"
    992                               " thread", "/Drivers/NAT%u/NATRxWakeups", pDrvIns->iInstance);
     987                               STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "counting wakeups of NATRX"
     988                               " thread", "/Drivers/NAT%u/NATRxWakeups", pDrvIns->iInstance);
    993989# endif
    994990#endif
     
    11121108    /* pfnResume */
    11131109    NULL,
     1110    /* pfnAttach */
     1111    NULL,
    11141112    /* pfnDetach */
     1113    NULL,
     1114    /* pfnPowerOff */
     1115    NULL,
     1116    /* pfnSoftReset */
    11151117    NULL,
    1116     /* pfnPowerOff */
    1117     NULL
     1118    /* u32EndVersion */
     1119    PDM_DRVREG_VERSION
    11181120};
     1121
  • trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp

    r15518 r22277  
    302302 * Construct a NAT network transport driver instance.
    303303 *
    304  * @returns VBox status.
    305  * @param   pDrvIns     The driver instance data.
    306  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    307  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    308  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    309  *                      iInstance it's expected to be used a bit in this function.
    310  */
    311 static DECLCALLBACK(int) drvNetSnifferConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     304 * @copydoc FNPDMDRVCONSTRUCT
     305 */
     306static DECLCALLBACK(int) drvNetSnifferConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    312307{
    313308    PDRVNETSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER);
     
    380375     */
    381376    PPDMIBASE   pBaseDown;
    382     rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseDown);
     377    rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBaseDown);
    383378    if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    384379        pThis->pConnector = NULL;
     
    458453    /* pfnResume */
    459454    NULL,
     455    /* pfnAttach */
     456    NULL,
    460457    /* pfnDetach */
    461     NULL,
     458    NULL, 
    462459    /* pfnPowerOff */
    463     NULL
     460    NULL,
     461    /* pfnSoftReset */
     462    NULL,
     463    /* u32EndVersion */
     464    PDM_DRVREG_VERSION
    464465};
    465466
  • trunk/src/VBox/Devices/Network/DrvTAP.cpp

    r20708 r22277  
    882882 * Construct a TAP network transport driver instance.
    883883 *
    884  * @returns VBox status.
    885  * @param   pDrvIns     The driver instance data.
    886  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    887  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    888  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    889  *                      iInstance it's expected to be used a bit in this function.
    890  */
    891 static DECLCALLBACK(int) drvTAPConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     884 * @copydoc FNPDMDRVCONSTRUCT
     885 */
     886static DECLCALLBACK(int) drvTAPConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    892887{
    893888    PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP);
     
    926921     * Check that no-one is attached to us.
    927922     */
    928     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, NULL);
    929     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    930         return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_NO_ATTACH,
    931                                 N_("Configuration error: Cannot attach drivers to the TAP driver"));
     923    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     924                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     925                    VERR_PDM_DRVINS_NO_ATTACH);
    932926
    933927    /*
     
    942936     * Read the configuration.
    943937     */
     938    int rc;
    944939#if defined(RT_OS_SOLARIS)   /** @todo Other platforms' TAP code should be moved here from ConsoleImpl & VBoxBFE. */
    945940    rc = CFGMR3QueryStringAlloc(pCfgHandle, "TAPSetupApplication", &pThis->pszSetupApplication);
     
    10961091    /* pfnResume */
    10971092    NULL,
     1093    /* pfnAttach */
     1094    NULL,
    10981095    /* pfnDetach */
     1096    NULL,
     1097    /* pfnPowerOff */
     1098    NULL,
     1099    /* pfnSoftReset */
    10991100    NULL,
    1100     /* pfnPowerOff */
    1101     NULL
     1101    /* u32EndVersion */
     1102    PDM_DRVREG_VERSION
    11021103};
     1104
  • trunk/src/VBox/Devices/PC/DrvACPI.cpp

    r19967 r22277  
    724724 * Construct an ACPI driver instance.
    725725 *
    726  * @returns VBox status.
    727  * @param   pDrvIns     The driver instance data.
    728  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    729  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    730  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    731  *                      iInstance it's expected to be used a bit in this function.
     726 * @copydoc FNPDMDRVCONSTRUCT
    732727 */
    733 static DECLCALLBACK(int) drvACPIConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     728static DECLCALLBACK(int) drvACPIConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    734729{
    735730    PDRVACPI pThis = PDMINS_2_DATA(pDrvIns, PDRVACPI);
     
    754749     * Check that no-one is attached to us.
    755750     */
    756     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, NULL);
    757     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    758     {
    759         AssertMsgFailed(("Configuration error: Cannot attach drivers to the ACPI driver!\n"));
    760         return VERR_PDM_DRVINS_NO_ATTACH;
    761     }
     751    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     752                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     753                    VERR_PDM_DRVINS_NO_ATTACH);
    762754
    763755    /*
     
    768760    if (!pThis->pPort)
    769761    {
    770         AssertMsgFailed(("Configuration error: "
    771                          "the above device/driver didn't export the ACPI port interface!\n"));
     762        AssertMsgFailed(("Configuration error: the above device/driver didn't export the ACPI port interface!\n"));
    772763        return VERR_PDM_MISSING_INTERFACE_ABOVE;
    773764    }
     
    810801    /* pfnResume */
    811802    NULL,
     803    /* pfnAttach */
     804    NULL,
    812805    /* pfnDetach */
     806    NULL,
     807    /* pfnPowerOff */
     808    NULL,
     809    /* pfnSoftReset */
    813810    NULL,
    814     /* pfnPowerOff */
    815     NULL
     811    /* u32EndVersion */
     812    PDM_DRVREG_VERSION
    816813};
    817814
  • trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp

    r20961 r22277  
    260260/**
    261261 * Construct a host parallel driver instance.
    262  *
    263  * @returns VBox status.
    264  * @param   pDrvIns     The driver instance data.
    265  *                      If the registration structure is needed,
    266  *                      pDrvIns->pDrvReg points to it.
    267  * @param   pCfgHandle  Configuration node handle for the driver. Use this to
    268  *                      obtain the configuration of the driver instance. It's
    269  *                      also found in pDrvIns->pCfgHandle as it's expected to
    270  *                      be used frequently in this function.
    271  */
    272 static DECLCALLBACK(int) drvHostParallelConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     262 * 
     263 * @copydoc FNPDMDRVCONSTRUCT
     264 */
     265static DECLCALLBACK(int) drvHostParallelConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    273266{
    274267    PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
     
    437430    /* pfnResume */
    438431    NULL,
     432    /* pfnAttach */
     433    NULL,
    439434    /* pfnDetach */
    440     NULL,
    441     /** pfnPowerOff */
    442     NULL
     435    NULL,
     436    /* pfnPowerOff */
     437    NULL,
     438    /* pfnSoftReset */
     439    NULL,
     440    /* u32EndVersion */
     441    PDM_DRVREG_VERSION
    443442};
    444443
  • trunk/src/VBox/Devices/Serial/DrvChar.cpp

    r19624 r22277  
    288288/**
    289289 * Construct a char driver instance.
    290  *
    291  * @returns VBox status.
    292  * @param   pDrvIns     The driver instance data.
    293  *                      If the registration structure is needed,
    294  *                      pDrvIns->pDrvReg points to it.
    295  * @param   pCfgHandle  Configuration node handle for the driver. Use this to
    296  *                      obtain the configuration of the driver instance. It's
    297  *                      also found in pDrvIns->pCfgHandle as it's expected to
    298  *                      be used frequently in this function.
    299  */
    300 static DECLCALLBACK(int) drvCharConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     290 * 
     291 * @copydoc FNPDMDRVCONSTRUCT
     292 */
     293static DECLCALLBACK(int) drvCharConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    301294{
    302295    PDRVCHAR pThis = PDMINS_2_DATA(pDrvIns, PDRVCHAR);
     
    326319     */
    327320    PPDMIBASE pBase;
    328     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBase);
     321    int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBase);
    329322    if (RT_FAILURE(rc))
    330323        return rc; /* Don't call PDMDrvHlpVMSetError here as we assume that the driver already set an appropriate error */
     
    428421    /* pfnResume */
    429422    NULL,
     423    /* pfnAttach */
     424    NULL,
    430425    /* pfnDetach */
    431     NULL,
    432     /** pfnPowerOff */
    433     NULL
     426    NULL,
     427    /* pfnPowerOff */
     428    NULL,
     429    /* pfnSoftReset */
     430    NULL,
     431    /* u32EndVersion */
     432    PDM_DRVREG_VERSION
    434433};
    435434
  • trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp

    r22072 r22277  
    11781178/**
    11791179 * Construct a char driver instance.
    1180  *
    1181  * @returns VBox status.
    1182  * @param   pDrvIns     The driver instance data.
    1183  *                      If the registration structure is needed,
    1184  *                      pDrvIns->pDrvReg points to it.
    1185  * @param   pCfgHandle  Configuration node handle for the driver. Use this to
    1186  *                      obtain the configuration of the driver instance. It's
    1187  *                      also found in pDrvIns->pCfgHandle as it's expected to
    1188  *                      be used frequently in this function.
     1180 * 
     1181 * @copydoc FNPDMDRVCONSTRUCT
    11891182 */
    1190 static DECLCALLBACK(int) drvHostSerialConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     1183static DECLCALLBACK(int) drvHostSerialConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    11911184{
    11921185    PDRVHOSTSERIAL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTSERIAL);
     
    14651458    /* pfnResume */
    14661459    NULL,
     1460    /* pfnAttach */
     1461    NULL,
    14671462    /* pfnDetach */
     1463    NULL,
     1464    /* pfnPowerOff */
     1465    NULL,
     1466    /* pfnSoftReset */
    14681467    NULL,
    1469     /** pfnPowerOff */
    1470     NULL
     1468    /* u32EndVersion */
     1469    PDM_DRVREG_VERSION
    14711470};
    14721471
  • trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp

    r18443 r22277  
    396396 * Construct a named pipe stream driver instance.
    397397 *
    398  * @returns VBox status.
    399  * @param   pDrvIns     The driver instance data.
    400  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    401  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    402  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    403  *                      iInstance it's expected to be used a bit in this function.
    404  */
    405 static DECLCALLBACK(int) drvNamedPipeConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     398 * @copydoc FNPDMDRVCONSTRUCT
     399 */
     400static DECLCALLBACK(int) drvNamedPipeConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    406401{
    407402    int rc;
     
    646641    /* pfnResume */
    647642    NULL,
     643    /* pfnAttach */
     644    NULL,
    648645    /* pfnDetach */
    649646    NULL,
    650647    /* pfnPowerOff */
    651648    drvNamedPipePowerOff,
     649    /* pfnSoftReset */
     650    NULL,
     651    /* u32EndVersion */
     652    PDM_DRVREG_VERSION
    652653};
     654
  • trunk/src/VBox/Devices/Serial/DrvRawFile.cpp

    r19626 r22277  
    1 /** @file
    2  *
    3  * VBox stream devices:
    4  * Raw file output
     1/* $Id$ */
     2/** @file
     3 * VBox stream drivers - Raw file output.
    54 */
    65
     
    2524*   Header Files                                                               *
    2625*******************************************************************************/
    27 #define LOG_GROUP LOG_GROUP_DRV_NAMEDPIPE
     26#define LOG_GROUP LOG_GROUP_DEFAULT
    2827#include <VBox/pdmdrv.h>
    2928#include <iprt/assert.h>
     
    6059    PPDMDRVINS          pDrvIns;
    6160    /** Pointer to the file name. (Freed by MM) */
    62     char                *pszLocation;
     61    char               *pszLocation;
    6362    /** Flag whether VirtualBox represents the server or client side. */
    6463    RTFILE              OutputFile;
     
    121120 * Construct a raw output stream driver instance.
    122121 *
    123  * @returns VBox status.
    124  * @param   pDrvIns     The driver instance data.
    125  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    126  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    127  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    128  *                      iInstance it's expected to be used a bit in this function.
    129  */
    130 static DECLCALLBACK(int) drvRawFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
    131 {
    132     int rc;
    133     char *pszLocation = NULL;
     122 * @copydoc FNPDMDRVCONSTRUCT
     123 */
     124static DECLCALLBACK(int) drvRawFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
     125{
    134126    PDRVRAWFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE);
    135127
     
    149141     */
    150142    if (!CFGMR3AreValuesValid(pCfgHandle, "Location\0"))
    151     {
    152         rc = VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    153         goto out;
    154     }
    155 
    156     rc = CFGMR3QueryStringAlloc(pCfgHandle, "Location", &pszLocation);
     143        AssertFailedReturn(VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES);
     144
     145    int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Location", &pThis->pszLocation);
     146    if (RT_FAILURE(rc))
     147        AssertMsgFailedReturn(("Configuration error: query \"Location\" resulted in %Rrc.\n", rc), rc);
     148
     149    /*
     150     * Open the raw file.
     151     */
     152    rc = RTFileOpen(&pThis->OutputFile, pThis->pszLocation, RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
    157153    if (RT_FAILURE(rc))
    158154    {
    159         AssertMsgFailed(("Configuration error: query \"Location\" resulted in %Rrc.\n", rc));
    160         goto out;
    161     }
    162     pThis->pszLocation = pszLocation;
    163 
    164     rc = RTFileOpen(&pThis->OutputFile, pThis->pszLocation, RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE);
    165     if (RT_FAILURE(rc))
    166     {
    167         LogRel(("RawFile%d: CreateFile failed rc=%Rrc\n", pThis->pDrvIns->iInstance));
    168         return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("RawFile#%d failed to create the raw output file %s"), pDrvIns->iInstance, pszLocation);
    169     }
    170 
    171 out:
    172     if (RT_FAILURE(rc))
    173     {
    174         if (pszLocation)
    175             MMR3HeapFree(pszLocation);
    176         return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("RawFile#%d failed to initialize"), pDrvIns->iInstance);
    177     }
    178 
    179     LogFlow(("drvRawFileConstruct: location %s\n", pszLocation));
    180     LogRel(("RawFile: location %s\n", pszLocation));
     155        LogRel(("RawFile%d: CreateFile failed rc=%Rrc\n", pDrvIns->iInstance));
     156        return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("RawFile#%d failed to create the raw output file %s"), pDrvIns->iInstance, pThis->pszLocation);
     157    }
     158
     159    LogFlow(("drvRawFileConstruct: location %s\n", pThis->pszLocation));
     160    LogRel(("RawFile#%u: location %s\n", pDrvIns->iInstance, pThis->pszLocation));
    181161    return VINF_SUCCESS;
    182162}
     
    198178    if (pThis->pszLocation)
    199179        MMR3HeapFree(pThis->pszLocation);
     180
     181    if (pThis->OutputFile != NIL_RTFILE)
     182    {   
     183        RTFileClose(pThis->OutputFile);
     184        pThis->OutputFile = NIL_RTFILE;
     185    }
    200186}
    201187
     
    214200
    215201    if (pThis->OutputFile != NIL_RTFILE)
     202    {   
    216203        RTFileClose(pThis->OutputFile);
     204        pThis->OutputFile = NIL_RTFILE;
     205    }
    217206}
    218207
     
    251240    /* pfnResume */
    252241    NULL,
     242    /* pfnAttach */
     243    NULL,
    253244    /* pfnDetach */
    254245    NULL,
    255246    /* pfnPowerOff */
    256247    drvRawFilePowerOff,
     248    /* pfnSoftReset */
     249    NULL,
     250    /* u32EndVersion */
     251    PDM_DRVREG_VERSION
    257252};
     253
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r21188 r22277  
    57155715    unsigned        iInterface;
    57165716
    5717     AssertMsg(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     5717    AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    57185718              ("PIIX3IDE: Device does not support hotplugging\n"));
    57195719
     
    58935893    unsigned        iInterface;
    58945894
    5895     AssertMsgReturn(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     5895    AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    58965896                    ("PIIX3IDE: Device does not support hotplugging\n"),
    58975897                    VERR_INVALID_PARAMETER);
  • trunk/src/VBox/Devices/Storage/DevBusLogic.cpp

    r21363 r22277  
    25472547    Log(("%s:\n", __FUNCTION__));
    25482548
    2549     AssertMsg(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     2549    AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    25502550              ("BusLogic: Device does not support hotplugging\n"));
    25512551
     
    25742574    int rc;
    25752575
    2576     AssertMsgReturn(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     2576    AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    25772577                    ("BusLogic: Device does not support hotplugging\n"),
    25782578                    VERR_INVALID_PARAMETER);
  • trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp

    r21363 r22277  
    50835083    PLSILOGICDEVICE pDevice = &pThis->aDeviceStates[iLUN];
    50845084
    5085     AssertMsg(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     5085    AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    50865086              ("LsiLogic: Device does not support hotplugging\n"));
    50875087
     
    51115111    int rc;
    51125112
    5113     AssertMsgReturn(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     5113    AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    51145114                    ("LsiLogic: Device does not support hotplugging\n"),
    51155115                    VERR_INVALID_PARAMETER);
  • trunk/src/VBox/Devices/Storage/DrvBlock.cpp

    r18498 r22277  
    515515     * Attach the media driver and query it's interface.
    516516     */
     517    uint32_t fTachFlags = 0; /** @todo figure attachment flags for mount. */
    517518    PPDMIBASE pBase;
    518     int rc = pThis->pDrvIns->pDrvHlp->pfnAttach(pThis->pDrvIns, &pBase);
     519    int rc = PDMDrvHlpAttach(pThis->pDrvIns, fTachFlags, &pBase);
    519520    if (RT_FAILURE(rc))
    520521    {
     
    555556     */
    556557    AssertMsgFailed(("No media interface!\n"));
    557     int rc2 = pThis->pDrvIns->pDrvHlp->pfnDetach(pThis->pDrvIns);
     558    int rc2 = pThis->pDrvIns->pDrvHlp->pfnDetach(pThis->pDrvIns, fTachFlags);
    558559    AssertRC(rc2);
    559560    pThis->pDrvMedia = NULL;
     
    587588     * Detach the media driver and query it's interface.
    588589     */
    589     int rc = pThis->pDrvIns->pDrvHlp->pfnDetach(pThis->pDrvIns);
     590    int rc = pThis->pDrvIns->pDrvHlp->pfnDetach(pThis->pDrvIns, 0 /*fFlags*/);
    590591    if (RT_FAILURE(rc))
    591592    {
     
    668669
    669670/** @copydoc FNPDMDRVDETACH. */
    670 static DECLCALLBACK(void)  drvblockDetach(PPDMDRVINS pDrvIns)
     671static DECLCALLBACK(void)  drvblockDetach(PPDMDRVINS pDrvIns, uint32_t fFlags)
    671672{
    672673    PDRVBLOCK pThis = PDMINS_2_DATA(pDrvIns, PDRVBLOCK);
    673674    pThis->pDrvMedia = NULL;
    674675    pThis->pDrvMediaAsync = NULL;
     676    NOREF(fFlags);
    675677}
    676678
     
    691693 * Construct a block driver instance.
    692694 *
    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.
     695 * @copydoc FNPDMDRVCONSTRUCT
    699696 */
    700 static DECLCALLBACK(int) drvblockConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     697static DECLCALLBACK(int) drvblockConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    701698{
    702699    PDRVBLOCK pThis = PDMINS_2_DATA(pDrvIns, PDRVBLOCK);
     
    867864     */
    868865    PPDMIBASE pBase;
    869     rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBase);
     866    rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBase);
    870867    if (    rc == VERR_PDM_NO_ATTACHED_DRIVER
    871868        &&  pThis->enmType != PDMBLOCKTYPE_HARD_DISK)
     
    926923    /* pfnResume */
    927924    NULL,
     925    /* pfnAttach */
     926    NULL,
    928927    /* pfnDetach */
    929     drvblockDetach
     928    drvblockDetach,
     929    /* pfnPowerOff */
     930    NULL,
     931    /* pfnSoftReset */
     932    NULL,
     933    /* u32EndVersion */
     934    PDM_DRVREG_VERSION
    930935};
     936
  • trunk/src/VBox/Devices/Storage/DrvHostBase.cpp

    r21691 r22277  
    20452045     * Check that there are no drivers below us.
    20462046     */
    2047     PPDMIBASE pBase;
    2048     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBase);
    2049     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    2050     {
    2051         AssertMsgFailed(("Configuration error: No attached driver, please! (rc=%Rrc)\n", rc));
    2052         return VERR_PDM_DRVINS_NO_ATTACH;
    2053     }
     2047    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     2048                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     2049                    VERR_PDM_DRVINS_NO_ATTACH);
    20542050
    20552051    /*
    20562052     * Register saved state.
    20572053     */
    2058     rc = pDrvIns->pDrvHlp->pfnSSMRegister(pDrvIns, pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, 1, 0,
    2059                                           NULL, NULL, NULL,
    2060                                           NULL, NULL, drvHostBaseLoadDone);
     2054    int rc = pDrvIns->pDrvHlp->pfnSSMRegister(pDrvIns, pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, 1, 0,
     2055                                              NULL, NULL, NULL,
     2056                                              NULL, NULL, drvHostBaseLoadDone);
    20612057    if (RT_FAILURE(rc))
    20622058        return rc;
  • trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp

    r19968 r22277  
    741741 * Construct a host dvd drive driver instance.
    742742 *
    743  * @returns VBox status.
    744  * @param   pDrvIns     The driver instance data.
    745  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    746  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    747  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    748  *                      iInstance it's expected to be used a bit in this function.
    749  */
    750 static DECLCALLBACK(int) drvHostDvdConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     743 * @copydoc FNPDMDRVCONSTRUCT
     744 */
     745static DECLCALLBACK(int) drvHostDvdConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    751746{
    752747    PDRVHOSTBASE pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTBASE);
     
    862857    /* pfnResume */
    863858    NULL,
     859    /* pfnAttach */
     860    NULL,
    864861    /* pfnDetach */
    865     NULL
     862    NULL,
     863    /* pfnPowerOff */
     864    NULL,
     865    /* pfnSoftReset */
     866    NULL,
     867    /* u32EndVersion */
     868    PDM_DRVREG_VERSION
    866869};
    867870
  • trunk/src/VBox/Devices/Storage/DrvHostFloppy.cpp

    r11284 r22277  
    147147 * @copydoc FNPDMDRVCONSTRUCT
    148148 */
    149 static DECLCALLBACK(int) drvHostFloppyConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     149static DECLCALLBACK(int) drvHostFloppyConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    150150{
    151151    PDRVHOSTFLOPPY pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTFLOPPY);
     
    228228    /* pfnResume */
    229229    NULL,
     230    /* pfnAttach */
     231    NULL,
    230232    /* pfnDetach */
    231     NULL
     233    NULL,
     234    /* pfnPowerOff */
     235    NULL,
     236    /* pfnSoftReset */
     237    NULL,
     238    /* u32EndVersion */
     239    PDM_DRVREG_VERSION
    232240};
    233241
  • trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp

    r13840 r22277  
    9090 * Construct a ISO media driver instance.
    9191 *
    92  * @returns VBox status.
    93  * @param   pDrvIns     The driver instance data.
    94  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    95  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    96  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    97  *                      iInstance it's expected to be used a bit in this function.
    98  */
    99 static DECLCALLBACK(int) drvMediaISOConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     92 * @copydoc FNPDMDRVCONSTRUCT
     93 */
     94static DECLCALLBACK(int) drvMediaISOConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    10095{
    10196    PDRVMEDIAISO pThis = PDMINS_2_DATA(pDrvIns, PDRVMEDIAISO);
     
    348343    /* pfnResume */
    349344    NULL,
     345    /* pfnAttach */
     346    NULL,
    350347    /* pfnDetach */
    351     NULL,
     348    NULL, 
    352349    /* pfnPowerOff */
    353     NULL
     350    NULL,
     351    /* pfnSoftReset */
     352    NULL,
     353    /* u32EndVersion */
     354    PDM_DRVREG_VERSION
    354355};
     356
  • trunk/src/VBox/Devices/Storage/DrvRawImage.cpp

    r13840 r22277  
    9292/**
    9393 * Construct a raw image driver instance.
    94  *
    95  * @returns VBox status.
    96  * @param   pDrvIns     The driver instance data.
    97  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    98  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    99  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    100  *                      iInstance it's expected to be used a bit in this function.
    101  */
    102 static DECLCALLBACK(int) drvRawImageConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     94 * 
     95 * @copydoc FNPDMDRVCONSTRUCT
     96 */
     97static DECLCALLBACK(int) drvRawImageConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    10398{
    10499    PDRVRAWIMAGE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWIMAGE);
     
    398393    /* pfnResume */
    399394    NULL,
     395    /* pfnAttach */
     396    NULL,
    400397    /* pfnDetach */
    401     NULL,
     398    NULL, 
    402399    /* pfnPowerOff */
    403     NULL
     400    NULL,
     401    /* pfnSoftReset */
     402    NULL,
     403    /* u32EndVersion */
     404    PDM_DRVREG_VERSION
    404405};
  • trunk/src/VBox/Devices/Storage/DrvSCSI.cpp

    r21321 r22277  
    753753 * Construct a block driver instance.
    754754 *
    755  * @returns VBox status.
    756  * @param   pDrvIns     The driver instance data.
    757  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    758  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    759  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    760  *                      iInstance it's expected to be used a bit in this function.
    761  */
    762 static DECLCALLBACK(int) drvscsiConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
    763 {
    764     int rc = VINF_SUCCESS;
    765     PDMBLOCKTYPE enmType;
     755 * @copydoc FNPDMDRVCONSTRUCT
     756 */
     757static DECLCALLBACK(int) drvscsiConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
     758{
    766759    PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI);
    767760
     
    777770     * Try attach driver below and query it's block interface.
    778771     */
    779     rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pThis->pDrvBase);
     772    int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pThis->pDrvBase);
    780773    AssertMsgReturn(RT_SUCCESS(rc), ("Attaching driver below failed rc=%Rrc\n", rc), rc);
    781774
     
    817810    pThis->pDrvBlockAsync = (PDMIBLOCKASYNC *)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_BLOCK_ASYNC);
    818811
    819     enmType = pThis->pDrvBlock->pfnGetType(pThis->pDrvBlock);
     812    PDMBLOCKTYPE enmType = pThis->pDrvBlock->pfnGetType(pThis->pDrvBlock);
    820813    if (enmType != PDMBLOCKTYPE_HARD_DISK)
    821814    {
     
    877870    /* pfnResume */
    878871    NULL,
     872    /* pfnAttach */
     873    NULL,
    879874    /* pfnDetach */
     875    NULL,
     876    /* pfnPowerOff */
     877    NULL,
     878    /* pfnSoftReset */
    880879    NULL,
    881     /* pfnPowerOff */
    882     NULL
     880    /* u32EndVersion */
     881    PDM_DRVREG_VERSION
    883882};
  • trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp

    r21321 r22277  
    441441 * Construct a block driver instance.
    442442 *
    443  * @returns VBox status.
    444  * @param   pDrvIns     The driver instance data.
    445  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    446  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    447  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    448  *                      iInstance it's expected to be used a bit in this function.
    449  */
    450 static DECLCALLBACK(int) drvscsihostConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
    451 {
    452     int rc = VINF_SUCCESS;
     443 * @copydoc FNPDMDRVCONSTRUCT
     444 */
     445static DECLCALLBACK(int) drvscsihostConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
     446{
    453447    PDRVSCSIHOST pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSIHOST);
    454448
     
    475469
    476470    /* Create request queue. */
    477     rc = RTReqCreateQueue(&pThis->pQueueRequests);
     471    int rc = RTReqCreateQueue(&pThis->pQueueRequests);
    478472    AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create request queue rc=%Rrc\n"), rc);
    479473
     
    528522    /* pfnSuspend */
    529523    NULL,
    530     /* pfnResume */
     524    /* pfnAttach */
    531525    NULL,
    532526    /* pfnDetach */
    533     NULL
     527    NULL,
     528    /* pfnPowerOff */
     529    NULL,
     530    /* pfnSoftReset */
     531    NULL,
     532    /* u32EndVersion */
     533    PDM_DRVREG_VERSION
    534534};
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r21806 r22277  
    789789 * Construct a VBox disk media driver instance.
    790790 *
    791  * @returns VBox status.
    792  * @param   pDrvIns     The driver instance data.
    793  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    794  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    795  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle as it's expected
    796  *                      to be used frequently in this function.
     791 * @copydoc FNPDMDRVCONSTRUCT
    797792 */
    798793static DECLCALLBACK(int) drvvdConstruct(PPDMDRVINS pDrvIns,
    799                                         PCFGMNODE pCfgHandle)
     794                                        PCFGMNODE pCfgHandle,
     795                                        uint32_t fFlags)
    800796{
    801797    LogFlow(("%s:\n", __FUNCTION__));
     
    885881        PPDMIBASE pBase;
    886882
    887         rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBase);
     883        rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBase);
    888884        if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    889885        {
     
    13081304    /* pfnResume */
    13091305    drvvdResume,
     1306    /* pfnAttach */
     1307    NULL,
    13101308    /* pfnDetach */
    13111309    NULL,
    13121310    /* pfnPowerOff */
    1313     drvvdPowerOff
     1311    drvvdPowerOff,
     1312    /* pfnSoftReset */
     1313    NULL,
     1314    /* u32EndVersion */
     1315    PDM_DRVREG_VERSION
    13141316};
     1317
  • trunk/src/VBox/Devices/Storage/ISCSIHDDCore.cpp

    r22258 r22277  
    12491249    ISCSIREQ aISCSIReq[4];
    12501250    uint32_t aReqBHS[12];
    1251     LogFlow(("drvISCSIDetach: entering\n"));
     1251    LogFlow(("iscsiDetach: entering\n"));
    12521252
    12531253    RTSemMutexRequest(pImage->Mutex, RT_INDEFINITE_WAIT);
     
    13171317    RTSemMutexRelease(pImage->Mutex);
    13181318
    1319     LogFlow(("drvISCSIDetach: leaving\n"));
     1319    LogFlow(("iscsiDetach: leaving\n"));
    13201320    LogRel(("iSCSI: logout to target %s\n", pImage->pszTargetName));
    13211321    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Storage/fdc.c

    r21328 r22277  
    26652665    LogFlow (("ideDetach: iLUN=%u\n", iLUN));
    26662666
    2667     AssertMsgReturn(fFlags & PDMDEVATT_FLAGS_NOT_HOT_PLUG,
     2667    AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
    26682668                    ("The FDC device does not support hotplugging\n"),
    26692669                    VERR_INVALID_PARAMETER);
  • trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.cpp

    r21227 r22277  
    11761176 * Construct a display driver instance.
    11771177 *
    1178  * @returns VBox status.
    1179  * @param   pDrvIns     The driver instance data.
    1180  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    1181  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    1182  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    1183  *                      iInstance it's expected to be used a bit in this function.
    1184  */
    1185 DECLCALLBACK(int) VMDisplay::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     1178 * @copydoc FNPDMDRVCONSTRUCT
     1179 */
     1180DECLCALLBACK(int) VMDisplay::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    11861181{
    11871182    PDRVMAINDISPLAY pData = PDMINS_2_DATA(pDrvIns, PDRVMAINDISPLAY);
     
    11941189    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    11951190        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    1196     PPDMIBASE pBaseIgnore;
    1197     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    1198     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    1199     {
    1200         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    1201         return VERR_PDM_DRVINS_NO_ATTACH;
    1202     }
     1191    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     1192                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     1193                    VERR_PDM_DRVINS_NO_ATTACH);
    12031194
    12041195    /*
     
    12291220     */
    12301221    void *pv;
    1231     rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
     1222    int rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
    12321223    if (RT_FAILURE(rc))
    12331224    {
     
    12861277    /* pfnResume */
    12871278    NULL,
     1279    /* pfnAttach */
     1280    NULL,
    12881281    /* pfnDetach */
    1289     NULL
     1282    NULL,
     1283    /* pfnPowerOff */
     1284    NULL,
     1285    /* pfnSoftReset */
     1286    NULL,
     1287    /* u32EndVersion */
     1288    PDM_DRVREG_VERSION
    12901289};
     1290
  • trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.h

    r21227 r22277  
    6969
    7070    static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    71     static DECLCALLBACK(int)   drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     71    static DECLCALLBACK(int)   drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    7272    static DECLCALLBACK(int)   displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
    7373    static DECLCALLBACK(void)  displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
  • trunk/src/VBox/Frontends/VBoxBFE/KeyboardImpl.cpp

    r13837 r22277  
    208208 * Construct a keyboard driver instance.
    209209 *
    210  * @returns VBox status.
    211  * @param   pDrvIns     The driver instance data.
    212  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    213  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    214  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    215  *                      iInstance it's expected to be used a bit in this function.
    216  */
    217 DECLCALLBACK(int) Keyboard::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     210 * @copydoc FNPDMDRVCONSTRUCT
     211 */
     212DECLCALLBACK(int) Keyboard::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    218213{
    219214    PDRVMAINKEYBOARD pData = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD);
     
    225220    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    226221        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    227     PPDMIBASE pBaseIgnore;
    228     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    229     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    230     {
    231         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    232         return VERR_PDM_DRVINS_NO_ATTACH;
    233     }
     222    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     223                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     224                    VERR_PDM_DRVINS_NO_ATTACH);
    234225
    235226    /*
     
    254245     */
    255246    void *pv;
    256     rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
     247    int rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
    257248    if (RT_FAILURE(rc))
    258249    {
     
    300291    /* pfnResume */
    301292    NULL,
     293    /* pfnAttach */
     294    NULL,
    302295    /* pfnDetach */
    303     NULL
     296    NULL,
     297    /* pfnPowerOff */
     298    NULL,
     299    /* pfnSoftReset */
     300    NULL,
     301    /* u32EndVersion */
     302    PDM_DRVREG_VERSION
    304303};
  • trunk/src/VBox/Frontends/VBoxBFE/KeyboardImpl.h

    r11661 r22277  
    5757
    5858    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    59     static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     59    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    6060    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
    6161
  • trunk/src/VBox/Frontends/VBoxBFE/MouseImpl.cpp

    r21226 r22277  
    216216 * Construct a mouse driver instance.
    217217 *
    218  * @returns VBox status.
    219  * @param   pDrvIns     The driver instance data.
    220  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    221  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    222  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    223  *                      iInstance it's expected to be used a bit in this function.
    224  */
    225 DECLCALLBACK(int) Mouse::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     218 * @copydoc FNPDMDRVCONSTRUCT
     219 */
     220DECLCALLBACK(int) Mouse::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    226221{
    227222    PDRVMAINMOUSE pData = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
     
    233228    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    234229        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    235 
    236     PPDMIBASE pBaseIgnore;
    237     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    238     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    239     {
    240         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    241         return VERR_PDM_DRVINS_NO_ATTACH;
    242     }
     230    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     231                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     232                    VERR_PDM_DRVINS_NO_ATTACH);
    243233
    244234    /*
     
    261251     */
    262252    void *pv;
    263     rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
     253    int rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
    264254    if (RT_FAILURE(rc))
    265255    {
     
    308298    /* pfnResume */
    309299    NULL,
     300    /* pfnAttach */
     301    NULL,
    310302    /* pfnDetach */
    311     NULL
     303    NULL,
     304    /* pfnPowerOff */
     305    NULL,
     306    /* pfnSoftReset */
     307    NULL,
     308    /* u32EndVersion */
     309    PDM_DRVREG_VERSION
    312310};
     311
  • trunk/src/VBox/Frontends/VBoxBFE/MouseImpl.h

    r8155 r22277  
    6969
    7070    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    71     static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     71    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    7272    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
    7373
  • trunk/src/VBox/Frontends/VBoxBFE/StatusImpl.cpp

    r13837 r22277  
    129129 * Construct a status driver instance.
    130130 *
    131  * @returns VBox status.
    132  * @param   pDrvIns     The driver instance data.
    133  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    134  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    135  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    136  *                      iInstance it's expected to be used a bit in this function.
    137  */
    138 DECLCALLBACK(int) VMStatus::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     131 * @copydoc FNPDMDRVCONSTRUCT
     132 */
     133DECLCALLBACK(int) VMStatus::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    139134{
    140135    PDRVMAINSTATUS pData = PDMINS_2_DATA(pDrvIns, PDRVMAINSTATUS);
     
    146141    if (!CFGMR3AreValuesValid(pCfgHandle, "papLeds\0First\0Last\0"))
    147142        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    148     PPDMIBASE pBaseIgnore;
    149     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    150     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    151     {
    152         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    153         return VERR_PDM_DRVINS_NO_ATTACH;
    154     }
     143    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     144                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     145                    VERR_PDM_DRVINS_NO_ATTACH);
    155146
    156147    /*
     
    163154     * Read config.
    164155     */
    165     rc = CFGMR3QueryPtr(pCfgHandle, "papLeds", (void **)&pData->papLeds);
     156    int rc = CFGMR3QueryPtr(pCfgHandle, "papLeds", (void **)&pData->papLeds);
    166157    if (RT_FAILURE(rc))
    167158    {
     
    244235    /* pfnResume */
    245236    NULL,
     237    /* pfnAttach */
     238    NULL,
    246239    /* pfnDetach */
    247     NULL
     240    NULL,
     241    /* pfnPowerOff */
     242    NULL,
     243    /* pfnSoftReset */
     244    NULL,
     245    /* u32EndVersion */
     246    PDM_DRVREG_VERSION
    248247};
     248
  • trunk/src/VBox/Frontends/VBoxBFE/StatusImpl.h

    r8155 r22277  
    3636    static DECLCALLBACK(void)   drvUnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
    3737    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    38     static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     38    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    3939    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
    4040};
  • trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.cpp

    r21227 r22277  
    387387 * Construct a VMMDev driver instance.
    388388 *
    389  * @returns VBox status.
    390  * @param   pDrvIns     The driver instance data.
    391  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    392  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    393  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    394  *                      iInstance it's expected to be used a bit in this function.
    395  */
    396 DECLCALLBACK(int) VMMDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     389 * @copydoc FNPDMDRVCONSTRUCT
     390 */
     391DECLCALLBACK(int) VMMDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    397392{
    398393    PDRVMAINVMMDEV pData = PDMINS_2_DATA(pDrvIns, PDRVMAINVMMDEV);
     
    404399    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    405400        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    406 
    407     PPDMIBASE pBaseIgnore;
    408     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    409     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    410     {
    411         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    412         return VERR_PDM_DRVINS_NO_ATTACH;
    413     }
     401    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     402                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     403                    VERR_PDM_DRVINS_NO_ATTACH);
    414404
    415405    /*
     
    464454     */
    465455    void *pv;
    466     rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
     456    int rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
    467457    if (RT_FAILURE(rc))
    468458    {
     
    525515    /* pfnResume */
    526516    NULL,
     517    /* pfnAttach */
     518    NULL,
    527519    /* pfnDetach */
    528     NULL
     520    NULL,
     521    /* pfnPowerOff */
     522    NULL,
     523    /* pfnSoftReset */
     524    NULL,
     525    /* u32EndVersion */
     526    PDM_DRVREG_VERSION
    529527};
     528
  • trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.h

    r8155 r22277  
    5656    static DECLCALLBACK(void)   UpdateMouseCapabilities(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities);
    5757    static DECLCALLBACK(void)   UpdatePointerShape(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
    58                                                      uint32_t xHot, uint32_t yHot,
    59                                                      uint32_t width, uint32_t height,
    60                                                      void *pShape);
     58                                                   uint32_t xHot, uint32_t yHot,
     59                                                   uint32_t width, uint32_t height,
     60                                                   void *pShape);
    6161    static DECLCALLBACK(int)    VideoModeSupported(PPDMIVMMDEVCONNECTOR pInterface, uint32_t width, uint32_t height,
    6262                                                   uint32_t bpp, bool *fSupported);
     
    6464
    6565    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    66     static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     66    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    6767    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
    6868};
  • trunk/src/VBox/Main/AudioSnifferInterface.cpp

    r14772 r22277  
    157157
    158158/**
    159  * Construct a AudioSniffer driver instance.
    160  *
    161  * @returns VBox status.
    162  * @param   pDrvIns     The driver instance data.
    163  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    164  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    165  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    166  *                      iInstance it's expected to be used a bit in this function.
    167  */
    168 DECLCALLBACK(int) AudioSniffer::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     159 * Construct a AudioSniffer driver instance.
     160 * 
     161 * @copydoc FNPDMDRVCONSTRUCT
     162 */
     163DECLCALLBACK(int) AudioSniffer::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    169164{
    170165    PDRVAUDIOSNIFFER pData = PDMINS_2_DATA(pDrvIns, PDRVAUDIOSNIFFER);
     
    176171     */
    177172    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    178     {
    179173        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    180     }
    181 
    182     PPDMIBASE pBaseIgnore;
    183     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    184     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    185     {
    186         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    187         return VERR_PDM_DRVINS_NO_ATTACH;
    188     }
     174    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     175                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     176                    VERR_PDM_DRVINS_NO_ATTACH);
    189177
    190178    /*
     
    211199     */
    212200    void *pv;
    213     rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
     201    int rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
    214202    if (RT_FAILURE(rc))
    215203    {
     
    257245    /* pfnResume */
    258246    NULL,
     247    /* pfnAttach */
     248    NULL,
    259249    /* pfnDetach */
    260     NULL
     250    NULL,
     251    /* pfnPowerOff */
     252    NULL,
     253    /* pfnSoftReset */
     254    NULL,
     255    /* u32EndVersion */
     256    PDM_DRVREG_VERSION
    261257};
    262258/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r22173 r22277  
    30663066            case DriveState_HostDriveCaptured:
    30673067            {
    3068                 rc = PDMR3DeviceDetach (pVM, pszDevice, uInstance, uLun, PDMDEVATT_FLAGS_NOT_HOT_PLUG);
     3068                rc = PDMR3DeviceDetach (pVM, pszDevice, uInstance, uLun, PDM_TACH_FLAGS_NOT_HOT_PLUG);
    30693069                if (rc == VINF_PDM_NO_DRIVER_ATTACHED_TO_LUN)
    30703070                    rc = VINF_SUCCESS;
     
    31023102             * Detach existing driver chain (block).
    31033103             */
    3104             int rc = PDMR3DeviceDetach (pVM, pszDevice, uInstance, uLun, PDMDEVATT_FLAGS_NOT_HOT_PLUG);
     3104            int rc = PDMR3DeviceDetach (pVM, pszDevice, uInstance, uLun, PDM_TACH_FLAGS_NOT_HOT_PLUG);
    31053105            if (VBOX_FAILURE (rc))
    31063106            {
     
    31323132                 * Attempt to attach the driver.
    31333133                 */
    3134                 rc = PDMR3DeviceAttach (pVM, pszDevice, uInstance, uLun, NULL, PDMDEVATT_FLAGS_NOT_HOT_PLUG);
     3134                rc = PDMR3DeviceAttach(pVM, pszDevice, uInstance, uLun, PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/);
    31353135                AssertRC (rc);
    31363136            }
     
    31883188                         * Attach the driver.
    31893189                         */
    3190                         rc = PDMR3DeviceAttach (pVM, pszDevice, uInstance, uLun, &pBase, PDMDEVATT_FLAGS_NOT_HOT_PLUG);
     3190                        rc = PDMR3DeviceAttach(pVM, pszDevice, uInstance, uLun, PDM_TACH_FLAGS_NOT_HOT_PLUG, &pBase);
    31913191                        RC_CHECK();
    31923192                    }
     
    70857085         * Detach the driver and replace the config node.
    70867086         */
    7087         rc = PDMR3DeviceDetach(pVM, pcszDevice, 0, iLUN, PDMDEVATT_FLAGS_NOT_HOT_PLUG); RC_CHECK();
     7087        rc = PDMR3DeviceDetach(pVM, pcszDevice, 0, iLUN, PDM_TACH_FLAGS_NOT_HOT_PLUG); RC_CHECK();
    70887088        CFGMR3RemoveNode(pCfg);
    70897089        rc = CFGMR3InsertNode(pLunL1, "Config", &pCfg);                             RC_CHECK();
     
    71867186     * Attach the new driver.
    71877187     */
    7188     rc = PDMR3DeviceAttach(pVM, pcszDevice, 0, iLUN, NULL, PDMDEVATT_FLAGS_NOT_HOT_PLUG); RC_CHECK();
     7188    rc = PDMR3DeviceAttach(pVM, pcszDevice, 0, iLUN, PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); RC_CHECK();
    71897189
    71907190    LogFlowFunc (("Returns success\n"));
     
    75067506 * Construct a status driver instance.
    75077507 *
    7508  * @returns VBox status.
    7509  * @param   pDrvIns     The driver instance data.
    7510  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    7511  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    7512  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    7513  *                      iInstance it's expected to be used a bit in this function.
     7508 * @copydoc FNPDMDRVCONSTRUCT
    75147509 */
    7515 DECLCALLBACK(int) Console::drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     7510DECLCALLBACK(int) Console::drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    75167511{
    75177512    PDRVMAINSTATUS pData = PDMINS_2_DATA(pDrvIns, PDRVMAINSTATUS);
     
    75237518    if (!CFGMR3AreValuesValid(pCfgHandle, "papLeds\0First\0Last\0"))
    75247519        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    7525     PPDMIBASE pBaseIgnore;
    7526     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    7527     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    7528     {
    7529         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    7530         return VERR_PDM_DRVINS_NO_ATTACH;
    7531     }
     7520    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     7521                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     7522                    VERR_PDM_DRVINS_NO_ATTACH);
    75327523
    75337524    /*
     
    75407531     * Read config.
    75417532     */
    7542     rc = CFGMR3QueryPtr(pCfgHandle, "papLeds", (void **)&pData->papLeds);
     7533    int rc = CFGMR3QueryPtr(pCfgHandle, "papLeds", (void **)&pData->papLeds);
    75437534    if (VBOX_FAILURE(rc))
    75447535    {
     
    76217612    /* pfnResume */
    76227613    NULL,
     7614    /* pfnAttach */
     7615    NULL,
    76237616    /* pfnDetach */
    7624     NULL
     7617    NULL,
     7618    /* pfnPowerOff */
     7619    NULL,
     7620    /* pfnSoftReset */
     7621    NULL,
     7622    /* u32EndVersion */
     7623    PDM_DRVREG_VERSION
    76257624};
    76267625
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r22265 r22277  
    27732773                if (fAttachDetach)
    27742774                {
    2775                     rc = PDMR3DeviceAttach(pVM, pszDevice, uInstance, uLun, NULL, 0 /*fFlags*/);
     2775                    rc = PDMR3DeviceAttach(pVM, pszDevice, uInstance, uLun, 0 /*fFlags*/, NULL /*ppBase*/);
    27762776                    AssertRC(rc);
    27772777                }
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r22215 r22277  
    24272427 * Construct a display driver instance.
    24282428 *
    2429  * @returns VBox status.
    2430  * @param   pDrvIns     The driver instance data.
    2431  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    2432  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    2433  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    2434  *                      iInstance it's expected to be used a bit in this function.
    2435  */
    2436 DECLCALLBACK(int) Display::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     2429 * @copydoc FNPDMDRVCONSTRUCT
     2430 */
     2431DECLCALLBACK(int) Display::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    24372432{
    24382433    PDRVMAINDISPLAY pData = PDMINS_2_DATA(pDrvIns, PDRVMAINDISPLAY);
     
    24442439    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    24452440        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    2446     PPDMIBASE pBaseIgnore;
    2447     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    2448     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    2449     {
    2450         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    2451         return VERR_PDM_DRVINS_NO_ATTACH;
    2452     }
     2441    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     2442                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     2443                    VERR_PDM_DRVINS_NO_ATTACH);
    24532444
    24542445    /*
     
    24892480     */
    24902481    void *pv;
    2491     rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
     2482    int rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
    24922483    if (RT_FAILURE(rc))
    24932484    {
     
    25452536    /* pfnResume */
    25462537    NULL,
     2538    /* pfnAttach */
     2539    NULL,
    25472540    /* pfnDetach */
    2548     NULL
     2541    NULL,
     2542    /* pfnPowerOff */
     2543    NULL,
     2544    /* pfnSoftReset */
     2545    NULL,
     2546    /* u32EndVersion */
     2547    PDM_DRVREG_VERSION
    25492548};
    25502549/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/KeyboardImpl.cpp

    r21878 r22277  
    272272 * Construct a keyboard driver instance.
    273273 *
    274  * @returns VBox status.
    275  * @param   pDrvIns     The driver instance data.
    276  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    277  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    278  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    279  *                      iInstance it's expected to be used a bit in this function.
    280  */
    281 DECLCALLBACK(int) Keyboard::drvConstruct (PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     274 * @copydoc FNPDMDRVCONSTRUCT
     275 */
     276DECLCALLBACK(int) Keyboard::drvConstruct (PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    282277{
    283278    PDRVMAINKEYBOARD pData = PDMINS_2_DATA (pDrvIns, PDRVMAINKEYBOARD);
     
    289284    if (!CFGMR3AreValuesValid (pCfgHandle, "Object\0"))
    290285        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    291     PPDMIBASE pBaseIgnore;
    292     int rc = pDrvIns->pDrvHlp->pfnAttach (pDrvIns, &pBaseIgnore);
    293     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    294     {
    295         AssertMsgFailed (("Configuration error: Not possible to attach anything to this driver!\n"));
    296         return VERR_PDM_DRVINS_NO_ATTACH;
    297     }
     286    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     287                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     288                    VERR_PDM_DRVINS_NO_ATTACH);
    298289
    299290    /*
     
    318309     */
    319310    void *pv;
    320     rc = CFGMR3QueryPtr (pCfgHandle, "Object", &pv);
     311    int rc = CFGMR3QueryPtr (pCfgHandle, "Object", &pv);
    321312    if (RT_FAILURE(rc))
    322313    {
     
    364355    /* pfnResume */
    365356    NULL,
     357    /* pfnAttach */
     358    NULL,
    366359    /* pfnDetach */
    367     NULL
     360    NULL,
     361    /* pfnPowerOff */
     362    NULL,
     363    /* pfnSoftReset */
     364    NULL,
     365    /* u32EndVersion */
     366    PDM_DRVREG_VERSION
    368367};
    369368/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/MouseImpl.cpp

    r21878 r22277  
    389389 * Construct a mouse driver instance.
    390390 *
    391  * @returns VBox status.
    392  * @param   pDrvIns     The driver instance data.
    393  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    394  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    395  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    396  *                      iInstance it's expected to be used a bit in this function.
    397  */
    398 DECLCALLBACK(int) Mouse::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     391 * @copydoc FNPDMDRVCONSTRUCT
     392 */
     393DECLCALLBACK(int) Mouse::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    399394{
    400395    PDRVMAINMOUSE pData = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
     
    406401    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    407402        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    408     PPDMIBASE pBaseIgnore;
    409     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    410     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    411     {
    412         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    413         return VERR_PDM_DRVINS_NO_ATTACH;
    414     }
     403    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     404                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     405                    VERR_PDM_DRVINS_NO_ATTACH);
    415406
    416407    /*
     
    433424     */
    434425    void *pv;
    435     rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
     426    int rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
    436427    if (RT_FAILURE(rc))
    437428    {
     
    479470    /* pfnResume */
    480471    NULL,
     472    /* pfnAttach */
     473    NULL,
    481474    /* pfnDetach */
    482     NULL
     475    NULL,
     476    /* pfnPowerOff */
     477    NULL,
     478    /* pfnSoftReset */
     479    NULL,
     480    /* u32EndVersion */
     481    PDM_DRVREG_VERSION
    483482};
    484483/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/VMMDevInterface.cpp

    r21878 r22277  
    704704 * Construct a VMMDev driver instance.
    705705 *
    706  * @returns VBox status.
    707  * @param   pDrvIns     The driver instance data.
    708  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    709  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    710  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    711  *                      iInstance it's expected to be used a bit in this function.
    712  */
    713 DECLCALLBACK(int) VMMDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     706 * @copydoc FNPDMDRVCONSTRUCT
     707 */
     708DECLCALLBACK(int) VMMDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    714709{
    715710    PDRVMAINVMMDEV pData = PDMINS_2_DATA(pDrvIns, PDRVMAINVMMDEV);
     
    721716    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    722717        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    723 
    724     PPDMIBASE pBaseIgnore;
    725     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBaseIgnore);
    726     if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    727     {
    728         AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
    729         return VERR_PDM_DRVINS_NO_ATTACH;
    730     }
     718    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     719                    ("Configuration error: Not possible to attach anything to this driver!\n"),
     720                    VERR_PDM_DRVINS_NO_ATTACH);
    731721
    732722    /*
     
    779769     */
    780770    void *pv;
    781     rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
     771    int rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
    782772    if (RT_FAILURE(rc))
    783773    {
     
    862852    /* pfnResume */
    863853    NULL,
     854    /* pfnAttach */
     855    NULL,
    864856    /* pfnDetach */
    865     NULL
     857    NULL,
     858    /* pfnPowerOff */
     859    NULL,
     860    /* pfnSoftReset */
     861    NULL,
     862    /* u32EndVersion */
     863    PDM_DRVREG_VERSION
    866864};
    867865/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/include/AudioSnifferInterface.h

    r21878 r22277  
    4545private:
    4646    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    47     static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     47    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    4848    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
    4949
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r22166 r22277  
    485485    static DECLCALLBACK(void)   drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
    486486    static DECLCALLBACK(void)   drvStatus_Destruct(PPDMDRVINS pDrvIns);
    487     static DECLCALLBACK(int)    drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     487    static DECLCALLBACK(int)    drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    488488
    489489    int mcAudioRefs;
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r21878 r22277  
    262262
    263263    static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    264     static DECLCALLBACK(int)   drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     264    static DECLCALLBACK(int)   drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    265265    static DECLCALLBACK(void)  drvDestruct(PPDMDRVINS pDrvIns);
    266266    static DECLCALLBACK(int)   displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
  • trunk/src/VBox/Main/include/KeyboardImpl.h

    r21878 r22277  
    9797
    9898    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    99     static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     99    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    100100    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
    101101
  • trunk/src/VBox/Main/include/MouseImpl.h

    r21878 r22277  
    9898
    9999    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    100     static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     100    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    101101    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
    102102
  • trunk/src/VBox/Main/include/VMMDev.h

    r21878 r22277  
    6161private:
    6262    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
    63     static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
     63    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    6464    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
    6565    static DECLCALLBACK(void)   drvReset(PPDMDRVINS pDrvIns);
  • trunk/src/VBox/VMM/PDMDevHlp.cpp

    r21789 r22277  
    895895                         */
    896896                        pLun->pTop = pLun->pBottom = pNew;
    897                         rc = pDrv->pDrvReg->pfnConstruct(pNew, pNew->pCfgHandle);
     897                        rc = pDrv->pDrvReg->pfnConstruct(pNew, pNew->pCfgHandle, 0 /*fFlags*/);
    898898                        if (RT_SUCCESS(rc))
    899899                        {
  • trunk/src/VBox/VMM/PDMDevice.cpp

    r21363 r22277  
    790790 * @thread  EMT
    791791 */
    792 VMMR3DECL(int) PDMR3DeviceAttach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMIBASE *ppBase, uint32_t fFlags)
     792VMMR3DECL(int) PDMR3DeviceAttach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags, PPDMIBASE *ppBase)
    793793{
    794794    VM_ASSERT_EMT(pVM);
    795     LogFlow(("PDMR3DeviceAttach: pszDevice=%p:{%s} iInstance=%d iLun=%d ppBase=%p\n",
    796              pszDevice, pszDevice, iInstance, iLun, ppBase));
     795    LogFlow(("PDMR3DeviceAttach: pszDevice=%p:{%s} iInstance=%d iLun=%d fFlags=%#x ppBase=%p\n",
     796             pszDevice, pszDevice, iInstance, iLun, fFlags, ppBase));
    797797
    798798    /*
     
    871871                rc = VINF_PDM_NO_DRIVER_ATTACHED_TO_LUN;
    872872        }
    873         else
    874             rc = VERR_PDM_DEVICE_NO_RT_DETACH;
    875873    }
    876874
     
    879877}
    880878
     879
     880/**
     881 * Detaches the specified driver instance.
     882 * 
     883 * This is used to replumb drivers at runtime for simulating hot plugging and
     884 * media changes.
     885 * 
     886 * This is a superset of PDMR3DeviceDetach.  It allows detaching drivers from
     887 * any driver or device by specifying the driver to start detaching at.  The
     888 * only prerequisite is that the driver or device above implements the
     889 * pfnDetach callback (PDMDRVREG / PDMDEVREG).
     890 * 
     891 * @returns VBox status code.
     892 * @param   pVM             VM Handle.
     893 * @param   pszDevice       Device name.
     894 * @param   iDevIns         Device instance.
     895 * @param   iLun            The Logical Unit in which to look for the driver.
     896 * @param   pszDriver       The name of the driver which to detach.  If NULL
     897 *                          then the entire driver chain is detatched.
     898 * @param   iOccurance      The occurance of that driver in the chain.  This is
     899 *                          usually 0.
     900 * @param   fFlags          Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
     901 * @thread  EMT
     902 */             
     903VMMR3DECL(int) PDMR3DriverDetach(PVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
     904                                 const char *pszDriver, unsigned iOccurance, uint32_t fFlags)
     905{
     906    LogFlow(("PDMR3DriverDetach: pszDevice=%p:{%s} iDevIns=%u iLun=%u pszDriver=%p:{%s} iOccurance=%u fFlags=%#x\n",
     907             pszDevice, pszDevice, iDevIns, iLun, pszDriver, iOccurance, fFlags));
     908    VM_ASSERT_EMT(pVM);
     909    AssertPtr(pszDevice);
     910    AssertPtrNull(pszDriver);
     911    Assert(iOccurance == 0 || pszDriver);
     912    Assert(!(fFlags & ~(PDM_TACH_FLAGS_NOT_HOT_PLUG)));
     913
     914    /*
     915     * Find the LUN in question.
     916     */
     917    PPDMLUN pLun;
     918    int rc = pdmR3DevFindLun(pVM, pszDevice, iDevIns, iLun, &pLun);
     919    if (RT_SUCCESS(rc))
     920    {
     921        /*
     922         * Locate the driver.
     923         */
     924        PPDMDRVINS pDrvIns = pLun->pTop;
     925        if (pDrvIns)
     926        {
     927            if (pszDriver)
     928            {
     929                while (pDrvIns)
     930                {
     931                    if (!strcmp(pDrvIns->pDrvReg->szDriverName, pszDriver))
     932                    {
     933                        if (iOccurance == 0)
     934                            break;
     935                        iOccurance--;
     936                    }
     937                    pDrvIns = pDrvIns->Internal.s.pDown;
     938                }
     939            }
     940            if (pDrvIns)
     941                rc = pdmR3DrvDetach(pDrvIns, fFlags);
     942            else
     943                rc = VERR_PDM_DRIVER_INSTANCE_NOT_FOUND;
     944        }
     945        else
     946            rc = VINF_PDM_NO_DRIVER_ATTACHED_TO_LUN;
     947    }
     948
     949    LogFlow(("PDMR3DeviceDetach: returns %Rrc\n", rc));
     950    return rc;
     951}
     952
  • trunk/src/VBox/VMM/PDMDriver.cpp

    r21789 r22277  
    275275     * Validate the registration structure.
    276276     */
    277     Assert(pDrvReg);
    278     if (pDrvReg->u32Version != PDM_DRVREG_VERSION)
    279     {
    280         AssertMsgFailed(("Unknown struct version %#x!\n", pDrvReg->u32Version));
    281         return VERR_PDM_UNKNOWN_DRVREG_VERSION;
    282     }
    283     if (    !pDrvReg->szDriverName[0]
    284         ||  strlen(pDrvReg->szDriverName) >= sizeof(pDrvReg->szDriverName))
    285     {
    286         AssertMsgFailed(("Invalid name '%s'\n", pDrvReg->szDriverName));
    287         return VERR_PDM_INVALID_DRIVER_REGISTRATION;
    288     }
    289     if ((pDrvReg->fFlags & PDM_DRVREG_FLAGS_HOST_BITS_MASK) != PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT)
    290     {
    291         AssertMsgFailed(("Invalid host bits flags! fFlags=%#x (Driver %s)\n", pDrvReg->fFlags, pDrvReg->szDriverName));
    292         return VERR_PDM_INVALID_DRIVER_HOST_BITS;
    293     }
    294     if (pDrvReg->cMaxInstances <= 0)
    295     {
    296         AssertMsgFailed(("Max instances %u! (Driver %s)\n", pDrvReg->cMaxInstances, pDrvReg->szDriverName));
    297         return VERR_PDM_INVALID_DRIVER_REGISTRATION;
    298     }
    299     if (pDrvReg->cbInstance > _1M)
    300     {
    301         AssertMsgFailed(("Instance size above 1MB, %d bytes! (Driver %s)\n", pDrvReg->cbInstance, pDrvReg->szDriverName));
    302         return VERR_PDM_INVALID_DRIVER_REGISTRATION;
    303     }
    304     if (!pDrvReg->pfnConstruct)
    305     {
    306         AssertMsgFailed(("No constructore! (Driver %s)\n", pDrvReg->szDriverName));
    307         return VERR_PDM_INVALID_DRIVER_REGISTRATION;
    308     }
     277    AssertPtrReturn(pDrvReg, VERR_INVALID_POINTER);
     278    AssertMsgReturn(pDrvReg->u32Version == PDM_DRVREG_VERSION, ("%#x\n", pDrvReg->u32Version), VERR_PDM_UNKNOWN_DRVREG_VERSION);
     279    AssertReturn(pDrvReg->szDriverName[0], VERR_PDM_INVALID_DRIVER_REGISTRATION);
     280    AssertMsgReturn(memchr(pDrvReg->szDriverName, '\0', sizeof(pDrvReg->szDriverName)),
     281                    (".*s\n", sizeof(pDrvReg->szDriverName), pDrvReg->szDriverName),
     282                    VERR_PDM_INVALID_DRIVER_REGISTRATION);
     283    AssertMsgReturn((pDrvReg->fFlags & PDM_DRVREG_FLAGS_HOST_BITS_MASK) == PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
     284                    ("%s: fFlags=%#x\n", pDrvReg->szDriverName, pDrvReg->fFlags), 
     285                    VERR_PDM_INVALID_DRIVER_HOST_BITS);
     286    AssertMsgReturn(pDrvReg->cMaxInstances > 0, ("%s: %#x\n", pDrvReg->szDriverName, pDrvReg->cMaxInstances),
     287                    VERR_PDM_INVALID_DRIVER_REGISTRATION);
     288    AssertMsgReturn(pDrvReg->cbInstance <= _1M, ("%s: %#x\n", pDrvReg->szDriverName, pDrvReg->cbInstance),
     289                    VERR_PDM_INVALID_DRIVER_REGISTRATION);
     290    AssertMsgReturn(VALID_PTR(pDrvReg->pfnConstruct), ("%s: %p\n", pDrvReg->szDriverName, pDrvReg->pfnConstruct),
     291                    VERR_PDM_INVALID_DRIVER_REGISTRATION);
     292    AssertMsgReturn(pDrvReg->pfnSoftReset == NULL, ("%s: %p\n", pDrvReg->szDriverName, pDrvReg->pfnSoftReset),
     293                    VERR_PDM_INVALID_DRIVER_REGISTRATION);
     294    AssertMsgReturn(pDrvReg->u32VersionEnd == PDM_DRVREG_VERSION, ("%s: #x\n", pDrvReg->szDriverName, pDrvReg->u32VersionEnd),
     295                    VERR_PDM_INVALID_DRIVER_REGISTRATION);
    309296
    310297    /*
     
    385372     */
    386373    if (pDrvIns->Internal.s.pUp
    387             ? !pDrvIns->Internal.s.pUp->pDrvReg->pfnDetach
    388             : !pDrvIns->Internal.s.pLun->pDevIns->pDevReg->pfnDetach)
     374        ? !pDrvIns->Internal.s.pUp->pDrvReg->pfnDetach
     375        : !pDrvIns->Internal.s.pLun->pDevIns->pDevReg->pfnDetach)
    389376    {
    390377        AssertMsgFailed(("Cannot detach driver instance because the driver/device above doesn't support it!\n"));
     
    406393 *
    407394 * @param   pDrvIns     Pointer to the driver instance to start with.
    408  * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
     395 * @param   fFlags      PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
    409396 */
    410397void pdmR3DrvDestroyChain(PPDMDRVINS pDrvIns, uint32_t fFlags)
     
    442429
    443430            if (pParent->pDrvReg->pfnDetach)
    444                 pParent->pDrvReg->pfnDetach(pParent);
     431                pParent->pDrvReg->pfnDetach(pParent, fFlags);
    445432
    446433            pParent->pDownBase = NULL;
     
    492479
    493480/** @copydoc PDMDRVHLP::pfnAttach */
    494 static DECLCALLBACK(int) pdmR3DrvHlp_Attach(PPDMDRVINS pDrvIns, PPDMIBASE *ppBaseInterface)
     481static DECLCALLBACK(int) pdmR3DrvHlp_Attach(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface)
    495482{
    496483    PDMDRV_ASSERT_DRVINS(pDrvIns);
     
    498485    LogFlow(("pdmR3DrvHlp_Attach: caller='%s'/%d:\n",
    499486             pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance));
     487    Assert(!(fFlags & ~(PDM_TACH_FLAGS_NOT_HOT_PLUG)));
    500488
    501489    /*
     
    564552
    565553                            Log(("PDM: Constructing driver '%s' instance %d...\n", pNew->pDrvReg->szDriverName, pNew->iInstance));
    566                             rc = pDrv->pDrvReg->pfnConstruct(pNew, pNew->pCfgHandle);
     554                            rc = pDrv->pDrvReg->pfnConstruct(pNew, pNew->pCfgHandle, 0 /*fFlags*/);
    567555                            if (RT_SUCCESS(rc))
    568556                            {
     
    622610
    623611/** @copydoc PDMDRVHLP::pfnDetach */
    624 static DECLCALLBACK(int) pdmR3DrvHlp_Detach(PPDMDRVINS pDrvIns)
    625 {
    626     PDMDRV_ASSERT_DRVINS(pDrvIns);
    627     LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d:\n",
    628              pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance));
     612static DECLCALLBACK(int) pdmR3DrvHlp_Detach(PPDMDRVINS pDrvIns, uint32_t fFlags)
     613{
     614    PDMDRV_ASSERT_DRVINS(pDrvIns);
     615    LogFlow(("pdmR3DrvHlp_Detach: caller='%s'/%d: fFlags=%#x\n",
     616             pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, fFlags));
    629617    VM_ASSERT_EMT(pDrvIns->Internal.s.pVM);
    630618
     
    634622    int rc;
    635623    if (pDrvIns->Internal.s.pDown)
    636     {
    637         /** @todo: Current assumption is that drivers will never initiate hot plug events. */
    638         rc = pdmR3DrvDetach(pDrvIns->Internal.s.pDown, PDMDEVATT_FLAGS_NOT_HOT_PLUG);
    639     }
     624        rc = pdmR3DrvDetach(pDrvIns->Internal.s.pDown, fFlags);
    640625    else
    641626    {
     
    651636
    652637/** @copydoc PDMDRVHLP::pfnDetachSelf */
    653 static DECLCALLBACK(int) pdmR3DrvHlp_DetachSelf(PPDMDRVINS pDrvIns)
    654 {
    655     PDMDRV_ASSERT_DRVINS(pDrvIns);
    656     LogFlow(("pdmR3DrvHlp_DetachSelf: caller='%s'/%d:\n",
    657              pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance));
    658     VM_ASSERT_EMT(pDrvIns->Internal.s.pVM);
    659 
    660     /** @todo: Current assumption is that drivers will never initiate hot plug events. */
    661     int rc = pdmR3DrvDetach(pDrvIns, PDMDEVATT_FLAGS_NOT_HOT_PLUG);
     638static DECLCALLBACK(int) pdmR3DrvHlp_DetachSelf(PPDMDRVINS pDrvIns, uint32_t fFlags)
     639{
     640    PDMDRV_ASSERT_DRVINS(pDrvIns);
     641    LogFlow(("pdmR3DrvHlp_DetachSelf: caller='%s'/%d: fFlags=%#x\n",
     642             pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, fFlags));
     643    VM_ASSERT_EMT(pDrvIns->Internal.s.pVM);
     644
     645    int rc = pdmR3DrvDetach(pDrvIns, fFlags);
    662646
    663647    LogFlow(("pdmR3DrvHlp_Detach: returns %Rrc\n", rc)); /* pDrvIns is freed by now. */
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