Changeset 52585 in vbox
- Timestamp:
- Sep 3, 2014 2:06:48 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
include/VBox/vd.h (modified) (2 diffs)
-
src/VBox/Main/include/SystemPropertiesImpl.h (modified) (3 diffs)
-
src/VBox/Main/include/VirtualBoxImpl.h (modified) (2 diffs)
-
src/VBox/Main/src-all/ExtPackManagerImpl.cpp (modified) (3 diffs)
-
src/VBox/Main/src-server/SystemPropertiesImpl.cpp (modified) (4 diffs)
-
src/VBox/Main/src-server/VirtualBoxImpl.cpp (modified) (1 diff)
-
src/VBox/Storage/VD.cpp (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vd.h
r51886 r52585 4 4 5 5 /* 6 * Copyright (C) 2006-201 3Oracle Corporation6 * Copyright (C) 2006-2014 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 502 502 503 503 /** 504 * Unloads a single plugin given by filename. 505 * 506 * @returns VBox status code. 507 * @param pszFilename The plugin filename to unload. 508 */ 509 VBOXDDU_DECL(int) VDPluginUnloadFromFilename(const char *pszFilename); 510 511 /** 512 * Unload all plugins from a given path. 513 * 514 * @returns VBox statuse code. 515 * @param pszPath The path to unload plugins from. 516 */ 517 VBOXDDU_DECL(int) VDPluginUnloadFromPath(const char *pszPath); 518 519 /** 504 520 * Lists all HDD backends and their capabilities in a caller-provided buffer. 505 521 * -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r52200 r52585 7 7 8 8 /* 9 * Copyright (C) 2006-201 3Oracle Corporation9 * Copyright (C) 2006-2014 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 52 52 ComObjPtr<MediumFormat> i_mediumFormat(const Utf8Str &aFormat); 53 53 ComObjPtr<MediumFormat> i_mediumFormatFromExtension(const Utf8Str &aExt); 54 55 void i_extPackInstallNotify(const char *pszExtPackName); 56 void i_extPackUninstallNotify(const char *pszExtPackName); 54 57 55 58 private: … … 126 129 ULONG *aMaxInstances); 127 130 131 HRESULT i_loadExtPackVDPluginCrypt(); 132 HRESULT i_unloadExtPackVDPluginCrypt(); 133 128 134 HRESULT i_getUserHomeDirectory(Utf8Str &strPath); 129 135 HRESULT i_setDefaultMachineFolder(const Utf8Str &strPath); -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r52095 r52585 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 127 127 void i_addProcessToReap(RTPROCESS pid); 128 128 void i_updateClientWatcher(); 129 130 void i_extPackInstallNotify(const char *pszExtPackName); 131 void i_extPackUninstallNotify(const char *pszExtPackName); 129 132 130 133 void i_onMachineStateChange(const Guid &aId, MachineState_T aState); -
trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
r52267 r52585 2530 2530 { 2531 2531 if (pExtPack && a_fReplace) 2532 { 2533 m->pVirtualBox->i_extPackUninstallNotify(pStrName->c_str()); 2532 2534 hrc = pExtPack->i_callUninstallHookAndClose(m->pVirtualBox, false /*a_ForcedRemoval*/); 2535 } 2533 2536 else if (pExtPack) 2534 2537 hrc = setError(E_FAIL, … … 2562 2565 pExtPack->i_callInstalledHook(m->pVirtualBox, &autoLock, &ErrInfo.Core); 2563 2566 if (RT_SUCCESS(ErrInfo.Core.rc)) 2567 { 2564 2568 LogRel(("ExtPackManager: Successfully installed extension pack '%s'.\n", pStrName->c_str())); 2569 m->pVirtualBox->i_extPackInstallNotify(pStrName->c_str()); 2570 } 2565 2571 else 2566 2572 { … … 2665 2671 * Call the uninstall hook and unload the main dll. 2666 2672 */ 2673 m->pVirtualBox->i_extPackUninstallNotify(a_pstrName->c_str()); 2667 2674 hrc = pExtPack->i_callUninstallHookAndClose(m->pVirtualBox, a_fForcedRemoval); 2668 2675 if (SUCCEEDED(hrc)) -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r52200 r52585 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 44 44 ///////////////////////////////////////////////////////////////////////////// 45 45 46 // globals 47 ///////////////////////////////////////////////////////////////////////////// 48 static const Utf8Str g_strExtPackPuel("Oracle VM VirtualBox Extension Pack"); 49 static const char *g_pszVDPluginCrypt = "VDPluginCrypt"; 50 46 51 // constructor / destructor 47 52 ///////////////////////////////////////////////////////////////////////////// … … 113 118 HRESULT rc = S_OK; 114 119 115 # ifdef VBOX_WITH_EXTPACK116 120 /* Load all VD plugins from all extension packs first. */ 117 121 /** @todo: Make generic for 4.4 (requires interface changes). */ 118 static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack"); 119 static const char *s_pszVDPlugin = "VDPluginCrypt"; 120 if (mParent->i_getExtPackManager()->i_isExtPackUsable(strExtPackPuel.c_str())) 121 { 122 Utf8Str strPlugin; 123 rc = mParent->i_getExtPackManager()->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin); 124 if (SUCCEEDED(rc)) 125 { 126 int vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 127 NOREF(vrc); /** @todo: Don't ignore errors. */ 128 } 129 else 130 rc = S_OK; /* ignore errors */ 131 } 132 # endif 122 rc = i_loadExtPackVDPluginCrypt(); 133 123 134 124 /* Fetch info of all available hd backends. */ … … 1127 1117 } 1128 1118 1119 1120 /** 1121 * Extension pack install notification 1122 */ 1123 void SystemProperties::i_extPackInstallNotify(const char *pszExtPackName) 1124 { 1125 if (g_strExtPackPuel.equals(pszExtPackName)) 1126 { 1127 i_loadExtPackVDPluginCrypt(); 1128 } 1129 } 1130 1131 /** 1132 * Extension pack uninstall notification 1133 */ 1134 void SystemProperties::i_extPackUninstallNotify(const char *pszExtPackName) 1135 { 1136 if (g_strExtPackPuel.equals(pszExtPackName)) 1137 { 1138 i_unloadExtPackVDPluginCrypt(); 1139 } 1140 } 1141 1142 HRESULT SystemProperties::i_loadExtPackVDPluginCrypt() 1143 { 1144 HRESULT rc = S_OK; 1145 #ifdef VBOX_WITH_EXTPACK 1146 if (mParent->i_getExtPackManager()->i_isExtPackUsable(g_strExtPackPuel.c_str())) 1147 { 1148 Utf8Str strPlugin; 1149 rc = mParent->i_getExtPackManager()->i_getLibraryPathForExtPack(g_pszVDPluginCrypt, &g_strExtPackPuel, &strPlugin); 1150 if (SUCCEEDED(rc)) 1151 { 1152 int vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 1153 NOREF(vrc); /** @todo: don't ignore errors. */ 1154 } 1155 else 1156 rc = S_OK; /* ignore errors */ 1157 } 1158 # endif 1159 return rc; 1160 } 1161 1162 HRESULT SystemProperties::i_unloadExtPackVDPluginCrypt() 1163 { 1164 HRESULT rc = S_OK; 1165 #ifdef VBOX_WITH_EXTPACK 1166 Utf8Str strPlugin; 1167 rc = mParent->i_getExtPackManager()->i_getLibraryPathForExtPack(g_pszVDPluginCrypt, &g_strExtPackPuel, &strPlugin); 1168 if (SUCCEEDED(rc)) 1169 { 1170 int vrc = VDPluginUnloadFromFilename(strPlugin.c_str()); 1171 NOREF(vrc); /** @todo: don't ignore errors. */ 1172 } 1173 else 1174 rc = S_OK; /* ignore errors */ 1175 # endif 1176 return rc; 1177 } 1178 1129 1179 // private methods 1130 1180 ///////////////////////////////////////////////////////////////////////////// -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r52546 r52585 2635 2635 }; 2636 2636 2637 2638 /** 2639 * Extpack install notification 2640 */ 2641 void VirtualBox::i_extPackInstallNotify(const char *pszExtPackName) 2642 { 2643 m->pSystemProperties->i_extPackInstallNotify(pszExtPackName); 2644 } 2645 2646 /** 2647 * Extpack uninstall notification 2648 */ 2649 void VirtualBox::i_extPackUninstallNotify(const char *pszExtPackName) 2650 { 2651 m->pSystemProperties->i_extPackUninstallNotify(pszExtPackName); 2652 } 2653 2654 2637 2655 /** 2638 2656 * @note Doesn't lock any object. -
trunk/src/VBox/Storage/VD.cpp
r52359 r52585 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 622 622 /** Array of pointers to the image backends. */ 623 623 static PCVBOXHDDBACKEND *g_apBackends = NULL; 624 /** Array of handles to the corresponding plugin. */ 625 static RTLDRMOD *g_ahBackendPlugins = NULL; 624 626 /** Builtin image backends. */ 625 627 static PCVBOXHDDBACKEND aStaticBackends[] = … … 641 643 /** Array of pointers to the cache backends. */ 642 644 static PCVDCACHEBACKEND *g_apCacheBackends = NULL; 645 /** Array of handles to the corresponding plugin. */ 646 static RTLDRMOD *g_ahCacheBackendPlugins = NULL; 643 647 /** Builtin cache backends. */ 644 648 static PCVDCACHEBACKEND aStaticCacheBackends[] = … … 651 655 /** Array of pointers to the filters backends. */ 652 656 static PCVDFILTERBACKEND *g_apFilterBackends = NULL; 657 /** Array of handles to the corresponding plugin. */ 658 static RTLDRMOD *g_ahFilterBackendPlugins = NULL; 653 659 654 660 /** Forward declaration of the async discard helper. */ … … 662 668 * internal: add several backends. 663 669 */ 664 static int vdAddBackends( PCVBOXHDDBACKEND *ppBackends, unsigned cBackends)670 static int vdAddBackends(RTLDRMOD hPlugin, PCVBOXHDDBACKEND *ppBackends, unsigned cBackends) 665 671 { 666 672 PCVBOXHDDBACKEND *pTmp = (PCVBOXHDDBACKEND*)RTMemRealloc(g_apBackends, … … 668 674 if (RT_UNLIKELY(!pTmp)) 669 675 return VERR_NO_MEMORY; 676 RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemRealloc(g_ahBackendPlugins, 677 (g_cBackends + cBackends) * sizeof(RTLDRMOD)); 678 if (RT_UNLIKELY(!pTmpPlugins)) 679 return VERR_NO_MEMORY; 670 680 g_apBackends = pTmp; 681 g_ahBackendPlugins = pTmpPlugins; 671 682 memcpy(&g_apBackends[g_cBackends], ppBackends, cBackends * sizeof(PCVBOXHDDBACKEND)); 683 for (unsigned i = g_cBackends; i < g_cBackends + cBackends; i++) 684 g_ahBackendPlugins[i] = hPlugin; 672 685 g_cBackends += cBackends; 673 686 return VINF_SUCCESS; … … 677 690 * internal: add single backend. 678 691 */ 679 DECLINLINE(int) vdAddBackend( PCVBOXHDDBACKEND pBackend)680 { 681 return vdAddBackends( &pBackend, 1);692 DECLINLINE(int) vdAddBackend(RTLDRMOD hPlugin, PCVBOXHDDBACKEND pBackend) 693 { 694 return vdAddBackends(hPlugin, &pBackend, 1); 682 695 } 683 696 … … 685 698 * internal: add several cache backends. 686 699 */ 687 static int vdAddCacheBackends( PCVDCACHEBACKEND *ppBackends, unsigned cBackends)700 static int vdAddCacheBackends(RTLDRMOD hPlugin, PCVDCACHEBACKEND *ppBackends, unsigned cBackends) 688 701 { 689 702 PCVDCACHEBACKEND *pTmp = (PCVDCACHEBACKEND*)RTMemRealloc(g_apCacheBackends, … … 691 704 if (RT_UNLIKELY(!pTmp)) 692 705 return VERR_NO_MEMORY; 706 RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemRealloc(g_ahCacheBackendPlugins, 707 (g_cCacheBackends + cBackends) * sizeof(RTLDRMOD)); 708 if (RT_UNLIKELY(!pTmpPlugins)) 709 return VERR_NO_MEMORY; 693 710 g_apCacheBackends = pTmp; 711 g_ahCacheBackendPlugins = pTmpPlugins; 694 712 memcpy(&g_apCacheBackends[g_cCacheBackends], ppBackends, cBackends * sizeof(PCVDCACHEBACKEND)); 713 for (unsigned i = g_cCacheBackends; i < g_cCacheBackends + cBackends; i++) 714 g_ahCacheBackendPlugins[i] = hPlugin; 695 715 g_cCacheBackends += cBackends; 696 716 return VINF_SUCCESS; … … 700 720 * internal: add single cache backend. 701 721 */ 702 DECLINLINE(int) vdAddCacheBackend( PCVDCACHEBACKEND pBackend)703 { 704 return vdAddCacheBackends( &pBackend, 1);705 } 706 707 /** 708 * Add several filter ba kends.722 DECLINLINE(int) vdAddCacheBackend(RTLDRMOD hPlugin, PCVDCACHEBACKEND pBackend) 723 { 724 return vdAddCacheBackends(hPlugin, &pBackend, 1); 725 } 726 727 /** 728 * Add several filter backends. 709 729 * 710 730 * @returns VBox status code. 731 * @param hPlugin Plugin handle to add. 711 732 * @param ppBackends Array of filter backends to add. 712 733 * @param cBackends Number of backends to add. 713 734 */ 714 static int vdAddFilterBackends( PCVDFILTERBACKEND *ppBackends, unsigned cBackends)735 static int vdAddFilterBackends(RTLDRMOD hPlugin, PCVDFILTERBACKEND *ppBackends, unsigned cBackends) 715 736 { 716 737 PCVDFILTERBACKEND *pTmp = (PCVDFILTERBACKEND *)RTMemRealloc(g_apFilterBackends, … … 718 739 if (RT_UNLIKELY(!pTmp)) 719 740 return VERR_NO_MEMORY; 741 RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemRealloc(g_ahFilterBackendPlugins, 742 (g_cFilterBackends + cBackends) * sizeof(RTLDRMOD)); 743 if (RT_UNLIKELY(!pTmpPlugins)) 744 return VERR_NO_MEMORY; 720 745 g_apFilterBackends = pTmp; 746 g_ahFilterBackendPlugins = pTmpPlugins; 721 747 memcpy(&g_apFilterBackends[g_cFilterBackends], ppBackends, cBackends * sizeof(PCVDFILTERBACKEND)); 748 for (unsigned i = g_cFilterBackends; i < g_cFilterBackends + cBackends; i++) 749 g_ahFilterBackendPlugins[i] = hPlugin; 722 750 g_cFilterBackends += cBackends; 723 751 return VINF_SUCCESS; … … 728 756 * 729 757 * @returns VBox status code. 758 * @param hPlugin Plugin handle to add. 730 759 * @param pBackend The backend to add. 731 760 */ 732 DECLINLINE(int) vdAddFilterBackend( PCVDFILTERBACKEND pBackend)733 { 734 return vdAddFilterBackends( &pBackend, 1);761 DECLINLINE(int) vdAddFilterBackend(RTLDRMOD hPlugin, PCVDFILTERBACKEND pBackend) 762 { 763 return vdAddFilterBackends(hPlugin, &pBackend, 1); 735 764 } 736 765 … … 3492 3521 3493 3522 if (pBackend->cbSize == sizeof(VBOXHDDBACKEND)) 3494 vdAddBackend( pBackend);3523 vdAddBackend((RTLDRMOD)pvUser, pBackend); 3495 3524 else 3496 3525 { … … 3510 3539 3511 3540 if (pBackend->cbSize == sizeof(VDCACHEBACKEND)) 3512 vdAddCacheBackend( pBackend);3541 vdAddCacheBackend((RTLDRMOD)pvUser, pBackend); 3513 3542 else 3514 3543 { … … 3528 3557 3529 3558 if (pBackend->cbSize == sizeof(VDFILTERBACKEND)) 3530 vdAddFilterBackend( pBackend);3559 vdAddFilterBackend((RTLDRMOD)pvUser, pBackend); 3531 3560 else 3532 3561 { … … 3562 3591 * @returns VBox status code. 3563 3592 * @param hPlugin Plugin handle to add. 3564 * @param pszFilename The associated filename, sued for finding duplicates.3593 * @param pszFilename The associated filename, used for finding duplicates. 3565 3594 */ 3566 3595 static int vdAddPlugin(RTLDRMOD hPlugin, const char *pszFilename) … … 3586 3615 return rc; 3587 3616 } 3617 3618 static int vdRemovePlugin(const char *pszFilename) 3619 { 3620 /* Find plugin to be removed from the list. */ 3621 PVDPLUGIN pIt = NULL; 3622 RTListForEach(&g_ListPluginsLoaded, pIt, VDPLUGIN, NodePlugin) 3623 { 3624 if (!RTStrCmp(pIt->pszFilename, pszFilename)) 3625 break; 3626 } 3627 if (!pIt) 3628 return VINF_SUCCESS; 3629 3630 /** @todo r=klaus: need to add a plugin entry point for unregistering the 3631 * backends. Only if this doesn't exist (or fails to work) we should fall 3632 * back to the following uncoordinated backend cleanup. */ 3633 for (unsigned i = 0; i < g_cBackends; i++) 3634 { 3635 while (i < g_cBackends && g_ahBackendPlugins[i] == pIt->hPlugin) 3636 { 3637 memcpy(&g_apBackends[i], &g_apBackends[i + 1], (g_cBackends - i - 1) * sizeof(PCVBOXHDDBACKEND)); 3638 memcpy(&g_ahBackendPlugins[i], &g_ahBackendPlugins[i + 1], (g_cBackends - i - 1) * sizeof(RTLDRMOD)); 3639 /** @todo for now skip reallocating, doesn't save much */ 3640 g_cBackends--; 3641 } 3642 } 3643 for (unsigned i = 0; i < g_cCacheBackends; i++) 3644 { 3645 while (i < g_cCacheBackends && g_ahCacheBackendPlugins[i] == pIt->hPlugin) 3646 { 3647 memcpy(&g_apCacheBackends[i], &g_apCacheBackends[i + 1], (g_cCacheBackends - i - 1) * sizeof(PCVBOXHDDBACKEND)); 3648 memcpy(&g_ahCacheBackendPlugins[i], &g_ahCacheBackendPlugins[i + 1], (g_cCacheBackends - i - 1) * sizeof(RTLDRMOD)); 3649 /** @todo for now skip reallocating, doesn't save much */ 3650 g_cCacheBackends--; 3651 } 3652 } 3653 for (unsigned i = 0; i < g_cFilterBackends; i++) 3654 { 3655 while (i < g_cFilterBackends && g_ahFilterBackendPlugins[i] == pIt->hPlugin) 3656 { 3657 memcpy(&g_apFilterBackends[i], &g_apFilterBackends[i + 1], (g_cFilterBackends - i - 1) * sizeof(PCVBOXHDDBACKEND)); 3658 memcpy(&g_ahFilterBackendPlugins[i], &g_ahFilterBackendPlugins[i + 1], (g_cFilterBackends - i - 1) * sizeof(RTLDRMOD)); 3659 /** @todo for now skip reallocating, doesn't save much */ 3660 g_cFilterBackends--; 3661 } 3662 } 3663 3664 /* Remove the plugin node now, all traces of it are gone. */ 3665 RTListNodeRemove(&pIt->NodePlugin); 3666 RTLdrClose(pIt->hPlugin); 3667 RTStrFree(pIt->pszFilename); 3668 RTMemFree(pIt); 3669 3670 return VINF_SUCCESS; 3671 } 3588 3672 #endif 3589 3673 … … 3624 3708 { 3625 3709 /* Get the function table. */ 3626 rc = pfnVDPluginLoad( NULL, &BackendRegister);3710 rc = pfnVDPluginLoad(hPlugin, &BackendRegister); 3627 3711 } 3628 3712 else … … 3744 3828 #else 3745 3829 return VINF_SUCCESS; 3830 #endif 3831 } 3832 3833 /** 3834 * Worker for VDPluginUnloadFromFilename() and vdPluginUnloadFromPath(). 3835 * 3836 * @returns VBox status code. 3837 * @param pszFilename The plugin filename to unload. 3838 */ 3839 static int vdPluginUnloadFromFilename(const char *pszFilename) 3840 { 3841 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 3842 return vdRemovePlugin(pszFilename); 3843 #else 3844 return VERR_NOT_IMPLEMENTED; 3845 #endif 3846 } 3847 3848 /** 3849 * Worker for VDPluginUnloadFromPath(). 3850 * 3851 * @returns VBox status code. 3852 * @param pszPath The path to unload plugins from. 3853 */ 3854 static int vdPluginUnloadFromPath(const char *pszPath) 3855 { 3856 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 3857 /* To get all entries with VBoxHDD as prefix. */ 3858 char *pszPluginFilter = RTPathJoinA(pszPath, VD_PLUGIN_PREFIX "*"); 3859 if (!pszPluginFilter) 3860 return VERR_NO_STR_MEMORY; 3861 3862 PRTDIRENTRYEX pPluginDirEntry = NULL; 3863 PRTDIR pPluginDir = NULL; 3864 size_t cbPluginDirEntry = sizeof(RTDIRENTRYEX); 3865 int rc = RTDirOpenFiltered(&pPluginDir, pszPluginFilter, RTDIRFILTER_WINNT, 0); 3866 if (RT_FAILURE(rc)) 3867 { 3868 /* On Windows the above immediately signals that there are no 3869 * files matching, while on other platforms enumerating the 3870 * files below fails. Either way: no plugins. */ 3871 goto out; 3872 } 3873 3874 pPluginDirEntry = (PRTDIRENTRYEX)RTMemAllocZ(sizeof(RTDIRENTRYEX)); 3875 if (!pPluginDirEntry) 3876 { 3877 rc = VERR_NO_MEMORY; 3878 goto out; 3879 } 3880 3881 while ((rc = RTDirReadEx(pPluginDir, pPluginDirEntry, &cbPluginDirEntry, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK)) != VERR_NO_MORE_FILES) 3882 { 3883 char *pszPluginPath = NULL; 3884 3885 if (rc == VERR_BUFFER_OVERFLOW) 3886 { 3887 /* allocate new buffer. */ 3888 RTMemFree(pPluginDirEntry); 3889 pPluginDirEntry = (PRTDIRENTRYEX)RTMemAllocZ(cbPluginDirEntry); 3890 if (!pPluginDirEntry) 3891 { 3892 rc = VERR_NO_MEMORY; 3893 break; 3894 } 3895 /* Retry. */ 3896 rc = RTDirReadEx(pPluginDir, pPluginDirEntry, &cbPluginDirEntry, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK); 3897 if (RT_FAILURE(rc)) 3898 break; 3899 } 3900 else if (RT_FAILURE(rc)) 3901 break; 3902 3903 /* We got the new entry. */ 3904 if (!RTFS_IS_FILE(pPluginDirEntry->Info.Attr.fMode)) 3905 continue; 3906 3907 /* Prepend the path to the libraries. */ 3908 pszPluginPath = RTPathJoinA(pszPath, pPluginDirEntry->szName); 3909 if (!pszPluginPath) 3910 { 3911 rc = VERR_NO_STR_MEMORY; 3912 break; 3913 } 3914 3915 rc = vdPluginUnloadFromFilename(pszPluginPath); 3916 RTStrFree(pszPluginPath); 3917 } 3918 out: 3919 if (rc == VERR_NO_MORE_FILES) 3920 rc = VINF_SUCCESS; 3921 RTStrFree(pszPluginFilter); 3922 if (pPluginDirEntry) 3923 RTMemFree(pPluginDirEntry); 3924 if (pPluginDir) 3925 RTDirClose(pPluginDir); 3926 return rc; 3927 #else 3928 return VERR_NOT_IMPLEMENTED; 3746 3929 #endif 3747 3930 } … … 5489 5672 VBOXDDU_DECL(int) VDInit(void) 5490 5673 { 5491 int rc = vdAddBackends( aStaticBackends, RT_ELEMENTS(aStaticBackends));5674 int rc = vdAddBackends(NIL_RTLDRMOD, aStaticBackends, RT_ELEMENTS(aStaticBackends)); 5492 5675 if (RT_SUCCESS(rc)) 5493 5676 { 5494 rc = vdAddCacheBackends( aStaticCacheBackends, RT_ELEMENTS(aStaticCacheBackends));5677 rc = vdAddCacheBackends(NIL_RTLDRMOD, aStaticCacheBackends, RT_ELEMENTS(aStaticCacheBackends)); 5495 5678 if (RT_SUCCESS(rc)) 5496 5679 { … … 5577 5760 5578 5761 return vdPluginLoadFromPath(pszPath); 5762 } 5763 5764 /** 5765 * Unloads a single plugin given by filename. 5766 * 5767 * @returns VBox status code. 5768 * @param pszFilename The plugin filename to unload. 5769 */ 5770 VBOXDDU_DECL(int) VDPluginUnloadFromFilename(const char *pszFilename) 5771 { 5772 if (!g_apBackends) 5773 { 5774 int rc = VDInit(); 5775 if (RT_FAILURE(rc)) 5776 return rc; 5777 } 5778 5779 return vdPluginUnloadFromFilename(pszFilename); 5780 } 5781 5782 /** 5783 * Unload all plugins from a given path. 5784 * 5785 * @returns VBox statuse code. 5786 * @param pszPath The path to unload plugins from. 5787 */ 5788 VBOXDDU_DECL(int) VDPluginUnloadFromPath(const char *pszPath) 5789 { 5790 if (!g_apBackends) 5791 { 5792 int rc = VDInit(); 5793 if (RT_FAILURE(rc)) 5794 return rc; 5795 } 5796 5797 return vdPluginUnloadFromPath(pszPath); 5579 5798 } 5580 5799
Note:
See TracChangeset
for help on using the changeset viewer.

