[66491] | 1 | /* $Id: VDBackendsInline.h 67463 2017-06-19 10:05:52Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * VD - backends inline helpers.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
| 7 | * Copyright (C) 2017 Oracle Corporation
|
---|
| 8 | *
|
---|
| 9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
| 10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
| 11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
| 12 | * General Public License (GPL) as published by the Free Software
|
---|
| 13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
| 14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
| 15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | /*******************************************************************************
|
---|
| 19 | * Header Files *
|
---|
| 20 | *******************************************************************************/
|
---|
| 21 | #ifndef ___VDBackendsInline_h
|
---|
| 22 | #define ___VDBackendsInline_h
|
---|
| 23 |
|
---|
| 24 | #include <iprt/cdefs.h>
|
---|
| 25 |
|
---|
| 26 | RT_C_DECLS_BEGIN
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * Stub for VDIMAGEBACKEND::pfnGetComment when the backend doesn't suport comments.
|
---|
| 30 | *
|
---|
| 31 | * @returns VBox status code.
|
---|
[67463] | 32 | * @param a_StubName The name of the stub.
|
---|
[66491] | 33 | */
|
---|
[67463] | 34 | #define VD_BACKEND_CALLBACK_GET_COMMENT_DEF_NOT_SUPPORTED(a_StubName) \
|
---|
| 35 | static DECLCALLBACK(int) a_StubName(void *pBackendData, char *pszComment, size_t cbComment) \
|
---|
[66491] | 36 | { \
|
---|
| 37 | RT_NOREF2(pszComment, cbComment); \
|
---|
[66498] | 38 | LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment)); \
|
---|
| 39 | AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
|
---|
[66491] | 40 | LogFlowFunc(("returns %Rrc comment='%s'\n", VERR_NOT_SUPPORTED, pszComment)); \
|
---|
| 41 | return VERR_NOT_SUPPORTED; \
|
---|
| 42 | } \
|
---|
| 43 | typedef int ignore_semicolon
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | /**
|
---|
| 47 | * Stub for VDIMAGEBACKEND::pfnSetComment when the backend doesn't suport comments.
|
---|
| 48 | *
|
---|
| 49 | * @returns VBox status code.
|
---|
[67463] | 50 | * @param a_StubName The name of the stub.
|
---|
| 51 | * @param a_ImageStateType Type of the backend image state.
|
---|
[66491] | 52 | */
|
---|
[67463] | 53 | #define VD_BACKEND_CALLBACK_SET_COMMENT_DEF_NOT_SUPPORTED(a_StubName, a_ImageStateType) \
|
---|
| 54 | static DECLCALLBACK(int) a_StubName(void *pBackendData, const char *pszComment) \
|
---|
[66491] | 55 | { \
|
---|
| 56 | RT_NOREF1(pszComment); \
|
---|
[66498] | 57 | LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment)); \
|
---|
| 58 | a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
|
---|
[66491] | 59 | AssertPtrReturn(pThis, VERR_VD_NOT_OPENED); \
|
---|
| 60 | int rc = VERR_NOT_SUPPORTED; \
|
---|
| 61 | if (pThis->uOpenFlags & VD_OPEN_FLAGS_READONLY) \
|
---|
| 62 | rc = VERR_VD_IMAGE_READ_ONLY; \
|
---|
| 63 | LogFlowFunc(("returns %Rrc\n", rc)); \
|
---|
| 64 | return rc; \
|
---|
| 65 | } \
|
---|
| 66 | typedef int ignore_semicolon
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | /**
|
---|
| 70 | * Stub for VDIMAGEBACKEND::pfnGetUuid when the backend doesn't suport UUIDs.
|
---|
| 71 | *
|
---|
| 72 | * @returns VBox status code.
|
---|
[67463] | 73 | * @param a_StubName The name of the stub.
|
---|
[66491] | 74 | */
|
---|
[67463] | 75 | #define VD_BACKEND_CALLBACK_GET_UUID_DEF_NOT_SUPPORTED(a_StubName) \
|
---|
| 76 | static DECLCALLBACK(int) a_StubName(void *pBackendData, PRTUUID pUuid) \
|
---|
[66491] | 77 | { \
|
---|
| 78 | RT_NOREF1(pUuid); \
|
---|
[66498] | 79 | LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid)); \
|
---|
| 80 | AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
|
---|
[66491] | 81 | LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid)); \
|
---|
| 82 | return VERR_NOT_SUPPORTED; \
|
---|
| 83 | } \
|
---|
| 84 | typedef int ignore_semicolon
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | /**
|
---|
| 88 | * Stub for VDIMAGEBACKEND::pfnSetComment when the backend doesn't suport UUIDs.
|
---|
| 89 | *
|
---|
| 90 | * @returns VBox status code.
|
---|
[67463] | 91 | * @param a_StubName The name of the stub.
|
---|
| 92 | * @param a_ImageStateType Type of the backend image state.
|
---|
[66491] | 93 | */
|
---|
[67463] | 94 | #define VD_BACKEND_CALLBACK_SET_UUID_DEF_NOT_SUPPORTED(a_StubName, a_ImageStateType) \
|
---|
| 95 | static DECLCALLBACK(int) a_StubName(void *pBackendData, PCRTUUID pUuid) \
|
---|
[66491] | 96 | { \
|
---|
| 97 | RT_NOREF1(pUuid); \
|
---|
[66498] | 98 | LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid)); \
|
---|
| 99 | a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
|
---|
[66491] | 100 | AssertPtrReturn(pThis, VERR_VD_NOT_OPENED); \
|
---|
| 101 | int rc = VERR_NOT_SUPPORTED; \
|
---|
| 102 | if (pThis->uOpenFlags & VD_OPEN_FLAGS_READONLY) \
|
---|
| 103 | rc = VERR_VD_IMAGE_READ_ONLY; \
|
---|
| 104 | LogFlowFunc(("returns %Rrc\n", rc)); \
|
---|
| 105 | return rc; \
|
---|
| 106 | } \
|
---|
| 107 | typedef int ignore_semicolon
|
---|
| 108 |
|
---|
| 109 | RT_C_DECLS_END
|
---|
| 110 |
|
---|
| 111 | #endif
|
---|