VirtualBox

source: vbox/trunk/src/VBox/Storage/VDBackendsInline.h@ 102493

Last change on this file since 102493 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1/* $Id: VDBackendsInline.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VD - backends inline helpers.
4 */
5
6/*
7 * Copyright (C) 2017-2023 Oracle and/or its affiliates.
8 *
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
26 */
27
28/*******************************************************************************
29* Header Files *
30*******************************************************************************/
31
32#ifndef VBOX_INCLUDED_SRC_Storage_VDBackendsInline_h
33#define VBOX_INCLUDED_SRC_Storage_VDBackendsInline_h
34#ifndef RT_WITHOUT_PRAGMA_ONCE
35# pragma once
36#endif
37
38#include <iprt/cdefs.h>
39
40RT_C_DECLS_BEGIN
41
42/**
43 * Stub for VDIMAGEBACKEND::pfnGetComment when the backend doesn't suport comments.
44 *
45 * @returns VBox status code.
46 * @param a_StubName The name of the stub.
47 */
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) \
50 { \
51 RT_NOREF2(pszComment, cbComment); \
52 LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment)); \
53 AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
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.
64 * @param a_StubName The name of the stub.
65 * @param a_ImageStateType Type of the backend image state.
66 */
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) \
69 { \
70 RT_NOREF1(pszComment); \
71 LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment)); \
72 a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
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.
87 * @param a_StubName The name of the stub.
88 */
89#define VD_BACKEND_CALLBACK_GET_UUID_DEF_NOT_SUPPORTED(a_StubName) \
90 static DECLCALLBACK(int) a_StubName(void *pBackendData, PRTUUID pUuid) \
91 { \
92 RT_NOREF1(pUuid); \
93 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid)); \
94 AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
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.
105 * @param a_StubName The name of the stub.
106 * @param a_ImageStateType Type of the backend image state.
107 */
108#define VD_BACKEND_CALLBACK_SET_UUID_DEF_NOT_SUPPORTED(a_StubName, a_ImageStateType) \
109 static DECLCALLBACK(int) a_StubName(void *pBackendData, PCRTUUID pUuid) \
110 { \
111 RT_NOREF1(pUuid); \
112 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid)); \
113 a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
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
123RT_C_DECLS_END
124
125#endif /* !VBOX_INCLUDED_SRC_Storage_VDBackendsInline_h */
Note: See TracBrowser for help on using the repository browser.

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