- Timestamp:
- Nov 24, 2010 9:39:23 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 68107
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDMAsyncCompletionFile.cpp
r33540 r34344 283 283 if (RT_FAILURE(rc)) 284 284 ASMAtomicCmpXchgS32(&pTaskFile->rc, rc, VINF_SUCCESS); 285 #ifdef DEBUG 286 else 287 { 288 PPDMASYNCCOMPLETIONENDPOINTFILE pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pTaskFile->Core.pEndpoint; 289 290 /* Overwrite with injected error code. */ 291 if (pTask->enmTransferType == PDMACTASKFILETRANSFER_READ) 292 rc = ASMAtomicXchgS32(&pEpFile->rcReqRead, VINF_SUCCESS); 293 else 294 rc = ASMAtomicXchgS32(&pEpFile->rcReqWrite, VINF_SUCCESS); 295 296 if (RT_FAILURE(rc)) 297 ASMAtomicCmpXchgS32(&pTaskFile->rc, rc, VINF_SUCCESS); 298 } 299 #endif 285 300 286 301 if (!(uOld - pTask->DataSeg.cbSeg) … … 583 598 } 584 599 600 #ifdef DEBUG 601 /** 602 * Error inject callback. 603 * 604 * The argument parsing is quite ugly but it is only a development tool 605 * not compiled into a release build. Will improve some day. 606 */ 607 static DECLCALLBACK(void) pdmacEpFileErrorInject(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs) 608 { 609 bool fWrite; 610 int rcToInject = VINF_SUCCESS; 611 char *pszFilename = NULL; 612 PPDMASYNCCOMPLETIONEPCLASSFILE pEpClassFile = (PPDMASYNCCOMPLETIONEPCLASSFILE)pvUser; 613 614 /* Syntax is "read|write <filename> <status code>" */ 615 if (!RTStrNCmp(pszArgs, "read", 4)) 616 fWrite = false; 617 else if (!RTStrNCmp(pszArgs, "write", 5)) 618 fWrite = true; 619 else 620 return; 621 622 pszArgs += fWrite ? 5 : 4; 623 624 /* Skip white space. */ 625 while ( *pszArgs == ' ' 626 && *pszArgs != '\0') 627 pszArgs++; 628 629 if (pszArgs != '\0') 630 { 631 /* Extract the filename */ 632 const char *pszPos = pszArgs; 633 634 /* ASSUMPTION: No white space in the filename. */ 635 while ( *pszArgs != ' ' 636 && *pszArgs != '\0') 637 pszArgs++; 638 639 if (*pszArgs != '\0') 640 { 641 size_t cchFilename = pszArgs - pszPos; 642 pszFilename = RTStrDupN(pszPos, cchFilename); 643 if (pszFilename) 644 { 645 /* Skip white space. */ 646 while ( *pszArgs == ' ' 647 && *pszArgs != '\0') 648 pszArgs++; 649 650 if (*pszArgs != '\0') 651 { 652 /* Extract error number. */ 653 rcToInject = RTStrToInt32(pszArgs); 654 if (rcToInject != 0) 655 { 656 /* Search for the matching endpoint. */ 657 RTCritSectEnter(&pEpClassFile->Core.CritSect); 658 PPDMASYNCCOMPLETIONENDPOINTFILE pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pEpClassFile->Core.pEndpointsHead; 659 660 while (pEpFile) 661 { 662 if (!RTStrCmp(pszFilename, RTPathFilename(pEpFile->Core.pszUri))) 663 break; 664 pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pEpFile->Core.pNext; 665 } 666 667 if (pEpFile) 668 { 669 if (fWrite) 670 ASMAtomicXchgS32(&pEpFile->rcReqWrite, rcToInject); 671 else 672 ASMAtomicXchgS32(&pEpFile->rcReqRead, rcToInject); 673 674 pHlp->pfnPrintf(pHlp, "Injected %Rrc into '%s' for %s\n", 675 rcToInject, pszFilename, fWrite ? "write" : "read"); 676 } 677 else 678 pHlp->pfnPrintf(pHlp, "No file with name '%s' found\n", pszFilename); 679 680 RTCritSectLeave(&pEpClassFile->Core.CritSect); 681 RTStrFree(pszFilename); 682 return; 683 } 684 } 685 RTStrFree(pszFilename); 686 } 687 } 688 } 689 pHlp->pfnPrintf(pHlp, "Error parsing command line\n"); 690 } 691 #endif 692 585 693 static int pdmacFileInitialize(PPDMASYNCCOMPLETIONEPCLASS pClassGlobals, PCFGMNODE pCfgNode) 586 694 { … … 670 778 LogRel(("AIOMgr: Cache was globally disabled\n")); 671 779 } 780 781 #ifdef DEBUG 782 /* Install the error injection handler. */ 783 if (RT_SUCCESS(rc)) 784 { 785 rc = DBGFR3InfoRegisterExternal(pClassGlobals->pVM, "injecterror", 786 "Inject an error into the async file I/O handling", 787 pdmacEpFileErrorInject, pEpClassFile); 788 AssertRC(rc); 789 } 790 #endif 672 791 673 792 return rc; -
trunk/src/VBox/VMM/PDMAsyncCompletionFileInternal.h
r33846 r34344 542 542 /** Flag whether the host supports the async flush API. */ 543 543 bool fAsyncFlushSupported; 544 #ifdef DEBUG 545 /** Status code to inject for the next complete read. */ 546 volatile int rcReqRead; 547 /** Status code to inject for the next complete write. */ 548 volatile int rcReqWrite; 549 #endif 544 550 /** Flag whether a blocking event is pending and needs 545 551 * processing by the I/O manager. */
Note:
See TracChangeset
for help on using the changeset viewer.