Changeset 90812 in vbox
- Timestamp:
- Aug 23, 2021 8:08:03 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VD.cpp
r90811 r90812 9339 9339 PRTUUID pUuid) 9340 9340 { 9341 int rc = VINF_SUCCESS;9342 int rc2;9343 bool fLockRead = false;9344 9345 9341 LogFlowFunc(("pDisk=%#p nImage=%u pUuid=%#p\n", pDisk, nImage, pUuid)); 9346 do 9347 { 9348 /* sanity check */ 9349 AssertPtrBreakStmt(pDisk, rc = VERR_INVALID_PARAMETER); 9350 AssertMsg(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature)); 9351 9352 /* Check arguments. */ 9353 AssertMsgBreakStmt(VALID_PTR(pUuid), 9354 ("pUuid=%#p\n", pUuid), 9355 rc = VERR_INVALID_PARAMETER); 9356 9357 rc2 = vdThreadStartRead(pDisk); 9358 AssertRC(rc2); 9359 fLockRead = true; 9360 9361 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 9362 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 9363 9342 /* sanity check */ 9343 AssertPtrReturn(pDisk, VERR_INVALID_POINTER); 9344 AssertMsg(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature)); 9345 9346 /* Check arguments. */ 9347 AssertPtrReturn(pUuid, VERR_INVALID_POINTER); 9348 9349 /* Do the job. */ 9350 int rc2 = vdThreadStartRead(pDisk); 9351 AssertRC(rc2); 9352 9353 int rc; 9354 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 9355 AssertPtr(pImage); 9356 if (pImage) 9364 9357 rc = pImage->Backend->pfnGetParentUuid(pImage->pBackendData, pUuid); 9365 } while (0); 9366 9367 if (RT_UNLIKELY(fLockRead)) 9368 { 9369 rc2 = vdThreadFinishRead(pDisk); 9370 AssertRC(rc2); 9371 } 9358 else 9359 rc = VERR_VD_IMAGE_NOT_FOUND; 9360 9361 rc2 = vdThreadFinishRead(pDisk); 9362 AssertRC(rc2); 9372 9363 9373 9364 LogFlowFunc(("returns %Rrc, Uuid={%RTuuid}\n", rc, pUuid)); … … 9379 9370 PCRTUUID pUuid) 9380 9371 { 9381 int rc;9382 int rc2;9383 bool fLockWrite = false;9384 9385 9372 LogFlowFunc(("pDisk=%#p nImage=%u pUuid=%#p {%RTuuid}\n", 9386 9373 pDisk, nImage, pUuid, pUuid)); 9387 do 9388 { 9389 /* sanity check */ 9390 AssertPtrBreakStmt(pDisk, rc = VERR_INVALID_PARAMETER); 9391 AssertMsg(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature)); 9392 9393 /* Check arguments. */ 9394 AssertMsgBreakStmt(VALID_PTR(pUuid) || pUuid == NULL, 9395 ("pUuid=%#p\n", pUuid), 9396 rc = VERR_INVALID_PARAMETER); 9397 9398 rc2 = vdThreadStartWrite(pDisk); 9399 AssertRC(rc2); 9400 fLockWrite = true; 9401 9402 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 9403 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 9404 9405 RTUUID Uuid; 9406 if (!pUuid) 9407 { 9408 RTUuidCreate(&Uuid); 9409 pUuid = &Uuid; 9410 } 9374 /* sanity check */ 9375 AssertPtrReturn(pDisk, VERR_INVALID_POINTER); 9376 AssertMsg(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature)); 9377 9378 /* Check arguments. */ 9379 RTUUID Uuid; 9380 if (pUuid) 9381 AssertPtrReturn(pUuid, VERR_INVALID_POINTER); 9382 else 9383 { 9384 int rc = RTUuidCreate(&Uuid); 9385 AssertRCReturn(rc, rc); 9386 pUuid = &Uuid; 9387 } 9388 9389 /* Do the job. */ 9390 int rc2 = vdThreadStartWrite(pDisk); 9391 AssertRC(rc2); 9392 9393 int rc; 9394 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 9395 AssertPtr(pImage); 9396 if (pImage) 9411 9397 rc = pImage->Backend->pfnSetParentUuid(pImage->pBackendData, pUuid); 9412 } while (0); 9413 9414 if (RT_UNLIKELY(fLockWrite)) 9415 { 9416 rc2 = vdThreadFinishWrite(pDisk); 9417 AssertRC(rc2); 9418 } 9398 else 9399 rc = VERR_VD_IMAGE_NOT_FOUND; 9400 9401 rc2 = vdThreadFinishWrite(pDisk); 9402 AssertRC(rc2); 9419 9403 9420 9404 LogFlowFunc(("returns %Rrc\n", rc)); … … 9425 9409 VBOXDDU_DECL(void) VDDumpImages(PVDISK pDisk) 9426 9410 { 9427 int rc2; 9428 bool fLockRead = false; 9429 9430 do 9431 { 9432 /* sanity check */ 9433 AssertPtrBreak(pDisk); 9434 AssertMsg(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature)); 9435 9436 if (!pDisk->pInterfaceError || !VALID_PTR(pDisk->pInterfaceError->pfnMessage)) 9437 pDisk->pInterfaceError->pfnMessage = vdLogMessage; 9438 9439 rc2 = vdThreadStartRead(pDisk); 9440 AssertRC(rc2); 9441 fLockRead = true; 9442 9443 vdMessageWrapper(pDisk, "--- Dumping VD Disk, Images=%u\n", pDisk->cImages); 9444 for (PVDIMAGE pImage = pDisk->pBase; pImage; pImage = pImage->pNext) 9445 { 9446 vdMessageWrapper(pDisk, "Dumping VD image \"%s\" (Backend=%s)\n", 9447 pImage->pszFilename, pImage->Backend->pszBackendName); 9448 pImage->Backend->pfnDump(pImage->pBackendData); 9449 } 9450 } while (0); 9451 9452 if (RT_UNLIKELY(fLockRead)) 9453 { 9454 rc2 = vdThreadFinishRead(pDisk); 9455 AssertRC(rc2); 9456 } 9411 /* sanity check */ 9412 AssertPtrReturnVoid(pDisk); 9413 AssertMsg(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature)); 9414 9415 if (!pDisk->pInterfaceError || !RT_VALID_PTR(pDisk->pInterfaceError->pfnMessage)) /** @todo r=bird: first test is boinkers. */ 9416 pDisk->pInterfaceError->pfnMessage = vdLogMessage; 9417 9418 int rc2 = vdThreadStartRead(pDisk); 9419 AssertRC(rc2); 9420 9421 vdMessageWrapper(pDisk, "--- Dumping VD Disk, Images=%u\n", pDisk->cImages); 9422 for (PVDIMAGE pImage = pDisk->pBase; pImage; pImage = pImage->pNext) 9423 { 9424 vdMessageWrapper(pDisk, "Dumping VD image \"%s\" (Backend=%s)\n", 9425 pImage->pszFilename, pImage->Backend->pszBackendName); 9426 pImage->Backend->pfnDump(pImage->pBackendData); 9427 } 9428 9429 rc2 = vdThreadFinishRead(pDisk); 9430 AssertRC(rc2); 9457 9431 } 9458 9432
Note:
See TracChangeset
for help on using the changeset viewer.