Changeset 15592 in vbox for trunk/src/VBox/Main
- Timestamp:
- Dec 16, 2008 2:48:13 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r15574 r15592 6895 6895 } 6896 6896 6897 /** @todo this should be unified with the relevant part of 6898 * Console::configConstructor to avoid inconsistencies. */ 6899 6897 6900 /* 6898 6901 * Is there an existing LUN? If not create it. … … 6901 6904 PCFGMNODE pCfg; 6902 6905 PCFGMNODE pLunL1; 6906 PCFGMNODE pLunL2; 6903 6907 6904 6908 pLunL1 = CFGMR3GetChildF(CFGMR3GetRoot(pVM), "Devices/%s/0/LUN#%d/AttachedDriver/", pcszDevice, iLUN); … … 6929 6933 #endif 6930 6934 6931 /*6932 * Check if things has changed.6933 */6934 6935 pCfg = CFGMR3GetChild(pLunL1, "Config"); 6935 6936 AssertReturn(pCfg, VERR_INTERNAL_ERROR); 6936 6937 6937 /* the format */ 6938 hrc = hardDisk->COMGETTER(Format)(bstr.asOutParam()); H(); 6939 char *pszFormat; 6940 rc = CFGMR3QueryStringAlloc(pCfg, "Format", &pszFormat); RC_CHECK(); 6941 if (bstr == pszFormat) 6942 { 6943 /* the image */ 6944 hrc = hardDisk->COMGETTER(Location)(bstr.asOutParam()); H(); 6945 char *pszPath; 6946 rc = CFGMR3QueryStringAlloc(pCfg, "Path", &pszPath); RC_CHECK(); 6947 if (bstr == pszPath) 6948 { 6949 /* parent images. */ 6950 ComPtr<IHardDisk2> parentHardDisk = hardDisk; 6951 for (PCFGMNODE pParent = pCfg;;) 6952 { 6953 MMR3HeapFree(pszPath); 6954 pszPath = NULL; 6955 6956 MMR3HeapFree(pszFormat); 6957 pszFormat = NULL; 6958 6959 /* get parent */ 6960 ComPtr<IHardDisk2> curHardDisk; 6961 hrc = parentHardDisk->COMGETTER(Parent)(curHardDisk.asOutParam()); H(); 6962 PCFGMNODE pCur; 6963 pCur = CFGMR3GetChild(pParent, "Parent"); 6964 if (!pCur && !curHardDisk) 6965 { 6966 /* no change */ 6967 LogFlowFunc (("No change!\n")); 6968 return VINF_SUCCESS; 6969 } 6970 if (!pCur || !curHardDisk) 6971 break; 6972 6973 /* compare formats. */ 6974 hrc = curHardDisk->COMGETTER(Format)(bstr.asOutParam()); H(); 6975 rc = CFGMR3QueryStringAlloc(pCfg, "Format", &pszPath); RC_CHECK(); 6976 if (bstr != pszFormat) 6977 break; 6978 6979 /* compare paths. */ 6980 hrc = curHardDisk->COMGETTER(Location)(bstr.asOutParam()); H(); 6981 rc = CFGMR3QueryStringAlloc(pCfg, "Path", &pszPath); RC_CHECK(); 6982 if (bstr != pszPath) 6983 break; 6984 6985 /* next */ 6986 pParent = pCur; 6987 parentHardDisk = curHardDisk; 6988 } 6989 6990 } 6991 else 6992 LogFlowFunc (("LUN#%d: old leaf location '%s'\n", iLUN, pszPath)); 6993 6994 MMR3HeapFree(pszPath); 6995 } 6996 else 6997 LogFlowFunc (("LUN#%d: old leaf format '%s'\n", iLUN, pszFormat)); 6998 6999 MMR3HeapFree(pszFormat); 6938 /* Here used to be a lot of code checking if things have changed, 6939 * but that's not really worth it, as with snapshots there is always 6940 * some change, so the code was just logging useless information in 6941 * a hard to analyze form. */ 7000 6942 7001 6943 /* … … 7010 6952 * Create the driver configuration. 7011 6953 */ 6954 hrc = hardDisk->COMGETTER(Location)(bstr.asOutParam()); H(); 6955 LogFlowFunc (("LUN#%d: leaf location '%ls'\n", iLUN, bstr.raw())); 6956 rc = CFGMR3InsertString(pCfg, "Path", Utf8Str(bstr)); RC_CHECK(); 7012 6957 hrc = hardDisk->COMGETTER(Format)(bstr.asOutParam()); H(); 7013 6958 LogFlowFunc (("LUN#%d: leaf format '%ls'\n", iLUN, bstr.raw())); 7014 6959 rc = CFGMR3InsertString(pCfg, "Format", Utf8Str(bstr)); RC_CHECK(); 7015 hrc = hardDisk->COMGETTER(Location)(bstr.asOutParam()); H(); 7016 LogFlowFunc (("LUN#%d: leaf location '%ls'\n", iLUN, bstr.raw())); 7017 rc = CFGMR3InsertString(pCfg, "Path", Utf8Str(bstr)); RC_CHECK(); 6960 6961 #if defined(VBOX_WITH_PDM_ASYNC_COMPLETION) 6962 if (bstr == L"VMDK") 6963 { 6964 /* Create cfgm nodes for async transport driver because VMDK is 6965 * currently the only one which may support async I/O. This has 6966 * to be made generic based on the capabiliy flags when the new 6967 * HardDisk interface is merged. 6968 */ 6969 rc = CFGMR3InsertNode (pLunL1, "AttachedDriver", &pLunL2); RC_CHECK(); 6970 rc = CFGMR3InsertString (pLunL2, "Driver", "TransportAsync"); RC_CHECK(); 6971 /* The async transport driver has no config options yet. */ 6972 } 6973 #endif 6974 6975 /* Pass all custom parameters. */ 6976 bool fHostIP = true; 6977 SafeArray <BSTR> names; 6978 SafeArray <BSTR> values; 6979 hrc = hardDisk->GetProperties (NULL, 6980 ComSafeArrayAsOutParam (names), 6981 ComSafeArrayAsOutParam (values)); H(); 6982 6983 if (names.size() != 0) 6984 { 6985 PCFGMNODE pVDC; 6986 rc = CFGMR3InsertNode (pCfg, "VDConfig", &pVDC); RC_CHECK(); 6987 for (size_t i = 0; i < names.size(); ++ i) 6988 { 6989 if (values [i]) 6990 { 6991 Utf8Str name = names [i]; 6992 Utf8Str value = values [i]; 6993 rc = CFGMR3InsertString (pVDC, name, value); 6994 if ( !(name.compare("HostIPStack")) 6995 && !(value.compare("0"))) 6996 fHostIP = false; 6997 } 6998 } 6999 } 7000 7018 7001 /* Create an inversed tree of parents. */ 7019 7002 ComPtr<IHardDisk2> parentHardDisk = hardDisk; 7020 7003 for (PCFGMNODE pParent = pCfg;;) 7021 7004 { 7022 ComPtr<IHardDisk2> curHardDisk; 7023 hrc = parentHardDisk->COMGETTER(Parent)(curHardDisk.asOutParam()); H(); 7024 if (!curHardDisk) 7005 hrc = parentHardDisk->COMGETTER(Parent)(hardDisk.asOutParam()); H(); 7006 if (hardDisk.isNull()) 7025 7007 break; 7026 7008 7027 7009 PCFGMNODE pCur; 7028 7010 rc = CFGMR3InsertNode(pParent, "Parent", &pCur); RC_CHECK(); 7029 hrc = curHardDisk->COMGETTER(Format)(bstr.asOutParam()); H(); 7011 hrc = hardDisk->COMGETTER(Location)(bstr.asOutParam()); H(); 7012 rc = CFGMR3InsertString(pCur, "Path", Utf8Str(bstr)); RC_CHECK(); 7013 7014 hrc = hardDisk->COMGETTER(Format)(bstr.asOutParam()); H(); 7030 7015 rc = CFGMR3InsertString(pCur, "Format", Utf8Str(bstr)); RC_CHECK(); 7031 hrc = curHardDisk->COMGETTER(Location)(bstr.asOutParam()); H(); 7032 rc = CFGMR3InsertString(pCur, "Path", Utf8Str(bstr)); RC_CHECK(); 7016 7017 /* Pass all custom parameters. */ 7018 SafeArray <BSTR> names; 7019 SafeArray <BSTR> values; 7020 hrc = hardDisk->GetProperties (NULL, 7021 ComSafeArrayAsOutParam (names), 7022 ComSafeArrayAsOutParam (values));H(); 7023 7024 if (names.size() != 0) 7025 { 7026 PCFGMNODE pVDC; 7027 rc = CFGMR3InsertNode (pCur, "VDConfig", &pVDC); RC_CHECK(); 7028 for (size_t i = 0; i < names.size(); ++ i) 7029 { 7030 if (values [i]) 7031 { 7032 Utf8Str name = names [i]; 7033 Utf8Str value = values [i]; 7034 rc = CFGMR3InsertString (pVDC, name, value); 7035 if ( !(name.compare("HostIPStack")) 7036 && !(value.compare("0"))) 7037 fHostIP = false; 7038 } 7039 } 7040 } 7041 7042 7043 /* Custom code: put marker to not use host IP stack to driver 7044 * configuration node. Simplifies life of DrvVD a bit. */ 7045 if (!fHostIP) 7046 { 7047 rc = CFGMR3InsertInteger (pCfg, "HostIPStack", 0); RC_CHECK(); 7048 } 7049 7033 7050 7034 7051 /* next */ 7035 7052 pParent = pCur; 7036 parentHardDisk = curHardDisk; 7037 } 7053 parentHardDisk = hardDisk; 7054 } 7055 7056 CFGMR3Dump(CFGMR3GetRoot(pVM)); 7038 7057 7039 7058 /* -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r15582 r15592 898 898 } 899 899 } 900 /* Custom code: put marker to not use host IP stack to driver901 * configuration node. Simplifies life of DrvVD a bit. */902 if (!fHostIP)903 {904 rc = CFGMR3InsertInteger (pCfg, "HostIPStack", 0); RC_CHECK();905 }906 900 } 907 901 … … 933 927 { 934 928 PCFGMNODE pVDC; 935 rc = CFGMR3InsertNode (pC fg, "VDConfig", &pVDC); RC_CHECK();929 rc = CFGMR3InsertNode (pCur, "VDConfig", &pVDC); RC_CHECK(); 936 930 for (size_t i = 0; i < names.size(); ++ i) 937 931 { 938 rc = CFGMR3InsertString (pVDC, Utf8Str (names [i]), 939 Utf8Str (values [i])); RC_CHECK(); 940 } 932 if (values [i]) 933 { 934 Utf8Str name = names [i]; 935 Utf8Str value = values [i]; 936 rc = CFGMR3InsertString (pVDC, name, value); 937 if ( !(name.compare("HostIPStack")) 938 && !(value.compare("0"))) 939 fHostIP = false; 940 } 941 } 942 } 943 944 /* Custom code: put marker to not use host IP stack to driver 945 * configuration node. Simplifies life of DrvVD a bit. */ 946 if (!fHostIP) 947 { 948 rc = CFGMR3InsertInteger (pCfg, "HostIPStack", 0); RC_CHECK(); 941 949 } 942 950
Note:
See TracChangeset
for help on using the changeset viewer.