- Timestamp:
- Apr 8, 2010 4:45:59 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r28098 r28106 407 407 ulLineSpeed(0), 408 408 fTraceEnabled(false), 409 mode(NetworkAttachmentType_Null) 409 mode(NetworkAttachmentType_Null), 410 ulBootPriority(0) 410 411 {} 411 412 … … 427 428 // with bridged: host interface or empty; 428 429 // otherwise: network name (required) 430 uint32_t ulBootPriority; 429 431 }; 430 432 typedef std::list<NetworkAdapter> NetworkAdaptersList; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r27980 r28106 206 206 " [--nictracefile<1-N> <filename>]\n" 207 207 " [--nicspeed<1-N> <kbps>]\n" 208 " [--nicbootprio<1-N> <priority>]\n" 208 209 " [--bridgeadapter<1-N> none|<devicename>]\n" 209 210 #if defined(VBOX_WITH_NETFLT) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r27822 r28106 856 856 nic->COMGETTER(LineSpeed)(&ulLineSpeed); 857 857 858 /* boot priority of the adapter */ 859 ULONG ulBootPriority; 860 nic->COMGETTER(BootPriority)(&ulBootPriority); 861 858 862 if (details == VMINFO_MACHINEREADABLE) 859 863 { … … 863 867 } 864 868 else 865 RTPrintf("NIC %d: MAC: %lS, Attachment: %s, Cable connected: %s, Trace: %s (file: %lS), Type: %s, Reported speed: %d Mbps \n",869 RTPrintf("NIC %d: MAC: %lS, Attachment: %s, Cable connected: %s, Trace: %s (file: %lS), Type: %s, Reported speed: %d Mbps, Boot priority: %d\n", 866 870 currentNIC + 1, strMACAddress.raw(), strAttachment.raw(), 867 871 fConnected ? "on" : "off", … … 869 873 traceFile.isEmpty() ? Bstr("none").raw() : traceFile.raw(), 870 874 strNICType.raw(), 871 ulLineSpeed / 1000); 875 ulLineSpeed / 1000, 876 (int)ulBootPriority); 872 877 } 873 878 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r28041 r28106 109 109 MODIFYVM_NICTYPE, 110 110 MODIFYVM_NICSPEED, 111 MODIFYVM_NICBOOTPRIO, 111 112 MODIFYVM_NIC, 112 113 MODIFYVM_CABLECONNECTED, … … 213 214 { "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, 214 215 { "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX }, 216 { "--nicbootprio", MODIFYVM_NICBOOTPRIO, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX }, 215 217 { "--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX }, 216 218 { "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX }, … … 1124 1126 } 1125 1127 1128 case MODIFYVM_NICBOOTPRIO: 1129 { 1130 ComPtr<INetworkAdapter> nic; 1131 1132 CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam())); 1133 ASSERT(nic); 1134 1135 /* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices 1136 * to the PXE ROM, hence only boot priorities 1-4 are allowed (in addition to 1137 * 0 for the default lowest priority). 1138 */ 1139 if (ValueUnion.u32 > 4) 1140 { 1141 errorArgument("Invalid boot priority '%u' specfied for NIC %u", ValueUnion.u32, GetOptState.uIndex); 1142 rc = E_FAIL; 1143 } 1144 else 1145 { 1146 CHECK_ERROR(nic, COMSETTER(BootPriority)(ValueUnion.u32)); 1147 } 1148 break; 1149 } 1150 1126 1151 case MODIFYVM_NIC: 1127 1152 { -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r27976 r28106 192 192 193 193 /* 194 * Simple class for storing network boot information. 195 */ 196 struct BootNic { 197 ULONG mInstance; 198 unsigned mPciDev; 199 unsigned mPciFn; 200 ULONG mBootPrio; 201 bool operator < (const BootNic &rhs) const 202 { 203 int lval = mBootPrio ? mBootPrio : INT_MAX; 204 int rval = rhs.mBootPrio ? rhs.mBootPrio : INT_MAX; 205 return lval < rval; /* Zero compares as highest number (lowest prio). */ 206 } 207 }; 208 209 /* 194 210 * VC++ 8 / amd64 has some serious trouble with this function. 195 211 * As a temporary measure, we'll drop global optimizations. … … 1450 1466 rc = CFGMR3InsertNode(pDevices, "virtio-net", &pDevVirtioNet); RC_CHECK(); 1451 1467 #endif /* VBOX_WITH_VIRTIO */ 1468 std::list<BootNic> llNics; 1452 1469 for (ULONG ulInstance = 0; ulInstance < SchemaDefs::NetworkAdapterCount; ++ulInstance) 1453 1470 { … … 1529 1546 } 1530 1547 #endif 1531 /* 1532 * Transfer boot device information to the BIOS.1548 /* 1549 * Collect information needed for network booting and add it to the list. 1533 1550 */ 1534 if (ulInstance == 0) 1535 { 1536 unsigned uBootIdx = 0; 1537 1538 if (pNetBootCfg) /* NetBoot node doesn't exist for EFI! */ 1539 { 1540 PCFGMNODE pNetBtDevCfg; 1541 char achBootIdx[] = "0"; 1542 1543 achBootIdx[0] = '0' + uBootIdx; /* Boot device order. */ 1544 rc = CFGMR3InsertNode(pNetBootCfg, achBootIdx, &pNetBtDevCfg); RC_CHECK(); 1545 rc = CFGMR3InsertInteger(pNetBtDevCfg, "NIC", ulInstance); RC_CHECK(); 1546 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIDeviceNo", iPciDeviceNo);RC_CHECK(); 1547 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIFunctionNo", 0); RC_CHECK(); 1548 } 1549 } 1551 BootNic nic; 1552 1553 nic.mInstance = ulInstance; 1554 nic.mPciDev = iPciDeviceNo; 1555 nic.mPciFn = 0; 1556 1557 hrc = networkAdapter->COMGETTER(BootPriority)(&nic.mBootPrio); H(); 1558 1559 llNics.push_back(nic); 1550 1560 1551 1561 /* … … 1622 1632 rc = configNetwork(pConsole, pszAdapterName, ulInstance, 0, networkAdapter, 1623 1633 pCfg, pLunL0, pInst, false /*fAttachDetach*/); RC_CHECK(); 1634 } 1635 1636 /* 1637 * Build network boot information and transfer it to the BIOS. 1638 */ 1639 if (pNetBootCfg && !llNics.empty()) /* NetBoot node doesn't exist for EFI! */ 1640 { 1641 llNics.sort(); /* Sort the list by boot priority. */ 1642 1643 PCFGMNODE pNetBtDevCfg; 1644 char achBootIdx[] = "0"; 1645 unsigned uBootIdx = 0; 1646 1647 std::list<BootNic>::iterator it; 1648 1649 for (it = llNics.begin(); it != llNics.end(); ++it) 1650 { 1651 Assert(iter); 1652 1653 /* A NIC with priority 0 is only used if it's first in the list. */ 1654 if (it->mBootPrio == 0 && uBootIdx != 0) 1655 break; 1656 1657 achBootIdx[0] = '0' + uBootIdx++; /* Boot device order. */ 1658 rc = CFGMR3InsertNode(pNetBootCfg, achBootIdx, &pNetBtDevCfg); RC_CHECK(); 1659 rc = CFGMR3InsertInteger(pNetBtDevCfg, "NIC", it->mInstance); RC_CHECK(); 1660 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIDeviceNo", it->mPciDev); RC_CHECK(); 1661 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIFunctionNo", it->mPciFn);RC_CHECK(); 1662 } 1624 1663 } 1625 1664 -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r27976 r28106 803 803 } 804 804 805 STDMETHODIMP NetworkAdapter::COMGETTER(BootPriority) (ULONG *aBootPriority) 806 { 807 CheckComArgOutPointerValid(aBootPriority); 808 809 AutoCaller autoCaller(this); 810 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 811 812 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 813 814 *aBootPriority = mData->mBootPriority; 815 816 return S_OK; 817 } 818 819 STDMETHODIMP NetworkAdapter::COMSETTER(BootPriority) (ULONG aBootPriority) 820 { 821 AutoCaller autoCaller(this); 822 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 823 824 /* the machine needs to be mutable */ 825 AutoMutableStateDependency adep(mParent); 826 if (FAILED(adep.rc())) return adep.rc(); 827 828 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 829 830 if (aBootPriority != mData->mBootPriority) 831 { 832 mData.backup(); 833 mData->mBootPriority = aBootPriority; 834 835 m_fModified = true; 836 // leave the lock before informing callbacks 837 alock.release(); 838 839 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 840 mParent->setModified(Machine::IsModified_NetworkAdapters); 841 mlock.release(); 842 843 /* No change in CFGM logic => changeAdapter=FALSE. */ 844 mParent->onNetworkAdapterChange(this, FALSE); 845 } 846 847 return S_OK; 848 } 849 805 850 // INetworkAdapter methods 806 851 //////////////////////////////////////////////////////////////////////////////// … … 1076 1121 mData->mTraceEnabled = data.fTraceEnabled; 1077 1122 mData->mTraceFile = data.strTraceFile; 1123 /* boot priority (defaults to 0, i.e. lowest) */ 1124 mData->mBootPriority = data.ulBootPriority; 1078 1125 1079 1126 switch (data.mode) … … 1146 1193 1147 1194 data.strTraceFile = mData->mTraceFile; 1195 1196 data.ulBootPriority = mData->mBootPriority; 1148 1197 1149 1198 data.type = mData->mAdapterType; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r28046 r28106 11581 11581 <interface 11582 11582 name="INetworkAdapter" extends="$unknown" 11583 uuid=" 65607a27-2b73-4d43-b4cc-0ba2c817fbde"11583 uuid="5bdb9df8-a5e1-4322-a139-b7a4a734c790" 11584 11584 wsmap="managed" 11585 11585 > … … 11680 11680 for this interface. This is active only when the interface actually uses 11681 11681 NAT (see <link to="#attachToNAT" />). 11682 </desc> 11683 </attribute> 11684 11685 <attribute name="bootPriority" type="unsigned long"> 11686 <desc> 11687 Network boot priority of the adapter. Priority 1 is highest. If not set, 11688 the priority is considered to be at the lowest possible setting. 11682 11689 </desc> 11683 11690 </attribute> -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r27857 r28106 64 64 Bstr mInternalNetwork; 65 65 Bstr mNATNetwork; 66 ULONG mBootPriority; 66 67 }; 67 68 … … 113 114 STDMETHOD(COMSETTER(TraceFile)) (IN_BSTR aTraceFile); 114 115 STDMETHOD(COMGETTER(NatDriver)) (INATEngine **aNatDriver); 116 STDMETHOD(COMGETTER(BootPriority)) (ULONG *aBootPriority); 117 STDMETHOD(COMSETTER(BootPriority)) (ULONG aBootPriority); 115 118 116 119 // INetworkAdapter methods -
trunk/src/VBox/Main/xml/Settings.cpp
r28098 r28106 1373 1373 && (mode == n.mode) 1374 1374 && (strName == n.strName) 1375 && (ulBootPriority == n.ulBootPriority) 1375 1376 ) 1376 1377 ); … … 1820 1821 pelmAdapter->getAttributeValue("trace", nic.fTraceEnabled); 1821 1822 pelmAdapter->getAttributeValue("tracefile", nic.strTraceFile); 1823 pelmAdapter->getAttributeValue("bootPriority", nic.ulBootPriority); 1822 1824 1823 1825 const xml::ElementNode *pelmAdapterChild; … … 3288 3290 pelmAdapter->setAttribute("cable", nic.fCableConnected); 3289 3291 pelmAdapter->setAttribute("speed", nic.ulLineSpeed); 3292 if (nic.ulBootPriority != 0) 3293 { 3294 pelmAdapter->setAttribute("bootPriority", nic.ulBootPriority); 3295 } 3290 3296 if (nic.fTraceEnabled) 3291 3297 {
Note:
See TracChangeset
for help on using the changeset viewer.