VirtualBox

Ignore:
Timestamp:
Mar 13, 2008 2:33:18 PM (17 years ago)
Author:
vboxsync
Message:

Main: Applied SATA changes from #2406. Increased XML settings version format from 1.2 to 1.3.pre.

File:
1 edited

Legend:

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

    r7207 r7442  
    2828HRESULT HardDiskAttachment::FinalConstruct()
    2929{
    30     mController = DiskControllerType_Null;
    31     mDeviceNumber = 0;
     30    mBus = StorageBus_Null;
     31    mChannel = 0;
     32    mDevice = 0;
    3233
    3334    return S_OK;
     
    4647 *
    4748 *  @param aHD      hard disk object
    48  *  @param aCtl     controller type
    49  *  @param aDev     device number on the controller
     49 *  @param aBus     bus type
     50 *  @param aChannel channel number
     51 *  @param aDevice  device number on the channel
    5052 *  @param aDirty   whether the attachment is initially dirty or not
    5153 */
    52 HRESULT HardDiskAttachment::init (HardDisk *aHD, DiskControllerType_T aCtl, LONG aDev,
     54HRESULT HardDiskAttachment::init (HardDisk *aHD, StorageBus_T aBus, LONG aChannel, LONG aDevice,
    5355                                  BOOL aDirty)
    5456{
    5557    ComAssertRet (aHD, E_INVALIDARG);
     58
     59    if (aBus == StorageBus_IDE)
     60    {
     61        if (aChannel < 0 || aChannel > 1)
     62            return setError (E_FAIL,
     63                tr ("Invalid IDE channel for hard disk '%ls': %d. "
     64                    "IDE channel number must be in range [0,1]"),
     65                aHD->toString().raw(), aChannel);
     66        if (aDevice < 0 || aDevice > 1 || (aChannel == 1 && aDevice == 0))
     67            return setError (E_FAIL,
     68                tr ("Invalid IDE device slot for hard disk '%ls': %d. "
     69                    "IDE device slot number must be in range [0,1] for "
     70                    "channel 0 and always 1 for channel 1"),
     71                aHD->toString().raw(), aDevice);
     72    }
    5673
    5774    AutoLock alock (this);
     
    6077
    6178    mHardDisk = aHD;
    62     mController = aCtl;
    63     mDeviceNumber = aDev;
     79    mBus = aBus;
     80    mChannel = aChannel;
     81    mDevice = aDevice;
    6482
    6583    setReady (true);
     
    84102}
    85103
    86 STDMETHODIMP HardDiskAttachment::COMGETTER(Controller) (DiskControllerType_T *aController)
     104STDMETHODIMP HardDiskAttachment::COMGETTER(Bus) (StorageBus_T *aBus)
    87105{
    88     if (!aController)
     106    if (!aBus)
    89107        return E_POINTER;
    90108
     
    92110    CHECK_READY();
    93111
    94     *aController = mController;
     112    *aBus = mBus;
    95113    return S_OK;
    96114}
    97115
    98 STDMETHODIMP HardDiskAttachment::COMGETTER(DeviceNumber) (LONG *aDeviceNumber)
     116STDMETHODIMP HardDiskAttachment::COMGETTER(Channel) (LONG *aChannel)
    99117{
    100     if (!aDeviceNumber)
     118    if (!aChannel)
    101119        return E_INVALIDARG;
    102120
     
    104122    CHECK_READY();
    105123
    106     *aDeviceNumber = mDeviceNumber;
     124    *aChannel = mChannel;
    107125    return S_OK;
    108126}
    109127
     128STDMETHODIMP HardDiskAttachment::COMGETTER(Device) (LONG *aDevice)
     129{
     130    if (!aDevice)
     131        return E_INVALIDARG;
     132
     133    AutoLock alock (this);
     134    CHECK_READY();
     135
     136    *aDevice = mDevice;
     137    return S_OK;
     138}
     139
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