1 | /** @file
|
---|
2 | * VD: Plugin support API.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2014 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef __vd_plugin_h__
|
---|
27 | #define __vd_plugin_h__
|
---|
28 |
|
---|
29 | #include <VBox/vd.h>
|
---|
30 | #include <VBox/vd-image-backend.h>
|
---|
31 | #include <VBox/vd-cache-backend.h>
|
---|
32 | #include <VBox/vd-filter-backend.h>
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Backend register callbacks structure.
|
---|
36 | */
|
---|
37 | typedef struct VDBACKENDREGISTER
|
---|
38 | {
|
---|
39 | /**
|
---|
40 | * Registers a new image backend.
|
---|
41 | *
|
---|
42 | * @returns VBox status code.
|
---|
43 | * @param pvUser Opaque user data given in the plugin load callback.
|
---|
44 | * @param pBackend The image backend to register.
|
---|
45 | */
|
---|
46 | DECLR3CALLBACKMEMBER(int, pfnRegisterImage, (void *pvUser, PCVBOXHDDBACKEND pBackend));
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Registers a new cache backend.
|
---|
50 | *
|
---|
51 | * @returns VBox status code.
|
---|
52 | * @param pvUser Opaque user data given in the plugin load callback.
|
---|
53 | * @param pBackend The cache backend to register.
|
---|
54 | */
|
---|
55 | DECLR3CALLBACKMEMBER(int, pfnRegisterCache, (void *pvUser, PCVDCACHEBACKEND pBackend));
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Registers a new filter plugin.
|
---|
59 | * @param pvUser Opaque user data given in the plugin load callback.
|
---|
60 | * @param pBackend The filter backend to register.
|
---|
61 | */
|
---|
62 | DECLR3CALLBACKMEMBER(int, pfnRegisterFilter, (void *pvUser, PCVDFILTERBACKEND pBackend));
|
---|
63 |
|
---|
64 | } VDBACKENDREGISTER;
|
---|
65 | /** Pointer to a backend register callbacks structure. */
|
---|
66 | typedef VDBACKENDREGISTER *PVDBACKENDREGISTER;
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Initialization entry point called by the generic VD layer when
|
---|
70 | * a plugin is loaded.
|
---|
71 | *
|
---|
72 | * @returns VBox status code.
|
---|
73 | * @param pvUser Opaque user data passed in the register callbacks.
|
---|
74 | * @param pRegisterCallbacks Pointer to the register callbacks structure.
|
---|
75 | */
|
---|
76 | typedef DECLCALLBACK(int) FNVDPLUGINLOAD(void *pvUser, PVDBACKENDREGISTER pRegisterCallbacks);
|
---|
77 | typedef FNVDPLUGINLOAD *PFNVDPLUGINLOAD;
|
---|
78 | #define VD_PLUGIN_LOAD_NAME "VDPluginLoad"
|
---|
79 |
|
---|
80 | /** The prefix to identify Storage Plugins. */
|
---|
81 | #define VD_PLUGIN_PREFIX "VDPlugin"
|
---|
82 | /** The size of the prefix excluding the '\\0' terminator. */
|
---|
83 | #define VD_PLUGIN_PREFIX_LENGTH (sizeof(VD_PLUGIN_PREFIX)-1)
|
---|
84 |
|
---|
85 | #endif
|
---|