Changeset 66602 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Apr 18, 2017 3:27:30 PM (8 years ago)
- Location:
- trunk/src/VBox/Runtime/common
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/filesystem/fatvfs.cpp
r66574 r66602 463 463 * @interface_method_impl{RTVFSDIROPS,pfnOpenDir} 464 464 */ 465 static DECLCALLBACK(int) rtFsFatDir_OpenDir(void *pvThis, const char *pszSubDir, PRTVFSDIR phVfsDir)466 { 467 RT_NOREF(pvThis, pszSubDir, phVfsDir);465 static DECLCALLBACK(int) rtFsFatDir_OpenDir(void *pvThis, const char *pszSubDir, uint32_t fFlags, PRTVFSDIR phVfsDir) 466 { 467 RT_NOREF(pvThis, pszSubDir, fFlags, phVfsDir); 468 468 return VERR_NOT_IMPLEMENTED; 469 469 } … … 516 516 static DECLCALLBACK(int) rtFsFatDir_RewindDir(void *pvThis) 517 517 { 518 RT_NOREF(pvThis); 518 519 return VERR_NOT_IMPLEMENTED; 519 520 } … … 526 527 RTFSOBJATTRADD enmAddAttr) 527 528 { 529 RT_NOREF(pvThis, pDirEntry, pcbDirEntry, enmAddAttr); 528 530 return VERR_NOT_IMPLEMENTED; 529 531 } … … 571 573 static DECLCALLBACK(void) rtFsFatVol_Destroy(void *pvThis) 572 574 { 575 RT_NOREF(pvThis); 573 576 } 574 577 … … 579 582 static DECLCALLBACK(int) rtFsFatVol_OpenRoot(void *pvThis, PRTVFSDIR phVfsDir) 580 583 { 584 RT_NOREF(pvThis, phVfsDir); 581 585 return VERR_NOT_IMPLEMENTED; 582 586 } … … 604 608 }; 605 609 610 611 612 RTDECL(int) RTFsFatVolOpen(RTVFSFILE hVfsFileIn, bool fReadOnly, PRTVFS phVfs, PRTERRINFO pErrInfo) 613 { 614 RT_NOREF(hVfsFileIn, fReadOnly, pErrInfo, phVfs); 615 return VERR_NOT_IMPLEMENTED; 616 } 617 618 619 /** 620 * @interface_method_impl{RTVFSCHAINELEMENTREG,pfnValidate} 621 */ 622 static DECLCALLBACK(int) rtVfsChainFatVol_Validate(PCRTVFSCHAINELEMENTREG pProviderReg, PRTVFSCHAINSPEC pSpec, 623 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError, PRTERRINFO pErrInfo) 624 { 625 RT_NOREF(pProviderReg); 626 627 /* 628 * Basic checks. 629 */ 630 if (pElement->enmTypeIn != RTVFSOBJTYPE_FILE) 631 return pElement->enmTypeIn == RTVFSOBJTYPE_INVALID ? VERR_VFS_CHAIN_CANNOT_BE_FIRST_ELEMENT : VERR_VFS_CHAIN_TAKES_FILE; 632 if ( pElement->enmType != RTVFSOBJTYPE_VFS 633 && pElement->enmType != RTVFSOBJTYPE_DIR) 634 return VERR_VFS_CHAIN_ONLY_DIR_OR_VFS; 635 if (pElement->cArgs > 1) 636 return VERR_VFS_CHAIN_AT_MOST_ONE_ARG; 637 638 /* 639 * Parse the flag if present, save in pElement->uProvider. 640 */ 641 bool fReadOnly = (pSpec->fOpenFile & RTFILE_O_ACCESS_MASK) == RTFILE_O_READ; 642 if (pElement->cArgs > 0) 643 { 644 const char *psz = pElement->paArgs[0].psz; 645 if (*psz) 646 { 647 if (!strcmp(psz, "ro")) 648 fReadOnly = true; 649 else if (!strcmp(psz, "rw")) 650 fReadOnly = false; 651 else 652 { 653 *poffError = pElement->paArgs[0].offSpec; 654 return RTErrInfoSet(pErrInfo, VERR_VFS_CHAIN_INVALID_ARGUMENT, "Expected 'ro' or 'rw' as argument"); 655 } 656 } 657 } 658 659 pElement->uProvider = fReadOnly; 660 return VINF_SUCCESS; 661 } 662 663 664 /** 665 * @interface_method_impl{RTVFSCHAINELEMENTREG,pfnInstantiate} 666 */ 667 static DECLCALLBACK(int) rtVfsChainFatVol_Instantiate(PCRTVFSCHAINELEMENTREG pProviderReg, PCRTVFSCHAINSPEC pSpec, 668 PCRTVFSCHAINELEMSPEC pElement, RTVFSOBJ hPrevVfsObj, 669 PRTVFSOBJ phVfsObj, uint32_t *poffError, PRTERRINFO pErrInfo) 670 { 671 RT_NOREF(pProviderReg, pSpec, poffError); 672 673 int rc; 674 RTVFSFILE hVfsFileIn = RTVfsObjToFile(hPrevVfsObj); 675 if (hVfsFileIn != NIL_RTVFSFILE) 676 { 677 RTVFS hVfs; 678 rc = RTFsFatVolOpen(hVfsFileIn, pElement->uProvider != false, &hVfs, pErrInfo); 679 RTVfsFileRelease(hVfsFileIn); 680 if (RT_SUCCESS(rc)) 681 { 682 *phVfsObj = RTVfsObjFromVfs(hVfs); 683 RTVfsRelease(hVfs); 684 if (*phVfsObj != NIL_RTVFSOBJ) 685 return VINF_SUCCESS; 686 rc = VERR_VFS_CHAIN_CAST_FAILED; 687 } 688 } 689 else 690 rc = VERR_VFS_CHAIN_CAST_FAILED; 691 return rc; 692 } 693 694 695 /** 696 * @interface_method_impl{RTVFSCHAINELEMENTREG,pfnCanReuseElement} 697 */ 698 static DECLCALLBACK(bool) rtVfsChainFatVol_CanReuseElement(PCRTVFSCHAINELEMENTREG pProviderReg, 699 PCRTVFSCHAINSPEC pSpec, PCRTVFSCHAINELEMSPEC pElement, 700 PCRTVFSCHAINSPEC pReuseSpec, PCRTVFSCHAINELEMSPEC pReuseElement) 701 { 702 RT_NOREF(pProviderReg, pSpec, pReuseSpec); 703 if ( pElement->paArgs[0].uProvider == pReuseElement->paArgs[0].uProvider 704 || !pReuseElement->paArgs[0].uProvider) 705 return true; 706 return false; 707 } 708 709 710 /** VFS chain element 'file'. */ 711 static RTVFSCHAINELEMENTREG g_rtVfsChainFatVolReg = 712 { 713 /* uVersion = */ RTVFSCHAINELEMENTREG_VERSION, 714 /* fReserved = */ 0, 715 /* pszName = */ "fat", 716 /* ListEntry = */ { NULL, NULL }, 717 /* pszHelp = */ "Open a FAT file system, requires a file object on the left side.\n" 718 "First argument is an optional 'ro' (read-only) or 'rw' (read-write) flag.\n", 719 /* pfnValidate = */ rtVfsChainFatVol_Validate, 720 /* pfnInstantiate = */ rtVfsChainFatVol_Instantiate, 721 /* pfnCanReuseElement = */ rtVfsChainFatVol_CanReuseElement, 722 /* uEndMarker = */ RTVFSCHAINELEMENTREG_VERSION 723 }; 724 725 RTVFSCHAIN_AUTO_REGISTER_ELEMENT_PROVIDER(&g_rtVfsChainFatVolReg, rtVfsChainFatVolReg); 726 -
trunk/src/VBox/Runtime/common/vfs/vfschain.cpp
r66601 r66602 66 66 67 67 68 RTDECL(int) RTVfsChainValidateOpenFileOrIoStream(PRTVFSCHAINSPEC pSpec, PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError) 68 RTDECL(int) RTVfsChainValidateOpenFileOrIoStream(PRTVFSCHAINSPEC pSpec, PRTVFSCHAINELEMSPEC pElement, 69 uint32_t *poffError, PRTERRINFO pErrInfo) 69 70 { 70 71 if (pElement->cArgs < 1) … … 101 102 if ( pElement->cArgs == 2 102 103 || RT_FAILURE(RTFileModeToFlagsEx(pszAccess, "open-create", "", &pElement->uProvider))) 104 { 103 105 *poffError = pElement->paArgs[1].offSpec; 106 rc = RTErrInfoSet(pErrInfo, VERR_VFS_CHAIN_INVALID_ARGUMENT, "Expected valid access flags: 'r', 'rw', or 'w'"); 107 } 104 108 else if ( pElement->cArgs == 3 105 109 || RT_FAILURE(RTFileModeToFlagsEx(pszAccess, pszDisp, "", &pElement->uProvider))) 110 { 106 111 *poffError = pElement->paArgs[2].offSpec; 112 rc = RTErrInfoSet(pErrInfo, VERR_VFS_CHAIN_INVALID_ARGUMENT, 113 "Expected valid open disposition: create, create-replace, open, open-create, open-append, open-truncate"); 114 } 107 115 else 116 { 108 117 *poffError = pElement->paArgs[3].offSpec; 109 return VERR_VFS_CHAIN_INVALID_ARGUMENT; 118 rc = RTErrInfoSet(pErrInfo, VERR_VFS_CHAIN_INVALID_ARGUMENT, "Expected valid sharing flags: nr, nw, nrw, d"); 119 120 } 121 return rc; 110 122 } 111 123 … … 115 127 */ 116 128 static DECLCALLBACK(int) rtVfsChainOpen_Validate(PCRTVFSCHAINELEMENTREG pProviderReg, PRTVFSCHAINSPEC pSpec, 117 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError )129 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError, PRTERRINFO pErrInfo) 118 130 { 119 131 RT_NOREF(pProviderReg); … … 140 152 { 141 153 pElement->pProvider = pNewProvider; 142 return pNewProvider->pfnValidate(pNewProvider, pSpec, pElement, poffError );154 return pNewProvider->pfnValidate(pNewProvider, pSpec, pElement, poffError, pErrInfo); 143 155 } 144 156 return VERR_VFS_CHAIN_CANNOT_BE_FIRST_ELEMENT; … … 154 166 && pElement->enmType != RTVFSOBJTYPE_IO_STREAM) 155 167 { 156 int rc = RTVfsChainValidateOpenFileOrIoStream(pSpec, pElement, poffError );168 int rc = RTVfsChainValidateOpenFileOrIoStream(pSpec, pElement, poffError, pErrInfo); 157 169 if (RT_SUCCESS(rc)) 158 170 { … … 181 193 static DECLCALLBACK(int) rtVfsChainOpen_Instantiate(PCRTVFSCHAINELEMENTREG pProviderReg, PCRTVFSCHAINSPEC pSpec, 182 194 PCRTVFSCHAINELEMSPEC pElement, RTVFSOBJ hPrevVfsObj, 183 PRTVFSOBJ phVfsObj, uint32_t *poffError )184 { 185 RT_NOREF(pProviderReg, pSpec, pElement, poffError );195 PRTVFSOBJ phVfsObj, uint32_t *poffError, PRTERRINFO pErrInfo) 196 { 197 RT_NOREF(pProviderReg, pSpec, pElement, poffError, pErrInfo); 186 198 AssertReturn(hPrevVfsObj != NIL_RTVFSOBJ, VERR_VFS_CHAIN_IPE); 187 199 … … 595 607 596 608 RTDECL(int) RTVfsChainSpecParse(const char *pszSpec, uint32_t fFlags, RTVFSOBJTYPE enmDesiredType, 597 PRTVFSCHAINSPEC *ppSpec, const char **ppszError) 598 { 599 AssertPtrNullReturn(ppszError, VERR_INVALID_POINTER); 600 if (ppszError) 601 *ppszError = NULL; 609 PRTVFSCHAINSPEC *ppSpec, uint32_t *poffError) 610 { 611 if (poffError) 612 { 613 AssertPtrReturn(poffError, VERR_INVALID_POINTER); 614 *poffError = 0; 615 } 602 616 AssertPtrReturn(ppSpec, VERR_INVALID_POINTER); 603 617 *ppSpec = NULL; … … 729 743 } 730 744 731 #if 1 745 #if 0 746 /* 747 * Dump the chain. Useful for debugging the above code. 748 */ 732 749 RTAssertMsg2("dbg: cElements=%d rc=%Rrc\n", pSpec->cElements, rc); 733 750 for (uint32_t i = 0; i < pSpec->cElements; i++) … … 739 756 RTAssertMsg2(j == 0 ? (cArgs > 1 ? " [%s" : " [%s]") : j + 1 < cArgs ? ", %s" : ", %s]", 740 757 pSpec->paElements[i].paArgs[j].psz); 741 //RTAssertMsg2(" offSpec=%d cchSpec=%d", pSpec->paElements[i].offSpec, pSpec->paElements[i].cchSpec);758 RTAssertMsg2(" offSpec=%d cchSpec=%d", pSpec->paElements[i].offSpec, pSpec->paElements[i].cchSpec); 742 759 RTAssertMsg2(" spec: %.*s\n", pSpec->paElements[i].cchSpec, &pszSpec[pSpec->paElements[i].offSpec]); 743 760 } … … 752 769 else 753 770 { 754 if (p pszError)755 *p pszError = pszSrc;771 if (poffError) 772 *poffError = (uint32_t)(pszSrc - pszSpec); 756 773 RTVfsChainSpecFree(pSpec); 757 774 } … … 811 828 812 829 RTDECL(int) RTVfsChainSpecCheckAndSetup(PRTVFSCHAINSPEC pSpec, PCRTVFSCHAINSPEC pReuseSpec, 813 PRTVFSOBJ phVfsObj, uint32_t *poffError )830 PRTVFSOBJ phVfsObj, uint32_t *poffError, PRTERRINFO pErrInfo) 814 831 { 815 832 AssertPtrReturn(poffError, VERR_INVALID_POINTER); … … 818 835 *phVfsObj = NIL_RTVFSOBJ; 819 836 AssertPtrReturn(pSpec, VERR_INVALID_POINTER); 837 AssertPtrNullReturn(pErrInfo, VERR_INVALID_POINTER); 820 838 821 839 /* … … 837 855 if (pElement->pProvider) 838 856 { 839 rc = pElement->pProvider->pfnValidate(pElement->pProvider, pSpec, pElement, poffError );857 rc = pElement->pProvider->pfnValidate(pElement->pProvider, pSpec, pElement, poffError, pErrInfo); 840 858 if (RT_SUCCESS(rc)) 841 859 continue; … … 916 934 */ 917 935 RTVFSOBJ hVfsObj = NIL_RTVFSOBJ; 918 rc = pElement->pProvider->pfnInstantiate(pElement->pProvider, pSpec, pElement, hPrevVfsObj, &hVfsObj, poffError); 936 rc = pElement->pProvider->pfnInstantiate(pElement->pProvider, pSpec, pElement, hPrevVfsObj, 937 &hVfsObj, poffError, pErrInfo); 919 938 if (RT_FAILURE(rc)) 920 939 break; … … 986 1005 987 1006 988 RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint64_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError) 989 { 1007 RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint64_t fOpen, 1008 PRTVFSFILE phVfsFile, uint32_t *poffError, PRTERRINFO pErrInfo) 1009 { 1010 uint32_t offErrorIgn; 1011 if (!poffError) 1012 poffError = &offErrorIgn; 1013 *poffError = 0; 990 1014 AssertPtrReturn(pszSpec, VERR_INVALID_POINTER); 991 1015 AssertReturn(*pszSpec != '\0', VERR_INVALID_PARAMETER); 992 1016 AssertPtrReturn(phVfsFile, VERR_INVALID_POINTER); 993 if (ppszError) 994 *ppszError = NULL; 1017 AssertPtrNullReturn(pErrInfo, VERR_INVALID_POINTER); 995 1018 996 1019 /* … … 1015 1038 { 1016 1039 PRTVFSCHAINSPEC pSpec; 1017 rc = RTVfsChainSpecParse(pszSpec, 0 /*fFlags*/, RTVFSOBJTYPE_FILE, &pSpec, p pszError);1040 rc = RTVfsChainSpecParse(pszSpec, 0 /*fFlags*/, RTVFSOBJTYPE_FILE, &pSpec, poffError); 1018 1041 if (RT_SUCCESS(rc)) 1019 1042 { 1020 1043 pSpec->fOpenFile = fOpen; 1021 1044 1022 uint32_t offError = 0;1023 1045 RTVFSOBJ hVfsObj = NIL_RTVFSOBJ; 1024 rc = RTVfsChainSpecCheckAndSetup(pSpec, NULL /*pReuseSpec*/, &hVfsObj, &offError);1046 rc = RTVfsChainSpecCheckAndSetup(pSpec, NULL /*pReuseSpec*/, &hVfsObj, poffError, pErrInfo); 1025 1047 if (RT_SUCCESS(rc)) 1026 1048 { … … 1032 1054 RTVfsObjRelease(hVfsObj); 1033 1055 } 1034 else if (ppszError)1035 *ppszError = &pszSpec[offError];1036 1056 1037 1057 RTVfsChainSpecFree(pSpec); … … 1042 1062 1043 1063 1044 RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint64_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError) 1045 { 1046 if (ppszError) 1047 *ppszError = NULL; 1048 1064 RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint64_t fOpen, 1065 PRTVFSIOSTREAM phVfsIos, uint32_t *poffError, PRTERRINFO pErrInfo) 1066 { 1067 uint32_t offErrorIgn; 1068 if (!poffError) 1069 poffError = &offErrorIgn; 1070 *poffError = 0; 1049 1071 AssertPtrReturn(pszSpec, VERR_INVALID_POINTER); 1050 1072 AssertReturn(*pszSpec != '\0', VERR_INVALID_PARAMETER); 1051 1073 AssertPtrReturn(phVfsIos, VERR_INVALID_POINTER); 1074 AssertPtrNullReturn(pErrInfo, VERR_INVALID_POINTER); 1052 1075 1053 1076 /* … … 1078 1101 { 1079 1102 PRTVFSCHAINSPEC pSpec; 1080 rc = RTVfsChainSpecParse(pszSpec, 0 /*fFlags*/, RTVFSOBJTYPE_IO_STREAM, &pSpec, p pszError);1103 rc = RTVfsChainSpecParse(pszSpec, 0 /*fFlags*/, RTVFSOBJTYPE_IO_STREAM, &pSpec, poffError); 1081 1104 if (RT_SUCCESS(rc)) 1082 1105 { 1083 1106 pSpec->fOpenFile = fOpen; 1084 1107 1085 uint32_t offError = 0;1086 1108 RTVFSOBJ hVfsObj = NIL_RTVFSOBJ; 1087 rc = RTVfsChainSpecCheckAndSetup(pSpec, NULL /*pReuseSpec*/, &hVfsObj, &offError);1109 rc = RTVfsChainSpecCheckAndSetup(pSpec, NULL /*pReuseSpec*/, &hVfsObj, poffError, pErrInfo); 1088 1110 if (RT_SUCCESS(rc)) 1089 1111 { … … 1095 1117 RTVfsObjRelease(hVfsObj); 1096 1118 } 1097 else if (ppszError)1098 *ppszError = &pszSpec[offError];1099 1100 1119 RTVfsChainSpecFree(pSpec); 1101 1120 } -
trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp
r66601 r66602 819 819 */ 820 820 static DECLCALLBACK(int) rtVfsChainReadAhead_Validate(PCRTVFSCHAINELEMENTREG pProviderReg, PRTVFSCHAINSPEC pSpec, 821 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError )822 { 823 RT_NOREF(pProviderReg, poffError );821 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError, PRTERRINFO pErrInfo) 822 { 823 RT_NOREF(pProviderReg, poffError, pErrInfo); 824 824 825 825 /* … … 886 886 static DECLCALLBACK(int) rtVfsChainReadAhead_Instantiate(PCRTVFSCHAINELEMENTREG pProviderReg, PCRTVFSCHAINSPEC pSpec, 887 887 PCRTVFSCHAINELEMSPEC pElement, RTVFSOBJ hPrevVfsObj, 888 PRTVFSOBJ phVfsObj, uint32_t *poffError )889 { 890 RT_NOREF(pProviderReg, pSpec, pElement, poffError );888 PRTVFSOBJ phVfsObj, uint32_t *poffError, PRTERRINFO pErrInfo) 889 { 890 RT_NOREF(pProviderReg, pSpec, pElement, poffError, pErrInfo); 891 891 AssertReturn(hPrevVfsObj != NIL_RTVFSOBJ, VERR_VFS_CHAIN_IPE); 892 892 -
trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
r66601 r66602 517 517 */ 518 518 static DECLCALLBACK(int) rtVfsChainStdFile_Validate(PCRTVFSCHAINELEMENTREG pProviderReg, PRTVFSCHAINSPEC pSpec, 519 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError )519 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError, PRTERRINFO pErrInfo) 520 520 { 521 521 RT_NOREF(pProviderReg); … … 534 534 * Join common cause with the 'open' provider. 535 535 */ 536 return RTVfsChainValidateOpenFileOrIoStream(pSpec, pElement, poffError );536 return RTVfsChainValidateOpenFileOrIoStream(pSpec, pElement, poffError, pErrInfo); 537 537 } 538 538 … … 543 543 static DECLCALLBACK(int) rtVfsChainStdFile_Instantiate(PCRTVFSCHAINELEMENTREG pProviderReg, PCRTVFSCHAINSPEC pSpec, 544 544 PCRTVFSCHAINELEMSPEC pElement, RTVFSOBJ hPrevVfsObj, 545 PRTVFSOBJ phVfsObj, uint32_t *poffError )546 { 547 RT_NOREF(pProviderReg, pSpec, poffError );545 PRTVFSOBJ phVfsObj, uint32_t *poffError, PRTERRINFO pErrInfo) 546 { 547 RT_NOREF(pProviderReg, pSpec, poffError, pErrInfo); 548 548 AssertReturn(hPrevVfsObj == NIL_RTVFSOBJ, VERR_VFS_CHAIN_IPE); 549 549 -
trunk/src/VBox/Runtime/common/zip/gzipvfs.cpp
r66601 r66602 835 835 */ 836 836 static DECLCALLBACK(int) rtVfsChainGunzip_Validate(PCRTVFSCHAINELEMENTREG pProviderReg, PRTVFSCHAINSPEC pSpec, 837 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError )838 { 839 RT_NOREF(pProviderReg, poffError );837 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError, PRTERRINFO pErrInfo) 838 { 839 RT_NOREF(pProviderReg, poffError, pErrInfo); 840 840 841 841 if (pElement->enmType != RTVFSOBJTYPE_IO_STREAM) … … 860 860 static DECLCALLBACK(int) rtVfsChainGunzip_Instantiate(PCRTVFSCHAINELEMENTREG pProviderReg, PCRTVFSCHAINSPEC pSpec, 861 861 PCRTVFSCHAINELEMSPEC pElement, RTVFSOBJ hPrevVfsObj, 862 PRTVFSOBJ phVfsObj, uint32_t *poffError )863 { 864 RT_NOREF(pProviderReg, pSpec, pElement, poffError );862 PRTVFSOBJ phVfsObj, uint32_t *poffError, PRTERRINFO pErrInfo) 863 { 864 RT_NOREF(pProviderReg, pSpec, pElement, poffError, pErrInfo); 865 865 AssertReturn(hPrevVfsObj != NIL_RTVFSOBJ, VERR_VFS_CHAIN_IPE); 866 866 … … 918 918 */ 919 919 static DECLCALLBACK(int) rtVfsChainGzip_Validate(PCRTVFSCHAINELEMENTREG pProviderReg, PRTVFSCHAINSPEC pSpec, 920 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError )920 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError, PRTERRINFO pErrInfo) 921 921 { 922 922 RT_NOREF(pProviderReg); … … 955 955 { 956 956 *poffError = pElement->paArgs[0].offSpec; 957 return VERR_VFS_CHAIN_INVALID_ARGUMENT;957 return RTErrInfoSet(pErrInfo, VERR_VFS_CHAIN_INVALID_ARGUMENT, "Expected compression level: 1-9, default, or fast"); 958 958 } 959 959 } … … 970 970 static DECLCALLBACK(int) rtVfsChainGzip_Instantiate(PCRTVFSCHAINELEMENTREG pProviderReg, PCRTVFSCHAINSPEC pSpec, 971 971 PCRTVFSCHAINELEMSPEC pElement, RTVFSOBJ hPrevVfsObj, 972 PRTVFSOBJ phVfsObj, uint32_t *poffError )973 { 974 RT_NOREF(pProviderReg, pSpec, pElement, poffError );972 PRTVFSOBJ phVfsObj, uint32_t *poffError, PRTERRINFO pErrInfo) 973 { 974 RT_NOREF(pProviderReg, pSpec, pElement, poffError, pErrInfo); 975 975 AssertReturn(hPrevVfsObj != NIL_RTVFSOBJ, VERR_VFS_CHAIN_IPE); 976 976 -
trunk/src/VBox/Runtime/common/zip/tarcmd.cpp
r65559 r66602 195 195 && strcmp(pOpts->pszFile, "-") != 0) 196 196 { 197 const char *pszError; 198 rc = RTVfsChainOpenIoStream(pOpts->pszFile, 199 RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN, 200 &hVfsIos, 201 &pszError); 197 uint32_t offError = 0; 198 RTERRINFOSTATIC ErrInfo; 199 rc = RTVfsChainOpenIoStream(pOpts->pszFile, RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN, 200 &hVfsIos, &offError, RTErrInfoInitStatic(&ErrInfo)); 202 201 if (RT_FAILURE(rc)) 203 { 204 if (pszError && *pszError) 205 return RTMsgErrorExit(RTEXITCODE_FAILURE, 206 "RTVfsChainOpenIoStream failed with rc=%Rrc:\n" 207 " '%s'\n" 208 " %*s^\n", 209 rc, pOpts->pszFile, pszError - pOpts->pszFile, ""); 210 return RTMsgErrorExit(RTEXITCODE_FAILURE, 211 "Failed with %Rrc opening the input archive '%s'", rc, pOpts->pszFile); 212 } 202 return RTVfsChainMsgErrorExitFailure("RTVfsChainOpenIoStream", pOpts->pszFile, rc, offError, &ErrInfo.Core); 213 203 } 214 204 else -
trunk/src/VBox/Runtime/common/zip/unzipcmd.cpp
r62564 r66602 256 256 * Open the input file. 257 257 */ 258 RTVFSIOSTREAM hVfsIos; 259 const char *pszError; 260 int rc = RTVfsChainOpenIoStream(pOpts->pszFile, 261 RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN, 262 &hVfsIos, 263 &pszError); 264 if (RT_FAILURE(rc)) 265 { 266 if (pszError && *pszError) 267 return RTMsgErrorExit(RTEXITCODE_FAILURE, 268 "RTVfsChainOpenIoStream failed with rc=%Rrc:\n" 269 " '%s'\n" 270 " %*s^\n", 271 rc, pOpts->pszFile, pszError - pOpts->pszFile, ""); 272 return RTMsgErrorExit(RTEXITCODE_FAILURE, 273 "Failed with %Rrc opening the input archive '%s'", rc, pOpts->pszFile); 274 } 258 RTVFSIOSTREAM hVfsIos; 259 uint32_t offError = 0; 260 RTERRINFOSTATIC ErrInfo; 261 int rc = RTVfsChainOpenIoStream(pOpts->pszFile, RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN, 262 &hVfsIos, &offError, RTErrInfoInitStatic(&ErrInfo)); 263 if (RT_FAILURE(rc)) 264 return RTVfsChainMsgErrorExitFailure("RTVfsChainOpenIoStream", pOpts->pszFile, rc, offError, &ErrInfo.Core); 275 265 276 266 rc = RTZipPkzipFsStreamFromIoStream(hVfsIos, 0 /*fFlags*/, phVfsFss);
Note:
See TracChangeset
for help on using the changeset viewer.