VirtualBox

Changeset 51103 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Apr 18, 2014 10:13:25 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
93385
Message:

Devics/Storage/DrvVD: Add support for filter plugins

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r48947 r51103  
    614614{
    615615    return CFGMR3QueryString((PCFGMNODE)pvUser, pszName, pszString, cchString);
     616}
     617
     618static int drvvdCfgQueryBytes(void *pvUser, const char *pszName, void *ppvData, size_t cbData)
     619{
     620    return CFGMR3QueryBytes((PCFGMNODE)pvUser, pszName, ppvData, cbData);
    616621}
    617622
     
    19261931}
    19271932
     1933/**
     1934 * Sets up the disk filter chain.
     1935 *
     1936 * @returns VBox status code.
     1937 * @param   pThis    The disk instance.
     1938 * @param   pCfg     CFGM node holding the filter parameters.
     1939 */
     1940static int drvvdSetupFilters(PVBOXDISK pThis, PCFGMNODE pCfg)
     1941{
     1942    int rc = VINF_SUCCESS;
     1943    PCFGMNODE pCfgFilter = CFGMR3GetChild(pCfg, "Filters");
     1944
     1945    if (pCfgFilter)
     1946    {
     1947        PCFGMNODE pCfgFilterConfig = CFGMR3GetChild(pCfgFilter, "VDConfig");
     1948        char *pszFilterName = NULL;
     1949        VDINTERFACECONFIG VDIfConfig;
     1950        PVDINTERFACE pVDIfsFilter = NULL;
     1951
     1952        rc = CFGMR3QueryStringAlloc(pCfgFilter, "FilterName", &pszFilterName);
     1953        if (RT_SUCCESS(rc))
     1954        {
     1955            VDIfConfig.pfnAreKeysValid = drvvdCfgAreKeysValid;
     1956            VDIfConfig.pfnQuerySize    = drvvdCfgQuerySize;
     1957            VDIfConfig.pfnQuery        = drvvdCfgQuery;
     1958            VDIfConfig.pfnQueryBytes   = drvvdCfgQueryBytes;
     1959            rc = VDInterfaceAdd(&VDIfConfig.Core, "DrvVD_Config", VDINTERFACETYPE_CONFIG,
     1960                                pCfgFilterConfig, sizeof(VDINTERFACECONFIG), &pVDIfsFilter);
     1961            AssertRC(rc);
     1962
     1963            rc = VDFilterAdd(pThis->pDisk, pszFilterName, pVDIfsFilter);
     1964
     1965            MMR3HeapFree(pszFilterName);
     1966        }
     1967    }
     1968
     1969    return rc;
     1970}
     1971
    19281972/*******************************************************************************
    19291973*   Base interface methods                                                     *
     
    25642608        pImage->VDIfConfig.pfnQuerySize    = drvvdCfgQuerySize;
    25652609        pImage->VDIfConfig.pfnQuery        = drvvdCfgQuery;
     2610        pImage->VDIfConfig.pfnQueryBytes   = NULL;
    25662611        rc = VDInterfaceAdd(&pImage->VDIfConfig.Core, "DrvVD_Config", VDINTERFACETYPE_CONFIG,
    25672612                            pCfgVDConfig, sizeof(VDINTERFACECONFIG), &pImage->pVDIfsImage);
     
    28512896        }
    28522897    }
     2898
     2899    if (RT_SUCCESS(rc))
     2900        rc = drvvdSetupFilters(pThis, pCfg);
    28532901
    28542902    /*
Note: See TracChangeset for help on using the changeset viewer.

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