1 | /** @file
|
---|
2 | * VD: Plugin support API.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef VBOX_INCLUDED_vd_plugin_h
|
---|
37 | #define VBOX_INCLUDED_vd_plugin_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/vd.h>
|
---|
43 | #include <VBox/vd-common.h>
|
---|
44 | #include <VBox/vd-image-backend.h>
|
---|
45 | #include <VBox/vd-cache-backend.h>
|
---|
46 | #include <VBox/vd-filter-backend.h>
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Backend register callbacks structure.
|
---|
50 | */
|
---|
51 | typedef struct VDBACKENDREGISTER
|
---|
52 | {
|
---|
53 | /** Interface version.
|
---|
54 | * This is set to VD_BACKENDREG_CB_VERSION. */
|
---|
55 | uint32_t u32Version;
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Registers a new image backend.
|
---|
59 | *
|
---|
60 | * @returns VBox status code.
|
---|
61 | * @param pvUser Opaque user data given in the plugin load callback.
|
---|
62 | * @param pBackend The image backend to register.
|
---|
63 | */
|
---|
64 | DECLR3CALLBACKMEMBER(int, pfnRegisterImage, (void *pvUser, PCVDIMAGEBACKEND pBackend));
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Registers a new cache backend.
|
---|
68 | *
|
---|
69 | * @returns VBox status code.
|
---|
70 | * @param pvUser Opaque user data given in the plugin load callback.
|
---|
71 | * @param pBackend The cache backend to register.
|
---|
72 | */
|
---|
73 | DECLR3CALLBACKMEMBER(int, pfnRegisterCache, (void *pvUser, PCVDCACHEBACKEND pBackend));
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Registers a new filter plugin.
|
---|
77 | * @param pvUser Opaque user data given in the plugin load callback.
|
---|
78 | * @param pBackend The filter backend to register.
|
---|
79 | */
|
---|
80 | DECLR3CALLBACKMEMBER(int, pfnRegisterFilter, (void *pvUser, PCVDFILTERBACKEND pBackend));
|
---|
81 |
|
---|
82 | } VDBACKENDREGISTER;
|
---|
83 | /** Pointer to a backend register callbacks structure. */
|
---|
84 | typedef VDBACKENDREGISTER *PVDBACKENDREGISTER;
|
---|
85 |
|
---|
86 | /** Current version of the VDBACKENDREGISTER structure. */
|
---|
87 | #define VD_BACKENDREG_CB_VERSION VD_VERSION_MAKE(0xff00, 1, 0)
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Initialization entry point called by the generic VD layer when
|
---|
91 | * a plugin is loaded.
|
---|
92 | *
|
---|
93 | * @returns VBox status code.
|
---|
94 | * @param pvUser Opaque user data passed in the register callbacks.
|
---|
95 | * @param pRegisterCallbacks Pointer to the register callbacks structure.
|
---|
96 | */
|
---|
97 | typedef DECLCALLBACKTYPE(int, FNVDPLUGINLOAD,(void *pvUser, PVDBACKENDREGISTER pRegisterCallbacks));
|
---|
98 | typedef FNVDPLUGINLOAD *PFNVDPLUGINLOAD;
|
---|
99 | #define VD_PLUGIN_LOAD_NAME "VDPluginLoad"
|
---|
100 |
|
---|
101 | /** The prefix to identify Storage Plugins. */
|
---|
102 | #define VD_PLUGIN_PREFIX "VDPlugin"
|
---|
103 | /** The size of the prefix excluding the '\\0' terminator. */
|
---|
104 | #define VD_PLUGIN_PREFIX_LENGTH (sizeof(VD_PLUGIN_PREFIX)-1)
|
---|
105 |
|
---|
106 | #endif /* !VBOX_INCLUDED_vd_plugin_h */
|
---|