VirtualBox

Ignore:
Timestamp:
Aug 2, 2010 12:13:00 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64314
Message:

Initial API changes for resource control (storage/network/cpu)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MediumAttachmentImpl.cpp

    r30681 r31287  
    5252    const LONG          lDevice;
    5353    const DeviceType_T  type;
    54     bool                fPassthrough : 1;
    55     bool                fImplicit : 1;
     54    bool                fPassthrough;
     55    bool                fImplicit;
     56    ULONG               mBandwidthLimit;
    5657};
    5758
     
    132133    m->bd->fImplicit = false;
    133134
     135    /* Default is no limit. */
     136    m->bd->mBandwidthLimit = 0;
     137
    134138    /* Confirm a successful initialization when it's the case */
    135139    autoInitSpan.setSucceeded();
     
    272276}
    273277
     278STDMETHODIMP MediumAttachment::COMGETTER(BandwidthLimit) (ULONG *aLimit)
     279{
     280    CheckComArgOutPointerValid(aLimit);
     281
     282    AutoCaller autoCaller(this);
     283    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     284
     285    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     286
     287    *aLimit = m->bd->mBandwidthLimit;
     288    return S_OK;
     289}
     290
     291STDMETHODIMP MediumAttachment::COMSETTER(BandwidthLimit) (ULONG aLimit)
     292{
     293    AutoCaller autoCaller(this);
     294    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     295
     296    /* the machine doesn't need to be mutable */
     297
     298    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     299
     300    if (aLimit != m->bd->mBandwidthLimit)
     301    {
     302        m->bd.backup();
     303        m->bd->mBandwidthLimit = aLimit;
     304
     305        /* todo: not all storage attachments will support this. */
     306    }
     307    return S_OK;
     308}
     309
    274310/**
    275311 *  @note Locks this object for writing.
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