- Timestamp:
- Dec 3, 2008 9:26:46 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 40321
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/RawHDDCore.cpp
r14954 r14960 1167 1167 rawAsyncRead, 1168 1168 /* pfnAsyncWrite */ 1169 rawAsyncWrite, 1170 /* pfnComposeLocation */ 1171 genericFileComposeLocation, 1172 /* pfnComposeName */ 1173 genericFileComposeName 1169 rawAsyncWrite 1174 1170 }; 1175 1171 -
trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp
r14954 r14960 761 761 } 762 762 763 for (unsigned i = 0; i < g_cBackends; i++) 764 { 765 pEntries[i].pszBackend = g_apBackends[i]->pszBackendName; 766 pEntries[i].uBackendCaps = g_apBackends[i]->uBackendCaps; 767 pEntries[i].papszFileExtensions = g_apBackends[i]->papszFileExtensions; 768 pEntries[i].pfnComposeLocation = g_apBackends[i]->pfnComposeLocation; 769 pEntries[i].pfnComposeName = g_apBackends[i]->pfnComposeName; 770 } 763 for (unsigned i = 0; i < g_cBackends; i++) 764 { 765 pEntries[i].pszBackend = g_apBackends[i]->pszBackendName; 766 pEntries[i].uBackendCaps = g_apBackends[i]->uBackendCaps; 767 pEntries[i].papszFileExtensions = g_apBackends[i]->papszFileExtensions; 768 pEntries[i].paConfigInfo = g_apBackends[i]->paConfigInfo; 769 } 771 770 772 771 LogFlowFunc(("returns %Rrc *pcEntriesUsed=%u\n", rc, cEntries)); … … 3553 3552 } 3554 3553 3555 #if 03556 /** @copydoc VBOXHDDBACKEND::pfnComposeLocation */3557 int genericFileComposeLocation(PVDINTERFACE pConfig, char **pszLocation)3558 {3559 return NULL;3560 }3561 3562 3563 /** @copydoc VBOXHDDBACKEND::pfnComposeName */3564 int genericFileComposeName(PVDINTERFACE pConfig, char **pszName)3565 {3566 return NULL;3567 }3568 #endif -
trunk/src/VBox/Devices/Storage/VBoxHDD-newInternal.h
r14954 r14960 494 494 PPDMDATASEG paSeg, unsigned cSeg, void *pvUser)); 495 495 496 /** Returns a human readable hard disk location string given a497 * set of hard disk configuration keys. The returned string is an498 * equivalent of the full file path for image-based hard disks.499 * Mandatory for backends with no VD_CAP_FILE and NULL otherwise. */500 DECLR3CALLBACKMEMBER(int, pfnComposeLocation, (PVDINTERFACE pConfig, char **pszLocation));501 502 /** Returns a human readable hard disk name string given a503 * set of hard disk configuration keys. The returned string is an504 * equivalent of the file name part in the full file path for505 * image-based hard disks. Mandatory for backends with no506 * VD_CAP_FILE and NULL otherwise. */507 DECLR3CALLBACKMEMBER(int, pfnComposeName, (PVDINTERFACE pConfig, char **pszName));508 509 496 } VBOXHDDBACKEND; 510 497 … … 514 501 /** Constant pointer to VD backend. */ 515 502 typedef const VBOXHDDBACKEND *PCVBOXHDDBACKEND; 516 517 /** @copydoc VBOXHDDBACKEND::pfnComposeLocation */518 DECLINLINE(int) genericFileComposeLocation(PVDINTERFACE pConfig, char **pszLocation)519 {520 *pszLocation = NULL;521 return VINF_SUCCESS;522 }523 /** @copydoc VBOXHDDBACKEND::pfnComposeName */524 DECLINLINE(int) genericFileComposeName(PVDINTERFACE pConfig, char **pszName)525 {526 *pszName = NULL;527 return VINF_SUCCESS;528 }529 503 530 504 /** Initialization entry point. */ -
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r14954 r14960 1946 1946 vdiAsyncRead, 1947 1947 /* pfnAsyncWrite */ 1948 vdiAsyncWrite, 1949 /* pfnComposeLocation */ 1950 genericFileComposeLocation, 1951 /* pfnComposeName */ 1952 genericFileComposeName 1948 vdiAsyncWrite 1953 1949 }; 1954 1950 -
trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp
r14954 r14960 1952 1952 vhdAsyncRead, 1953 1953 /* pfnAsyncWrite */ 1954 vhdAsyncWrite, 1955 /* pfnComposeLocation */ 1956 genericFileComposeLocation, 1957 /* pfnComposeName */ 1958 genericFileComposeName 1954 vhdAsyncWrite 1959 1955 }; -
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r14954 r14960 5394 5394 vmdkAsyncRead, 5395 5395 /* pfnAsyncWrite */ 5396 vmdkAsyncWrite, 5397 /* pfnComposeLocation */ 5398 genericFileComposeLocation, 5399 /* pfnComposeName */ 5400 genericFileComposeName 5396 vmdkAsyncWrite 5401 5397 }; -
trunk/src/VBox/Devices/Storage/testcase/tstVD-2.cpp
r14954 r14960 37 37 unsigned g_cErrors = 0; 38 38 39 static struct KeyValuePair {40 const char *key;41 const char *value;42 } aCfgNode[] = {43 { "TargetName", "test" },44 { "LUN", "1" },45 { "TargetAddress", "address" },46 { NULL, NULL }47 };48 49 static bool tstAreKeysValid(void *pvUser, const char *pszzValid)50 {51 return true;52 }53 54 static const char *tstGetValueByKey(const char *pszKey)55 {56 for (int i = 0; aCfgNode[i].key; i++)57 if (!strcmp(aCfgNode[i].key, pszKey))58 return aCfgNode[i].value;59 return NULL;60 }61 62 static int tstQuerySize(void *pvUser, const char *pszName, size_t *pcbValue)63 {64 const char *pszValue = tstGetValueByKey(pszName);65 if (!pszValue)66 return VERR_CFGM_VALUE_NOT_FOUND;67 *pcbValue = strlen(pszValue) + 1;68 return VINF_SUCCESS;69 }70 71 static int tstQuery(void *pvUser, const char *pszName, char *pszValue, size_t cchValue)72 {73 const char *pszTmp = tstGetValueByKey(pszName);74 if (!pszValue)75 return VERR_CFGM_VALUE_NOT_FOUND;76 size_t cchTmp = strlen(pszTmp) + 1;77 if (cchValue < cchTmp)78 return VERR_CFGM_NOT_ENOUGH_SPACE;79 memcpy(pszValue, pszTmp, cchTmp);80 return VINF_SUCCESS;81 }82 83 84 VDINTERFACECONFIG icc = {85 sizeof(VDINTERFACECONFIG),86 VDINTERFACETYPE_CONFIG,87 tstAreKeysValid,88 tstQuerySize,89 tstQuery90 };91 39 92 40 static int tstVDBackendInfo(void) … … 181 129 RTPrintf("<NONE>"); 182 130 RTPrintf("\n"); 183 184 VDINTERFACE ic;185 ic.cbSize = sizeof(ic);186 ic.enmInterface = VDINTERFACETYPE_CONFIG;187 ic.pCallbacks = &icc;188 char *pszLocation, *pszName;189 rc = aVDInfo[i].pfnComposeLocation(&ic, &pszLocation);190 CHECK("pfnComposeLocation()");191 if (pszLocation)192 {193 RTMemFree(pszLocation);194 if (aVDInfo[i].uBackendCaps & VD_CAP_FILE)195 {196 RTPrintf("Non-NULL location returned for file-based backend!\n");197 return VERR_INTERNAL_ERROR;198 }199 }200 rc = aVDInfo[i].pfnComposeName(&ic, &pszName);201 CHECK("pfnComposeName()");202 if (pszName)203 {204 RTMemFree(pszName);205 if (aVDInfo[i].uBackendCaps & VD_CAP_FILE)206 {207 RTPrintf("Non-NULL name returned for file-based backend!\n");208 return VERR_INTERNAL_ERROR;209 }210 }211 131 } 212 132
Note:
See TracChangeset
for help on using the changeset viewer.