driver.h 23.0 KB
Newer Older
1
/*
2
 * driver.h: description of the set of interfaces provided by a
3 4 5 6 7 8
 *           entry point to the virtualization engine
 */

#ifndef __VIR_DRIVER_H__
#define __VIR_DRIVER_H__

9 10
#include "libvirt/libvirt.h"
#include "libvirt/virterror.h"
11

12 13
#include <libxml/uri.h>

14 15
#include <signal.h>

16 17 18 19
/*
 * List of registered drivers numbers
 */
typedef enum {
20 21 22
    VIR_DRV_XEN_UNIFIED = 1,
    VIR_DRV_TEST = 2,
    VIR_DRV_QEMU = 3,
23
    VIR_DRV_REMOTE = 4,
24
    VIR_DRV_OPENVZ = 5,
D
Daniel Veillard 已提交
25
    VIR_DRV_LXC = 6
26 27 28
} virDrvNo;


29 30 31 32 33 34 35 36 37 38 39 40 41 42
/* 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;

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
/* Feature detection.  This is a libvirt-private interface for determining
 * what features are supported by the driver.
 *
 * The remote driver passes features through to the real driver at the
 * remote end unmodified, except if you query a VIR_DRV_FEATURE_REMOTE*
 * feature.
 */
    /* Driver supports V1-style virDomainMigrate, ie. domainMigratePrepare/
     * domainMigratePerform/domainMigrateFinish.
     */
#define VIR_DRV_FEATURE_MIGRATION_V1 1

    /* Driver is not local. */
#define VIR_DRV_FEATURE_REMOTE 2

/* Internal feature-detection macro.  Don't call drv->supports_feature
 * directly, because it may be NULL, use this macro instead.
 *
 * Note that you must check for errors.
 *
 * Returns:
 *   >= 1  Feature is supported.
 *   0     Feature is not supported.
 *   -1    Error.
 */
#define VIR_DRV_SUPPORTS_FEATURE(drv,conn,feature)                      \
    ((drv)->supports_feature ? (drv)->supports_feature((conn),(feature)) : 0)

71
typedef const char *
72
        (*virDrvProbe)			(void);
73
typedef virDrvOpenStatus
74
        (*virDrvOpen)			(virConnectPtr conn,
75 76 77
                             xmlURIPtr uri,
                             virConnectAuthPtr auth,
                             int flags);
78
typedef int
79
        (*virDrvClose)			(virConnectPtr conn);
80 81
typedef int
    (*virDrvSupportsFeature) (virConnectPtr conn, int feature);
82
typedef const char *
83
        (*virDrvGetType)		(virConnectPtr conn);
84
typedef int
85 86
        (*virDrvGetVersion)		(virConnectPtr conn,
                                         unsigned long *hvVer);
87 88 89 90
typedef char *
    (*virDrvGetHostname)    (virConnectPtr conn);
typedef char *
    (*virDrvGetURI)         (virConnectPtr conn);
91
typedef int
92 93
        (*virDrvGetMaxVcpus)		(virConnectPtr conn,
                                         const char *type);
94
typedef int
95 96
        (*virDrvNodeGetInfo)		(virConnectPtr conn,
                                         virNodeInfoPtr info);
97
typedef char *
98
        (*virDrvGetCapabilities) (virConnectPtr conn);
99
typedef int
100 101 102
        (*virDrvListDomains)		(virConnectPtr conn,
                                         int *ids,
                                         int maxids);
103
typedef int
104
        (*virDrvNumOfDomains)		(virConnectPtr conn);
105
typedef virDomainPtr
106
        (*virDrvDomainCreateXML)	(virConnectPtr conn,
107 108
                                         const char *xmlDesc,
                                         unsigned int flags);
109
typedef virDomainPtr
110 111
        (*virDrvDomainLookupByID)	(virConnectPtr conn,
                                         int id);
112
typedef virDomainPtr
113 114
        (*virDrvDomainLookupByUUID)	(virConnectPtr conn,
                                         const unsigned char *uuid);
115
typedef virDomainPtr
116 117
        (*virDrvDomainLookupByName)	(virConnectPtr conn,
                                         const char *name);
118
typedef int
119
        (*virDrvDomainSuspend)		(virDomainPtr domain);
120
typedef int
121
        (*virDrvDomainResume)		(virDomainPtr domain);
122
typedef int
123
        (*virDrvDomainShutdown)		(virDomainPtr domain);
124
typedef int
125 126
        (*virDrvDomainReboot)		(virDomainPtr domain,
                                         unsigned int flags);
127
typedef int
128
        (*virDrvDomainDestroy)		(virDomainPtr domain);
129
typedef char *
130
        (*virDrvDomainGetOSType)	(virDomainPtr domain);
131
typedef unsigned long
132
        (*virDrvDomainGetMaxMemory)	(virDomainPtr domain);
133
typedef int
134 135
        (*virDrvDomainSetMaxMemory)	(virDomainPtr domain,
                                         unsigned long memory);
136
typedef int
137 138
        (*virDrvDomainSetMemory)	(virDomainPtr domain,
                                         unsigned long memory);
139
typedef int
140 141
        (*virDrvDomainGetInfo)		(virDomainPtr domain,
                                         virDomainInfoPtr info);
142
typedef int
143 144
        (*virDrvDomainSave)		(virDomainPtr domain,
                                         const char *to);
145
typedef int
146 147
        (*virDrvDomainRestore)		(virConnectPtr conn,
                                         const char *from);
D
Daniel Veillard 已提交
148
typedef int
149 150 151
        (*virDrvDomainCoreDump)		(virDomainPtr domain,
                                         const char *to,
                                         int flags);
152
typedef char *
153 154
        (*virDrvDomainDumpXML)		(virDomainPtr dom,
                                         int flags);
155
typedef int
156 157 158
        (*virDrvListDefinedDomains)	(virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
159
typedef int
160
        (*virDrvNumOfDefinedDomains)	(virConnectPtr conn);
161
typedef int
162
        (*virDrvDomainCreate)		(virDomainPtr dom);
163
typedef virDomainPtr
164 165
        (*virDrvDomainDefineXML)	(virConnectPtr conn,
                                         const char *xml);
166
typedef int
167
        (*virDrvDomainUndefine)		(virDomainPtr dom);
168
typedef int
169 170
        (*virDrvDomainSetVcpus)		(virDomainPtr domain,
                                         unsigned int nvcpus);
171
typedef int
172 173 174 175
        (*virDrvDomainPinVcpu)		(virDomainPtr domain,
                                         unsigned int vcpu,
                                         unsigned char *cpumap,
                                         int maplen);
176
typedef int
177 178 179 180 181
        (*virDrvDomainGetVcpus)		(virDomainPtr domain,
                                         virVcpuInfoPtr info,
                                         int maxinfo,
                                         unsigned char *cpumaps,
                                         int maplen);
182
typedef int
183
        (*virDrvDomainGetMaxVcpus)	(virDomainPtr domain);
184
typedef int
185 186
        (*virDrvDomainAttachDevice)	(virDomainPtr domain,
                                         const char *xml);
187
typedef int
188 189
        (*virDrvDomainDetachDevice)	(virDomainPtr domain,
                                         const char *xml);
190
typedef int
191 192
        (*virDrvDomainGetAutostart)	(virDomainPtr domain,
                                         int *autostart);
193
typedef int
194 195
        (*virDrvDomainSetAutostart)	(virDomainPtr domain,
                                         int autostart);
196

197
typedef char *
198 199
        (*virDrvDomainGetSchedulerType)	(virDomainPtr domain,
                                         int *nparams);
200

201
typedef int
202 203 204 205
        (*virDrvDomainGetSchedulerParameters)
                                        (virDomainPtr domain,
                                         virSchedParameterPtr params,
                                         int *nparams);
206 207

typedef int
208 209 210 211
        (*virDrvDomainSetSchedulerParameters)
                                        (virDomainPtr domain,
                                         virSchedParameterPtr params,
                                         int nparams);
212

213 214 215 216 217 218 219 220 221 222 223
typedef int
    (*virDrvDomainBlockStats)
                    (virDomainPtr domain,
                     const char *path,
                     struct _virDomainBlockStats *stats);
typedef int
    (*virDrvDomainInterfaceStats)
                    (virDomainPtr domain,
                     const char *path,
                     struct _virDomainInterfaceStats *stats);

R
Richard W.M. Jones 已提交
224 225 226 227 228
typedef int
    (*virDrvDomainBlockPeek)
                    (virDomainPtr domain,
                     const char *path,
                     unsigned long long offset, size_t size,
229 230
                     void *buffer,
                     unsigned int flags);
R
Richard W.M. Jones 已提交
231

R
Richard W.M. Jones 已提交
232 233 234 235 236 237 238
typedef int
    (*virDrvDomainMemoryPeek)
                    (virDomainPtr domain,
                     unsigned long long start, size_t size,
                     void *buffer,
                     unsigned int flags);

239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
typedef int
    (*virDrvDomainMigratePrepare)
                    (virConnectPtr dconn,
                     char **cookie,
                     int *cookielen,
                     const char *uri_in,
                     char **uri_out,
                     unsigned long flags,
                     const char *dname,
                     unsigned long resource);

typedef int
    (*virDrvDomainMigratePerform)
                    (virDomainPtr domain,
                     const char *cookie,
                     int cookielen,
                     const char *uri,
                     unsigned long flags,
                     const char *dname,
                     unsigned long resource);

typedef virDomainPtr
    (*virDrvDomainMigrateFinish)
                    (virConnectPtr dconn,
                     const char *dname,
                     const char *cookie,
                     int cookielen,
                     const char *uri,
                     unsigned long flags);

269 270 271
typedef struct _virDriver virDriver;
typedef virDriver *virDriverPtr;

272 273 274 275 276 277 278
typedef int
    (*virDrvNodeGetCellsFreeMemory)
                    (virConnectPtr conn,
                     unsigned long long *freeMems,
                     int startCell,
                     int maxCells);

279 280
typedef unsigned long long
    (*virDrvNodeGetFreeMemory)
281
                    (virConnectPtr conn);
282

283 284 285 286 287 288 289 290 291 292 293
typedef int
    (*virDrvDomainEventRegister)
                    (virConnectPtr conn,
                     void *callback,
                     void *opaque);

typedef int
    (*virDrvDomainEventDeregister)
                    (virConnectPtr conn,
                     void *callback);

294 295 296 297 298
/**
 * _virDriver:
 *
 * Structure associated to a virtualization driver, defining the various
 * entry points for it.
299 300 301 302 303 304
 *
 * All drivers must support the following fields/methods:
 *  - no
 *  - name
 *  - open
 *  - close
305 306
 */
struct _virDriver {
307 308 309 310 311 312
    int	       no;	/* the number virDrvNo */
    const char * name;	/* the name of the driver */
    unsigned long ver;	/* the version of the backend */
    virDrvProbe			probe;
    virDrvOpen			open;
    virDrvClose			close;
313
    virDrvSupportsFeature   supports_feature;
314 315
    virDrvGetType			type;
    virDrvGetVersion		version;
316 317
    virDrvGetHostname       getHostname;
    virDrvGetURI            getURI;
318 319 320 321 322
    virDrvGetMaxVcpus		getMaxVcpus;
    virDrvNodeGetInfo		nodeGetInfo;
    virDrvGetCapabilities		getCapabilities;
    virDrvListDomains		listDomains;
    virDrvNumOfDomains		numOfDomains;
323
    virDrvDomainCreateXML		domainCreateXML;
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
    virDrvDomainLookupByID		domainLookupByID;
    virDrvDomainLookupByUUID	domainLookupByUUID;
    virDrvDomainLookupByName	domainLookupByName;
    virDrvDomainSuspend		domainSuspend;
    virDrvDomainResume		domainResume;
    virDrvDomainShutdown		domainShutdown;
    virDrvDomainReboot		domainReboot;
    virDrvDomainDestroy		domainDestroy;
    virDrvDomainGetOSType		domainGetOSType;
    virDrvDomainGetMaxMemory	domainGetMaxMemory;
    virDrvDomainSetMaxMemory	domainSetMaxMemory;
    virDrvDomainSetMemory		domainSetMemory;
    virDrvDomainGetInfo		domainGetInfo;
    virDrvDomainSave		domainSave;
    virDrvDomainRestore		domainRestore;
    virDrvDomainCoreDump		domainCoreDump;
    virDrvDomainSetVcpus		domainSetVcpus;
    virDrvDomainPinVcpu		domainPinVcpu;
    virDrvDomainGetVcpus		domainGetVcpus;
    virDrvDomainGetMaxVcpus		domainGetMaxVcpus;
    virDrvDomainDumpXML		domainDumpXML;
    virDrvListDefinedDomains	listDefinedDomains;
    virDrvNumOfDefinedDomains	numOfDefinedDomains;
    virDrvDomainCreate		domainCreate;
    virDrvDomainDefineXML           domainDefineXML;
    virDrvDomainUndefine            domainUndefine;
    virDrvDomainAttachDevice	domainAttachDevice;
    virDrvDomainDetachDevice	domainDetachDevice;
    virDrvDomainGetAutostart	domainGetAutostart;
    virDrvDomainSetAutostart	domainSetAutostart;
    virDrvDomainGetSchedulerType	domainGetSchedulerType;
    virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
    virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
357 358 359
    virDrvDomainMigratePrepare	domainMigratePrepare;
    virDrvDomainMigratePerform	domainMigratePerform;
    virDrvDomainMigrateFinish	domainMigrateFinish;
360 361
    virDrvDomainBlockStats      domainBlockStats;
    virDrvDomainInterfaceStats  domainInterfaceStats;
R
Richard W.M. Jones 已提交
362
    virDrvDomainBlockPeek	domainBlockPeek;
R
Richard W.M. Jones 已提交
363
    virDrvDomainMemoryPeek      domainMemoryPeek;
364 365
    virDrvNodeGetCellsFreeMemory	nodeGetCellsFreeMemory;
    virDrvNodeGetFreeMemory		getFreeMemory;
366 367
    virDrvDomainEventRegister         domainEventRegister;
    virDrvDomainEventDeregister       domainEventDeregister;
368 369
};

370
typedef int
371
        (*virDrvNumOfNetworks)		(virConnectPtr conn);
372
typedef int
373 374 375
        (*virDrvListNetworks)		(virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
376
typedef int
377
        (*virDrvNumOfDefinedNetworks)	(virConnectPtr conn);
378
typedef int
379 380 381
        (*virDrvListDefinedNetworks)	(virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
382
typedef virNetworkPtr
383 384
        (*virDrvNetworkLookupByUUID)	(virConnectPtr conn,
                                         const unsigned char *uuid);
385
typedef virNetworkPtr
386 387
        (*virDrvNetworkLookupByName)	(virConnectPtr conn,
                                         const char *name);
388
typedef virNetworkPtr
389 390
        (*virDrvNetworkCreateXML)	(virConnectPtr conn,
                                         const char *xmlDesc);
391
typedef virNetworkPtr
392 393
        (*virDrvNetworkDefineXML)	(virConnectPtr conn,
                                         const char *xml);
394
typedef int
395
        (*virDrvNetworkUndefine)	(virNetworkPtr network);
396
typedef int
397
        (*virDrvNetworkCreate)		(virNetworkPtr network);
398
typedef int
399
        (*virDrvNetworkDestroy)		(virNetworkPtr network);
400
typedef char *
401 402
        (*virDrvNetworkDumpXML)		(virNetworkPtr network,
                                         int flags);
403
typedef char *
404
        (*virDrvNetworkGetBridgeName)	(virNetworkPtr network);
405
typedef int
406 407
        (*virDrvNetworkGetAutostart)	(virNetworkPtr network,
                                         int *autostart);
408
typedef int
409 410
        (*virDrvNetworkSetAutostart)	(virNetworkPtr network,
                                         int autostart);
411

412 413 414 415 416 417 418 419 420

typedef struct _virNetworkDriver virNetworkDriver;
typedef virNetworkDriver *virNetworkDriverPtr;

/**
 * _virNetworkDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
421 422 423 424
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
425 426
 */
struct _virNetworkDriver {
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
        const char * name;	/* the name of the driver */
        virDrvOpen			open;
        virDrvClose			close;
        virDrvNumOfNetworks		numOfNetworks;
        virDrvListNetworks		listNetworks;
        virDrvNumOfDefinedNetworks	numOfDefinedNetworks;
        virDrvListDefinedNetworks	listDefinedNetworks;
        virDrvNetworkLookupByUUID	networkLookupByUUID;
        virDrvNetworkLookupByName	networkLookupByName;
        virDrvNetworkCreateXML		networkCreateXML;
        virDrvNetworkDefineXML		networkDefineXML;
        virDrvNetworkUndefine		networkUndefine;
        virDrvNetworkCreate		networkCreate;
        virDrvNetworkDestroy		networkDestroy;
        virDrvNetworkDumpXML		networkDumpXML;
        virDrvNetworkGetBridgeName	networkGetBridgeName;
        virDrvNetworkGetAutostart	networkGetAutostart;
        virDrvNetworkSetAutostart	networkSetAutostart;
445 446
};

447 448 449 450 451 452 453 454 455 456 457 458 459

typedef int
    (*virDrvConnectNumOfStoragePools)        (virConnectPtr conn);
typedef int
    (*virDrvConnectListStoragePools)         (virConnectPtr conn,
                                              char **const names,
                                              int maxnames);
typedef int
    (*virDrvConnectNumOfDefinedStoragePools) (virConnectPtr conn);
typedef int
    (*virDrvConnectListDefinedStoragePools)  (virConnectPtr conn,
                                              char **const names,
                                              int maxnames);
460 461 462 463 464
typedef char *
    (*virDrvConnectFindStoragePoolSources)   (virConnectPtr conn,
                                              const char *type,
                                              const char *srcSpec,
                                              unsigned int flags);
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568
typedef virStoragePoolPtr
    (*virDrvStoragePoolLookupByName)         (virConnectPtr conn,
                                              const char *name);
typedef virStoragePoolPtr
    (*virDrvStoragePoolLookupByUUID)         (virConnectPtr conn,
                                              const unsigned char *uuid);
typedef virStoragePoolPtr
    (*virDrvStoragePoolLookupByVolume)       (virStorageVolPtr vol);
typedef virStoragePoolPtr
    (*virDrvStoragePoolCreateXML)            (virConnectPtr conn,
                                              const char *xmlDesc,
                                              unsigned int flags);
typedef virStoragePoolPtr
    (*virDrvStoragePoolDefineXML)            (virConnectPtr conn,
                                              const char *xmlDesc,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolUndefine)             (virStoragePoolPtr pool);
typedef int
    (*virDrvStoragePoolBuild)                (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolCreate)               (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolDestroy)              (virStoragePoolPtr pool);
typedef int
    (*virDrvStoragePoolDelete)               (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolRefresh)              (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolGetInfo)              (virStoragePoolPtr vol,
                                              virStoragePoolInfoPtr info);
typedef char *
    (*virDrvStoragePoolGetXMLDesc)           (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolGetAutostart)         (virStoragePoolPtr pool,
                                              int *autostart);
typedef int
    (*virDrvStoragePoolSetAutostart)         (virStoragePoolPtr pool,
                                              int autostart);
typedef int
    (*virDrvStoragePoolNumOfVolumes)         (virStoragePoolPtr pool);
typedef int
    (*virDrvStoragePoolListVolumes)          (virStoragePoolPtr pool,
                                              char **const names,
                                              int maxnames);


typedef virStorageVolPtr
    (*virDrvStorageVolLookupByName)          (virStoragePoolPtr pool,
                                              const char *name);
typedef virStorageVolPtr
    (*virDrvStorageVolLookupByKey)           (virConnectPtr pool,
                                              const char *key);
typedef virStorageVolPtr
    (*virDrvStorageVolLookupByPath)          (virConnectPtr pool,
                                              const char *path);


typedef virStorageVolPtr
    (*virDrvStorageVolCreateXML)             (virStoragePoolPtr pool,
                                              const char *xmldesc,
                                              unsigned int flags);
typedef int
    (*virDrvStorageVolDelete)               (virStorageVolPtr vol,
                                             unsigned int flags);

typedef int
    (*virDrvStorageVolGetInfo)               (virStorageVolPtr vol,
                                              virStorageVolInfoPtr info);
typedef char *
    (*virDrvStorageVolGetXMLDesc)            (virStorageVolPtr pool,
                                              unsigned int flags);
typedef char *
    (*virDrvStorageVolGetPath)               (virStorageVolPtr vol);



typedef struct _virStorageDriver virStorageDriver;
typedef virStorageDriver *virStorageDriverPtr;

/**
 * _virStorageDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virStorageDriver {
    const char * name;    /* the name of the driver */
    virDrvOpen            open;
    virDrvClose           close;

    virDrvConnectNumOfStoragePools numOfPools;
    virDrvConnectListStoragePools listPools;
    virDrvConnectNumOfDefinedStoragePools numOfDefinedPools;
    virDrvConnectListDefinedStoragePools listDefinedPools;
569
    virDrvConnectFindStoragePoolSources findPoolSources;
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597
    virDrvStoragePoolLookupByName poolLookupByName;
    virDrvStoragePoolLookupByUUID poolLookupByUUID;
    virDrvStoragePoolLookupByVolume poolLookupByVolume;
    virDrvStoragePoolCreateXML poolCreateXML;
    virDrvStoragePoolDefineXML poolDefineXML;
    virDrvStoragePoolBuild poolBuild;
    virDrvStoragePoolUndefine poolUndefine;
    virDrvStoragePoolCreate poolCreate;
    virDrvStoragePoolDestroy poolDestroy;
    virDrvStoragePoolDelete poolDelete;
    virDrvStoragePoolRefresh poolRefresh;
    virDrvStoragePoolGetInfo poolGetInfo;
    virDrvStoragePoolGetXMLDesc poolGetXMLDesc;
    virDrvStoragePoolGetAutostart poolGetAutostart;
    virDrvStoragePoolSetAutostart poolSetAutostart;
    virDrvStoragePoolNumOfVolumes poolNumOfVolumes;
    virDrvStoragePoolListVolumes poolListVolumes;

    virDrvStorageVolLookupByName volLookupByName;
    virDrvStorageVolLookupByKey volLookupByKey;
    virDrvStorageVolLookupByPath volLookupByPath;
    virDrvStorageVolCreateXML volCreateXML;
    virDrvStorageVolDelete volDelete;
    virDrvStorageVolGetInfo volGetInfo;
    virDrvStorageVolGetXMLDesc volGetXMLDesc;
    virDrvStorageVolGetPath volGetPath;
};

598 599 600 601
typedef int (*virDrvStateInitialize) (void);
typedef int (*virDrvStateCleanup) (void);
typedef int (*virDrvStateReload) (void);
typedef int (*virDrvStateActive) (void);
A
Atsushi SAKAI 已提交
602
#ifdef WITH_LIBVIRTD
603
typedef int (*virDrvSigHandler) (siginfo_t *siginfo);
604 605 606 607 608 609 610 611 612

typedef struct _virStateDriver virStateDriver;
typedef virStateDriver *virStateDriverPtr;

struct _virStateDriver {
    virDrvStateInitialize  initialize;
    virDrvStateCleanup     cleanup;
    virDrvStateReload      reload;
    virDrvStateActive      active;
613
    virDrvSigHandler       sigHandler;
614
};
A
Atsushi SAKAI 已提交
615
#endif
616 617 618 619 620 621 622

/*
 * Registration
 * TODO: also need ways to (des)activate a given driver
 *       lookup based on the URI given in a virConnectOpen(ReadOnly)
 */
int virRegisterDriver(virDriverPtr);
623
int virRegisterNetworkDriver(virNetworkDriverPtr);
624
int virRegisterStorageDriver(virStorageDriverPtr);
A
Atsushi SAKAI 已提交
625
#ifdef WITH_LIBVIRTD
626
int virRegisterStateDriver(virStateDriverPtr);
A
Atsushi SAKAI 已提交
627
#endif
628 629

#endif /* __VIR_DRIVER_H__ */