VirtualBox

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

Last change on this file since 86719 was 82968, checked in by vboxsync, 5 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.2 KB
Line 
1/* $Id: VDBackendsInline.h 82968 2020-02-04 10:35:17Z vboxsync $ */
2/** @file
3 * VD - backends inline helpers.
4 */
5
6/*
7 * Copyright (C) 2017-2020 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
22#ifndef VBOX_INCLUDED_SRC_Storage_VDBackendsInline_h
23#define VBOX_INCLUDED_SRC_Storage_VDBackendsInline_h
24#ifndef RT_WITHOUT_PRAGMA_ONCE
25# pragma once
26#endif
27
28#include <iprt/cdefs.h>
29
30RT_C_DECLS_BEGIN
31
32/**
33 * Stub for VDIMAGEBACKEND::pfnGetComment when the backend doesn't suport comments.
34 *
35 * @returns VBox status code.
36 * @param a_StubName The name of the stub.
37 */
38#define VD_BACKEND_CALLBACK_GET_COMMENT_DEF_NOT_SUPPORTED(a_StubName) \
39 static DECLCALLBACK(int) a_StubName(void *pBackendData, char *pszComment, size_t cbComment) \
40 { \
41 RT_NOREF2(pszComment, cbComment); \
42 LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment)); \
43 AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
44 LogFlowFunc(("returns %Rrc comment='%s'\n", VERR_NOT_SUPPORTED, pszComment)); \
45 return VERR_NOT_SUPPORTED; \
46 } \
47 typedef int ignore_semicolon
48
49
50/**
51 * Stub for VDIMAGEBACKEND::pfnSetComment when the backend doesn't suport comments.
52 *
53 * @returns VBox status code.
54 * @param a_StubName The name of the stub.
55 * @param a_ImageStateType Type of the backend image state.
56 */
57#define VD_BACKEND_CALLBACK_SET_COMMENT_DEF_NOT_SUPPORTED(a_StubName, a_ImageStateType) \
58 static DECLCALLBACK(int) a_StubName(void *pBackendData, const char *pszComment) \
59 { \
60 RT_NOREF1(pszComment); \
61 LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment)); \
62 a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
63 AssertPtrReturn(pThis, VERR_VD_NOT_OPENED); \
64 int rc = VERR_NOT_SUPPORTED; \
65 if (pThis->uOpenFlags & VD_OPEN_FLAGS_READONLY) \
66 rc = VERR_VD_IMAGE_READ_ONLY; \
67 LogFlowFunc(("returns %Rrc\n", rc)); \
68 return rc; \
69 } \
70 typedef int ignore_semicolon
71
72
73/**
74 * Stub for VDIMAGEBACKEND::pfnGetUuid when the backend doesn't suport UUIDs.
75 *
76 * @returns VBox status code.
77 * @param a_StubName The name of the stub.
78 */
79#define VD_BACKEND_CALLBACK_GET_UUID_DEF_NOT_SUPPORTED(a_StubName) \
80 static DECLCALLBACK(int) a_StubName(void *pBackendData, PRTUUID pUuid) \
81 { \
82 RT_NOREF1(pUuid); \
83 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid)); \
84 AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
85 LogFlowFunc(("returns %Rrc (%RTuuid)\n", VERR_NOT_SUPPORTED, pUuid)); \
86 return VERR_NOT_SUPPORTED; \
87 } \
88 typedef int ignore_semicolon
89
90
91/**
92 * Stub for VDIMAGEBACKEND::pfnSetComment when the backend doesn't suport UUIDs.
93 *
94 * @returns VBox status code.
95 * @param a_StubName The name of the stub.
96 * @param a_ImageStateType Type of the backend image state.
97 */
98#define VD_BACKEND_CALLBACK_SET_UUID_DEF_NOT_SUPPORTED(a_StubName, a_ImageStateType) \
99 static DECLCALLBACK(int) a_StubName(void *pBackendData, PCRTUUID pUuid) \
100 { \
101 RT_NOREF1(pUuid); \
102 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid)); \
103 a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
104 AssertPtrReturn(pThis, VERR_VD_NOT_OPENED); \
105 int rc = VERR_NOT_SUPPORTED; \
106 if (pThis->uOpenFlags & VD_OPEN_FLAGS_READONLY) \
107 rc = VERR_VD_IMAGE_READ_ONLY; \
108 LogFlowFunc(("returns %Rrc\n", rc)); \
109 return rc; \
110 } \
111 typedef int ignore_semicolon
112
113RT_C_DECLS_END
114
115#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