Changeset 7442 in vbox for trunk/src/VBox/Main/HardDiskAttachmentImpl.cpp
- Timestamp:
- Mar 13, 2008 2:33:18 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HardDiskAttachmentImpl.cpp
r7207 r7442 28 28 HRESULT HardDiskAttachment::FinalConstruct() 29 29 { 30 mController = DiskControllerType_Null; 31 mDeviceNumber = 0; 30 mBus = StorageBus_Null; 31 mChannel = 0; 32 mDevice = 0; 32 33 33 34 return S_OK; … … 46 47 * 47 48 * @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 50 52 * @param aDirty whether the attachment is initially dirty or not 51 53 */ 52 HRESULT HardDiskAttachment::init (HardDisk *aHD, DiskControllerType_T aCtl, LONG aDev,54 HRESULT HardDiskAttachment::init (HardDisk *aHD, StorageBus_T aBus, LONG aChannel, LONG aDevice, 53 55 BOOL aDirty) 54 56 { 55 57 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 } 56 73 57 74 AutoLock alock (this); … … 60 77 61 78 mHardDisk = aHD; 62 mController = aCtl; 63 mDeviceNumber = aDev; 79 mBus = aBus; 80 mChannel = aChannel; 81 mDevice = aDevice; 64 82 65 83 setReady (true); … … 84 102 } 85 103 86 STDMETHODIMP HardDiskAttachment::COMGETTER( Controller) (DiskControllerType_T *aController)104 STDMETHODIMP HardDiskAttachment::COMGETTER(Bus) (StorageBus_T *aBus) 87 105 { 88 if (!a Controller)106 if (!aBus) 89 107 return E_POINTER; 90 108 … … 92 110 CHECK_READY(); 93 111 94 *a Controller = mController;112 *aBus = mBus; 95 113 return S_OK; 96 114 } 97 115 98 STDMETHODIMP HardDiskAttachment::COMGETTER( DeviceNumber) (LONG *aDeviceNumber)116 STDMETHODIMP HardDiskAttachment::COMGETTER(Channel) (LONG *aChannel) 99 117 { 100 if (!a DeviceNumber)118 if (!aChannel) 101 119 return E_INVALIDARG; 102 120 … … 104 122 CHECK_READY(); 105 123 106 *a DeviceNumber = mDeviceNumber;124 *aChannel = mChannel; 107 125 return S_OK; 108 126 } 109 127 128 STDMETHODIMP 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.