driver.h 3.5 KB
Newer Older
1
/*
2
 * driver.h: description of the set of interfaces provided by a
3
 *           entry point to the virtualization engine
E
Eric Blake 已提交
4
 *
5
 * Copyright (C) 2006-2014 Red Hat, Inc.
E
Eric Blake 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
20 21 22
 */

#ifndef __VIR_DRIVER_H__
23
# define __VIR_DRIVER_H__
24

25
# include <unistd.h>
26

27
# include "internal.h"
28
# include "libvirt_internal.h"
M
Martin Kletzander 已提交
29
# include "viruri.h"
30 31 32 33
/*
 * List of registered drivers numbers
 */
typedef enum {
34 35 36
    VIR_DRV_XEN_UNIFIED = 1,
    VIR_DRV_TEST = 2,
    VIR_DRV_QEMU = 3,
37
    VIR_DRV_REMOTE = 4,
38
    VIR_DRV_OPENVZ = 5,
39 40
    VIR_DRV_LXC = 6,
    VIR_DRV_UML = 7,
41
    VIR_DRV_VBOX = 8,
D
Daniel Veillard 已提交
42
    VIR_DRV_ONE = 9,
43
    VIR_DRV_ESX = 10,
44
    VIR_DRV_PHYP = 11,
45
    VIR_DRV_XENAPI = 12,
J
Jim Fehlig 已提交
46 47
    VIR_DRV_VMWARE = 13,
    VIR_DRV_LIBXL = 14,
M
Matthias Bolte 已提交
48
    VIR_DRV_HYPERV = 15,
D
Dmitry Guryanov 已提交
49
    VIR_DRV_PARALLELS = 16,
R
Roman Bogorodskiy 已提交
50
    VIR_DRV_BHYVE = 17,
51 52 53
} virDrvNo;


54 55 56 57 58 59 60 61 62 63 64 65 66 67
/* Status codes returned from driver open call. */
typedef enum {
    /* Opened successfully. */
    VIR_DRV_OPEN_SUCCESS = 0,

    /* 'name' is not for us. */
    VIR_DRV_OPEN_DECLINED = -1,

    /* 'name' is for us, but there was some error.  virConnectOpen will
     * return an error rather than continue probing the other drivers.
     */
    VIR_DRV_OPEN_ERROR = -2,
} virDrvOpenStatus;

D
Daniel Veillard 已提交
68

69
/* Internal feature-detection macro.  Don't call drv->supports_feature
70 71
 * directly if you don't have to, because it may be NULL, use this macro
 * instead.
72
 *
73 74 75
 * Note that this treats a possible error returned by drv->supports_feature
 * the same as not supported. If you care about the error, call
 * drv->supports_feature directly.
76 77
 *
 * Returns:
78
 *   != 0  Feature is supported.
79 80
 *   0     Feature is not supported.
 */
M
Michal Privoznik 已提交
81
# define VIR_DRV_SUPPORTS_FEATURE(drv, conn, feature)                   \
82 83
    ((drv)->connectSupportsFeature ?                                    \
        (drv)->connectSupportsFeature((conn), (feature)) > 0 : 0)
84

85

86
# define __VIR_DRIVER_H_INCLUDES___
87

88 89 90 91 92 93
# include "driver-hypervisor.h"
# include "driver-interface.h"
# include "driver-network.h"
# include "driver-nodedev.h"
# include "driver-nwfilter.h"
# include "driver-secret.h"
94
# include "driver-state.h"
95 96
# include "driver-stream.h"
# include "driver-storage.h"
97

98
# undef __VIR_DRIVER_H_INCLUDES___
99

100
int virRegisterHypervisorDriver(virHypervisorDriverPtr) ATTRIBUTE_RETURN_CHECK;
101 102
int virRegisterNetworkDriver(virNetworkDriverPtr) ATTRIBUTE_RETURN_CHECK;
int virRegisterInterfaceDriver(virInterfaceDriverPtr) ATTRIBUTE_RETURN_CHECK;
103
int virRegisterNetworkDriver(virNetworkDriverPtr) ATTRIBUTE_RETURN_CHECK;
104 105
int virRegisterNodeDeviceDriver(virNodeDeviceDriverPtr) ATTRIBUTE_RETURN_CHECK;
int virRegisterNWFilterDriver(virNWFilterDriverPtr) ATTRIBUTE_RETURN_CHECK;
106
int virRegisterSecretDriver(virSecretDriverPtr) ATTRIBUTE_RETURN_CHECK;
107
int virRegisterStateDriver(virStateDriverPtr) ATTRIBUTE_RETURN_CHECK;
108 109
int virRegisterStorageDriver(virStorageDriverPtr) ATTRIBUTE_RETURN_CHECK;

110
void *virDriverLoadModule(const char *name);
111 112

#endif /* __VIR_DRIVER_H__ */