VirtualBox

Ignore:
Timestamp:
Dec 3, 2008 9:26:46 PM (16 years ago)
Author:
vboxsync
Message:

backed out r40315 as it breaks the tinderboxes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/testcase/tstVD-2.cpp

    r14954 r14960  
    3737unsigned g_cErrors = 0;
    3838
    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     tstQuery
    90 };
    9139
    9240static int tstVDBackendInfo(void)
     
    181129            RTPrintf("<NONE>");
    182130        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         }
    211131    }
    212132
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette