Changeset 35596 in vbox for trunk/src/VBox/Storage/testcase
- Timestamp:
- Jan 17, 2011 10:00:13 PM (14 years ago)
- Location:
- trunk/src/VBox/Storage/testcase
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/testcase/Makefile.kmk
r35471 r35596 88 88 tstVDIo_SOURCES = tstVDIo.cpp \ 89 89 VDIoBackendMem.cpp \ 90 VDMemDisk.cpp 90 VDMemDisk.cpp \ 91 VDIoRnd.cpp 91 92 endif 92 93 -
trunk/src/VBox/Storage/testcase/VDIoBackendMem.cpp
r35471 r35596 44 44 /** Size of the transfer. */ 45 45 size_t cbTransfer; 46 /** Segments array. */47 PCRTSGSEG paSegs;48 46 /** Number of segments in the array. */ 49 47 unsigned cSegs; … … 52 50 /** Opaque user data. */ 53 51 void *pvUser; 52 /** Segment array - variable in size */ 53 RTSGSEG aSegs[1]; 54 54 } VDIOBACKENDREQ, *PVDIOBACKENDREQ; 55 55 … … 145 145 size_t cbData; 146 146 147 RTCircBufAcquireWriteBlock(pIoBackend->pRequestRing, sizeof(VDIOBACKENDREQ), (void **)&pReq, &cbData);147 RTCircBufAcquireWriteBlock(pIoBackend->pRequestRing, RT_OFFSETOF(VDIOBACKENDREQ, aSegs[cSegs]), (void **)&pReq, &cbData); 148 148 if (!pReq) 149 149 return VERR_NO_MEMORY; … … 154 154 pReq->off = off; 155 155 pReq->pMemDisk = pMemDisk; 156 pReq->paSegs = paSegs;157 156 pReq->cSegs = cSegs; 158 157 pReq->pfnComplete = pfnComplete; 159 158 pReq->pvUser = pvUser; 159 for (unsigned i = 0; i < cSegs; i++) 160 { 161 pReq->aSegs[i].pvSeg = paSegs[i].pvSeg; 162 pReq->aSegs[i].cbSeg = paSegs[i].cbSeg; 163 } 160 164 RTCircBufReleaseWriteBlock(pIoBackend->pRequestRing, sizeof(VDIOBACKENDREQ)); 161 165 vdIoBackendMemThreadPoke(pIoBackend); … … 197 201 { 198 202 RTSGBUF SgBuf; 199 RTSgBufInit(&SgBuf, pReq-> paSegs, pReq->cSegs);203 RTSgBufInit(&SgBuf, pReq->aSegs, pReq->cSegs); 200 204 rcReq = VDMemDiskRead(pReq->pMemDisk, pReq->off, pReq->cbTransfer, &SgBuf); 201 205 break; … … 204 208 { 205 209 RTSGBUF SgBuf; 206 RTSgBufInit(&SgBuf, pReq-> paSegs, pReq->cSegs);210 RTSgBufInit(&SgBuf, pReq->aSegs, pReq->cSegs); 207 211 rcReq = VDMemDiskWrite(pReq->pMemDisk, pReq->off, pReq->cbTransfer, &SgBuf); 208 212 break; -
trunk/src/VBox/Storage/testcase/VDMemDisk.cpp
r35471 r35596 263 263 } 264 264 265 /* Kill a blocks coming after. */265 /* Kill all blocks coming after. */ 266 266 do 267 267 { … … 269 269 if (pSeg) 270 270 { 271 RTAvlrU64Remove(pMemDisk->pTreeSegments, pSeg->Core.Key); 271 272 RTMemFree(pSeg->pvSeg); 273 pSeg->pvSeg = NULL; 272 274 RTMemFree(pSeg); 273 275 } -
trunk/src/VBox/Storage/testcase/tstVDIo.cpp
r35579 r35596 27 27 #include <iprt/list.h> 28 28 #include <iprt/ctype.h> 29 #include <iprt/semaphore.h> 29 30 30 31 #include "VDMemDisk.h" 31 32 #include "VDIoBackendMem.h" 33 #include "VDIoRnd.h" 32 34 33 35 /** … … 73 75 /** Logical CHS geometry. */ 74 76 VDGEOMETRY LogicalGeom; 77 /** I/O RNG handle. */ 78 PVDIORND pIoRnd; 75 79 } VDTESTGLOB, *PVDTESTGLOB; 80 81 /** 82 * Transfer direction. 83 */ 84 typedef enum VDIOREQTXDIR 85 { 86 VDIOREQTXDIR_READ = 0, 87 VDIOREQTXDIR_WRITE, 88 VDIOREQTXDIR_FLUSH 89 } VDIOREQTXDIR; 90 91 /** 92 * I/O request. 93 */ 94 typedef struct VDIOREQ 95 { 96 /** Transfer type. */ 97 VDIOREQTXDIR enmTxDir; 98 /** slot index. */ 99 unsigned idx; 100 /** Start offset. */ 101 uint64_t off; 102 /** Size to transfer. */ 103 size_t cbReq; 104 /** S/G Buffer */ 105 RTSGBUF SgBuf; 106 /** Data segment */ 107 RTSGSEG DataSeg; 108 /** Flag whether the request is outstanding or not. */ 109 volatile bool fOutstanding; 110 } VDIOREQ, *PVDIOREQ; 111 112 /** 113 * I/O test data. 114 */ 115 typedef struct VDIOTEST 116 { 117 /** Start offset. */ 118 uint64_t offStart; 119 /** End offset. */ 120 uint64_t offEnd; 121 /** Flag whether random or sequential access is wanted */ 122 bool fRandomAccess; 123 /** Block size. */ 124 size_t cbBlkIo; 125 /** Number of bytes to transfer. */ 126 size_t cbIo; 127 unsigned uWriteChance; 128 PVDIORND pIoRnd; 129 uint64_t offNext; 130 } VDIOTEST, *PVDIOTEST; 76 131 77 132 /** … … 171 226 static DECLCALLBACK(int) vdScriptHandlerMerge(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 172 227 static DECLCALLBACK(int) vdScriptHandlerClose(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 228 static DECLCALLBACK(int) vdScriptHandlerIoRngCreate(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 229 static DECLCALLBACK(int) vdScriptHandlerIoRngDestroy(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 230 static DECLCALLBACK(int) vdScriptHandlerSleep(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 173 231 174 232 /* create action */ … … 223 281 /* pcszName chId enmType fFlags */ 224 282 {"mode", 'm', VDSCRIPTARGTYPE_STRING, VDSCRIPTARGDESC_FLAG_MANDATORY}, 225 {"delete", 'd', VDSCRIPTARGTYPE_BOOL ,VDSCRIPTARGDESC_FLAG_MANDATORY}283 {"delete", 'd', VDSCRIPTARGTYPE_BOOL, VDSCRIPTARGDESC_FLAG_MANDATORY} 226 284 }; 227 285 286 /* I/O RNG create action */ 287 const VDSCRIPTARGDESC g_aArgIoRngCreate[] = 288 { 289 /* pcszName chId enmType fFlags */ 290 {"size", 'd', VDSCRIPTARGTYPE_UNSIGNED_NUMBER, VDSCRIPTARGDESC_FLAG_MANDATORY | VDSCRIPTARGDESC_FLAG_SIZE_SUFFIX}, 291 {"seed", 's', VDSCRIPTARGTYPE_UNSIGNED_NUMBER, VDSCRIPTARGDESC_FLAG_MANDATORY} 292 }; 293 294 /* Sleep */ 295 const VDSCRIPTARGDESC g_aArgSleep[] = 296 { 297 /* pcszName chId enmType fFlags */ 298 {"time", 't', VDSCRIPTARGTYPE_UNSIGNED_NUMBER, VDSCRIPTARGDESC_FLAG_MANDATORY}, 299 }; 300 228 301 const VDSCRIPTACTION g_aScriptActions[] = 229 302 { 230 /* pcszAction paArgDesc cArgDescs pfnHandler */ 231 {"create", g_aArgCreate, RT_ELEMENTS(g_aArgCreate), vdScriptHandlerCreate}, 232 {"open", g_aArgOpen, RT_ELEMENTS(g_aArgOpen), vdScriptHandlerOpen}, 233 {"io", g_aArgIo, RT_ELEMENTS(g_aArgIo), vdScriptHandlerIo}, 234 {"flush", g_aArgFlush, RT_ELEMENTS(g_aArgFlush), vdScriptHandlerFlush}, 235 {"close", g_aArgClose, RT_ELEMENTS(g_aArgClose), vdScriptHandlerClose}, 236 {"merge", g_aArgMerge, RT_ELEMENTS(g_aArgMerge), vdScriptHandlerMerge}, 303 /* pcszAction paArgDesc cArgDescs pfnHandler */ 304 {"create", g_aArgCreate, RT_ELEMENTS(g_aArgCreate), vdScriptHandlerCreate}, 305 {"open", g_aArgOpen, RT_ELEMENTS(g_aArgOpen), vdScriptHandlerOpen}, 306 {"io", g_aArgIo, RT_ELEMENTS(g_aArgIo), vdScriptHandlerIo}, 307 {"flush", g_aArgFlush, RT_ELEMENTS(g_aArgFlush), vdScriptHandlerFlush}, 308 {"close", g_aArgClose, RT_ELEMENTS(g_aArgClose), vdScriptHandlerClose}, 309 {"merge", g_aArgMerge, RT_ELEMENTS(g_aArgMerge), vdScriptHandlerMerge}, 310 {"iorngcreate", g_aArgIoRngCreate, RT_ELEMENTS(g_aArgIoRngCreate), vdScriptHandlerIoRngCreate}, 311 {"iorngdestroy", NULL, 0, vdScriptHandlerIoRngDestroy}, 312 {"sleep", g_aArgSleep, RT_ELEMENTS(g_aArgSleep), vdScriptHandlerSleep}, 237 313 }; 238 314 … … 253 329 return VINF_SUCCESS; 254 330 } 331 332 static int tstVDIoTestInit(PVDIOTEST pIoTest, PVDTESTGLOB pGlob, bool fRandomAcc, size_t cbIo, 333 size_t cbBlkSize, uint64_t offStart, uint64_t offEnd, 334 unsigned uWriteChance, unsigned uReadChance); 335 static bool tstVDIoTestRunning(PVDIOTEST pIoTest); 336 static bool tstVDIoTestReqOutstanding(PVDIOREQ pIoReq); 337 static int tstVDIoTestReqInit(PVDIOTEST pIoTest, PVDIOREQ pIoReq); 338 static void tstVDIoTestReqComplete(void *pvUser1, void *pvUser2, int rcReq); 255 339 256 340 static DECLCALLBACK(int) vdScriptHandlerCreate(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs) … … 433 517 } 434 518 435 rc = VERR_NOT_IMPLEMENTED; 519 if (RT_SUCCESS(rc)) 520 { 521 VDIOTEST IoTest; 522 523 rc = tstVDIoTestInit(&IoTest, pGlob, fRandomAcc, cbIo, cbBlkSize, offStart, offEnd, uWriteChance, uReadChance); 524 if (RT_SUCCESS(rc)) 525 { 526 PVDIOREQ paIoReq = NULL; 527 unsigned cMaxTasksOutstanding = fAsync ? cMaxReqs : 1; 528 RTSEMEVENT EventSem; 529 530 rc = RTSemEventCreate(&EventSem); 531 paIoReq = (PVDIOREQ)RTMemAllocZ(cMaxTasksOutstanding * sizeof(VDIOREQ)); 532 if (paIoReq && RT_SUCCESS(rc)) 533 { 534 for (unsigned i = 0; i < cMaxTasksOutstanding; i++) 535 paIoReq[i].idx = i; 536 537 while (tstVDIoTestRunning(&IoTest)) 538 { 539 bool fTasksOutstanding = false; 540 unsigned idx = 0; 541 542 /* Submit all idling requests. */ 543 while ( idx < cMaxTasksOutstanding 544 && tstVDIoTestRunning(&IoTest)) 545 { 546 if (!tstVDIoTestReqOutstanding(&paIoReq[idx])) 547 { 548 rc = tstVDIoTestReqInit(&IoTest, &paIoReq[idx]); 549 AssertRC(rc); 550 551 if (RT_SUCCESS(rc)) 552 { 553 if (!fAsync) 554 { 555 switch (paIoReq[idx].enmTxDir) 556 { 557 case VDIOREQTXDIR_READ: 558 { 559 rc = VDRead(pGlob->pVD, paIoReq[idx].off, paIoReq[idx].DataSeg.pvSeg, paIoReq[idx].cbReq); 560 RTMemFree(paIoReq[idx].DataSeg.pvSeg); 561 break; 562 } 563 case VDIOREQTXDIR_WRITE: 564 { 565 rc = VDWrite(pGlob->pVD, paIoReq[idx].off, paIoReq[idx].DataSeg.pvSeg, paIoReq[idx].cbReq); 566 break; 567 } 568 case VDIOREQTXDIR_FLUSH: 569 { 570 rc = VDFlush(pGlob->pVD); 571 break; 572 } 573 } 574 if (RT_SUCCESS(rc)) 575 idx++; 576 } 577 else 578 { 579 switch (paIoReq[idx].enmTxDir) 580 { 581 case VDIOREQTXDIR_READ: 582 { 583 rc = VDAsyncRead(pGlob->pVD, paIoReq[idx].off, paIoReq[idx].cbReq, &paIoReq[idx].SgBuf, 584 tstVDIoTestReqComplete, &paIoReq[idx], EventSem); 585 if (rc == VINF_VD_ASYNC_IO_FINISHED) 586 RTMemFree(paIoReq[idx].DataSeg.pvSeg); 587 break; 588 } 589 case VDIOREQTXDIR_WRITE: 590 { 591 rc = VDAsyncWrite(pGlob->pVD, paIoReq[idx].off, paIoReq[idx].cbReq, &paIoReq[idx].SgBuf, 592 tstVDIoTestReqComplete, &paIoReq[idx], EventSem); 593 break; 594 } 595 case VDIOREQTXDIR_FLUSH: 596 { 597 rc = VDAsyncFlush(pGlob->pVD, tstVDIoTestReqComplete, &paIoReq[idx], EventSem); 598 break; 599 } 600 } 601 602 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 603 { 604 idx++; 605 fTasksOutstanding = true; 606 rc = VINF_SUCCESS; 607 } 608 else if (rc == VINF_VD_ASYNC_IO_FINISHED) 609 { 610 ASMAtomicXchgBool(&paIoReq[idx].fOutstanding, false); 611 rc = VINF_SUCCESS; 612 } 613 } 614 615 if (RT_FAILURE(rc)) 616 RTPrintf("Error submitting task %u rc=%Rrc\n", paIoReq[idx].idx, rc); 617 } 618 } 619 } 620 621 /* Wait for a request to complete. */ 622 if ( fAsync 623 && fTasksOutstanding) 624 { 625 rc = RTSemEventWait(EventSem, RT_INDEFINITE_WAIT); 626 AssertRC(rc); 627 } 628 } 629 630 /* Cleanup, wait for all tasks to complete. */ 631 while (fAsync) 632 { 633 unsigned idx = 0; 634 bool fAllIdle = true; 635 636 while (idx < cMaxTasksOutstanding) 637 { 638 if (tstVDIoTestReqOutstanding(&paIoReq[idx])) 639 { 640 fAllIdle = false; 641 break; 642 } 643 idx++; 644 } 645 646 if (!fAllIdle) 647 { 648 rc = RTSemEventWait(EventSem, 100); 649 Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT); 650 } 651 else 652 break; 653 } 654 655 RTSemEventDestroy(EventSem); 656 RTMemFree(paIoReq); 657 } 658 else 659 rc = VERR_NO_MEMORY; 660 } 661 } 662 436 663 return rc; 437 664 } … … 515 742 } 516 743 744 745 static DECLCALLBACK(int) vdScriptHandlerIoRngCreate(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs) 746 { 747 int rc = VINF_SUCCESS; 748 size_t cbPattern = 0; 749 uint64_t uSeed = 0; 750 751 for (unsigned i = 0; i < cScriptArgs; i++) 752 { 753 switch (paScriptArgs[i].chId) 754 { 755 case 'd': 756 { 757 cbPattern = paScriptArgs[i].u.u64; 758 break; 759 } 760 case 's': 761 { 762 uSeed = paScriptArgs[i].u.u64; 763 break; 764 } 765 default: 766 AssertMsgFailed(("Invalid argument given!\n")); 767 } 768 } 769 770 if (pGlob->pIoRnd) 771 { 772 RTPrintf("I/O RNG already exists\n"); 773 rc = VERR_INVALID_STATE; 774 } 775 else 776 rc = VDIoRndCreate(&pGlob->pIoRnd, cbPattern, uSeed); 777 778 return rc; 779 } 780 781 static DECLCALLBACK(int) vdScriptHandlerIoRngDestroy(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs) 782 { 783 if (pGlob->pIoRnd) 784 { 785 VDIoRndDestroy(pGlob->pIoRnd); 786 pGlob->pIoRnd = NULL; 787 } 788 else 789 RTPrintf("WARNING: No I/O RNG active, faulty script. Continuing\n"); 790 791 return VINF_SUCCESS; 792 } 793 794 static DECLCALLBACK(int) vdScriptHandlerSleep(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs) 795 { 796 int rc = VINF_SUCCESS; 797 uint64_t cMillies = 0; 798 799 for (unsigned i = 0; i < cScriptArgs; i++) 800 { 801 switch (paScriptArgs[i].chId) 802 { 803 case 't': 804 { 805 cMillies = paScriptArgs[i].u.u64; 806 break; 807 } 808 default: 809 AssertMsgFailed(("Invalid argument given!\n")); 810 } 811 } 812 813 rc = RTThreadSleep(cMillies); 814 return rc; 815 } 816 517 817 static DECLCALLBACK(int) tstVDIoFileOpen(void *pvUser, const char *pszLocation, 518 818 uint32_t fOpen, … … 537 837 if (fFound && pIt->pfnComplete) 538 838 rc = VERR_FILE_LOCK_FAILED; 539 else if ( fOpen &RTFILE_O_CREATE)839 else if ((fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE) 540 840 { 541 841 /* If the file exists delete the memory disk. */ … … 571 871 } 572 872 } 573 else if ( fOpen &RTFILE_O_OPEN)873 else if ((fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN) 574 874 { 575 875 if (!fFound) … … 784 1084 785 1085 return rc; 1086 } 1087 1088 static int tstVDIoTestInit(PVDIOTEST pIoTest, PVDTESTGLOB pGlob, bool fRandomAcc, size_t cbIo, 1089 size_t cbBlkSize, uint64_t offStart, uint64_t offEnd, 1090 unsigned uWriteChance, unsigned uReadChance) 1091 { 1092 pIoTest->fRandomAccess = fRandomAcc; 1093 pIoTest->cbIo = cbIo; 1094 pIoTest->cbBlkIo = cbBlkSize; 1095 pIoTest->offStart = offStart; 1096 pIoTest->offEnd = offEnd; 1097 pIoTest->uWriteChance = uWriteChance; 1098 pIoTest->pIoRnd = pGlob->pIoRnd; 1099 pIoTest->offNext = pIoTest->offEnd < pIoTest->offStart ? pIoTest->offEnd - cbBlkSize : 0; 1100 return VINF_SUCCESS; 1101 } 1102 1103 static bool tstVDIoTestRunning(PVDIOTEST pIoTest) 1104 { 1105 return pIoTest->cbIo > 0; 1106 } 1107 1108 static bool tstVDIoTestReqOutstanding(PVDIOREQ pIoReq) 1109 { 1110 return pIoReq->fOutstanding; 1111 } 1112 1113 /** 1114 * Returns true with the given chance in percent. 1115 * 1116 * @returns true or false 1117 * @param iPercentage The percentage of the chance to return true. 1118 */ 1119 static bool tstVDIoTestIsTrue(PVDIOTEST pIoTest, int iPercentage) 1120 { 1121 int uRnd = VDIoRndGetU32Ex(pIoTest->pIoRnd, 0, 100); 1122 1123 return (uRnd <= iPercentage); /* This should be enough for our purpose */ 1124 } 1125 1126 static int tstVDIoTestReqInit(PVDIOTEST pIoTest, PVDIOREQ pIoReq) 1127 { 1128 int rc = VINF_SUCCESS; 1129 1130 if (pIoTest->cbIo) 1131 { 1132 /* Read or Write? */ 1133 pIoReq->enmTxDir = tstVDIoTestIsTrue(pIoTest, pIoTest->uWriteChance) ? VDIOREQTXDIR_WRITE : VDIOREQTXDIR_READ; 1134 pIoReq->cbReq = RT_MIN(pIoTest->cbBlkIo, pIoTest->cbIo); 1135 pIoTest->cbIo -= pIoReq->cbReq; 1136 pIoReq->DataSeg.cbSeg = pIoReq->cbReq; 1137 pIoReq->off = pIoTest->offNext; 1138 1139 if (pIoReq->enmTxDir == VDIOREQTXDIR_WRITE) 1140 { 1141 rc = VDIoRndGetBuffer(pIoTest->pIoRnd, &pIoReq->DataSeg.pvSeg, pIoReq->cbReq); 1142 AssertRC(rc); 1143 } 1144 else 1145 { 1146 /* Read */ 1147 pIoReq->DataSeg.pvSeg = RTMemAlloc(pIoReq->cbReq); 1148 if (!pIoReq->DataSeg.pvSeg) 1149 rc = VERR_NO_MEMORY; 1150 } 1151 1152 if (RT_SUCCESS(rc)) 1153 { 1154 RTSgBufInit(&pIoReq->SgBuf, &pIoReq->DataSeg, 1); 1155 1156 if (pIoTest->fRandomAccess) 1157 { 1158 /** @todo */ 1159 } 1160 else 1161 { 1162 pIoTest->offNext = pIoTest->offEnd < pIoTest->offStart 1163 ? RT_MAX(pIoTest->offEnd, pIoTest->offNext - pIoTest->cbBlkIo) 1164 : RT_MIN(pIoTest->offEnd, pIoTest->offNext + pIoTest->cbBlkIo); 1165 } 1166 pIoReq->fOutstanding = true; 1167 } 1168 } 1169 else 1170 rc = VERR_ACCESS_DENIED; 1171 1172 return rc; 1173 } 1174 1175 static void tstVDIoTestReqComplete(void *pvUser1, void *pvUser2, int rcReq) 1176 { 1177 PVDIOREQ pIoReq = (PVDIOREQ)pvUser1; 1178 RTSEMEVENT hEventSem = (RTSEMEVENT)pvUser2; 1179 1180 ASMAtomicXchgBool(&pIoReq->fOutstanding, false); 1181 RTSemEventSignal(hEventSem); 1182 return; 786 1183 } 787 1184 … … 904 1301 case 'K': 905 1302 { 906 pScriptArg->u.u64 *= 1024;1303 pScriptArg->u.u64 *= _1K; 907 1304 break; 908 1305 } … … 910 1307 case 'M': 911 1308 { 912 pScriptArg->u.u64 *= 1024*1024;1309 pScriptArg->u.u64 *= _1M; 913 1310 break; 914 1311 } … … 916 1313 case 'G': 917 1314 { 918 pScriptArg->u.u64 *= 1024*1024*1024;1315 pScriptArg->u.u64 *= _1G; 919 1316 break; 920 1317 } … … 946 1343 case 'K': 947 1344 { 948 pScriptArg->u. Range.Start *= 1024;1345 pScriptArg->u.u64 *= _1K; 949 1346 break; 950 1347 } … … 952 1349 case 'M': 953 1350 { 954 pScriptArg->u. Range.Start *= 1024*1024;1351 pScriptArg->u.u64 *= _1M; 955 1352 break; 956 1353 } … … 958 1355 case 'G': 959 1356 { 960 pScriptArg->u. Range.Start *= 1024*1024*1024;1357 pScriptArg->u.u64 *= _1G; 961 1358 break; 962 1359 } … … 980 1377 case 'K': 981 1378 { 982 pScriptArg->u.Range.End *= 1024;1379 pScriptArg->u.Range.End *= _1K; 983 1380 break; 984 1381 } … … 986 1383 case 'M': 987 1384 { 988 pScriptArg->u.Range.End *= 1024*1024;1385 pScriptArg->u.Range.End *= _1M; 989 1386 break; 990 1387 } … … 992 1389 case 'G': 993 1390 { 994 pScriptArg->u.Range.End *= 1024*1024*1024;1391 pScriptArg->u.Range.End *= _1G; 995 1392 break; 996 1393 } … … 1177 1574 cScriptArgsMax = pVDScriptAction->cArgDescs; 1178 1575 paScriptArgs = (PVDSCRIPTARG)RTMemAllocZ(cScriptArgsMax * sizeof(VDSCRIPTARG)); 1179 if (paScriptArgs) 1576 } 1577 1578 if (paScriptArgs) 1579 { 1580 unsigned cScriptArgs; 1581 1582 rc = tstVDIoScriptArgumentListParse(psz, pVDScriptAction, paScriptArgs, &cScriptArgs); 1583 if (RT_SUCCESS(rc)) 1180 1584 { 1181 unsigned cScriptArgs; 1182 1183 rc = tstVDIoScriptArgumentListParse(psz, pVDScriptAction, paScriptArgs, &cScriptArgs); 1184 if (RT_SUCCESS(rc)) 1185 { 1186 /* Execute the handler. */ 1187 rc = pVDScriptAction->pfnHandler(pGlob, paScriptArgs, cScriptArgs); 1188 } 1585 /* Execute the handler. */ 1586 rc = pVDScriptAction->pfnHandler(pGlob, paScriptArgs, cScriptArgs); 1189 1587 } 1190 else1191 {1192 RTPrintf("Out of memory while allocating argument array for script action %s\n", pcszAction);1193 rc = VERR_NO_MEMORY;1194 }1588 } 1589 else 1590 { 1591 RTPrintf("Out of memory while allocating argument array for script action %s\n", pcszAction); 1592 rc = VERR_NO_MEMORY; 1195 1593 } 1196 1594 } … … 1209 1607 } while(RT_SUCCESS(rc)); 1210 1608 1609 if (rc == VERR_EOF) 1610 { 1611 RTPrintf("Successfully executed I/O script\n"); 1612 rc = VINF_SUCCESS; 1613 } 1211 1614 return rc; 1212 1615 }
Note:
See TracChangeset
for help on using the changeset viewer.