1 | /* $Id: VDBackendsInline.h 66498 2017-04-10 13:53:08Z 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.
|
---|
32 | * @param a_szStubName The name of the stub.
|
---|
33 | */
|
---|
34 | #define VD_BACKEND_CALLBACK_GET_COMMENT_DEF_NOT_SUPPORTED(a_szStubName) \
|
---|
35 | static DECLCALLBACK(int) a_szStubName(void *pBackendData, char *pszComment, size_t cbComment) \
|
---|
36 | { \
|
---|
37 | RT_NOREF2(pszComment, cbComment); \
|
---|
38 | LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment)); \
|
---|
39 | AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
|
---|
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.
|
---|
50 | * @param a_szStubName The name of the stub.
|
---|
51 | * @param a_ImageStateType Type of the backend image state.
|
---|
52 | */
|
---|
53 | #define VD_BACKEND_CALLBACK_SET_COMMENT_DEF_NOT_SUPPORTED(a_szStubName, a_ImageStateType) \
|
---|
54 | static DECLCALLBACK(int) a_szStubName(void *pBackendData, const char *pszComment) \
|
---|
55 | { \
|
---|
56 | RT_NOREF1(pszComment); \
|
---|
57 | LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment)); \
|
---|
58 | a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
|
---|
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.
|
---|
73 | * @param a_szStubName The name of the stub.
|
---|
74 | */
|
---|
75 | #define VD_BACKEND_CALLBACK_GET_UUID_DEF_NOT_SUPPORTED(a_szStubName) \
|
---|
76 | static DECLCALLBACK(int) a_szStubName(void *pBackendData, PRTUUID pUuid) \
|
---|
77 | { \
|
---|
78 | RT_NOREF1(pUuid); \
|
---|
79 | LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid)); \
|
---|
80 | AssertPtrReturn(pBackendData, VERR_VD_NOT_OPENED); \
|
---|
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.
|
---|
91 | * @param a_szStubName The name of the stub.
|
---|
92 | * @param a_ImageStateType Type of the backend image state.
|
---|
93 | */
|
---|
94 | #define VD_BACKEND_CALLBACK_SET_UUID_DEF_NOT_SUPPORTED(a_szStubName, a_ImageStateType) \
|
---|
95 | static DECLCALLBACK(int) a_szStubName(void *pBackendData, PCRTUUID pUuid) \
|
---|
96 | { \
|
---|
97 | RT_NOREF1(pUuid); \
|
---|
98 | LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid)); \
|
---|
99 | a_ImageStateType pThis = (a_ImageStateType)pBackendData; \
|
---|
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
|
---|