Changeset 72543 in vbox for trunk/src/VBox/Storage
- Timestamp:
- Jun 13, 2018 1:29:38 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123033
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VDPlugin.cpp
r69968 r72543 64 64 *********************************************************************************************************************************/ 65 65 66 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 66 67 /** Head of loaded plugin list. */ 67 68 static RTLISTANCHOR g_ListPluginsLoaded; 69 #endif 68 70 69 71 /** Number of image backends supported. */ … … 71 73 /** Array of pointers to the image backends. */ 72 74 static PCVDIMAGEBACKEND *g_apBackends = NULL; 75 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 73 76 /** Array of handles to the corresponding plugin. */ 74 77 static RTLDRMOD *g_ahBackendPlugins = NULL; 78 #endif 75 79 /** Builtin image backends. */ 76 80 static PCVDIMAGEBACKEND aStaticBackends[] = … … 94 98 /** Array of pointers to the cache backends. */ 95 99 static PCVDCACHEBACKEND *g_apCacheBackends = NULL; 100 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 96 101 /** Array of handles to the corresponding plugin. 97 102 * … … 99 104 */ 100 105 static RTLDRMOD *g_ahCacheBackendPlugins = NULL; 106 #endif 101 107 /** Builtin cache backends. */ 102 108 static PCVDCACHEBACKEND aStaticCacheBackends[] = … … 136 142 return VERR_NO_MEMORY; 137 143 g_apBackends = pTmp; 138 144 memcpy(&g_apBackends[g_cBackends], ppBackends, cBackends * sizeof(PCVDIMAGEBACKEND)); 145 146 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 139 147 RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemRealloc(g_ahBackendPlugins, 140 148 (g_cBackends + cBackends) * sizeof(RTLDRMOD)); … … 142 150 return VERR_NO_MEMORY; 143 151 g_ahBackendPlugins = pTmpPlugins; 144 memcpy(&g_apBackends[g_cBackends], ppBackends, cBackends * sizeof(PCVDIMAGEBACKEND));145 152 for (unsigned i = g_cBackends; i < g_cBackends + cBackends; i++) 146 153 g_ahBackendPlugins[i] = hPlugin; 154 #else 155 RT_NOREF(hPlugin); 156 #endif 157 147 158 g_cBackends += cBackends; 148 159 return VINF_SUCCESS; … … 168 179 return VERR_NO_MEMORY; 169 180 g_apCacheBackends = pTmp; 170 181 memcpy(&g_apCacheBackends[g_cCacheBackends], ppBackends, cBackends * sizeof(PCVDCACHEBACKEND)); 182 183 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 171 184 RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemReallocTag(g_ahCacheBackendPlugins, 172 185 (g_cCacheBackends + cBackends) * sizeof(RTLDRMOD), … … 175 188 return VERR_NO_MEMORY; 176 189 g_ahCacheBackendPlugins = pTmpPlugins; 177 memcpy(&g_apCacheBackends[g_cCacheBackends], ppBackends, cBackends * sizeof(PCVDCACHEBACKEND));178 190 for (unsigned i = g_cCacheBackends; i < g_cCacheBackends + cBackends; i++) 179 191 g_ahCacheBackendPlugins[i] = hPlugin; 192 #else 193 RT_NOREF(hPlugin); 194 #endif 195 180 196 g_cCacheBackends += cBackends; 181 197 return VINF_SUCCESS; … … 227 243 g_apFilterBackends = pTmp; 228 244 245 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 229 246 PRTLDRMOD pTmpPlugins = (PRTLDRMOD)RTMemRealloc(g_pahFilterBackendPlugins, 230 247 (g_cFilterBackends + cBackends) * sizeof(RTLDRMOD)); … … 236 253 for (unsigned i = g_cFilterBackends; i < g_cFilterBackends + cBackends; i++) 237 254 g_pahFilterBackendPlugins[i] = hPlugin; 255 #else 256 RT_NOREF(hPlugin); 257 #endif 258 238 259 g_cFilterBackends += cBackends; 239 260 return VINF_SUCCESS; … … 719 740 } 720 741 742 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 721 743 /** 722 744 * internal: scans plugin directory and loads found plugins. … … 724 746 static int vdLoadDynamicBackends(void) 725 747 { 726 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS727 748 /* 728 749 * Enumerate plugin backends from the application directory where the other … … 735 756 736 757 return vdPluginLoadFromPath(szPath); 737 #else 738 return VINF_SUCCESS; 739 #endif 740 } 758 } 759 #endif 741 760 742 761 /** … … 854 873 { 855 874 rc = vdAddCacheBackends(NIL_RTLDRMOD, aStaticCacheBackends, RT_ELEMENTS(aStaticCacheBackends)); 875 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 856 876 if (RT_SUCCESS(rc)) 857 877 { … … 859 879 rc = vdLoadDynamicBackends(); 860 880 } 881 #endif 861 882 } 862 883 … … 875 896 return VERR_INTERNAL_ERROR; 876 897 898 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 899 if (g_pahFilterBackendPlugins) 900 RTMemFree(g_pahFilterBackendPlugins); 901 #endif 902 if (g_apFilterBackends) 903 RTMemFree(g_apFilterBackends); 904 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 877 905 if (g_ahCacheBackendPlugins) 878 906 RTMemFree(g_ahCacheBackendPlugins); 907 #endif 879 908 if (g_apCacheBackends) 880 909 RTMemFree(g_apCacheBackends); … … 887 916 g_cCacheBackends = 0; 888 917 g_apCacheBackends = NULL; 918 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 889 919 g_ahCacheBackendPlugins = NULL; 920 #endif 921 922 /* Clear the supported filter backends. */ 923 g_cFilterBackends = 0; 924 g_apFilterBackends = NULL; 925 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS 926 g_pahFilterBackendPlugins = NULL; 927 #endif 890 928 891 929 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS
Note:
See TracChangeset
for help on using the changeset viewer.