VirtualBox

Changeset 70284 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Dec 21, 2017 2:36:05 PM (7 years ago)
Author:
vboxsync
Message:

VBoxGuest-win.cpp: State cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp

    r70282 r70284  
    5858
    5959
    60 #define VBOXGUEST_UPDATE_DEVSTATE(a_pDevExt, a_enmNewDevState) \
    61     do { \
    62         (a_pDevExt)->enmPrevDevState = (a_pDevExt)->enmDevState; \
    63         (a_pDevExt)->enmDevState     = (a_enmNewDevState); \
    64     } while (0)
    65 
    66 
    6760/*********************************************************************************************************************************
    6861*   Structures and Typedefs                                                                                                      *
     
    7366typedef enum VGDRVNTDEVSTATE
    7467{
     68    /** @name Stable states
     69     * @{ */
     70    VGDRVNTDEVSTATE_REMOVED = 0,
    7571    VGDRVNTDEVSTATE_STOPPED,
    76     VGDRVNTDEVSTATE_WORKING,
     72    VGDRVNTDEVSTATE_OPERATIONAL,
     73    /** @} */
     74
     75    /** @name Transitional states
     76     *  @{ */
    7777    VGDRVNTDEVSTATE_PENDINGSTOP,
    7878    VGDRVNTDEVSTATE_PENDINGREMOVE,
    79     VGDRVNTDEVSTATE_SURPRISEREMOVED,
    80     VGDRVNTDEVSTATE_REMOVED
     79    VGDRVNTDEVSTATE_SURPRISEREMOVED
     80    /** @} */
    8181} VGDRVNTDEVSTATE;
    8282
     
    124124    /** Device state. */
    125125    VGDRVNTDEVSTATE volatile enmDevState;
    126     /** The previous device state. */
     126    /** The previous stable device state. */
    127127    VGDRVNTDEVSTATE         enmPrevDevState;
    128128
     
    840840                        /* Ready to rumble! */
    841841                        LogRelFunc(("Device is ready!\n"));
    842                         VBOXGUEST_UPDATE_DEVSTATE(pDevExt, VGDRVNTDEVSTATE_WORKING);
     842                        pDevExt->enmDevState     = VGDRVNTDEVSTATE_OPERATIONAL;
     843                        pDevExt->enmPrevDevState = VGDRVNTDEVSTATE_OPERATIONAL;
    843844                        return STATUS_SUCCESS;
    844845                    }
     846
    845847                    pDevExt->pInterruptObject = NULL;
    846848
     
    12781280                {
    12791281                    rc = vgdrvNtSetupDevice(pDevExt, pDevObj, pIrp, NULL, NULL);
    1280                     if (!NT_SUCCESS(rc))
     1282                    if (NT_SUCCESS(rc))
     1283                        Log(("vgdrvNtNt5PlusPnP: START_DEVICE: success\n"));
     1284                    else
    12811285                        Log(("vgdrvNtNt5PlusPnP: START_DEVICE: vgdrvNtSetupDevice failed: %#x\n", rc));
    12821286                }
     
    13131317            if (NT_SUCCESS(rc))
    13141318            {
    1315                 VBOXGUEST_UPDATE_DEVSTATE(pDevExt, VGDRVNTDEVSTATE_PENDINGREMOVE);
     1319                pDevExt->enmDevState = VGDRVNTDEVSTATE_PENDINGREMOVE;
    13161320
    13171321                /* This IRP passed down to lower driver. */
     
    13661370        {
    13671371            Log(("vgdrvNtNt5PlusPnP: IRP_MN_SURPRISE_REMOVAL\n"));
    1368             VBOXGUEST_UPDATE_DEVSTATE(pDevExt, VGDRVNTDEVSTATE_SURPRISEREMOVED);
     1372            pDevExt->enmDevState = VGDRVNTDEVSTATE_SURPRISEREMOVED;
    13691373            LogRel(("VBoxGuest: unexpected device removal\n"));
    13701374
     
    13851389        {
    13861390            Log(("vgdrvNtNt5PlusPnP: REMOVE_DEVICE\n"));
    1387             VBOXGUEST_UPDATE_DEVSTATE(pDevExt, VGDRVNTDEVSTATE_REMOVED);
     1391            pDevExt->enmDevState = VGDRVNTDEVSTATE_REMOVED;
    13881392
    13891393            /*
     
    14251429        {
    14261430            Log(("vgdrvNtNt5PlusPnP: QUERY_STOP_DEVICE\n"));
    1427             VGDRVNTDEVSTATE const enmOldState = pDevExt->enmDevState;
    14281431            rc = vgdrvNtCheckIdle(pDevExt, "QUERY_STOP_DEVICE");
    14291432            if (NT_SUCCESS(rc))
    14301433            {
    1431                 VBOXGUEST_UPDATE_DEVSTATE(pDevExt, VGDRVNTDEVSTATE_PENDINGSTOP);
     1434                pDevExt->enmPrevDevState = pDevExt->enmDevState;
     1435                pDevExt->enmDevState = VGDRVNTDEVSTATE_PENDINGSTOP;
    14321436
    14331437                /* This IRP passed down to lower driver. */
     
    14821486        {
    14831487            Log(("vgdrvNtNt5PlusPnP: STOP_DEVICE\n"));
    1484             VBOXGUEST_UPDATE_DEVSTATE(pDevExt, VGDRVNTDEVSTATE_STOPPED);
     1488            pDevExt->enmDevState = VGDRVNTDEVSTATE_STOPPED;
    14851489
    14861490            /*
     
    18431847     * Check the device state.
    18441848     */
    1845     if (pDevExt->enmDevState != VGDRVNTDEVSTATE_WORKING)
     1849    if (pDevExt->enmDevState != VGDRVNTDEVSTATE_OPERATIONAL)
    18461850    {
    18471851        LogFlow(("vgdrvNtCreate: Failed. Device is not in 'working' state: %d\n", pDevExt->enmDevState));
Note: See TracChangeset for help on using the changeset viewer.

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