- Timestamp:
- Mar 9, 2010 1:03:27 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VBoxHDD.cpp
r27211 r27213 2061 2061 /* Update parent UUID so that image chain is consistent. */ 2062 2062 RTUUID Uuid; 2063 PVDIMAGE pImageChild = NULL; 2063 2064 if (nImageFrom < nImageTo) 2064 2065 { … … 2088 2089 AssertRC(rc); 2089 2090 2090 /* Reopen readonly if neccessary */ 2091 if (pImageFrom->pNext != pDisk->pLast) 2092 { 2093 PVDIMAGE pImageChild = pImageFrom->pNext; 2094 2095 uOpenFlags = pImageChild->Backend->pfnGetOpenFlags(pImageChild->pvBackendData); 2096 uOpenFlags |= VD_OPEN_FLAGS_READONLY; 2097 rc = pImageChild->Backend->pfnSetOpenFlags(pImageChild->pvBackendData, 2098 uOpenFlags); 2099 /** @todo: What to do if this fails?. Breaking would 2100 * prevent the merged images from being removed 2101 * from the chain possibly causing inconsistent behavior. 2102 */ 2103 if (RT_FAILURE(rc)) 2104 break; 2105 } 2091 pImageChild = pImageFrom->pNext; 2106 2092 } 2107 }2108 2109 /* Make sure destination image is back to read only if necessary. */2110 if (pImageTo != pDisk->pLast && pImageFrom != pDisk->pLast)2111 {2112 uOpenFlags = pImageTo->Backend->pfnGetOpenFlags(pImageTo->pvBackendData);2113 uOpenFlags |= VD_OPEN_FLAGS_READONLY;2114 rc = pImageTo->Backend->pfnSetOpenFlags(pImageTo->pvBackendData,2115 uOpenFlags);2116 if (RT_FAILURE(rc))2117 break;2118 2093 } 2119 2094 … … 2131 2106 RTMemFree(pImg); 2132 2107 pImg = pTmp; 2108 } 2109 2110 /* Make sure destination image is back to read only if necessary. */ 2111 if (pImageTo != pDisk->pLast) 2112 { 2113 uOpenFlags = pImageTo->Backend->pfnGetOpenFlags(pImageTo->pvBackendData); 2114 uOpenFlags |= VD_OPEN_FLAGS_READONLY; 2115 rc = pImageTo->Backend->pfnSetOpenFlags(pImageTo->pvBackendData, 2116 uOpenFlags); 2117 if (RT_FAILURE(rc)) 2118 break; 2119 } 2120 2121 /* 2122 * Make sure the child is readonly 2123 * for the child -> parent merge direction 2124 * if neccessary. 2125 */ 2126 if ( nImageFrom > nImageTo 2127 && pImageChild 2128 && pImageChild != pDisk->pLast) 2129 { 2130 uOpenFlags = pImageChild->Backend->pfnGetOpenFlags(pImageChild->pvBackendData); 2131 uOpenFlags |= VD_OPEN_FLAGS_READONLY; 2132 rc = pImageChild->Backend->pfnSetOpenFlags(pImageChild->pvBackendData, 2133 uOpenFlags); 2134 if (RT_FAILURE(rc)) 2135 break; 2133 2136 } 2134 2137 } while (0);
Note:
See TracChangeset
for help on using the changeset viewer.