VirtualBox

Changeset 66494 in vbox for trunk/src/VBox/Storage/QED.cpp


Ignore:
Timestamp:
Apr 10, 2017 9:57:25 AM (8 years ago)
Author:
vboxsync
Message:

Storage: Get rid of duplicated code in the backends for unsupported features

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/QED.cpp

    r66486 r66494  
    3333
    3434#include "VDBackends.h"
     35#include "VDBackendsInline.h"
    3536
    3637/**
     
    21252126
    21262127/** @copydoc VDIMAGEBACKEND::pfnGetComment */
    2127 static DECLCALLBACK(int) qedGetComment(void *pBackendData, char *pszComment,
    2128                                        size_t cbComment)
    2129 {
    2130     RT_NOREF2(pszComment, cbComment);
    2131     LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment));
    2132     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2133 
    2134     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2135 
    2136     LogFlowFunc(("returns %Rrc comment='%s'\n", VERR_NOT_SUPPORTED, pszComment));
    2137     return VERR_NOT_SUPPORTED;
    2138 }
     2128VD_BACKEND_CALLBACK_GET_COMMENT_DEF_NOT_SUPPORTED(qedGetComment);
    21392129
    21402130/** @copydoc VDIMAGEBACKEND::pfnSetComment */
    2141 static DECLCALLBACK(int) qedSetComment(void *pBackendData, const char *pszComment)
    2142 {
    2143     RT_NOREF1(pszComment);
    2144     LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment));
    2145     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2146 
    2147     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2148 
    2149     int rc;
    2150     if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    2151         rc = VERR_VD_IMAGE_READ_ONLY;
    2152     else
    2153         rc = VERR_NOT_SUPPORTED;
    2154 
    2155     LogFlowFunc(("returns %Rrc\n", rc));
    2156     return rc;
    2157 }
     2131VD_BACKEND_CALLBACK_SET_COMMENT_DEF_NOT_SUPPORTED(qedSetComment, PQEDIMAGE);
    21582132
    21592133/** @copydoc VDIMAGEBACKEND::pfnGetUuid */
    2160 static DECLCALLBACK(int) qedGetUuid(void *pBackendData, PRTUUID pUuid)
    2161 {
    2162     RT_NOREF1(pUuid);
    2163     LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    2164     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2165 
    2166     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2167 
    2168     LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid));
    2169     return VERR_NOT_SUPPORTED;
    2170 }
     2134VD_BACKEND_CALLBACK_GET_UUID_DEF_NOT_SUPPORTED(qedGetUuid);
    21712135
    21722136/** @copydoc VDIMAGEBACKEND::pfnSetUuid */
    2173 static DECLCALLBACK(int) qedSetUuid(void *pBackendData, PCRTUUID pUuid)
    2174 {
    2175     RT_NOREF1(pUuid);
    2176     LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    2177     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2178 
    2179     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2180 
    2181     int rc;
    2182     if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    2183         rc = VERR_VD_IMAGE_READ_ONLY;
    2184     else
    2185         rc = VERR_NOT_SUPPORTED;
    2186 
    2187     LogFlowFunc(("returns %Rrc\n", rc));
    2188     return rc;
    2189 }
     2137VD_BACKEND_CALLBACK_SET_UUID_DEF_NOT_SUPPORTED(qedSetUuid, PQEDIMAGE);
    21902138
    21912139/** @copydoc VDIMAGEBACKEND::pfnGetModificationUuid */
    2192 static DECLCALLBACK(int) qedGetModificationUuid(void *pBackendData, PRTUUID pUuid)
    2193 {
    2194     RT_NOREF1(pUuid);
    2195     LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    2196     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2197 
    2198     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2199 
    2200     LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid));
    2201     return VERR_NOT_SUPPORTED;
    2202 }
     2140VD_BACKEND_CALLBACK_GET_UUID_DEF_NOT_SUPPORTED(qedGetModificationUuid);
    22032141
    22042142/** @copydoc VDIMAGEBACKEND::pfnSetModificationUuid */
    2205 static DECLCALLBACK(int) qedSetModificationUuid(void *pBackendData, PCRTUUID pUuid)
    2206 {
    2207     RT_NOREF1(pUuid);
    2208     LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    2209     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2210 
    2211     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2212 
    2213     int rc;
    2214     if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    2215         rc = VERR_VD_IMAGE_READ_ONLY;
    2216     else
    2217         rc = VERR_NOT_SUPPORTED;
    2218 
    2219     LogFlowFunc(("returns %Rrc\n", rc));
    2220     return rc;
    2221 }
     2143VD_BACKEND_CALLBACK_SET_UUID_DEF_NOT_SUPPORTED(qedSetModificationUuid, PQEDIMAGE);
    22222144
    22232145/** @copydoc VDIMAGEBACKEND::pfnGetParentUuid */
    2224 static DECLCALLBACK(int) qedGetParentUuid(void *pBackendData, PRTUUID pUuid)
    2225 {
    2226     RT_NOREF1(pUuid);
    2227     LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    2228     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2229 
    2230     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2231 
    2232     LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid));
    2233     return VERR_NOT_SUPPORTED;
    2234 }
     2146VD_BACKEND_CALLBACK_GET_UUID_DEF_NOT_SUPPORTED(qedGetParentUuid);
    22352147
    22362148/** @copydoc VDIMAGEBACKEND::pfnSetParentUuid */
    2237 static DECLCALLBACK(int) qedSetParentUuid(void *pBackendData, PCRTUUID pUuid)
    2238 {
    2239     RT_NOREF1(pUuid);
    2240     LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    2241     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2242 
    2243     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2244 
    2245     int rc;
    2246     if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    2247         rc = VERR_VD_IMAGE_READ_ONLY;
    2248     else
    2249         rc = VERR_NOT_SUPPORTED;
    2250 
    2251     LogFlowFunc(("returns %Rrc\n", rc));
    2252     return rc;
    2253 }
     2149VD_BACKEND_CALLBACK_SET_UUID_DEF_NOT_SUPPORTED(qedSetParentUuid, PQEDIMAGE);
    22542150
    22552151/** @copydoc VDIMAGEBACKEND::pfnGetParentModificationUuid */
    2256 static DECLCALLBACK(int) qedGetParentModificationUuid(void *pBackendData, PRTUUID pUuid)
    2257 {
    2258     RT_NOREF1(pUuid);
    2259     LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    2260     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2261 
    2262     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2263 
    2264     LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid));
    2265     return VERR_NOT_SUPPORTED;
    2266 }
     2152VD_BACKEND_CALLBACK_GET_UUID_DEF_NOT_SUPPORTED(qedGetParentModificationUuid);
    22672153
    22682154/** @copydoc VDIMAGEBACKEND::pfnSetParentModificationUuid */
    2269 static DECLCALLBACK(int) qedSetParentModificationUuid(void *pBackendData, PCRTUUID pUuid)
    2270 {
    2271     RT_NOREF1(pUuid);
    2272     LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    2273     PQEDIMAGE pImage = (PQEDIMAGE)pBackendData;
    2274 
    2275     AssertPtrReturn(pImage, VERR_VD_NOT_OPENED);
    2276 
    2277     int rc;
    2278     if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    2279         rc = VERR_VD_IMAGE_READ_ONLY;
    2280     else
    2281         rc = VERR_NOT_SUPPORTED;
    2282 
    2283     LogFlowFunc(("returns %Rrc\n", rc));
    2284     return rc;
    2285 }
     2155VD_BACKEND_CALLBACK_SET_UUID_DEF_NOT_SUPPORTED(qedSetParentModificationUuid, PQEDIMAGE);
    22862156
    22872157/** @copydoc VDIMAGEBACKEND::pfnDump */
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