Changeset 46721 in vbox
- Timestamp:
- Jun 21, 2013 10:54:28 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86643
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/testcase/vbox-img.cpp
r46520 r46721 69 69 " repair --filename <filename>\n" 70 70 " [--dry-run]\n" 71 " [--format VDI|VMDK|VHD] (default: autodetect)\n", 71 " [--format VDI|VMDK|VHD] (default: autodetect)\n" 72 "\n" 73 " clearcomment --filename <filename>\n", 72 74 g_pszProgName); 73 75 } … … 1504 1506 1505 1507 1508 int handleClearComment(HandlerArg *a) 1509 { 1510 int rc = VINF_SUCCESS; 1511 PVBOXHDD pDisk = NULL; 1512 const char *pszFilename = NULL; 1513 bool fDryRun = false; 1514 1515 /* Parse the command line. */ 1516 static const RTGETOPTDEF s_aOptions[] = 1517 { 1518 { "--filename", 'f', RTGETOPT_REQ_STRING } 1519 }; 1520 int ch; 1521 RTGETOPTUNION ValueUnion; 1522 RTGETOPTSTATE GetState; 1523 RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 0, 0 /* fFlags */); 1524 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 1525 { 1526 switch (ch) 1527 { 1528 case 'f': // --filename 1529 pszFilename = ValueUnion.psz; 1530 break; 1531 1532 default: 1533 ch = RTGetOptPrintError(ch, &ValueUnion); 1534 printUsage(g_pStdErr); 1535 return ch; 1536 } 1537 } 1538 1539 /* Check for mandatory parameters. */ 1540 if (!pszFilename) 1541 return errorSyntax("Mandatory --filename option missing\n"); 1542 1543 /* just try it */ 1544 char *pszFormat = NULL; 1545 VDTYPE enmType = VDTYPE_INVALID; 1546 rc = VDGetFormat(NULL, NULL, pszFilename, &pszFormat, &enmType); 1547 if (RT_FAILURE(rc)) 1548 return errorSyntax("Format autodetect failed: %Rrc\n", rc); 1549 1550 rc = VDCreate(pVDIfs, enmType, &pDisk); 1551 if (RT_FAILURE(rc)) 1552 return errorRuntime("Error while creating the virtual disk container: %Rrc\n", rc); 1553 1554 /* Open the image */ 1555 rc = VDOpen(pDisk, pszFormat, pszFilename, VD_OPEN_FLAGS_INFO, NULL); 1556 if (RT_FAILURE(rc)) 1557 return errorRuntime("Error while opening the image: %Rrc\n", rc); 1558 1559 VDSetComment(pDisk, 0, NULL); 1560 1561 VDDestroy(pDisk); 1562 return rc; 1563 } 1564 1565 1506 1566 int main(int argc, char *argv[]) 1507 1567 { … … 1586 1646 } s_commandHandlers[] = 1587 1647 { 1588 { "setuuid", handleSetUUID }, 1589 { "convert", handleConvert }, 1590 { "info", handleInfo }, 1591 { "compact", handleCompact }, 1592 { "createcache", handleCreateCache }, 1593 { "createbase", handleCreateBase }, 1594 { "repair", handleRepair }, 1648 { "setuuid", handleSetUUID }, 1649 { "convert", handleConvert }, 1650 { "info", handleInfo }, 1651 { "compact", handleCompact }, 1652 { "createcache", handleCreateCache }, 1653 { "createbase", handleCreateBase }, 1654 { "repair", handleRepair }, 1655 { "clearcomment", handleClearComment }, 1595 1656 { NULL, NULL } 1596 1657 };
Note:
See TracChangeset
for help on using the changeset viewer.