- Timestamp:
- Sep 5, 2007 7:43:09 AM (17 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Makefile.kmk
r4491 r4522 32 32 SUBDIRS_CLEAN = PC/Etherboot-src 33 33 endif 34 35 SUBDIRS_LIBRARIES += Storage/VBoxHDDFormats 34 36 35 37 # -
trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp
r4071 r4522 30 30 #include <iprt/string.h> 31 31 #include <iprt/asm.h> 32 #include <iprt/ldr.h> 32 33 33 34 #include "VBoxHDD-newInternal.h" … … 100 101 void *pvErrorUser; 101 102 103 /** Handle for the shared object / DLL. */ 104 RTLDRMOD pluginHandle; 102 105 /** Function pointers for the various backend methods. */ 103 106 PVBOXHDDBACKEND Backend; … … 487 490 } 488 491 } 492 493 /* If no static backend is found try loading a shared module with pszBackend as filename. */ 494 if (!pBackend) 495 { 496 RTLDRMOD ldrHandle; 497 char *pszPluginName; 498 size_t cbPluginName; 499 500 /* HDD Format Plugins have VBoxHDD as prefix, thatswhy we have to prepend it. 501 * @todo: find out what to do if filenames are case sensitive. 502 */ 503 cbPluginName = RTStrAPrintf(&pszPluginName, "VBoxHDD%s", pszBackend); 504 if (cbPluginName == -1) 505 { 506 rc = VERR_NO_MEMORY; 507 } 508 else 509 { 510 /* try to load the plugin (RTldrLoad appends the suffix for the shared object/DLL). */ 511 rc = RTLdrLoad(pszPluginName, &ldrHandle); 512 if (VBOX_SUCCESS(rc)) 513 { 514 PFNVBOXHDDFORMATLOAD pfnHDDFormatLoad; 515 516 rc = RTLdrGetSymbol (ldrHandle, VBOX_HDDFORMAT_LOAD_NAME, (void**)&pfnHDDFormatLoad); 517 if (VBOX_FAILURE(rc) || !pfnHDDFormatLoad) 518 { 519 Log(("%s: Error resolving the entry point %s, rc = %d, pfnHDDFormat = %p\n", VBOX_HDDFORMAT_LOAD_NAME, rc, pfnHDDFormatLoad)); 520 if (VBOX_SUCCESS(rc)) 521 rc = VERR_SYMBOL_NOT_FOUND; 522 } 523 else 524 { 525 /* Get the function table. */ 526 pBackend = (PVBOXHDDBACKEND)RTMemAllocZ(sizeof(VBOXHDDBACKEND)); 527 if (!pBackend) 528 { 529 rc = VERR_NO_MEMORY; 530 } 531 else 532 { 533 pBackend->cbSize = sizeof(VBOXHDDBACKEND); 534 rc = pfnHDDFormatLoad(pBackend); 535 if (VBOX_FAILURE(rc)) 536 { 537 RTMemFree(pBackend); 538 pBackend = NULL; 539 } 540 } 541 } 542 } 543 RTStrFree(pszPluginName); 544 } 545 } 546 489 547 if (pBackend) 490 548 { … … 533 591 { 534 592 VDCloseAll(pDisk); 593 RTLdrClose(pDisk->pluginHandle); 594 RTMemFree(pDisk->Backend); 535 595 RTMemFree(pDisk); 536 596 } -
trunk/src/VBox/Devices/Storage/VBoxHDD-newInternal.h
r4071 r4522 21 21 #include <VBox/VBoxHDD-new.h> 22 22 23 24 23 /** 25 24 * Image format backend interface used by VBox HDD Container implementation. … … 27 26 typedef struct VBOXHDDBACKEND 28 27 { 28 /** 29 * The size of the structure. 30 */ 31 uint32_t cbSize; 32 29 33 /** 30 34 * Open a disk image. … … 277 281 } VBOXHDDBACKEND, *PVBOXHDDBACKEND; 278 282 283 /** Initialization entry point. */ 284 typedef DECLCALLBACK(int) VBOXHDDFORMATLOAD(PVBOXHDDBACKEND pBackendTable); 285 typedef VBOXHDDFORMATLOAD *PFNVBOXHDDFORMATLOAD; 286 #define VBOX_HDDFORMAT_LOAD_NAME "VBoxHDDFormatLoad" 279 287 280 288 #endif -
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r4372 r4522 3480 3480 VBOXHDDBACKEND g_VmdkBackend = 3481 3481 { 3482 /* cbSize */ 3483 sizeof(VBOXHDDBACKEND), 3482 3484 /* pfnOpen */ 3483 3485 vmdkOpen,
Note:
See TracChangeset
for help on using the changeset viewer.