Changeset 44227 in vbox for trunk/src/VBox/Storage
- Timestamp:
- Jan 2, 2013 12:15:42 PM (12 years ago)
- Location:
- trunk/src/VBox/Storage/testcase
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/testcase/tstVDIo.cpp
r40710 r44227 329 329 static DECLCALLBACK(int) vdScriptHandlerShowStatistics(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 330 330 static DECLCALLBACK(int) vdScriptHandlerResetStatistics(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 331 static DECLCALLBACK(int) vdScriptHandlerResize(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 331 332 332 333 /* create action */ … … 544 545 {"file", 'f', VDSCRIPTARGTYPE_STRING, VDSCRIPTARGDESC_FLAG_MANDATORY}, 545 546 }; 547 548 /* Resize disk. */ 549 const VDSCRIPTARGDESC g_aArgResize[] = 550 { 551 /* pcszName chId enmType fFlags */ 552 {"disk", 'd', VDSCRIPTARGTYPE_STRING, VDSCRIPTARGDESC_FLAG_MANDATORY}, 553 {"size", 's', VDSCRIPTARGTYPE_UNSIGNED_NUMBER, VDSCRIPTARGDESC_FLAG_MANDATORY | VDSCRIPTARGDESC_FLAG_SIZE_SUFFIX} 554 }; 555 546 556 547 557 const VDSCRIPTACTION g_aScriptActions[] = … … 572 582 {"print", g_aArgPrintMsg, RT_ELEMENTS(g_aArgPrintMsg), vdScriptHandlerPrintMsg}, 573 583 {"showstatistics", g_aArgShowStatistics, RT_ELEMENTS(g_aArgShowStatistics), vdScriptHandlerShowStatistics}, 574 {"resetstatistics", g_aArgResetStatistics, RT_ELEMENTS(g_aArgResetStatistics), vdScriptHandlerResetStatistics} 584 {"resetstatistics", g_aArgResetStatistics, RT_ELEMENTS(g_aArgResetStatistics), vdScriptHandlerResetStatistics}, 585 {"resize", g_aArgResize, RT_ELEMENTS(g_aArgResize), vdScriptHandlerResize}, 575 586 }; 576 587 … … 2550 2561 } 2551 2562 2563 static DECLCALLBACK(int) vdScriptHandlerResize(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs) 2564 { 2565 int rc = VINF_SUCCESS; 2566 const char *pcszDisk = NULL; 2567 uint64_t cbDiskNew = 0; 2568 PVDDISK pDisk = NULL; 2569 2570 for (unsigned i = 0; i < cScriptArgs; i++) 2571 { 2572 switch (paScriptArgs[i].chId) 2573 { 2574 case 'd': 2575 { 2576 pcszDisk = paScriptArgs[i].u.pcszString; 2577 break; 2578 } 2579 case 's': 2580 { 2581 cbDiskNew = paScriptArgs[i].u.u64; 2582 break; 2583 } 2584 default: 2585 AssertMsgFailed(("Invalid argument given!\n")); 2586 } 2587 } 2588 2589 pDisk = tstVDIoGetDiskByName(pGlob, pcszDisk); 2590 if (pDisk) 2591 { 2592 rc = VDResize(pDisk->pVD, cbDiskNew, &pDisk->PhysGeom, &pDisk->LogicalGeom, NULL); 2593 } 2594 else 2595 rc = VERR_NOT_FOUND; 2596 2597 return rc; 2598 } 2599 2552 2600 static DECLCALLBACK(int) tstVDIoFileOpen(void *pvUser, const char *pszLocation, 2553 2601 uint32_t fOpen, … … 3315 3363 { 3316 3364 pScriptArg->u.u64 *= _1G; 3365 break; 3366 } 3367 case 't': 3368 case 'T': 3369 { 3370 pScriptArg->u.u64 *= (uint64_t)1024 * _1G; 3317 3371 break; 3318 3372 }
Note:
See TracChangeset
for help on using the changeset viewer.