Changeset 70225 in vbox
- Timestamp:
- Dec 19, 2017 6:22:08 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Storage/VDVfs.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VDVfs.cpp
r69977 r70225 593 593 if (pElement->cArgs < 1) 594 594 return VERR_VFS_CHAIN_AT_LEAST_ONE_ARG; 595 if (pElement->cArgs > 2)596 return VERR_VFS_CHAIN_AT_MOST_TWO_ARGS;597 595 598 596 /* … … 603 601 if (pElement->cArgs > 1) 604 602 { 605 const char *psz = pElement->paArgs[1].psz; 603 pElement->paArgs[pElement->cArgs - 1].uProvider = true; /* indicates flags */ 604 const char *psz = pElement->paArgs[pElement->cArgs - 1].psz; 606 605 if (*psz) 607 606 { … … 617 616 fFlags |= VD_OPEN_FLAGS_NORMAL; 618 617 } 618 else if (strlen(psz) <= 4) 619 { 620 *poffError = pElement->paArgs[pElement->cArgs - 1].offSpec; 621 return RTErrInfoSet(pErrInfo, VERR_VFS_CHAIN_INVALID_ARGUMENT, "Expected 'ro' or 'rw' as argument"); 622 } 619 623 else 620 { 621 *poffError = pElement->paArgs[0].offSpec; 622 return RTErrInfoSet(pErrInfo, VERR_VFS_CHAIN_INVALID_ARGUMENT, "Expected 'ro' or 'rw' as argument"); 623 } 624 pElement->paArgs[pElement->cArgs - 1].uProvider = false; /* indicates no flags */ 624 625 } 625 626 } 626 627 627 628 pElement->uProvider = fFlags; 629 if ( pElement->cArgs > 2 630 || (pElement->cArgs == 2 && !pElement->paArgs[pElement->cArgs - 1].uProvider)) 631 pElement->uProvider |= RT_BIT_64(63); 628 632 return VINF_SUCCESS; 629 633 } … … 650 654 if (RT_SUCCESS(rc)) 651 655 { 652 rc = VDOpen(pDisk, pszFormat, pElement->paArgs[0].psz, (uint32_t)pElement->uProvider, NULL); 656 if (!(pElement->uProvider & RT_BIT_64(63))) 657 rc = VDOpen(pDisk, pszFormat, pElement->paArgs[0].psz, (uint32_t)pElement->uProvider, NULL); 658 else 659 { 660 uint32_t cChain = pElement->cArgs; 661 if (pElement->cArgs == 2 && pElement->paArgs[pElement->cArgs - 1].uProvider != 0) 662 cChain--; 663 uint32_t const fFinal = (uint32_t)pElement->uProvider; 664 uint32_t const fReadOnly = (fFinal & ~(VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_NORMAL)) | VD_OPEN_FLAGS_READONLY; 665 uint32_t iChain; 666 for (iChain = 0; iChain < cChain && RT_SUCCESS(rc); iChain++) 667 rc = VDOpen(pDisk, pszFormat, pElement->paArgs[iChain].psz, iChain + 1 >= cChain ? fFinal : fReadOnly, NULL); 668 } 653 669 if (RT_SUCCESS(rc)) 654 670 { … … 694 710 /* pszName = */ "vd", 695 711 /* ListEntry = */ { NULL, NULL }, 696 /* pszHelp = */ "Opens a container image using the VD API.\n", 712 /* pszHelp = */ "Opens a container image using the VD API.\n" 713 "To open a snapshot chain, start with the root image and end with the more recent diff image.\n" 714 "The final argument can be a flag 'ro' or 'r' for read-only, 'rw' for read-write.", 697 715 /* pfnValidate = */ vdVfsChain_Validate, 698 716 /* pfnInstantiate = */ vdVfsChain_Instantiate,
Note:
See TracChangeset
for help on using the changeset viewer.

