driver.h 73.2 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 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * Copyright (C) 2006-2013 Red Hat, Inc.
 *
 * 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"
M
Martin Kletzander 已提交
28
# include "viruri.h"
29 30 31 32
/*
 * List of registered drivers numbers
 */
typedef enum {
33 34 35
    VIR_DRV_XEN_UNIFIED = 1,
    VIR_DRV_TEST = 2,
    VIR_DRV_QEMU = 3,
36
    VIR_DRV_REMOTE = 4,
37
    VIR_DRV_OPENVZ = 5,
38 39
    VIR_DRV_LXC = 6,
    VIR_DRV_UML = 7,
40
    VIR_DRV_VBOX = 8,
D
Daniel Veillard 已提交
41
    VIR_DRV_ONE = 9,
42
    VIR_DRV_ESX = 10,
43
    VIR_DRV_PHYP = 11,
44
    VIR_DRV_XENAPI = 12,
J
Jim Fehlig 已提交
45 46
    VIR_DRV_VMWARE = 13,
    VIR_DRV_LIBXL = 14,
M
Matthias Bolte 已提交
47
    VIR_DRV_HYPERV = 15,
D
Dmitry Guryanov 已提交
48
    VIR_DRV_PARALLELS = 16,
49 50 51
} virDrvNo;


52 53 54 55 56 57 58 59 60 61 62 63 64 65
/* 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 已提交
66

67
/* Internal feature-detection macro.  Don't call drv->supports_feature
68 69
 * directly if you don't have to, because it may be NULL, use this macro
 * instead.
70
 *
71 72 73
 * 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.
74 75
 *
 * Returns:
76
 *   != 0  Feature is supported.
77 78
 *   0     Feature is not supported.
 */
79 80 81
# define VIR_DRV_SUPPORTS_FEATURE(drv,conn,feature)                     \
    ((drv)->connectSupportsFeature ?                                    \
        (drv)->connectSupportsFeature((conn), (feature)) > 0 : 0)
82

83
typedef virDrvOpenStatus
84 85 86 87
(*virDrvConnectOpen)(virConnectPtr conn,
                     virConnectAuthPtr auth,
                     unsigned int flags);

88
typedef int
89 90
(*virDrvConnectClose)(virConnectPtr conn);

91
typedef int
92 93 94
(*virDrvConnectSupportsFeature)(virConnectPtr conn,
                                int feature);

95
typedef const char *
96 97
(*virDrvConnectGetType)(virConnectPtr conn);

98
typedef int
99 100 101
(*virDrvConnectGetVersion)(virConnectPtr conn,
                           unsigned long *hvVer);

102
typedef int
103 104 105
(*virDrvConnectGetLibVersion)(virConnectPtr conn,
                              unsigned long *libVer);

106
typedef char *
107 108
(*virDrvConnectGetHostname)(virConnectPtr conn);

109
typedef char *
110 111
(*virDrvConnectGetURI)(virConnectPtr conn);

E
Eric Blake 已提交
112
typedef char *
113 114 115
(*virDrvConnectGetSysinfo)(virConnectPtr conn,
                           unsigned int flags);

116
typedef int
117 118 119
(*virDrvConnectGetMaxVcpus)(virConnectPtr conn,
                            const char *type);

120
typedef int
121 122 123
(*virDrvNodeGetInfo)(virConnectPtr conn,
                     virNodeInfoPtr info);

124
typedef char *
125 126
(*virDrvConnectGetCapabilities)(virConnectPtr conn);

127
typedef int
128 129 130 131
(*virDrvConnectListDomains)(virConnectPtr conn,
                            int *ids,
                            int maxids);

132
typedef int
133 134
(*virDrvConnectNumOfDomains)(virConnectPtr conn);

135
typedef virDomainPtr
136 137 138
(*virDrvDomainCreateXML)(virConnectPtr conn,
                         const char *xmlDesc,
                         unsigned int flags);
139 140 141 142 143 144
typedef virDomainPtr
(*virDrvDomainCreateXMLWithFiles)(virConnectPtr conn,
                                  const char *xmlDesc,
                                  unsigned int nfiles,
                                  int *files,
                                  unsigned int flags);
145

146
typedef virDomainPtr
147 148 149
(*virDrvDomainLookupByID)(virConnectPtr conn,
                          int id);

150
typedef virDomainPtr
151 152 153
(*virDrvDomainLookupByUUID)(virConnectPtr conn,
                            const unsigned char *uuid);

154
typedef virDomainPtr
155 156 157
(*virDrvDomainLookupByName)(virConnectPtr conn,
                            const char *name);

158
typedef int
159 160
(*virDrvDomainSuspend)(virDomainPtr domain);

161
typedef int
162 163
(*virDrvDomainResume)(virDomainPtr domain);

164
typedef int
165 166 167 168 169
 (*virDrvDomainPMSuspendForDuration)(virDomainPtr,
                                     unsigned int target,
                                     unsigned long long duration,
                                     unsigned int flags);

170
typedef int
171 172 173
(*virDrvDomainPMWakeup)(virDomainPtr domain,
                        unsigned int flags);

174
typedef int
175 176
(*virDrvDomainShutdown)(virDomainPtr domain);

177
typedef int
178 179 180
(*virDrvDomainReboot)(virDomainPtr domain,
                      unsigned int flags);

X
Xu He Jie 已提交
181
typedef int
182 183 184
(*virDrvDomainReset)(virDomainPtr domain,
                     unsigned int flags);

185
typedef int
186 187
(*virDrvDomainDestroy)(virDomainPtr domain);

188
typedef int
189 190 191
(*virDrvDomainDestroyFlags)(virDomainPtr domain,
                            unsigned int flags);

192
typedef char *
193
(*virDrvDomainGetOSType)(virDomainPtr domain);
G
Guido Günther 已提交
194 195

typedef char *
196 197
(*virDrvDomainGetHostname)(virDomainPtr domain,
                           unsigned int flags);
G
Guido Günther 已提交
198

199
typedef unsigned long long
200 201
(*virDrvDomainGetMaxMemory)(virDomainPtr domain);

202
typedef int
203 204 205
(*virDrvDomainSetMaxMemory)(virDomainPtr domain,
                            unsigned long memory);

206
typedef int
207 208 209
(*virDrvDomainSetMemory)(virDomainPtr domain,
                         unsigned long memory);

210
typedef int
211 212 213 214
(*virDrvDomainSetMemoryFlags)(virDomainPtr domain,
                              unsigned long memory,
                              unsigned int flags);

215 216 217 218 219
typedef int
(*virDrvDomainSetMemoryStatsPeriod)(virDomainPtr domain,
                                    int period,
                                    unsigned int flags);

220
typedef int
221 222 223 224 225
(*virDrvDomainSetMemoryParameters)(virDomainPtr domain,
                                   virTypedParameterPtr params,
                                   int nparams,
                                   unsigned int flags);

226
typedef int
227 228 229 230 231
(*virDrvDomainGetMemoryParameters)(virDomainPtr domain,
                                   virTypedParameterPtr params,
                                   int *nparams,
                                   unsigned int flags);

232
typedef int
233 234 235 236 237
(*virDrvDomainSetNumaParameters)(virDomainPtr domain,
                                 virTypedParameterPtr params,
                                 int nparams,
                                 unsigned int flags);

238
typedef int
239 240 241 242
(*virDrvDomainGetNumaParameters)(virDomainPtr domain,
                                 virTypedParameterPtr params,
                                 int *nparams,
                                 unsigned int flags);
243

244
typedef int
245 246 247 248 249
(*virDrvDomainSetBlkioParameters)(virDomainPtr domain,
                                  virTypedParameterPtr params,
                                  int nparams,
                                  unsigned int flags);

250
typedef int
251 252 253 254 255
(*virDrvDomainGetBlkioParameters)(virDomainPtr domain,
                                  virTypedParameterPtr params,
                                  int *nparams,
                                  unsigned int flags);

256
typedef int
257 258 259
(*virDrvDomainGetInfo)(virDomainPtr domain,
                       virDomainInfoPtr info);

260
typedef int
261 262 263 264 265
(*virDrvDomainGetState)(virDomainPtr domain,
                        int *state,
                        int *reason,
                        unsigned int flags);

266
typedef int
267 268 269 270
(*virDrvDomainGetControlInfo)(virDomainPtr domain,
                              virDomainControlInfoPtr info,
                              unsigned int flags);

271
typedef int
272 273 274
(*virDrvDomainSave)(virDomainPtr domain,
                    const char *to);

275
typedef int
276 277 278 279 280
(*virDrvDomainSaveFlags)(virDomainPtr domain,
                         const char *to,
                         const char *dxml,
                         unsigned int flags);

281
typedef int
282 283 284
(*virDrvDomainRestore)(virConnectPtr conn,
                       const char *from);

285
typedef int
286 287 288 289 290
(*virDrvDomainRestoreFlags)(virConnectPtr conn,
                            const char *from,
                            const char *dxml,
                            unsigned int flags);

291
typedef char *
292 293 294 295
(*virDrvDomainSaveImageGetXMLDesc)(virConnectPtr conn,
                                   const char *file,
                                   unsigned int flags);

296
typedef int
297 298 299 300 301
(*virDrvDomainSaveImageDefineXML)(virConnectPtr conn,
                                  const char *file,
                                  const char *dxml,
                                  unsigned int flags);

D
Daniel Veillard 已提交
302
typedef int
303 304 305 306
(*virDrvDomainCoreDump)(virDomainPtr domain,
                        const char *to,
                        unsigned int flags);

307
typedef char *
308 309 310 311 312
(*virDrvDomainScreenshot)(virDomainPtr domain,
                          virStreamPtr stream,
                          unsigned int screen,
                          unsigned int flags);

313
typedef char *
314 315 316
(*virDrvDomainGetXMLDesc)(virDomainPtr dom,
                          unsigned int flags);

317
typedef char *
318 319 320 321 322
(*virDrvConnectDomainXMLFromNative)(virConnectPtr conn,
                                    const char *nativeFormat,
                                    const char *nativeConfig,
                                    unsigned int flags);

323
typedef char *
324 325 326 327 328
(*virDrvConnectDomainXMLToNative)(virConnectPtr conn,
                                  const char *nativeFormat,
                                  const char *domainXml,
                                  unsigned int flags);

329
typedef int
330 331 332 333
(*virDrvConnectListDefinedDomains)(virConnectPtr conn,
                                   char **const names,
                                   int maxnames);

334
typedef int
335 336 337 338
(*virDrvConnectListAllDomains)(virConnectPtr conn,
                               virDomainPtr **domains,
                               unsigned int flags);

339
typedef int
340 341
(*virDrvConnectNumOfDefinedDomains)(virConnectPtr conn);

342
typedef int
343 344
(*virDrvDomainCreate)(virDomainPtr dom);

345
typedef int
346 347
(*virDrvDomainCreateWithFlags)(virDomainPtr dom,
                               unsigned int flags);
348 349 350 351 352
typedef int
(*virDrvDomainCreateWithFiles)(virDomainPtr dom,
                               unsigned int nfiles,
                               int *files,
                               unsigned int flags);
353

354
typedef virDomainPtr
355 356 357
(*virDrvDomainDefineXML)(virConnectPtr conn,
                         const char *xml);

358
typedef int
359 360
(*virDrvDomainUndefine)(virDomainPtr dom);

O
Osier Yang 已提交
361
typedef int
362 363 364
(*virDrvDomainUndefineFlags)(virDomainPtr dom,
                             unsigned int flags);

365
typedef int
366 367 368
(*virDrvDomainSetVcpus)(virDomainPtr domain,
                        unsigned int nvcpus);

E
Eric Blake 已提交
369
typedef int
370 371 372 373
(*virDrvDomainSetVcpusFlags)(virDomainPtr domain,
                             unsigned int nvcpus,
                             unsigned int flags);

E
Eric Blake 已提交
374
typedef int
375 376 377
(*virDrvDomainGetVcpusFlags)(virDomainPtr domain,
                             unsigned int flags);

378
typedef int
379 380 381 382 383
(*virDrvDomainPinVcpu)(virDomainPtr domain,
                       unsigned int vcpu,
                       unsigned char *cpumap,
                       int maplen);

384
typedef int
385 386 387 388 389 390
(*virDrvDomainPinVcpuFlags)(virDomainPtr domain,
                            unsigned int vcpu,
                            unsigned char *cpumap,
                            int maplen,
                            unsigned int flags);

391
typedef int
392 393 394 395 396 397
(*virDrvDomainGetVcpuPinInfo)(virDomainPtr domain,
                              int ncpumaps,
                              unsigned char *cpumaps,
                              int maplen,
                              unsigned int flags);

398
typedef int
399 400 401 402
(*virDrvDomainPinEmulator)(virDomainPtr domain,
                           unsigned char *cpumap,
                           int maplen,
                           unsigned int flags);
403

404
typedef int
405 406 407 408 409
(*virDrvDomainGetEmulatorPinInfo)(virDomainPtr domain,
                                  unsigned char *cpumaps,
                                  int maplen,
                                  unsigned int flags);

410
typedef int
411 412 413 414 415
(*virDrvDomainGetVcpus)(virDomainPtr domain,
                        virVcpuInfoPtr info,
                        int maxinfo,
                        unsigned char *cpumaps,
                        int maplen);
416 417

typedef int
418 419 420 421 422 423
(*virDrvDomainGetMaxVcpus)(virDomainPtr domain);

typedef int
(*virDrvDomainGetSecurityLabel)(virDomainPtr domain,
                                virSecurityLabelPtr seclabel);

M
Marcelo Cerri 已提交
424
typedef int
425 426 427
(*virDrvDomainGetSecurityLabelList)(virDomainPtr domain,
                                    virSecurityLabelPtr* seclabels);

428
typedef int
429 430 431
(*virDrvNodeGetSecurityModel)(virConnectPtr conn,
                              virSecurityModelPtr secmodel);

432
typedef int
433 434 435
(*virDrvDomainAttachDevice)(virDomainPtr domain,
                            const char *xml);

J
Jim Fehlig 已提交
436
typedef int
437 438 439 440
(*virDrvDomainAttachDeviceFlags)(virDomainPtr domain,
                                 const char *xml,
                                 unsigned int flags);

441
typedef int
442 443 444
(*virDrvDomainDetachDevice)(virDomainPtr domain,
                            const char *xml);

J
Jim Fehlig 已提交
445
typedef int
446 447 448 449
(*virDrvDomainDetachDeviceFlags)(virDomainPtr domain,
                                 const char *xml,
                                 unsigned int flags);

450
typedef int
451 452 453 454
(*virDrvDomainUpdateDeviceFlags)(virDomainPtr domain,
                                 const char *xml,
                                 unsigned int flags);

455
typedef int
456 457 458
(*virDrvDomainGetAutostart)(virDomainPtr domain,
                            int *autostart);

459
typedef int
460 461
(*virDrvDomainSetAutostart)(virDomainPtr domain,
                            int autostart);
462

463
typedef char *
464 465
(*virDrvDomainGetSchedulerType)(virDomainPtr domain,
                                int *nparams);
466

467
typedef int
468 469 470
(*virDrvDomainGetSchedulerParameters)(virDomainPtr domain,
                                      virTypedParameterPtr params,
                                      int *nparams);
471

472
typedef int
473 474 475 476
(*virDrvDomainGetSchedulerParametersFlags)(virDomainPtr domain,
                                           virTypedParameterPtr params,
                                           int *nparams,
                                           unsigned int flags);
477

478
typedef int
479 480 481
(*virDrvDomainSetSchedulerParameters)(virDomainPtr domain,
                                      virTypedParameterPtr params,
                                      int nparams);
482

483
typedef int
484 485 486 487
(*virDrvDomainSetSchedulerParametersFlags)(virDomainPtr domain,
                                           virTypedParameterPtr params,
                                           int nparams,
                                           unsigned int flags);
488

489
typedef int
490 491 492 493
(*virDrvDomainBlockStats)(virDomainPtr domain,
                          const char *path,
                          struct _virDomainBlockStats *stats);

494
typedef int
495 496 497 498 499 500
(*virDrvDomainBlockStatsFlags)(virDomainPtr domain,
                               const char *path,
                               virTypedParameterPtr params,
                               int *nparams,
                               unsigned int flags);

501
typedef int
502 503 504 505
(*virDrvDomainInterfaceStats)(virDomainPtr domain,
                              const char *path,
                              struct _virDomainInterfaceStats *stats);

506
typedef int
507 508 509 510 511 512
(*virDrvDomainSetInterfaceParameters)(virDomainPtr dom,
                                      const char *device,
                                      virTypedParameterPtr params,
                                      int nparams,
                                      unsigned int flags);

513
typedef int
514 515 516 517 518
(*virDrvDomainGetInterfaceParameters)(virDomainPtr dom,
                                      const char *device,
                                      virTypedParameterPtr params,
                                      int *nparams,
                                      unsigned int flags);
519

520
typedef int
521 522 523 524
(*virDrvDomainMemoryStats)(virDomainPtr domain,
                           struct _virDomainMemoryStat *stats,
                           unsigned int nr_stats,
                           unsigned int flags);
525

R
Richard W.M. Jones 已提交
526
typedef int
527 528 529 530 531 532 533
(*virDrvDomainBlockPeek)(virDomainPtr domain,
                         const char *path,
                         unsigned long long offset,
                         size_t size,
                         void *buffer,
                         unsigned int flags);

O
Osier Yang 已提交
534
typedef int
535 536 537 538 539
(*virDrvDomainBlockResize)(virDomainPtr domain,
                           const char *path,
                           unsigned long long size,
                           unsigned int flags);

R
Richard W.M. Jones 已提交
540
typedef int
541 542 543 544 545 546
(*virDrvDomainMemoryPeek)(virDomainPtr domain,
                          unsigned long long start,
                          size_t size,
                          void *buffer,
                          unsigned int flags);

547
typedef int
548 549 550 551
(*virDrvDomainGetBlockInfo)(virDomainPtr domain,
                            const char *path,
                            virDomainBlockInfoPtr info,
                            unsigned int flags);
R
Richard W.M. Jones 已提交
552

553
typedef int
554 555 556 557 558 559 560 561
(*virDrvDomainMigratePrepare)(virConnectPtr dconn,
                              char **cookie,
                              int *cookielen,
                              const char *uri_in,
                              char **uri_out,
                              unsigned long flags,
                              const char *dname,
                              unsigned long resource);
562 563

typedef int
564 565 566 567 568 569 570
(*virDrvDomainMigratePerform)(virDomainPtr domain,
                              const char *cookie,
                              int cookielen,
                              const char *uri,
                              unsigned long flags,
                              const char *dname,
                              unsigned long resource);
571 572

typedef virDomainPtr
573 574 575 576 577 578
(*virDrvDomainMigrateFinish)(virConnectPtr dconn,
                             const char *dname,
                             const char *cookie,
                             int cookielen,
                             const char *uri,
                             unsigned long flags);
579

580
typedef int
581 582 583 584 585
(*virDrvNodeGetCPUStats)(virConnectPtr conn,
                         int cpuNum,
                         virNodeCPUStatsPtr params,
                         int *nparams,
                         unsigned int flags);
586

587
typedef int
588 589 590 591 592
(*virDrvNodeGetMemoryStats)(virConnectPtr conn,
                            int cellNum,
                            virNodeMemoryStatsPtr params,
                            int *nparams,
                            unsigned int flags);
593

594
typedef int
595 596 597 598
(*virDrvNodeGetCellsFreeMemory)(virConnectPtr conn,
                                unsigned long long *freeMems,
                                int startCell,
                                int maxCells);
599

600
typedef unsigned long long
601
(*virDrvNodeGetFreeMemory)(virConnectPtr conn);
602

603
typedef int
604 605 606 607
(*virDrvConnectDomainEventRegister)(virConnectPtr conn,
                                    virConnectDomainEventCallback cb,
                                    void *opaque,
                                    virFreeCallback freecb);
608 609

typedef int
610 611
(*virDrvConnectDomainEventDeregister)(virConnectPtr conn,
                                      virConnectDomainEventCallback cb);
612

D
Daniel Veillard 已提交
613
typedef int
614 615 616 617 618 619 620 621 622
(*virDrvDomainMigratePrepare2)(virConnectPtr dconn,
                               char **cookie,
                               int *cookielen,
                               const char *uri_in,
                               char **uri_out,
                               unsigned long flags,
                               const char *dname,
                               unsigned long resource,
                               const char *dom_xml);
D
Daniel Veillard 已提交
623 624

typedef virDomainPtr
625 626 627 628 629 630 631
(*virDrvDomainMigrateFinish2)(virConnectPtr dconn,
                              const char *dname,
                              const char *cookie,
                              int cookielen,
                              const char *uri,
                              unsigned long flags,
                              int retcode);
D
Daniel Veillard 已提交
632

633
typedef int
634 635
(*virDrvNodeDeviceDettach)(virNodeDevicePtr dev);

636 637 638 639 640
typedef int
(*virDrvNodeDeviceDetachFlags)(virNodeDevicePtr dev,
                               const char *driverName,
                               unsigned int flags);

641
typedef int
642 643
(*virDrvNodeDeviceReAttach)(virNodeDevicePtr dev);

644
typedef int
645
(*virDrvNodeDeviceReset)(virNodeDevicePtr dev);
646

C
Chris Lalancette 已提交
647
typedef int
648 649 650 651 652 653
(*virDrvDomainMigratePrepareTunnel)(virConnectPtr dconn,
                                    virStreamPtr st,
                                    unsigned long flags,
                                    const char *dname,
                                    unsigned long resource,
                                    const char *dom_xml);
C
Chris Lalancette 已提交
654

655
typedef int
656 657
(*virDrvConnectIsEncrypted)(virConnectPtr conn);

658
typedef int
659 660
(*virDrvConnectIsSecure)(virConnectPtr conn);

J
Jiri Denemark 已提交
661
typedef int
662 663
(*virDrvConnectIsAlive)(virConnectPtr conn);

664
typedef int
665 666
(*virDrvDomainIsActive)(virDomainPtr dom);

667
typedef int
668 669
(*virDrvDomainIsPersistent)(virDomainPtr dom);

O
Osier Yang 已提交
670
typedef int
671
(*virDrvDomainIsUpdated)(virDomainPtr dom);
672

J
Jiri Denemark 已提交
673
typedef int
674 675 676 677
(*virDrvConnectCompareCPU)(virConnectPtr conn,
                           const char *cpu,
                           unsigned int flags);

678
typedef char *
679 680 681 682
(*virDrvConnectBaselineCPU)(virConnectPtr conn,
                            const char **xmlCPUs,
                            unsigned int ncpus,
                            unsigned int flags);
J
Jiri Denemark 已提交
683

684 685 686 687 688 689
typedef int
(*virDrvConnectGetCPUModelNames)(virConnectPtr conn,
                                 const char *args,
                                 char ***models,
                                 unsigned int flags);

690
typedef int
691 692 693
(*virDrvDomainGetJobInfo)(virDomainPtr domain,
                          virDomainJobInfoPtr info);

694
typedef int
695 696 697 698 699
(*virDrvDomainGetJobStats)(virDomainPtr domain,
                           int *type,
                           virTypedParameterPtr *params,
                           int *nparams,
                           unsigned int flags);
700

701
typedef int
702
(*virDrvDomainAbortJob)(virDomainPtr domain);
703

704
typedef int
705 706 707 708
(*virDrvDomainMigrateSetMaxDowntime)(virDomainPtr domain,
                                     unsigned long long downtime,
                                     unsigned int flags);

709
typedef int
710 711 712 713
(*virDrvDomainMigrateGetCompressionCache)(virDomainPtr domain,
                                          unsigned long long *cacheSize,
                                          unsigned int flags);

714
typedef int
715 716 717
(*virDrvDomainMigrateSetCompressionCache)(virDomainPtr domain,
                                          unsigned long long cacheSize,
                                          unsigned int flags);
718

719
typedef int
720 721 722
(*virDrvDomainMigrateSetMaxSpeed)(virDomainPtr domain,
                                  unsigned long bandwidth,
                                  unsigned int flags);
723

724
typedef int
725 726 727
(*virDrvDomainMigrateGetMaxSpeed)(virDomainPtr domain,
                                  unsigned long *bandwidth,
                                  unsigned int flags);
728

729
typedef int
730 731 732 733 734 735
(*virDrvConnectDomainEventRegisterAny)(virConnectPtr conn,
                                       virDomainPtr dom,
                                       int eventID,
                                       virConnectDomainEventGenericCallback cb,
                                       void *opaque,
                                       virFreeCallback freecb);
736 737

typedef int
738 739
(*virDrvConnectDomainEventDeregisterAny)(virConnectPtr conn,
                                         int callbackID);
740

741
typedef int
742 743
(*virDrvDomainManagedSave)(virDomainPtr domain,
                           unsigned int flags);
744 745

typedef int
746 747
(*virDrvDomainHasManagedSaveImage)(virDomainPtr domain,
                                   unsigned int flags);
748 749

typedef int
750 751
(*virDrvDomainManagedSaveRemove)(virDomainPtr domain,
                                 unsigned int flags);
752

C
Chris Lalancette 已提交
753
typedef virDomainSnapshotPtr
754 755 756
(*virDrvDomainSnapshotCreateXML)(virDomainPtr domain,
                                 const char *xmlDesc,
                                 unsigned int flags);
C
Chris Lalancette 已提交
757 758

typedef char *
759 760
(*virDrvDomainSnapshotGetXMLDesc)(virDomainSnapshotPtr snapshot,
                                  unsigned int flags);
C
Chris Lalancette 已提交
761 762

typedef int
763 764
(*virDrvDomainSnapshotNum)(virDomainPtr domain,
                           unsigned int flags);
C
Chris Lalancette 已提交
765 766

typedef int
767 768 769 770
(*virDrvDomainSnapshotListNames)(virDomainPtr domain,
                                 char **names,
                                 int nameslen,
                                 unsigned int flags);
C
Chris Lalancette 已提交
771

772
typedef int
773 774 775
(*virDrvDomainListAllSnapshots)(virDomainPtr domain,
                                virDomainSnapshotPtr **snaps,
                                unsigned int flags);
776

777
typedef int
778 779
(*virDrvDomainSnapshotNumChildren)(virDomainSnapshotPtr snapshot,
                                   unsigned int flags);
780 781

typedef int
782 783 784 785
(*virDrvDomainSnapshotListChildrenNames)(virDomainSnapshotPtr snapshot,
                                         char **names,
                                         int nameslen,
                                         unsigned int flags);
786

787
typedef int
788 789 790
(*virDrvDomainSnapshotListAllChildren)(virDomainSnapshotPtr snapshot,
                                       virDomainSnapshotPtr **snaps,
                                       unsigned int flags);
791

C
Chris Lalancette 已提交
792
typedef virDomainSnapshotPtr
793 794 795
(*virDrvDomainSnapshotLookupByName)(virDomainPtr domain,
                                    const char *name,
                                    unsigned int flags);
C
Chris Lalancette 已提交
796 797

typedef int
798 799
(*virDrvDomainHasCurrentSnapshot)(virDomainPtr domain,
                                  unsigned int flags);
C
Chris Lalancette 已提交
800

801
typedef virDomainSnapshotPtr
802 803
(*virDrvDomainSnapshotGetParent)(virDomainSnapshotPtr snapshot,
                                 unsigned int flags);
804

C
Chris Lalancette 已提交
805
typedef virDomainSnapshotPtr
806 807
(*virDrvDomainSnapshotCurrent)(virDomainPtr domain,
                               unsigned int flags);
C
Chris Lalancette 已提交
808

E
Eric Blake 已提交
809
typedef int
810 811
(*virDrvDomainSnapshotIsCurrent)(virDomainSnapshotPtr snapshot,
                                 unsigned int flags);
E
Eric Blake 已提交
812 813

typedef int
814 815
(*virDrvDomainSnapshotHasMetadata)(virDomainSnapshotPtr snapshot,
                                   unsigned int flags);
E
Eric Blake 已提交
816

C
Chris Lalancette 已提交
817
typedef int
818 819
(*virDrvDomainRevertToSnapshot)(virDomainSnapshotPtr snapshot,
                                unsigned int flags);
C
Chris Lalancette 已提交
820 821

typedef int
822 823
(*virDrvDomainSnapshotDelete)(virDomainSnapshotPtr snapshot,
                              unsigned int flags);
C
Chris Lalancette 已提交
824

C
Chris Lalancette 已提交
825
typedef int
826 827 828 829 830
(*virDrvDomainQemuMonitorCommand)(virDomainPtr domain,
                                  const char *cmd,
                                  char **result,
                                  unsigned int flags);

831
typedef char *
832 833 834 835
(*virDrvDomainQemuAgentCommand)(virDomainPtr domain,
                                const char *cmd,
                                int timeout,
                                unsigned int flags);
C
Chris Lalancette 已提交
836

837
/* Choice of unsigned int rather than pid_t is intentional.  */
838
typedef virDomainPtr
839 840 841
(*virDrvDomainQemuAttach)(virConnectPtr conn,
                          unsigned int pid_value,
                          unsigned int flags);
842

843
typedef int
844 845 846 847 848
(*virDrvDomainOpenConsole)(virDomainPtr dom,
                           const char *dev_name,
                           virStreamPtr st,
                           unsigned int flags);

849
typedef int
850 851 852 853
(*virDrvDomainOpenChannel)(virDomainPtr dom,
                           const char *name,
                           virStreamPtr st,
                           unsigned int flags);
854

855
typedef int
856 857 858 859
(*virDrvDomainOpenGraphics)(virDomainPtr dom,
                            unsigned int idx,
                            int fd,
                            unsigned int flags);
C
Chris Lalancette 已提交
860

861
typedef int
862 863
(*virDrvDomainInjectNMI)(virDomainPtr dom,
                         unsigned int flags);
864

865
typedef int
866 867 868 869 870 871
(*virDrvDomainSendKey)(virDomainPtr dom,
                       unsigned int codeset,
                       unsigned int holdtime,
                       unsigned int *keycodes,
                       int nkeycodes,
                       unsigned int flags);
872

873
typedef int
874 875 876 877
(*virDrvDomainSendProcessSignal)(virDomainPtr dom,
                                 long long pid_value,
                                 unsigned int signum,
                                 unsigned int flags);
878

879
typedef char *
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925
(*virDrvDomainMigrateBegin3)(virDomainPtr domain,
                             const char *xmlin,
                             char **cookieout,
                             int *cookieoutlen,
                             unsigned long flags,
                             const char *dname,
                             unsigned long resource);

typedef int
(*virDrvDomainMigratePrepare3)(virConnectPtr dconn,
                               const char *cookiein,
                               int cookieinlen,
                               char **cookieout,
                               int *cookieoutlen,
                               const char *uri_in,
                               char **uri_out,
                               unsigned long flags,
                               const char *dname,
                               unsigned long resource,
                               const char *dom_xml);

typedef int
(*virDrvDomainMigratePrepareTunnel3)(virConnectPtr dconn,
                                     virStreamPtr st,
                                     const char *cookiein,
                                     int cookieinlen,
                                     char **cookieout,
                                     int *cookieoutlen,
                                     unsigned long flags,
                                     const char *dname,
                                     unsigned long resource,
                                     const char *dom_xml);


typedef int
(*virDrvDomainMigratePerform3)(virDomainPtr dom,
                               const char *xmlin,
                               const char *cookiein,
                               int cookieinlen,
                               char **cookieout,
                               int *cookieoutlen,
                               const char *dconnuri,
                               const char *uri,
                               unsigned long flags,
                               const char *dname,
                               unsigned long resource);
926

927
typedef virDomainPtr
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950
(*virDrvDomainMigrateFinish3)(virConnectPtr dconn,
                              const char *dname,
                              const char *cookiein,
                              int cookieinlen,
                              char **cookieout,
                              int *cookieoutlen,
                              const char *dconnuri,
                              const char *uri,
                              unsigned long flags,
                              int cancelled);

typedef int
(*virDrvDomainMigrateConfirm3)(virDomainPtr domain,
                               const char *cookiein,
                               int cookieinlen,
                               unsigned long flags,
                               int cancelled);

typedef int
(*virDrvNodeSuspendForDuration)(virConnectPtr conn,
                                unsigned int target,
                                unsigned long long duration,
                                unsigned int flags);
951 952

typedef int
953 954 955
(*virDrvDomainBlockJobAbort)(virDomainPtr dom,
                             const char *path,
                             unsigned int flags);
956 957

typedef int
958 959 960 961
(*virDrvDomainGetBlockJobInfo)(virDomainPtr dom,
                               const char *path,
                               virDomainBlockJobInfoPtr info,
                               unsigned int flags);
962 963

typedef int
964 965 966 967
(*virDrvDomainBlockJobSetSpeed)(virDomainPtr dom,
                                const char *path,
                                unsigned long bandwidth,
                                unsigned int flags);
968 969

typedef int
970 971 972 973 974
(*virDrvDomainBlockPull)(virDomainPtr dom,
                         const char *path,
                         unsigned long bandwidth,
                         unsigned int flags);

975
typedef int
976 977 978 979 980 981
(*virDrvDomainBlockRebase)(virDomainPtr dom,
                           const char *path,
                           const char *base,
                           unsigned long bandwidth,
                           unsigned int flags);

E
Eric Blake 已提交
982
typedef int
983 984 985 986 987 988
(*virDrvDomainBlockCommit)(virDomainPtr dom,
                           const char *disk,
                           const char *base,
                           const char *top,
                           unsigned long bandwidth,
                           unsigned int flags);
989

J
Jiri Denemark 已提交
990
typedef int
991 992 993
(*virDrvConnectSetKeepAlive)(virConnectPtr conn,
                             int interval,
                             unsigned int count);
994

995
typedef int
996 997 998 999 1000 1001
(*virDrvDomainSetBlockIoTune)(virDomainPtr dom,
                              const char *disk,
                              virTypedParameterPtr params,
                              int nparams,
                              unsigned int flags);

1002
typedef int
1003 1004 1005 1006 1007 1008
(*virDrvDomainGetBlockIoTune)(virDomainPtr dom,
                              const char *disk,
                              virTypedParameterPtr params,
                              int *nparams,
                              unsigned int flags);

1009
typedef int
1010 1011
(*virDrvDomainShutdownFlags)(virDomainPtr domain,
                             unsigned int flags);
1012

1013
typedef int
1014 1015 1016 1017 1018 1019
(*virDrvDomainGetCPUStats)(virDomainPtr domain,
                           virTypedParameterPtr params,
                           unsigned int nparams,
                           int start_cpu,
                           unsigned int ncpus,
                           unsigned int flags);
1020

1021
typedef int
1022 1023 1024 1025
(*virDrvDomainGetDiskErrors)(virDomainPtr dom,
                             virDomainDiskErrorPtr errors,
                             unsigned int maxerrors,
                             unsigned int flags);
1026

1027
typedef int
1028 1029 1030 1031 1032 1033
(*virDrvDomainSetMetadata)(virDomainPtr dom,
                           int type,
                           const char *metadata,
                           const char *key,
                           const char *uri,
                           unsigned int flags);
1034 1035

typedef char *
1036 1037 1038 1039
(*virDrvDomainGetMetadata)(virDomainPtr dom,
                           int type,
                           const char *uri,
                           unsigned int flags);
1040

1041
typedef int
1042 1043 1044 1045
(*virDrvNodeGetMemoryParameters)(virConnectPtr conn,
                                 virTypedParameterPtr params,
                                 int *nparams,
                                 unsigned int flags);
1046 1047

typedef int
1048 1049 1050 1051
(*virDrvNodeSetMemoryParameters)(virConnectPtr conn,
                                 virTypedParameterPtr params,
                                 int nparams,
                                 unsigned int flags);
1052

1053
typedef int
1054 1055 1056 1057 1058
(*virDrvNodeGetCPUMap)(virConnectPtr conn,
                       unsigned char **cpumap,
                       unsigned int *online,
                       unsigned int flags);

1059
typedef int
1060 1061 1062 1063
(*virDrvDomainFSTrim)(virDomainPtr dom,
                      const char *mountPoint,
                      unsigned long long minimum,
                      unsigned int flags);
1064

1065
typedef int
1066 1067 1068 1069
(*virDrvDomainLxcOpenNamespace)(virDomainPtr dom,
                                int **fdlist,
                                unsigned int flags);

1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130
typedef char *
(*virDrvDomainMigrateBegin3Params)(virDomainPtr domain,
                                   virTypedParameterPtr params,
                                   int nparams,
                                   char **cookieout,
                                   int *cookieoutlen,
                                   unsigned int flags);

typedef int
(*virDrvDomainMigratePrepare3Params)(virConnectPtr dconn,
                                     virTypedParameterPtr params,
                                     int nparams,
                                     const char *cookiein,
                                     int cookieinlen,
                                     char **cookieout,
                                     int *cookieoutlen,
                                     char **uri_out,
                                     unsigned int flags);

typedef int
(*virDrvDomainMigratePrepareTunnel3Params)(virConnectPtr dconn,
                                           virStreamPtr st,
                                           virTypedParameterPtr params,
                                           int nparams,
                                           const char *cookiein,
                                           int cookieinlen,
                                           char **cookieout,
                                           int *cookieoutlen,
                                           unsigned int flags);

typedef int
(*virDrvDomainMigratePerform3Params)(virDomainPtr dom,
                                     const char *dconnuri,
                                     virTypedParameterPtr params,
                                     int nparams,
                                     const char *cookiein,
                                     int cookieinlen,
                                     char **cookieout,
                                     int *cookieoutlen,
                                     unsigned int flags);

typedef virDomainPtr
(*virDrvDomainMigrateFinish3Params)(virConnectPtr dconn,
                                    virTypedParameterPtr params,
                                    int nparams,
                                    const char *cookiein,
                                    int cookieinlen,
                                    char **cookieout,
                                    int *cookieoutlen,
                                    unsigned int flags,
                                    int cancelled);

typedef int
(*virDrvDomainMigrateConfirm3Params)(virDomainPtr domain,
                                     virTypedParameterPtr params,
                                     int nparams,
                                     const char *cookiein,
                                     int cookieinlen,
                                     unsigned int flags,
                                     int cancelled);

1131 1132
typedef struct _virDriver virDriver;
typedef virDriver *virDriverPtr;
1133

1134 1135 1136 1137 1138
/**
 * _virDriver:
 *
 * Structure associated to a virtualization driver, defining the various
 * entry points for it.
1139 1140 1141 1142 1143 1144
 *
 * All drivers must support the following fields/methods:
 *  - no
 *  - name
 *  - open
 *  - close
1145 1146
 */
struct _virDriver {
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163
    int no; /* the number virDrvNo */
    const char *name; /* the name of the driver */
    virDrvConnectOpen connectOpen;
    virDrvConnectClose connectClose;
    virDrvConnectSupportsFeature connectSupportsFeature;
    virDrvConnectGetType connectGetType;
    virDrvConnectGetVersion connectGetVersion;
    virDrvConnectGetLibVersion connectGetLibVersion;
    virDrvConnectGetHostname connectGetHostname;
    virDrvConnectGetSysinfo connectGetSysinfo;
    virDrvConnectGetMaxVcpus connectGetMaxVcpus;
    virDrvNodeGetInfo nodeGetInfo;
    virDrvConnectGetCapabilities connectGetCapabilities;
    virDrvConnectListDomains connectListDomains;
    virDrvConnectNumOfDomains connectNumOfDomains;
    virDrvConnectListAllDomains connectListAllDomains;
    virDrvDomainCreateXML domainCreateXML;
1164
    virDrvDomainCreateXMLWithFiles domainCreateXMLWithFiles;
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183
    virDrvDomainLookupByID domainLookupByID;
    virDrvDomainLookupByUUID domainLookupByUUID;
    virDrvDomainLookupByName domainLookupByName;
    virDrvDomainSuspend domainSuspend;
    virDrvDomainResume domainResume;
    virDrvDomainPMSuspendForDuration domainPMSuspendForDuration;
    virDrvDomainPMWakeup domainPMWakeup;
    virDrvDomainShutdown domainShutdown;
    virDrvDomainShutdownFlags domainShutdownFlags;
    virDrvDomainReboot domainReboot;
    virDrvDomainReset domainReset;
    virDrvDomainDestroy domainDestroy;
    virDrvDomainDestroyFlags domainDestroyFlags;
    virDrvDomainGetOSType domainGetOSType;
    virDrvDomainGetHostname domainGetHostname;
    virDrvDomainGetMaxMemory domainGetMaxMemory;
    virDrvDomainSetMaxMemory domainSetMaxMemory;
    virDrvDomainSetMemory domainSetMemory;
    virDrvDomainSetMemoryFlags domainSetMemoryFlags;
1184
    virDrvDomainSetMemoryStatsPeriod domainSetMemoryStatsPeriod;
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221
    virDrvDomainSetMemoryParameters domainSetMemoryParameters;
    virDrvDomainGetMemoryParameters domainGetMemoryParameters;
    virDrvDomainSetNumaParameters domainSetNumaParameters;
    virDrvDomainGetNumaParameters domainGetNumaParameters;
    virDrvDomainSetBlkioParameters domainSetBlkioParameters;
    virDrvDomainGetBlkioParameters domainGetBlkioParameters;
    virDrvDomainGetInfo domainGetInfo;
    virDrvDomainGetState domainGetState;
    virDrvDomainGetControlInfo domainGetControlInfo;
    virDrvDomainSave domainSave;
    virDrvDomainSaveFlags domainSaveFlags;
    virDrvDomainRestore domainRestore;
    virDrvDomainRestoreFlags domainRestoreFlags;
    virDrvDomainSaveImageGetXMLDesc domainSaveImageGetXMLDesc;
    virDrvDomainSaveImageDefineXML domainSaveImageDefineXML;
    virDrvDomainCoreDump domainCoreDump;
    virDrvDomainScreenshot domainScreenshot;
    virDrvDomainSetVcpus domainSetVcpus;
    virDrvDomainSetVcpusFlags domainSetVcpusFlags;
    virDrvDomainGetVcpusFlags domainGetVcpusFlags;
    virDrvDomainPinVcpu domainPinVcpu;
    virDrvDomainPinVcpuFlags domainPinVcpuFlags;
    virDrvDomainGetVcpuPinInfo domainGetVcpuPinInfo;
    virDrvDomainPinEmulator domainPinEmulator;
    virDrvDomainGetEmulatorPinInfo domainGetEmulatorPinInfo;
    virDrvDomainGetVcpus domainGetVcpus;
    virDrvDomainGetMaxVcpus domainGetMaxVcpus;
    virDrvDomainGetSecurityLabel domainGetSecurityLabel;
    virDrvDomainGetSecurityLabelList domainGetSecurityLabelList;
    virDrvNodeGetSecurityModel nodeGetSecurityModel;
    virDrvDomainGetXMLDesc domainGetXMLDesc;
    virDrvConnectDomainXMLFromNative connectDomainXMLFromNative;
    virDrvConnectDomainXMLToNative connectDomainXMLToNative;
    virDrvConnectListDefinedDomains connectListDefinedDomains;
    virDrvConnectNumOfDefinedDomains connectNumOfDefinedDomains;
    virDrvDomainCreate domainCreate;
    virDrvDomainCreateWithFlags domainCreateWithFlags;
1222
    virDrvDomainCreateWithFiles domainCreateWithFiles;
1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234
    virDrvDomainDefineXML domainDefineXML;
    virDrvDomainUndefine domainUndefine;
    virDrvDomainUndefineFlags domainUndefineFlags;
    virDrvDomainAttachDevice domainAttachDevice;
    virDrvDomainAttachDeviceFlags domainAttachDeviceFlags;
    virDrvDomainDetachDevice domainDetachDevice;
    virDrvDomainDetachDeviceFlags domainDetachDeviceFlags;
    virDrvDomainUpdateDeviceFlags domainUpdateDeviceFlags;
    virDrvDomainGetAutostart domainGetAutostart;
    virDrvDomainSetAutostart domainSetAutostart;
    virDrvDomainGetSchedulerType domainGetSchedulerType;
    virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
1235
    virDrvDomainGetSchedulerParametersFlags domainGetSchedulerParametersFlags;
1236
    virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
1237
    virDrvDomainSetSchedulerParametersFlags domainSetSchedulerParametersFlags;
1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259
    virDrvDomainMigratePrepare domainMigratePrepare;
    virDrvDomainMigratePerform domainMigratePerform;
    virDrvDomainMigrateFinish domainMigrateFinish;
    virDrvDomainBlockResize domainBlockResize;
    virDrvDomainBlockStats domainBlockStats;
    virDrvDomainBlockStatsFlags domainBlockStatsFlags;
    virDrvDomainInterfaceStats domainInterfaceStats;
    virDrvDomainSetInterfaceParameters domainSetInterfaceParameters;
    virDrvDomainGetInterfaceParameters domainGetInterfaceParameters;
    virDrvDomainMemoryStats domainMemoryStats;
    virDrvDomainBlockPeek domainBlockPeek;
    virDrvDomainMemoryPeek domainMemoryPeek;
    virDrvDomainGetBlockInfo domainGetBlockInfo;
    virDrvNodeGetCPUStats nodeGetCPUStats;
    virDrvNodeGetMemoryStats nodeGetMemoryStats;
    virDrvNodeGetCellsFreeMemory nodeGetCellsFreeMemory;
    virDrvNodeGetFreeMemory nodeGetFreeMemory;
    virDrvConnectDomainEventRegister connectDomainEventRegister;
    virDrvConnectDomainEventDeregister connectDomainEventDeregister;
    virDrvDomainMigratePrepare2 domainMigratePrepare2;
    virDrvDomainMigrateFinish2 domainMigrateFinish2;
    virDrvNodeDeviceDettach nodeDeviceDettach;
1260
    virDrvNodeDeviceDetachFlags nodeDeviceDetachFlags;
1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274
    virDrvNodeDeviceReAttach nodeDeviceReAttach;
    virDrvNodeDeviceReset nodeDeviceReset;
    virDrvDomainMigratePrepareTunnel domainMigratePrepareTunnel;
    virDrvConnectIsEncrypted connectIsEncrypted;
    virDrvConnectIsSecure connectIsSecure;
    virDrvDomainIsActive domainIsActive;
    virDrvDomainIsPersistent domainIsPersistent;
    virDrvDomainIsUpdated domainIsUpdated;
    virDrvConnectCompareCPU connectCompareCPU;
    virDrvConnectBaselineCPU connectBaselineCPU;
    virDrvDomainGetJobInfo domainGetJobInfo;
    virDrvDomainGetJobStats domainGetJobStats;
    virDrvDomainAbortJob domainAbortJob;
    virDrvDomainMigrateSetMaxDowntime domainMigrateSetMaxDowntime;
1275 1276
    virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCache;
    virDrvDomainMigrateSetCompressionCache domainMigrateSetCompressionCache;
1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289
    virDrvDomainMigrateGetMaxSpeed domainMigrateGetMaxSpeed;
    virDrvDomainMigrateSetMaxSpeed domainMigrateSetMaxSpeed;
    virDrvConnectDomainEventRegisterAny connectDomainEventRegisterAny;
    virDrvConnectDomainEventDeregisterAny connectDomainEventDeregisterAny;
    virDrvDomainManagedSave domainManagedSave;
    virDrvDomainHasManagedSaveImage domainHasManagedSaveImage;
    virDrvDomainManagedSaveRemove domainManagedSaveRemove;
    virDrvDomainSnapshotCreateXML domainSnapshotCreateXML;
    virDrvDomainSnapshotGetXMLDesc domainSnapshotGetXMLDesc;
    virDrvDomainSnapshotNum domainSnapshotNum;
    virDrvDomainSnapshotListNames domainSnapshotListNames;
    virDrvDomainListAllSnapshots domainListAllSnapshots;
    virDrvDomainSnapshotNumChildren domainSnapshotNumChildren;
1290
    virDrvDomainSnapshotListChildrenNames domainSnapshotListChildrenNames;
1291
    virDrvDomainSnapshotListAllChildren domainSnapshotListAllChildren;
1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334
    virDrvDomainSnapshotLookupByName domainSnapshotLookupByName;
    virDrvDomainHasCurrentSnapshot domainHasCurrentSnapshot;
    virDrvDomainSnapshotGetParent domainSnapshotGetParent;
    virDrvDomainSnapshotCurrent domainSnapshotCurrent;
    virDrvDomainSnapshotIsCurrent domainSnapshotIsCurrent;
    virDrvDomainSnapshotHasMetadata domainSnapshotHasMetadata;
    virDrvDomainRevertToSnapshot domainRevertToSnapshot;
    virDrvDomainSnapshotDelete domainSnapshotDelete;
    virDrvDomainQemuMonitorCommand domainQemuMonitorCommand;
    virDrvDomainQemuAttach domainQemuAttach;
    virDrvDomainQemuAgentCommand domainQemuAgentCommand;
    virDrvDomainOpenConsole domainOpenConsole;
    virDrvDomainOpenChannel domainOpenChannel;
    virDrvDomainOpenGraphics domainOpenGraphics;
    virDrvDomainInjectNMI domainInjectNMI;
    virDrvDomainMigrateBegin3 domainMigrateBegin3;
    virDrvDomainMigratePrepare3 domainMigratePrepare3;
    virDrvDomainMigratePrepareTunnel3 domainMigratePrepareTunnel3;
    virDrvDomainMigratePerform3 domainMigratePerform3;
    virDrvDomainMigrateFinish3 domainMigrateFinish3;
    virDrvDomainMigrateConfirm3 domainMigrateConfirm3;
    virDrvDomainSendKey domainSendKey;
    virDrvDomainBlockJobAbort domainBlockJobAbort;
    virDrvDomainGetBlockJobInfo domainGetBlockJobInfo;
    virDrvDomainBlockJobSetSpeed domainBlockJobSetSpeed;
    virDrvDomainBlockPull domainBlockPull;
    virDrvDomainBlockRebase domainBlockRebase;
    virDrvDomainBlockCommit domainBlockCommit;
    virDrvConnectSetKeepAlive connectSetKeepAlive;
    virDrvConnectIsAlive connectIsAlive;
    virDrvNodeSuspendForDuration nodeSuspendForDuration;
    virDrvDomainSetBlockIoTune domainSetBlockIoTune;
    virDrvDomainGetBlockIoTune domainGetBlockIoTune;
    virDrvDomainGetCPUStats domainGetCPUStats;
    virDrvDomainGetDiskErrors domainGetDiskErrors;
    virDrvDomainSetMetadata domainSetMetadata;
    virDrvDomainGetMetadata domainGetMetadata;
    virDrvNodeGetMemoryParameters nodeGetMemoryParameters;
    virDrvNodeSetMemoryParameters nodeSetMemoryParameters;
    virDrvNodeGetCPUMap nodeGetCPUMap;
    virDrvDomainFSTrim domainFSTrim;
    virDrvDomainSendProcessSignal domainSendProcessSignal;
    virDrvDomainLxcOpenNamespace domainLxcOpenNamespace;
1335 1336 1337 1338 1339 1340
    virDrvDomainMigrateBegin3Params domainMigrateBegin3Params;
    virDrvDomainMigratePrepare3Params domainMigratePrepare3Params;
    virDrvDomainMigratePrepareTunnel3Params domainMigratePrepareTunnel3Params;
    virDrvDomainMigratePerform3Params domainMigratePerform3Params;
    virDrvDomainMigrateFinish3Params domainMigrateFinish3Params;
    virDrvDomainMigrateConfirm3Params domainMigrateConfirm3Params;
1341
    virDrvConnectGetCPUModelNames connectGetCPUModelNames;
1342 1343
};

1344 1345 1346 1347

typedef virDrvConnectOpen virDrvNetworkOpen;
typedef virDrvConnectClose virDrvNetworkClose;

1348
typedef int
1349 1350
(*virDrvConnectNumOfNetworks)(virConnectPtr conn);

1351
typedef int
1352 1353 1354 1355
(*virDrvConnectListNetworks)(virConnectPtr conn,
                             char **const names,
                             int maxnames);

1356
typedef int
1357 1358
(*virDrvConnectNumOfDefinedNetworks)(virConnectPtr conn);

1359
typedef int
1360 1361 1362 1363
(*virDrvConnectListDefinedNetworks)(virConnectPtr conn,
                                    char **const names,
                                    int maxnames);

1364
typedef int
1365 1366 1367 1368
(*virDrvConnectListAllNetworks)(virConnectPtr conn,
                                virNetworkPtr **nets,
                                unsigned int flags);

1369
typedef virNetworkPtr
1370 1371 1372
(*virDrvNetworkLookupByUUID)(virConnectPtr conn,
                             const unsigned char *uuid);

1373
typedef virNetworkPtr
1374 1375 1376
(*virDrvNetworkLookupByName)(virConnectPtr conn,
                             const char *name);

1377
typedef virNetworkPtr
1378 1379 1380
(*virDrvNetworkCreateXML)(virConnectPtr conn,
                          const char *xmlDesc);

1381
typedef virNetworkPtr
1382 1383 1384
(*virDrvNetworkDefineXML)(virConnectPtr conn,
                          const char *xml);

1385
typedef int
1386 1387
(*virDrvNetworkUndefine)(virNetworkPtr network);

1388
typedef int
1389 1390 1391 1392 1393 1394 1395
(*virDrvNetworkUpdate)(virNetworkPtr network,
                       unsigned int command, /* virNetworkUpdateCommand */
                       unsigned int section, /* virNetworkUpdateSection */
                       int parentIndex,
                       const char *xml,
                       unsigned int flags);

1396
typedef int
1397 1398
(*virDrvNetworkCreate)(virNetworkPtr network);

1399
typedef int
1400 1401
(*virDrvNetworkDestroy)(virNetworkPtr network);

1402
typedef char *
1403 1404 1405
(*virDrvNetworkGetXMLDesc)(virNetworkPtr network,
                           unsigned int flags);

1406
typedef char *
1407 1408
(*virDrvNetworkGetBridgeName)(virNetworkPtr network);

1409
typedef int
1410 1411 1412
(*virDrvNetworkGetAutostart)(virNetworkPtr network,
                             int *autostart);

1413
typedef int
1414 1415
(*virDrvNetworkSetAutostart)(virNetworkPtr network,
                             int autostart);
1416

1417
typedef int
1418 1419
(*virDrvNetworkIsActive)(virNetworkPtr net);

1420
typedef int
1421
(*virDrvNetworkIsPersistent)(virNetworkPtr net);
1422 1423


1424 1425 1426 1427 1428 1429 1430 1431 1432

typedef struct _virNetworkDriver virNetworkDriver;
typedef virNetworkDriver *virNetworkDriverPtr;

/**
 * _virNetworkDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
1433 1434 1435 1436
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
1437 1438
 */
struct _virNetworkDriver {
1439
    const char * name; /* the name of the driver */
1440 1441
    virDrvNetworkOpen networkOpen;
    virDrvNetworkClose networkClose;
1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460
    virDrvConnectNumOfNetworks connectNumOfNetworks;
    virDrvConnectListNetworks connectListNetworks;
    virDrvConnectNumOfDefinedNetworks connectNumOfDefinedNetworks;
    virDrvConnectListDefinedNetworks connectListDefinedNetworks;
    virDrvConnectListAllNetworks connectListAllNetworks;
    virDrvNetworkLookupByUUID networkLookupByUUID;
    virDrvNetworkLookupByName networkLookupByName;
    virDrvNetworkCreateXML networkCreateXML;
    virDrvNetworkDefineXML networkDefineXML;
    virDrvNetworkUndefine networkUndefine;
    virDrvNetworkUpdate networkUpdate;
    virDrvNetworkCreate networkCreate;
    virDrvNetworkDestroy networkDestroy;
    virDrvNetworkGetXMLDesc networkGetXMLDesc;
    virDrvNetworkGetBridgeName networkGetBridgeName;
    virDrvNetworkGetAutostart networkGetAutostart;
    virDrvNetworkSetAutostart networkSetAutostart;
    virDrvNetworkIsActive networkIsActive;
    virDrvNetworkIsPersistent networkIsPersistent;
1461 1462
};

1463

1464 1465 1466
typedef virDrvConnectOpen virDrvInterfaceOpen;
typedef virDrvConnectClose virDrvInterfaceClose;

D
Daniel Veillard 已提交
1467
typedef int
1468 1469
(*virDrvConnectNumOfInterfaces)(virConnectPtr conn);

D
Daniel Veillard 已提交
1470
typedef int
1471 1472 1473 1474
(*virDrvConnectListInterfaces)(virConnectPtr conn,
                               char **const names,
                               int maxnames);

1475
typedef int
1476 1477
(*virDrvConnectNumOfDefinedInterfaces)(virConnectPtr conn);

1478
typedef int
1479 1480 1481 1482
(*virDrvConnectListDefinedInterfaces)(virConnectPtr conn,
                                      char **const names,
                                      int maxnames);

1483
typedef int
1484 1485 1486 1487
(*virDrvConnectListAllInterfaces)(virConnectPtr conn,
                                  virInterfacePtr **ifaces,
                                  unsigned int flags);

D
Daniel Veillard 已提交
1488
typedef virInterfacePtr
1489 1490 1491
(*virDrvInterfaceLookupByName)(virConnectPtr conn,
                               const char *name);

D
Daniel Veillard 已提交
1492
typedef virInterfacePtr
1493 1494
(*virDrvInterfaceLookupByMACString)(virConnectPtr conn,
                                    const char *mac);
D
Daniel Veillard 已提交
1495 1496

typedef char *
1497 1498
(*virDrvInterfaceGetXMLDesc)(virInterfacePtr iface,
                             unsigned int flags);
D
Daniel Veillard 已提交
1499 1500

typedef virInterfacePtr
1501 1502 1503 1504
(*virDrvInterfaceDefineXML)(virConnectPtr conn,
                            const char *xmlDesc,
                            unsigned int flags);

D
Daniel Veillard 已提交
1505
typedef int
1506 1507
(*virDrvInterfaceUndefine)(virInterfacePtr iface);

D
Daniel Veillard 已提交
1508
typedef int
1509 1510 1511
(*virDrvInterfaceCreate)(virInterfacePtr iface,
                         unsigned int flags);

D
Daniel Veillard 已提交
1512
typedef int
1513 1514
(*virDrvInterfaceDestroy)(virInterfacePtr iface,
                          unsigned int flags);
D
Daniel Veillard 已提交
1515

1516
typedef int
1517
(*virDrvInterfaceIsActive)(virInterfacePtr iface);
1518

1519
typedef int
1520 1521 1522
(*virDrvInterfaceChangeBegin)(virConnectPtr conn,
                              unsigned int flags);

1523
typedef int
1524 1525 1526
(*virDrvInterfaceChangeCommit)(virConnectPtr conn,
                               unsigned int flags);

1527
typedef int
1528 1529
(*virDrvInterfaceChangeRollback)(virConnectPtr conn,
                                 unsigned int flags);
1530

D
Daniel Veillard 已提交
1531 1532 1533 1534 1535 1536
typedef struct _virInterfaceDriver virInterfaceDriver;
typedef virInterfaceDriver *virInterfaceDriverPtr;

/**
 * _virInterfaceDriver:
 *
1537
 * Structure associated to a network interface driver, defining the various
D
Daniel Veillard 已提交
1538 1539 1540 1541 1542 1543 1544
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virInterfaceDriver {
1545
    const char *name; /* the name of the driver */
1546 1547
    virDrvInterfaceOpen interfaceOpen;
    virDrvInterfaceClose interfaceClose;
1548 1549 1550 1551 1552 1553
    virDrvConnectNumOfInterfaces connectNumOfInterfaces;
    virDrvConnectListInterfaces connectListInterfaces;
    virDrvConnectNumOfDefinedInterfaces connectNumOfDefinedInterfaces;
    virDrvConnectListDefinedInterfaces connectListDefinedInterfaces;
    virDrvConnectListAllInterfaces connectListAllInterfaces;
    virDrvInterfaceLookupByName interfaceLookupByName;
D
Daniel Veillard 已提交
1554
    virDrvInterfaceLookupByMACString interfaceLookupByMACString;
1555 1556 1557 1558 1559 1560 1561 1562 1563
    virDrvInterfaceGetXMLDesc interfaceGetXMLDesc;
    virDrvInterfaceDefineXML interfaceDefineXML;
    virDrvInterfaceUndefine interfaceUndefine;
    virDrvInterfaceCreate interfaceCreate;
    virDrvInterfaceDestroy interfaceDestroy;
    virDrvInterfaceIsActive interfaceIsActive;
    virDrvInterfaceChangeBegin interfaceChangeBegin;
    virDrvInterfaceChangeCommit interfaceChangeCommit;
    virDrvInterfaceChangeRollback interfaceChangeRollback;
D
Daniel Veillard 已提交
1564 1565
};

1566

1567 1568 1569 1570
typedef virDrvConnectOpen virDrvStorageOpen;
typedef virDrvConnectClose virDrvStorageClose;


1571
typedef int
1572 1573
(*virDrvConnectNumOfStoragePools)(virConnectPtr conn);

1574
typedef int
1575 1576 1577 1578
(*virDrvConnectListStoragePools)(virConnectPtr conn,
                                 char **const names,
                                 int maxnames);

1579
typedef int
1580 1581
(*virDrvConnectNumOfDefinedStoragePools)(virConnectPtr conn);

1582
typedef int
1583 1584 1585 1586
(*virDrvConnectListDefinedStoragePools)(virConnectPtr conn,
                                        char **const names,
                                        int maxnames);

1587
typedef int
1588 1589 1590 1591
(*virDrvConnectListAllStoragePools)(virConnectPtr conn,
                                    virStoragePoolPtr **pools,
                                    unsigned int flags);

1592
typedef char *
1593 1594 1595 1596 1597
(*virDrvConnectFindStoragePoolSources)(virConnectPtr conn,
                                       const char *type,
                                       const char *srcSpec,
                                       unsigned int flags);

1598
typedef virStoragePoolPtr
1599 1600 1601
(*virDrvStoragePoolLookupByName)(virConnectPtr conn,
                                 const char *name);

1602
typedef virStoragePoolPtr
1603 1604 1605
(*virDrvStoragePoolLookupByUUID)(virConnectPtr conn,
                                 const unsigned char *uuid);

1606
typedef virStoragePoolPtr
1607 1608
(*virDrvStoragePoolLookupByVolume)(virStorageVolPtr vol);

1609
typedef virStoragePoolPtr
1610 1611 1612 1613
(*virDrvStoragePoolCreateXML)(virConnectPtr conn,
                              const char *xmlDesc,
                              unsigned int flags);

1614
typedef virStoragePoolPtr
1615 1616 1617 1618
(*virDrvStoragePoolDefineXML)(virConnectPtr conn,
                              const char *xmlDesc,
                              unsigned int flags);

1619
typedef int
1620 1621
(*virDrvStoragePoolUndefine)(virStoragePoolPtr pool);

1622
typedef int
1623 1624 1625
(*virDrvStoragePoolBuild)(virStoragePoolPtr pool,
                          unsigned int flags);

1626
typedef int
1627 1628 1629
(*virDrvStoragePoolCreate)(virStoragePoolPtr pool,
                           unsigned int flags);

1630
typedef int
1631 1632
(*virDrvStoragePoolDestroy)(virStoragePoolPtr pool);

1633
typedef int
1634 1635 1636
(*virDrvStoragePoolDelete)(virStoragePoolPtr pool,
                           unsigned int flags);

1637
typedef int
1638 1639 1640
(*virDrvStoragePoolRefresh)(virStoragePoolPtr pool,
                            unsigned int flags);

1641
typedef int
1642 1643 1644
(*virDrvStoragePoolGetInfo)(virStoragePoolPtr vol,
                            virStoragePoolInfoPtr info);

1645
typedef char *
1646 1647 1648
(*virDrvStoragePoolGetXMLDesc)(virStoragePoolPtr pool,
                               unsigned int flags);

1649
typedef int
1650 1651 1652
(*virDrvStoragePoolGetAutostart)(virStoragePoolPtr pool,
                                 int *autostart);

1653
typedef int
1654 1655 1656
(*virDrvStoragePoolSetAutostart)(virStoragePoolPtr pool,
                                 int autostart);

1657
typedef int
1658 1659
(*virDrvStoragePoolNumOfVolumes)(virStoragePoolPtr pool);

1660
typedef int
1661 1662 1663 1664
(*virDrvStoragePoolListVolumes)(virStoragePoolPtr pool,
                                char **const names,
                                int maxnames);

1665
typedef int
1666 1667 1668
(*virDrvStoragePoolListAllVolumes)(virStoragePoolPtr pool,
                                   virStorageVolPtr **vols,
                                   unsigned int flags);
1669 1670

typedef virStorageVolPtr
1671 1672 1673
(*virDrvStorageVolLookupByName)(virStoragePoolPtr pool,
                                const char *name);

1674
typedef virStorageVolPtr
1675 1676
(*virDrvStorageVolLookupByKey)(virConnectPtr pool,
                               const char *key);
1677

1678 1679 1680
typedef virStorageVolPtr
(*virDrvStorageVolLookupByPath)(virConnectPtr pool,
                                const char *path);
1681 1682

typedef virStorageVolPtr
1683 1684 1685 1686
(*virDrvStorageVolCreateXML)(virStoragePoolPtr pool,
                             const char *xmldesc,
                             unsigned int flags);

1687
typedef int
1688 1689
(*virDrvStorageVolDelete)(virStorageVolPtr vol,
                          unsigned int flags);
1690

1691
typedef int
1692 1693 1694
(*virDrvStorageVolWipe)(virStorageVolPtr vol,
                        unsigned int flags);

1695
typedef int
1696 1697 1698
(*virDrvStorageVolWipePattern)(virStorageVolPtr vol,
                               unsigned int algorithm,
                               unsigned int flags);
1699

1700
typedef int
1701 1702 1703
(*virDrvStorageVolGetInfo)(virStorageVolPtr vol,
                           virStorageVolInfoPtr info);

1704
typedef char *
1705 1706 1707
(*virDrvStorageVolGetXMLDesc)(virStorageVolPtr pool,
                              unsigned int flags);

1708
typedef char *
1709
(*virDrvStorageVolGetPath)(virStorageVolPtr vol);
1710

1711
typedef virStorageVolPtr
1712 1713 1714
(*virDrvStorageVolCreateXMLFrom)(virStoragePoolPtr pool,
                                 const char *xmldesc,
                                 virStorageVolPtr clonevol,
1715
                                 unsigned int flags);
1716

1717
typedef int
1718 1719 1720 1721 1722 1723
(*virDrvStorageVolDownload)(virStorageVolPtr vol,
                            virStreamPtr stream,
                            unsigned long long offset,
                            unsigned long long length,
                            unsigned int flags);

1724
typedef int
1725 1726 1727 1728 1729
(*virDrvStorageVolUpload)(virStorageVolPtr vol,
                          virStreamPtr stream,
                          unsigned long long offset,
                          unsigned long long length,
                          unsigned int flags);
1730

1731
typedef int
1732 1733 1734 1735
(*virDrvStorageVolResize)(virStorageVolPtr vol,
                          unsigned long long capacity,
                          unsigned int flags);

1736
typedef int
1737 1738 1739 1740
(*virDrvStoragePoolIsActive)(virStoragePoolPtr pool);

typedef int
(*virDrvStoragePoolIsPersistent)(virStoragePoolPtr pool);
1741 1742


1743 1744 1745 1746 1747 1748 1749

typedef struct _virStorageDriver virStorageDriver;
typedef virStorageDriver *virStorageDriverPtr;

/**
 * _virStorageDriver:
 *
1750
 * Structure associated to a storage driver, defining the various
1751 1752 1753 1754 1755 1756 1757
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virStorageDriver {
1758
    const char * name; /* the name of the driver */
1759 1760
    virDrvStorageOpen storageOpen;
    virDrvStorageClose storageClose;
1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800
    virDrvConnectNumOfStoragePools connectNumOfStoragePools;
    virDrvConnectListStoragePools connectListStoragePools;
    virDrvConnectNumOfDefinedStoragePools connectNumOfDefinedStoragePools;
    virDrvConnectListDefinedStoragePools connectListDefinedStoragePools;
    virDrvConnectListAllStoragePools connectListAllStoragePools;
    virDrvConnectFindStoragePoolSources connectFindStoragePoolSources;
    virDrvStoragePoolLookupByName storagePoolLookupByName;
    virDrvStoragePoolLookupByUUID storagePoolLookupByUUID;
    virDrvStoragePoolLookupByVolume storagePoolLookupByVolume;
    virDrvStoragePoolCreateXML storagePoolCreateXML;
    virDrvStoragePoolDefineXML storagePoolDefineXML;
    virDrvStoragePoolBuild storagePoolBuild;
    virDrvStoragePoolUndefine storagePoolUndefine;
    virDrvStoragePoolCreate storagePoolCreate;
    virDrvStoragePoolDestroy storagePoolDestroy;
    virDrvStoragePoolDelete storagePoolDelete;
    virDrvStoragePoolRefresh storagePoolRefresh;
    virDrvStoragePoolGetInfo storagePoolGetInfo;
    virDrvStoragePoolGetXMLDesc storagePoolGetXMLDesc;
    virDrvStoragePoolGetAutostart storagePoolGetAutostart;
    virDrvStoragePoolSetAutostart storagePoolSetAutostart;
    virDrvStoragePoolNumOfVolumes storagePoolNumOfVolumes;
    virDrvStoragePoolListVolumes storagePoolListVolumes;
    virDrvStoragePoolListAllVolumes storagePoolListAllVolumes;
    virDrvStorageVolLookupByName storageVolLookupByName;
    virDrvStorageVolLookupByKey storageVolLookupByKey;
    virDrvStorageVolLookupByPath storageVolLookupByPath;
    virDrvStorageVolCreateXML storageVolCreateXML;
    virDrvStorageVolCreateXMLFrom storageVolCreateXMLFrom;
    virDrvStorageVolDownload storageVolDownload;
    virDrvStorageVolUpload storageVolUpload;
    virDrvStorageVolDelete storageVolDelete;
    virDrvStorageVolWipe storageVolWipe;
    virDrvStorageVolWipePattern storageVolWipePattern;
    virDrvStorageVolGetInfo storageVolGetInfo;
    virDrvStorageVolGetXMLDesc storageVolGetXMLDesc;
    virDrvStorageVolGetPath storageVolGetPath;
    virDrvStorageVolResize storageVolResize;
    virDrvStoragePoolIsActive storagePoolIsActive;
    virDrvStoragePoolIsPersistent storagePoolIsPersistent;
1801 1802
};

1803
# ifdef WITH_LIBVIRTD
1804

1805 1806 1807 1808 1809
typedef int
(*virDrvStateInitialize)(bool privileged,
                         virStateInhibitCallback callback,
                         void *opaque);

1810 1811 1812
typedef void
(*virDrvStateAutoStart)(void);

1813 1814 1815 1816 1817 1818 1819 1820
typedef int
(*virDrvStateCleanup)(void);

typedef int
(*virDrvStateReload)(void);

typedef int
(*virDrvStateStop)(void);
1821 1822 1823 1824 1825

typedef struct _virStateDriver virStateDriver;
typedef virStateDriver *virStateDriverPtr;

struct _virStateDriver {
1826
    const char *name;
1827
    virDrvStateInitialize stateInitialize;
1828
    virDrvStateAutoStart stateAutoStart;
1829 1830 1831
    virDrvStateCleanup stateCleanup;
    virDrvStateReload stateReload;
    virDrvStateStop stateStop;
1832
};
1833
# endif
1834

1835

1836 1837 1838 1839
typedef virDrvConnectOpen virDrvNodeDeviceOpen;
typedef virDrvConnectClose virDrvNodeDeviceClose;


1840 1841 1842 1843
typedef int
(*virDrvNodeNumOfDevices)(virConnectPtr conn,
                          const char *cap,
                          unsigned int flags);
1844

1845 1846 1847 1848 1849 1850
typedef int
(*virDrvNodeListDevices)(virConnectPtr conn,
                         const char *cap,
                         char **const names,
                         int maxnames,
                         unsigned int flags);
1851

1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869
typedef int
(*virDrvConnectListAllNodeDevices)(virConnectPtr conn,
                                   virNodeDevicePtr **devices,
                                   unsigned int flags);

typedef virNodeDevicePtr
(*virDrvNodeDeviceLookupByName)(virConnectPtr conn,
                                const char *name);

typedef virNodeDevicePtr
(*virDrvNodeDeviceLookupSCSIHostByWWN)(virConnectPtr conn,
                                       const char *wwnn,
                                       const char *wwpn,
                                       unsigned int flags);

typedef char *
(*virDrvNodeDeviceGetXMLDesc)(virNodeDevicePtr dev,
                              unsigned int flags);
1870

1871 1872
typedef char *
(*virDrvNodeDeviceGetParent)(virNodeDevicePtr dev);
1873

1874 1875
typedef int
(*virDrvNodeDeviceNumOfCaps)(virNodeDevicePtr dev);
1876

1877 1878 1879 1880
typedef int
(*virDrvNodeDeviceListCaps)(virNodeDevicePtr dev,
                            char **const names,
                            int maxnames);
1881

1882 1883 1884 1885
typedef virNodeDevicePtr
(*virDrvNodeDeviceCreateXML)(virConnectPtr conn,
                             const char *xmlDesc,
                             unsigned int flags);
1886

1887 1888
typedef int
(*virDrvNodeDeviceDestroy)(virNodeDevicePtr dev);
1889 1890


1891

1892 1893
typedef struct _virNodeDeviceDriver virNodeDeviceDriver;
typedef virNodeDeviceDriver *virNodeDeviceDriverPtr;
1894

1895
/**
1896
 * _virNodeDeviceDriver:
1897 1898 1899 1900 1901
 *
 * Structure associated with monitoring the devices
 * on a virtualized node.
 *
 */
1902
struct _virNodeDeviceDriver {
1903
    const char * name; /* the name of the driver */
1904 1905
    virDrvNodeDeviceOpen nodeDeviceOpen;
    virDrvNodeDeviceClose nodeDeviceClose;
1906 1907
    virDrvNodeNumOfDevices nodeNumOfDevices;
    virDrvNodeListDevices nodeListDevices;
1908 1909
    virDrvConnectListAllNodeDevices connectListAllNodeDevices;
    virDrvNodeDeviceLookupByName nodeDeviceLookupByName;
1910 1911 1912 1913 1914 1915 1916
    virDrvNodeDeviceLookupSCSIHostByWWN nodeDeviceLookupSCSIHostByWWN;
    virDrvNodeDeviceGetXMLDesc nodeDeviceGetXMLDesc;
    virDrvNodeDeviceGetParent nodeDeviceGetParent;
    virDrvNodeDeviceNumOfCaps nodeDeviceNumOfCaps;
    virDrvNodeDeviceListCaps nodeDeviceListCaps;
    virDrvNodeDeviceCreateXML nodeDeviceCreateXML;
    virDrvNodeDeviceDestroy nodeDeviceDestroy;
1917 1918
};

1919 1920
enum {
    /* This getValue call is inside libvirt, override the "private" flag.
E
Eric Blake 已提交
1921
       This flag cannot be set by outside callers. */
1922
    VIR_SECRET_GET_VALUE_INTERNAL_CALL = 1 << 0,
1923 1924
};

1925 1926 1927 1928
typedef virDrvConnectOpen virDrvSecretOpen;
typedef virDrvConnectClose virDrvSecretClose;


1929
typedef virSecretPtr
1930 1931 1932
(*virDrvSecretLookupByUUID)(virConnectPtr conn,
                            const unsigned char *uuid);

1933
typedef virSecretPtr
1934 1935 1936 1937
(*virDrvSecretLookupByUsage)(virConnectPtr conn,
                             int usageType,
                             const char *usageID);

1938
typedef virSecretPtr
1939 1940 1941 1942
(*virDrvSecretDefineXML)(virConnectPtr conn,
                         const char *xml,
                         unsigned int flags);

1943
typedef char *
1944 1945 1946
(*virDrvSecretGetXMLDesc)(virSecretPtr secret,
                          unsigned int flags);

1947
typedef int
1948 1949 1950 1951 1952
(*virDrvSecretSetValue)(virSecretPtr secret,
                        const unsigned char *value,
                        size_t value_size,
                        unsigned int flags);

1953
typedef unsigned char *
1954 1955 1956 1957 1958
(*virDrvSecretGetValue)(virSecretPtr secret,
                        size_t *value_size,
                        unsigned int flags,
                        unsigned int internalFlags);

1959
typedef int
1960 1961
(*virDrvSecretUndefine)(virSecretPtr secret);

1962
typedef int
1963 1964
(*virDrvConnectNumOfSecrets)(virConnectPtr conn);

1965
typedef int
1966 1967 1968 1969
(*virDrvConnectListSecrets)(virConnectPtr conn,
                            char **uuids,
                            int maxuuids);

1970
typedef int
1971 1972 1973
(*virDrvConnectListAllSecrets)(virConnectPtr conn,
                               virSecretPtr **secrets,
                               unsigned int flags);
1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989

typedef struct _virSecretDriver virSecretDriver;
typedef virSecretDriver *virSecretDriverPtr;

/**
 * _virSecretDriver:
 *
 * Structure associated to a driver for storing secrets, defining the various
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virSecretDriver {
    const char *name;
1990 1991
    virDrvSecretOpen secretOpen;
    virDrvSecretClose secretClose;
1992 1993 1994 1995 1996 1997 1998 1999 2000 2001
    virDrvConnectNumOfSecrets connectNumOfSecrets;
    virDrvConnectListSecrets connectListSecrets;
    virDrvConnectListAllSecrets connectListAllSecrets;
    virDrvSecretLookupByUUID secretLookupByUUID;
    virDrvSecretLookupByUsage secretLookupByUsage;
    virDrvSecretDefineXML secretDefineXML;
    virDrvSecretGetXMLDesc secretGetXMLDesc;
    virDrvSecretSetValue secretSetValue;
    virDrvSecretGetValue secretGetValue;
    virDrvSecretUndefine secretUndefine;
2002 2003
};

2004

2005 2006 2007 2008
typedef int
(*virDrvStreamSend)(virStreamPtr st,
                    const char *data,
                    size_t nbytes);
2009

2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027
typedef int
(*virDrvStreamRecv)(virStreamPtr st,
                    char *data,
                    size_t nbytes);

typedef int
(*virDrvStreamEventAddCallback)(virStreamPtr stream,
                                int events,
                                virStreamEventCallback cb,
                                void *opaque,
                                virFreeCallback ff);

typedef int
(*virDrvStreamEventUpdateCallback)(virStreamPtr stream,
                                   int events);

typedef int
(*virDrvStreamEventRemoveCallback)(virStreamPtr stream);
2028

2029 2030
typedef int
(*virDrvStreamFinish)(virStreamPtr st);
2031

2032 2033
typedef int
(*virDrvStreamAbort)(virStreamPtr st);
2034

2035 2036
typedef struct _virStreamDriver virStreamDriver;
typedef virStreamDriver *virStreamDriverPtr;
2037 2038

struct _virStreamDriver {
2039 2040 2041
    virDrvStreamSend streamSend;
    virDrvStreamRecv streamRecv;
    virDrvStreamEventAddCallback streamEventAddCallback;
2042 2043
    virDrvStreamEventUpdateCallback streamEventUpdateCallback;
    virDrvStreamEventRemoveCallback streamEventRemoveCallback;
2044 2045
    virDrvStreamFinish streamFinish;
    virDrvStreamAbort streamAbort;
2046 2047 2048
};


2049 2050 2051 2052
typedef virDrvConnectOpen virDrvNWFilterOpen;
typedef virDrvConnectClose virDrvNWFilterClose;


S
Stefan Berger 已提交
2053
typedef int
2054 2055
(*virDrvConnectNumOfNWFilters)(virConnectPtr conn);

S
Stefan Berger 已提交
2056
typedef int
2057 2058 2059 2060
(*virDrvConnectListNWFilters)(virConnectPtr conn,
                              char **const names,
                              int maxnames);

2061
typedef int
2062 2063 2064 2065
(*virDrvConnectListAllNWFilters)(virConnectPtr conn,
                                 virNWFilterPtr **filters,
                                 unsigned int flags);

S
Stefan Berger 已提交
2066
typedef virNWFilterPtr
2067 2068 2069
(*virDrvNWFilterLookupByName)(virConnectPtr conn,
                              const char *name);

S
Stefan Berger 已提交
2070
typedef virNWFilterPtr
2071 2072 2073
(*virDrvNWFilterLookupByUUID)(virConnectPtr conn,
                              const unsigned char *uuid);

S
Stefan Berger 已提交
2074
typedef virNWFilterPtr
2075 2076 2077
(*virDrvNWFilterDefineXML)(virConnectPtr conn,
                           const char *xmlDesc);

S
Stefan Berger 已提交
2078
typedef int
2079
(*virDrvNWFilterUndefine)(virNWFilterPtr nwfilter);
S
Stefan Berger 已提交
2080 2081

typedef char *
2082 2083
(*virDrvNWFilterGetXMLDesc)(virNWFilterPtr nwfilter,
                            unsigned int flags);
S
Stefan Berger 已提交
2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099


typedef struct _virNWFilterDriver virNWFilterDriver;
typedef virNWFilterDriver *virNWFilterDriverPtr;

/**
 * _virNWFilterDriver:
 *
 * Structure associated to a network filter driver, defining the various
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virNWFilterDriver {
2100
    const char * name; /* the name of the driver */
2101 2102
    virDrvNWFilterOpen nwfilterOpen;
    virDrvNWFilterClose nwfilterClose;
2103
    virDrvConnectNumOfNWFilters connectNumOfNWFilters;
2104 2105 2106 2107 2108 2109 2110
    virDrvConnectListNWFilters connectListNWFilters;
    virDrvConnectListAllNWFilters connectListAllNWFilters;
    virDrvNWFilterLookupByName nwfilterLookupByName;
    virDrvNWFilterLookupByUUID nwfilterLookupByUUID;
    virDrvNWFilterDefineXML nwfilterDefineXML;
    virDrvNWFilterUndefine nwfilterUndefine;
    virDrvNWFilterGetXMLDesc nwfilterGetXMLDesc;
S
Stefan Berger 已提交
2111 2112 2113
};


2114 2115 2116 2117 2118 2119
/*
 * Registration
 * TODO: also need ways to (des)activate a given driver
 *       lookup based on the URI given in a virConnectOpen(ReadOnly)
 */
int virRegisterDriver(virDriverPtr);
2120
int virRegisterNetworkDriver(virNetworkDriverPtr);
D
Daniel Veillard 已提交
2121
int virRegisterInterfaceDriver(virInterfaceDriverPtr);
2122
int virRegisterStorageDriver(virStorageDriverPtr);
2123
int virRegisterNodeDeviceDriver(virNodeDeviceDriverPtr);
2124
int virRegisterSecretDriver(virSecretDriverPtr);
S
Stefan Berger 已提交
2125
int virRegisterNWFilterDriver(virNWFilterDriverPtr);
2126
# ifdef WITH_LIBVIRTD
2127
int virRegisterStateDriver(virStateDriverPtr);
2128
# endif
2129
void virDriverModuleInitialize(const char *defmoddir);
2130
void *virDriverLoadModule(const char *name);
2131 2132

#endif /* __VIR_DRIVER_H__ */