[66491] | 1 | /* $Id: VDBackendsInline.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * VD - backends inline helpers.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2017-2023 Oracle and/or its affiliates.
|
---|
[66491] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
| 25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
[66491] | 26 | */
|
---|
| 27 |
|
---|
| 28 | /*******************************************************************************
|
---|
| 29 | * Header Files *
|
---|
| 30 | *******************************************************************************/
|
---|
[76530] | 31 |
|
---|
[76578] | 32 | #ifndef VBOX_INCLUDED_SRC_Storage_VDBackendsInline_h
|
---|
| 33 | #define VBOX_INCLUDED_SRC_Storage_VDBackendsInline_h
|
---|
[76530] | 34 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 35 | # pragma once
|
---|
| 36 | #endif
|
---|
[66491] | 37 |
|
---|
| 38 | #include <iprt/cdefs.h>
|
---|
| 39 |
|
---|
| 40 | RT_C_DECLS_BEGIN
|
---|
| 41 |
|
---|
| 42 | /**
|
---|
| 43 | * Stub for VDIMAGEBACKEND::pfnGetComment when the backend doesn't suport comments.
|
---|
| 44 | *
|
---|
| 45 | * @returns VBox status code.
|
---|
[67463] | 46 | * @param a_StubName The name of the stub.
|
---|
[66491] | 47 | */
|
---|
[67463] | 48 | #define VD_BACKEND_CALLBACK_GET_COMMENT_DEF_NOT_SUPPORTED(a_StubName) \
|
---|
| 49 | static DECLCALLBACK(int) a_StubName(void *pBackendData, char *pszComment, size_t cbComment) \
|
---|
[66491] | 50 | { \
|
---|
| 51 | RT_NOREF2(pszComment, cbComment); \
|
---|
[66498] | 52 | LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment)); \
|
---|
| 53 | AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
|
---|
[66491] | 54 | LogFlowFunc(("returns %Rrc comment='%s'\n", VERR_NOT_SUPPORTED, pszComment)); \
|
---|
| 55 | return VERR_NOT_SUPPORTED; \
|
---|
| 56 | } \
|
---|
| 57 | typedef int ignore_semicolon
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 | /**
|
---|
| 61 | * Stub for VDIMAGEBACKEND::pfnSetComment when the backend doesn't suport comments.
|
---|
| 62 | *
|
---|
| 63 | * @returns VBox status code.
|
---|
[67463] | 64 | * @param a_StubName The name of the stub.
|
---|
| 65 | * @param a_ImageStateType Type of the backend image state.
|
---|
[66491] | 66 | */
|
---|
[67463] | 67 | #define VD_BACKEND_CALLBACK_SET_COMMENT_DEF_NOT_SUPPORTED(a_StubName, a_ImageStateType) \
|
---|
| 68 | static DECLCALLBACK(int) a_StubName(void *pBackendData, const char *pszComment) \
|
---|
[66491] | 69 | { \
|
---|
| 70 | RT_NOREF1(pszComment); \
|
---|
[66498] | 71 | LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment)); \
|
---|
| 72 | a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
|
---|
[66491] | 73 | AssertPtrReturn(pThis, VERR_VD_NOT_OPENED); \
|
---|
| 74 | int rc = VERR_NOT_SUPPORTED; \
|
---|
| 75 | if (pThis->uOpenFlags & VD_OPEN_FLAGS_READONLY) \
|
---|
| 76 | rc = VERR_VD_IMAGE_READ_ONLY; \
|
---|
| 77 | LogFlowFunc(("returns %Rrc\n", rc)); \
|
---|
| 78 | return rc; \
|
---|
| 79 | } \
|
---|
| 80 | typedef int ignore_semicolon
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | /**
|
---|
| 84 | * Stub for VDIMAGEBACKEND::pfnGetUuid when the backend doesn't suport UUIDs.
|
---|
| 85 | *
|
---|
| 86 | * @returns VBox status code.
|
---|
[67463] | 87 | * @param a_StubName The name of the stub.
|
---|
[66491] | 88 | */
|
---|
[67463] | 89 | #define VD_BACKEND_CALLBACK_GET_UUID_DEF_NOT_SUPPORTED(a_StubName) \
|
---|
| 90 | static DECLCALLBACK(int) a_StubName(void *pBackendData, PRTUUID pUuid) \
|
---|
[66491] | 91 | { \
|
---|
| 92 | RT_NOREF1(pUuid); \
|
---|
[66498] | 93 | LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid)); \
|
---|
| 94 | AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
|
---|
[66491] | 95 | LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid)); \
|
---|
| 96 | return VERR_NOT_SUPPORTED; \
|
---|
| 97 | } \
|
---|
| 98 | typedef int ignore_semicolon
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | /**
|
---|
| 102 | * Stub for VDIMAGEBACKEND::pfnSetComment when the backend doesn't suport UUIDs.
|
---|
| 103 | *
|
---|
| 104 | * @returns VBox status code.
|
---|
[67463] | 105 | * @param a_StubName The name of the stub.
|
---|
| 106 | * @param a_ImageStateType Type of the backend image state.
|
---|
[66491] | 107 | */
|
---|
[67463] | 108 | #define VD_BACKEND_CALLBACK_SET_UUID_DEF_NOT_SUPPORTED(a_StubName, a_ImageStateType) \
|
---|
| 109 | static DECLCALLBACK(int) a_StubName(void *pBackendData, PCRTUUID pUuid) \
|
---|
[66491] | 110 | { \
|
---|
| 111 | RT_NOREF1(pUuid); \
|
---|
[66498] | 112 | LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid)); \
|
---|
| 113 | a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
|
---|
[66491] | 114 | AssertPtrReturn(pThis, VERR_VD_NOT_OPENED); \
|
---|
| 115 | int rc = VERR_NOT_SUPPORTED; \
|
---|
| 116 | if (pThis->uOpenFlags & VD_OPEN_FLAGS_READONLY) \
|
---|
| 117 | rc = VERR_VD_IMAGE_READ_ONLY; \
|
---|
| 118 | LogFlowFunc(("returns %Rrc\n", rc)); \
|
---|
| 119 | return rc; \
|
---|
| 120 | } \
|
---|
| 121 | typedef int ignore_semicolon
|
---|
| 122 |
|
---|
| 123 | RT_C_DECLS_END
|
---|
| 124 |
|
---|
[76578] | 125 | #endif /* !VBOX_INCLUDED_SRC_Storage_VDBackendsInline_h */
|
---|