VirtualBox

Changeset 40212 in vbox


Ignore:
Timestamp:
Feb 22, 2012 2:32:06 PM (13 years ago)
Author:
vboxsync
Message:

Main: Added facility for auto-logon modules; added book-keeping of last facility statuses (10 max).

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r40084 r40212  
    83518351      <desc>VirtualBox base driver (VBoxGuest).</desc>
    83528352    </const>
     8353    <const name="AutoLogon"               value="90">
     8354      <desc>Auto-logon modules (VBoxGINA, VBoxCredProv, pam_vbox).</desc>
     8355    </const>
    83538356    <const name="VBoxService"             value="100">
    83548357      <desc>VirtualBox system service (VBoxService).</desc>
  • trunk/src/VBox/Main/include/AdditionsFacilityImpl.h

    r39890 r40212  
    44
    55/*
    6  * Copyright (C) 2011 Oracle Corporation
     6 * Copyright (C) 2012 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1818#define ____H_ADDITIONSFACILITYIMPL
    1919
     20#include <vector>
     21#include <iprt/time.h>
     22
    2023#include "VirtualBoxBase.h"
    21 #include <iprt/time.h>
    2224
    2325class Guest;
     
    6062    {
    6163        /** The facilitie's name. */
    62         const char            *mName; /* utf-8 */
     64        const char              *mName; /* utf-8 */
    6365        /** The facilitie's type. */
    6466        AdditionsFacilityType_T  mType;
     
    7880
    7981private:
     82    /** A structure for keeping a facility status
     83     *  set at a certain time. Good for book-keeping. */
     84    struct FacilityState
     85    {
     86        RTTIMESPEC                mTimestamp;
     87        /** The facilitie's current status. */
     88        AdditionsFacilityStatus_T mStatus;
     89    };
     90
    8091    struct Data
    8192    {
    82         /** Timestamp of last updated status.
    83          *  @todo Add a UpdateRecord struct to keep track of all
    84          *        status changed + their time; nice for some GUIs. */
    85         RTTIMESPEC mLastUpdated;
    86         /** The facilitie's current status. */
    87         AdditionsFacilityStatus_T mStatus;
     93        /** Record of current and previous facility
     94         *  states, limited to the 10 last states set.
     95         *  Note: This intentionally only is kept in
     96         *        Main so far! */
     97        std::vector<FacilityState> mStates;
    8898        /** The facilitie's ID/type. */
    89         AdditionsFacilityType_T mType;
     99        AdditionsFacilityType_T    mType;
    90100    } mData;
    91101};
  • trunk/src/VBox/Main/src-client/AdditionsFacilityImpl.cpp

    r39890 r40212  
    55
    66/*
    7  * Copyright (C) 2011 Oracle Corporation
     7 * Copyright (C) 2012 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2828    { "Unknown", AdditionsFacilityType_None, AdditionsFacilityClass_None },
    2929    { "VirtualBox Base Driver", AdditionsFacilityType_VBoxGuestDriver, AdditionsFacilityClass_Driver },
     30    { "Auto Logon", AdditionsFacilityType_AutoLogon, AdditionsFacilityClass_Feature },
    3031    { "VirtualBox System Service", AdditionsFacilityType_VBoxService, AdditionsFacilityClass_Service },
    3132    { "VirtualBox Desktop Integration", AdditionsFacilityType_VBoxTrayClient, AdditionsFacilityClass_Program },
     
    6566    AssertReturn(autoInitSpan.isOk(), E_FAIL);
    6667
    67     mData.mStatus       = a_enmStatus;
    68     mData.mType         = a_enmFacility;
    69     mData.mLastUpdated  = *a_pTimeSpecTS;
     68    FacilityState state;
     69    state.mStatus    = a_enmStatus;
     70    state.mTimestamp = *a_pTimeSpecTS;
     71    NOREF(a_fFlags);
     72
     73    Assert(mData.mStates.size() == 0);
     74    mData.mStates.push_back(state);
     75    mData.mType      = a_enmFacility;
    7076    /** @todo mClass is not initialized here. */
    7177    NOREF(a_fFlags);
     
    8995    if (autoUninitSpan.uninitDone())
    9096        return;
     97
     98    mData.mStates.clear();
    9199}
    92100
     
    193201LONG64 AdditionsFacility::getLastUpdated() const
    194202{
    195     return RTTimeSpecGetMilli(&mData.mLastUpdated);
     203    if (mData.mStates.size())
     204        return RTTimeSpecGetMilli(&mData.mStates.front().mTimestamp);
     205
     206    AssertMsgFailed(("Unknown timestamp of facility!\n"));
     207    return 0; /* Should never happen! */
    196208}
    197209
    198210AdditionsFacilityStatus_T AdditionsFacility::getStatus() const
    199211{
    200     return mData.mStatus;
     212    if (mData.mStates.size())
     213        return mData.mStates.back().mStatus;
     214
     215    AssertMsgFailed(("Unknown status of facility!\n"));
     216    return AdditionsFacilityStatus_Unknown; /* Should never happen! */
    201217}
    202218
     
    211227void AdditionsFacility::update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS)
    212228{
    213     mData.mStatus       = a_enmStatus;
    214     mData.mLastUpdated  = *a_pTimeSpecTS;
     229    FacilityState state;
     230    state.mStatus    = a_enmStatus;
     231    state.mTimestamp = *a_pTimeSpecTS;
    215232    NOREF(a_fFlags);
    216 }
    217 
     233
     234    mData.mStates.push_back(state);
     235    if (mData.mStates.size() > 10) /* Only keep the last 10 states. */
     236        mData.mStates.erase(mData.mStates.begin());
     237}
     238
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