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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

D
Daniel Veillard 已提交
614
typedef int
615 616 617 618 619 620 621 622 623
(*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 已提交
624 625

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

880
typedef char *
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 926
(*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);
927

928
typedef virDomainPtr
929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951
(*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);
952 953

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 1131
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);

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

1135 1136 1137 1138 1139
/**
 * _virDriver:
 *
 * Structure associated to a virtualization driver, defining the various
 * entry points for it.
1140 1141 1142 1143 1144 1145
 *
 * All drivers must support the following fields/methods:
 *  - no
 *  - name
 *  - open
 *  - close
1146 1147
 */
struct _virDriver {
1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164
    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;
1165
    virDrvDomainCreateXMLWithFiles domainCreateXMLWithFiles;
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184
    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;
1185
    virDrvDomainSetMemoryStatsPeriod domainSetMemoryStatsPeriod;
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 1222
    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;
1223
    virDrvDomainCreateWithFiles domainCreateWithFiles;
1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
    virDrvDomainDefineXML domainDefineXML;
    virDrvDomainUndefine domainUndefine;
    virDrvDomainUndefineFlags domainUndefineFlags;
    virDrvDomainAttachDevice domainAttachDevice;
    virDrvDomainAttachDeviceFlags domainAttachDeviceFlags;
    virDrvDomainDetachDevice domainDetachDevice;
    virDrvDomainDetachDeviceFlags domainDetachDeviceFlags;
    virDrvDomainUpdateDeviceFlags domainUpdateDeviceFlags;
    virDrvDomainGetAutostart domainGetAutostart;
    virDrvDomainSetAutostart domainSetAutostart;
    virDrvDomainGetSchedulerType domainGetSchedulerType;
    virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
1236
    virDrvDomainGetSchedulerParametersFlags domainGetSchedulerParametersFlags;
1237
    virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
1238
    virDrvDomainSetSchedulerParametersFlags domainSetSchedulerParametersFlags;
1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260
    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;
1261
    virDrvNodeDeviceDetachFlags nodeDeviceDetachFlags;
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275
    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;
1276 1277
    virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCache;
    virDrvDomainMigrateSetCompressionCache domainMigrateSetCompressionCache;
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290
    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;
1291
    virDrvDomainSnapshotListChildrenNames domainSnapshotListChildrenNames;
1292
    virDrvDomainSnapshotListAllChildren domainSnapshotListAllChildren;
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 1335
    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;
1336 1337 1338 1339 1340 1341
    virDrvDomainMigrateBegin3Params domainMigrateBegin3Params;
    virDrvDomainMigratePrepare3Params domainMigratePrepare3Params;
    virDrvDomainMigratePrepareTunnel3Params domainMigratePrepareTunnel3Params;
    virDrvDomainMigratePerform3Params domainMigratePerform3Params;
    virDrvDomainMigrateFinish3Params domainMigrateFinish3Params;
    virDrvDomainMigrateConfirm3Params domainMigrateConfirm3Params;
1342
    virDrvConnectGetCPUModelNames connectGetCPUModelNames;
1343 1344
};

1345 1346 1347 1348

typedef virDrvConnectOpen virDrvNetworkOpen;
typedef virDrvConnectClose virDrvNetworkClose;

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

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

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

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

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

1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381
typedef int
(*virDrvConnectNetworkEventRegisterAny)(virConnectPtr conn,
                                        virNetworkPtr dom,
                                        int eventID,
                                        virConnectNetworkEventGenericCallback cb,
                                        void *opaque,
                                        virFreeCallback freecb);

typedef int
(*virDrvConnectNetworkEventDeregisterAny)(virConnectPtr conn,
                                          int callbackID);

1382
typedef virNetworkPtr
1383 1384 1385
(*virDrvNetworkLookupByUUID)(virConnectPtr conn,
                             const unsigned char *uuid);

1386
typedef virNetworkPtr
1387 1388 1389
(*virDrvNetworkLookupByName)(virConnectPtr conn,
                             const char *name);

1390
typedef virNetworkPtr
1391 1392 1393
(*virDrvNetworkCreateXML)(virConnectPtr conn,
                          const char *xmlDesc);

1394
typedef virNetworkPtr
1395 1396 1397
(*virDrvNetworkDefineXML)(virConnectPtr conn,
                          const char *xml);

1398
typedef int
1399 1400
(*virDrvNetworkUndefine)(virNetworkPtr network);

1401
typedef int
1402 1403 1404 1405 1406 1407 1408
(*virDrvNetworkUpdate)(virNetworkPtr network,
                       unsigned int command, /* virNetworkUpdateCommand */
                       unsigned int section, /* virNetworkUpdateSection */
                       int parentIndex,
                       const char *xml,
                       unsigned int flags);

1409
typedef int
1410 1411
(*virDrvNetworkCreate)(virNetworkPtr network);

1412
typedef int
1413 1414
(*virDrvNetworkDestroy)(virNetworkPtr network);

1415
typedef char *
1416 1417 1418
(*virDrvNetworkGetXMLDesc)(virNetworkPtr network,
                           unsigned int flags);

1419
typedef char *
1420 1421
(*virDrvNetworkGetBridgeName)(virNetworkPtr network);

1422
typedef int
1423 1424 1425
(*virDrvNetworkGetAutostart)(virNetworkPtr network,
                             int *autostart);

1426
typedef int
1427 1428
(*virDrvNetworkSetAutostart)(virNetworkPtr network,
                             int autostart);
1429

1430
typedef int
1431 1432
(*virDrvNetworkIsActive)(virNetworkPtr net);

1433
typedef int
1434
(*virDrvNetworkIsPersistent)(virNetworkPtr net);
1435 1436


1437 1438 1439 1440 1441 1442 1443 1444 1445

typedef struct _virNetworkDriver virNetworkDriver;
typedef virNetworkDriver *virNetworkDriverPtr;

/**
 * _virNetworkDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
1446 1447 1448 1449
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
1450 1451
 */
struct _virNetworkDriver {
1452
    const char * name; /* the name of the driver */
1453 1454
    virDrvNetworkOpen networkOpen;
    virDrvNetworkClose networkClose;
1455 1456 1457 1458 1459
    virDrvConnectNumOfNetworks connectNumOfNetworks;
    virDrvConnectListNetworks connectListNetworks;
    virDrvConnectNumOfDefinedNetworks connectNumOfDefinedNetworks;
    virDrvConnectListDefinedNetworks connectListDefinedNetworks;
    virDrvConnectListAllNetworks connectListAllNetworks;
1460 1461
    virDrvConnectNetworkEventRegisterAny connectNetworkEventRegisterAny;
    virDrvConnectNetworkEventDeregisterAny connectNetworkEventDeregisterAny;
1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475
    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;
1476 1477
};

1478

1479 1480 1481
typedef virDrvConnectOpen virDrvInterfaceOpen;
typedef virDrvConnectClose virDrvInterfaceClose;

D
Daniel Veillard 已提交
1482
typedef int
1483 1484
(*virDrvConnectNumOfInterfaces)(virConnectPtr conn);

D
Daniel Veillard 已提交
1485
typedef int
1486 1487 1488 1489
(*virDrvConnectListInterfaces)(virConnectPtr conn,
                               char **const names,
                               int maxnames);

1490
typedef int
1491 1492
(*virDrvConnectNumOfDefinedInterfaces)(virConnectPtr conn);

1493
typedef int
1494 1495 1496 1497
(*virDrvConnectListDefinedInterfaces)(virConnectPtr conn,
                                      char **const names,
                                      int maxnames);

1498
typedef int
1499 1500 1501 1502
(*virDrvConnectListAllInterfaces)(virConnectPtr conn,
                                  virInterfacePtr **ifaces,
                                  unsigned int flags);

D
Daniel Veillard 已提交
1503
typedef virInterfacePtr
1504 1505 1506
(*virDrvInterfaceLookupByName)(virConnectPtr conn,
                               const char *name);

D
Daniel Veillard 已提交
1507
typedef virInterfacePtr
1508 1509
(*virDrvInterfaceLookupByMACString)(virConnectPtr conn,
                                    const char *mac);
D
Daniel Veillard 已提交
1510 1511

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

typedef virInterfacePtr
1516 1517 1518 1519
(*virDrvInterfaceDefineXML)(virConnectPtr conn,
                            const char *xmlDesc,
                            unsigned int flags);

D
Daniel Veillard 已提交
1520
typedef int
1521 1522
(*virDrvInterfaceUndefine)(virInterfacePtr iface);

D
Daniel Veillard 已提交
1523
typedef int
1524 1525 1526
(*virDrvInterfaceCreate)(virInterfacePtr iface,
                         unsigned int flags);

D
Daniel Veillard 已提交
1527
typedef int
1528 1529
(*virDrvInterfaceDestroy)(virInterfacePtr iface,
                          unsigned int flags);
D
Daniel Veillard 已提交
1530

1531
typedef int
1532
(*virDrvInterfaceIsActive)(virInterfacePtr iface);
1533

1534
typedef int
1535 1536 1537
(*virDrvInterfaceChangeBegin)(virConnectPtr conn,
                              unsigned int flags);

1538
typedef int
1539 1540 1541
(*virDrvInterfaceChangeCommit)(virConnectPtr conn,
                               unsigned int flags);

1542
typedef int
1543 1544
(*virDrvInterfaceChangeRollback)(virConnectPtr conn,
                                 unsigned int flags);
1545

D
Daniel Veillard 已提交
1546 1547 1548 1549 1550 1551
typedef struct _virInterfaceDriver virInterfaceDriver;
typedef virInterfaceDriver *virInterfaceDriverPtr;

/**
 * _virInterfaceDriver:
 *
1552
 * Structure associated to a network interface driver, defining the various
D
Daniel Veillard 已提交
1553 1554 1555 1556 1557 1558 1559
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virInterfaceDriver {
1560
    const char *name; /* the name of the driver */
1561 1562
    virDrvInterfaceOpen interfaceOpen;
    virDrvInterfaceClose interfaceClose;
1563 1564 1565 1566 1567 1568
    virDrvConnectNumOfInterfaces connectNumOfInterfaces;
    virDrvConnectListInterfaces connectListInterfaces;
    virDrvConnectNumOfDefinedInterfaces connectNumOfDefinedInterfaces;
    virDrvConnectListDefinedInterfaces connectListDefinedInterfaces;
    virDrvConnectListAllInterfaces connectListAllInterfaces;
    virDrvInterfaceLookupByName interfaceLookupByName;
D
Daniel Veillard 已提交
1569
    virDrvInterfaceLookupByMACString interfaceLookupByMACString;
1570 1571 1572 1573 1574 1575 1576 1577 1578
    virDrvInterfaceGetXMLDesc interfaceGetXMLDesc;
    virDrvInterfaceDefineXML interfaceDefineXML;
    virDrvInterfaceUndefine interfaceUndefine;
    virDrvInterfaceCreate interfaceCreate;
    virDrvInterfaceDestroy interfaceDestroy;
    virDrvInterfaceIsActive interfaceIsActive;
    virDrvInterfaceChangeBegin interfaceChangeBegin;
    virDrvInterfaceChangeCommit interfaceChangeCommit;
    virDrvInterfaceChangeRollback interfaceChangeRollback;
D
Daniel Veillard 已提交
1579 1580
};

1581

1582 1583 1584 1585
typedef virDrvConnectOpen virDrvStorageOpen;
typedef virDrvConnectClose virDrvStorageClose;


1586
typedef int
1587 1588
(*virDrvConnectNumOfStoragePools)(virConnectPtr conn);

1589
typedef int
1590 1591 1592 1593
(*virDrvConnectListStoragePools)(virConnectPtr conn,
                                 char **const names,
                                 int maxnames);

1594
typedef int
1595 1596
(*virDrvConnectNumOfDefinedStoragePools)(virConnectPtr conn);

1597
typedef int
1598 1599 1600 1601
(*virDrvConnectListDefinedStoragePools)(virConnectPtr conn,
                                        char **const names,
                                        int maxnames);

1602
typedef int
1603 1604 1605 1606
(*virDrvConnectListAllStoragePools)(virConnectPtr conn,
                                    virStoragePoolPtr **pools,
                                    unsigned int flags);

1607
typedef char *
1608 1609 1610 1611 1612
(*virDrvConnectFindStoragePoolSources)(virConnectPtr conn,
                                       const char *type,
                                       const char *srcSpec,
                                       unsigned int flags);

1613
typedef virStoragePoolPtr
1614 1615 1616
(*virDrvStoragePoolLookupByName)(virConnectPtr conn,
                                 const char *name);

1617
typedef virStoragePoolPtr
1618 1619 1620
(*virDrvStoragePoolLookupByUUID)(virConnectPtr conn,
                                 const unsigned char *uuid);

1621
typedef virStoragePoolPtr
1622 1623
(*virDrvStoragePoolLookupByVolume)(virStorageVolPtr vol);

1624
typedef virStoragePoolPtr
1625 1626 1627 1628
(*virDrvStoragePoolCreateXML)(virConnectPtr conn,
                              const char *xmlDesc,
                              unsigned int flags);

1629
typedef virStoragePoolPtr
1630 1631 1632 1633
(*virDrvStoragePoolDefineXML)(virConnectPtr conn,
                              const char *xmlDesc,
                              unsigned int flags);

1634
typedef int
1635 1636
(*virDrvStoragePoolUndefine)(virStoragePoolPtr pool);

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

1641
typedef int
1642 1643 1644
(*virDrvStoragePoolCreate)(virStoragePoolPtr pool,
                           unsigned int flags);

1645
typedef int
1646 1647
(*virDrvStoragePoolDestroy)(virStoragePoolPtr pool);

1648
typedef int
1649 1650 1651
(*virDrvStoragePoolDelete)(virStoragePoolPtr pool,
                           unsigned int flags);

1652
typedef int
1653 1654 1655
(*virDrvStoragePoolRefresh)(virStoragePoolPtr pool,
                            unsigned int flags);

1656
typedef int
1657 1658 1659
(*virDrvStoragePoolGetInfo)(virStoragePoolPtr vol,
                            virStoragePoolInfoPtr info);

1660
typedef char *
1661 1662 1663
(*virDrvStoragePoolGetXMLDesc)(virStoragePoolPtr pool,
                               unsigned int flags);

1664
typedef int
1665 1666 1667
(*virDrvStoragePoolGetAutostart)(virStoragePoolPtr pool,
                                 int *autostart);

1668
typedef int
1669 1670 1671
(*virDrvStoragePoolSetAutostart)(virStoragePoolPtr pool,
                                 int autostart);

1672
typedef int
1673 1674
(*virDrvStoragePoolNumOfVolumes)(virStoragePoolPtr pool);

1675
typedef int
1676 1677 1678 1679
(*virDrvStoragePoolListVolumes)(virStoragePoolPtr pool,
                                char **const names,
                                int maxnames);

1680
typedef int
1681 1682 1683
(*virDrvStoragePoolListAllVolumes)(virStoragePoolPtr pool,
                                   virStorageVolPtr **vols,
                                   unsigned int flags);
1684 1685

typedef virStorageVolPtr
1686 1687 1688
(*virDrvStorageVolLookupByName)(virStoragePoolPtr pool,
                                const char *name);

1689
typedef virStorageVolPtr
1690 1691
(*virDrvStorageVolLookupByKey)(virConnectPtr pool,
                               const char *key);
1692

1693 1694 1695
typedef virStorageVolPtr
(*virDrvStorageVolLookupByPath)(virConnectPtr pool,
                                const char *path);
1696 1697

typedef virStorageVolPtr
1698 1699 1700 1701
(*virDrvStorageVolCreateXML)(virStoragePoolPtr pool,
                             const char *xmldesc,
                             unsigned int flags);

1702
typedef int
1703 1704
(*virDrvStorageVolDelete)(virStorageVolPtr vol,
                          unsigned int flags);
1705

1706
typedef int
1707 1708 1709
(*virDrvStorageVolWipe)(virStorageVolPtr vol,
                        unsigned int flags);

1710
typedef int
1711 1712 1713
(*virDrvStorageVolWipePattern)(virStorageVolPtr vol,
                               unsigned int algorithm,
                               unsigned int flags);
1714

1715
typedef int
1716 1717 1718
(*virDrvStorageVolGetInfo)(virStorageVolPtr vol,
                           virStorageVolInfoPtr info);

1719
typedef char *
1720 1721 1722
(*virDrvStorageVolGetXMLDesc)(virStorageVolPtr pool,
                              unsigned int flags);

1723
typedef char *
1724
(*virDrvStorageVolGetPath)(virStorageVolPtr vol);
1725

1726
typedef virStorageVolPtr
1727 1728 1729
(*virDrvStorageVolCreateXMLFrom)(virStoragePoolPtr pool,
                                 const char *xmldesc,
                                 virStorageVolPtr clonevol,
1730
                                 unsigned int flags);
1731

1732
typedef int
1733 1734 1735 1736 1737 1738
(*virDrvStorageVolDownload)(virStorageVolPtr vol,
                            virStreamPtr stream,
                            unsigned long long offset,
                            unsigned long long length,
                            unsigned int flags);

1739
typedef int
1740 1741 1742 1743 1744
(*virDrvStorageVolUpload)(virStorageVolPtr vol,
                          virStreamPtr stream,
                          unsigned long long offset,
                          unsigned long long length,
                          unsigned int flags);
1745

1746
typedef int
1747 1748 1749 1750
(*virDrvStorageVolResize)(virStorageVolPtr vol,
                          unsigned long long capacity,
                          unsigned int flags);

1751
typedef int
1752 1753 1754 1755
(*virDrvStoragePoolIsActive)(virStoragePoolPtr pool);

typedef int
(*virDrvStoragePoolIsPersistent)(virStoragePoolPtr pool);
1756 1757


1758 1759 1760 1761 1762 1763 1764

typedef struct _virStorageDriver virStorageDriver;
typedef virStorageDriver *virStorageDriverPtr;

/**
 * _virStorageDriver:
 *
1765
 * Structure associated to a storage driver, defining the various
1766 1767 1768 1769 1770 1771 1772
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virStorageDriver {
1773
    const char * name; /* the name of the driver */
1774 1775
    virDrvStorageOpen storageOpen;
    virDrvStorageClose storageClose;
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 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815
    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;
1816 1817
};

1818
# ifdef WITH_LIBVIRTD
1819

1820 1821 1822 1823 1824
typedef int
(*virDrvStateInitialize)(bool privileged,
                         virStateInhibitCallback callback,
                         void *opaque);

1825 1826 1827
typedef void
(*virDrvStateAutoStart)(void);

1828 1829 1830 1831 1832 1833 1834 1835
typedef int
(*virDrvStateCleanup)(void);

typedef int
(*virDrvStateReload)(void);

typedef int
(*virDrvStateStop)(void);
1836 1837 1838 1839 1840

typedef struct _virStateDriver virStateDriver;
typedef virStateDriver *virStateDriverPtr;

struct _virStateDriver {
1841
    const char *name;
1842
    virDrvStateInitialize stateInitialize;
1843
    virDrvStateAutoStart stateAutoStart;
1844 1845 1846
    virDrvStateCleanup stateCleanup;
    virDrvStateReload stateReload;
    virDrvStateStop stateStop;
1847
};
1848
# endif
1849

1850

1851 1852 1853 1854
typedef virDrvConnectOpen virDrvNodeDeviceOpen;
typedef virDrvConnectClose virDrvNodeDeviceClose;


1855 1856 1857 1858
typedef int
(*virDrvNodeNumOfDevices)(virConnectPtr conn,
                          const char *cap,
                          unsigned int flags);
1859

1860 1861 1862 1863 1864 1865
typedef int
(*virDrvNodeListDevices)(virConnectPtr conn,
                         const char *cap,
                         char **const names,
                         int maxnames,
                         unsigned int flags);
1866

1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884
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);
1885

1886 1887
typedef char *
(*virDrvNodeDeviceGetParent)(virNodeDevicePtr dev);
1888

1889 1890
typedef int
(*virDrvNodeDeviceNumOfCaps)(virNodeDevicePtr dev);
1891

1892 1893 1894 1895
typedef int
(*virDrvNodeDeviceListCaps)(virNodeDevicePtr dev,
                            char **const names,
                            int maxnames);
1896

1897 1898 1899 1900
typedef virNodeDevicePtr
(*virDrvNodeDeviceCreateXML)(virConnectPtr conn,
                             const char *xmlDesc,
                             unsigned int flags);
1901

1902 1903
typedef int
(*virDrvNodeDeviceDestroy)(virNodeDevicePtr dev);
1904 1905


1906

1907 1908
typedef struct _virNodeDeviceDriver virNodeDeviceDriver;
typedef virNodeDeviceDriver *virNodeDeviceDriverPtr;
1909

1910
/**
1911
 * _virNodeDeviceDriver:
1912 1913 1914 1915 1916
 *
 * Structure associated with monitoring the devices
 * on a virtualized node.
 *
 */
1917
struct _virNodeDeviceDriver {
1918
    const char * name; /* the name of the driver */
1919 1920
    virDrvNodeDeviceOpen nodeDeviceOpen;
    virDrvNodeDeviceClose nodeDeviceClose;
1921 1922
    virDrvNodeNumOfDevices nodeNumOfDevices;
    virDrvNodeListDevices nodeListDevices;
1923 1924
    virDrvConnectListAllNodeDevices connectListAllNodeDevices;
    virDrvNodeDeviceLookupByName nodeDeviceLookupByName;
1925 1926 1927 1928 1929 1930 1931
    virDrvNodeDeviceLookupSCSIHostByWWN nodeDeviceLookupSCSIHostByWWN;
    virDrvNodeDeviceGetXMLDesc nodeDeviceGetXMLDesc;
    virDrvNodeDeviceGetParent nodeDeviceGetParent;
    virDrvNodeDeviceNumOfCaps nodeDeviceNumOfCaps;
    virDrvNodeDeviceListCaps nodeDeviceListCaps;
    virDrvNodeDeviceCreateXML nodeDeviceCreateXML;
    virDrvNodeDeviceDestroy nodeDeviceDestroy;
1932 1933
};

1934 1935
enum {
    /* This getValue call is inside libvirt, override the "private" flag.
E
Eric Blake 已提交
1936
       This flag cannot be set by outside callers. */
1937
    VIR_SECRET_GET_VALUE_INTERNAL_CALL = 1 << 0,
1938 1939
};

1940 1941 1942 1943
typedef virDrvConnectOpen virDrvSecretOpen;
typedef virDrvConnectClose virDrvSecretClose;


1944
typedef virSecretPtr
1945 1946 1947
(*virDrvSecretLookupByUUID)(virConnectPtr conn,
                            const unsigned char *uuid);

1948
typedef virSecretPtr
1949 1950 1951 1952
(*virDrvSecretLookupByUsage)(virConnectPtr conn,
                             int usageType,
                             const char *usageID);

1953
typedef virSecretPtr
1954 1955 1956 1957
(*virDrvSecretDefineXML)(virConnectPtr conn,
                         const char *xml,
                         unsigned int flags);

1958
typedef char *
1959 1960 1961
(*virDrvSecretGetXMLDesc)(virSecretPtr secret,
                          unsigned int flags);

1962
typedef int
1963 1964 1965 1966 1967
(*virDrvSecretSetValue)(virSecretPtr secret,
                        const unsigned char *value,
                        size_t value_size,
                        unsigned int flags);

1968
typedef unsigned char *
1969 1970 1971 1972 1973
(*virDrvSecretGetValue)(virSecretPtr secret,
                        size_t *value_size,
                        unsigned int flags,
                        unsigned int internalFlags);

1974
typedef int
1975 1976
(*virDrvSecretUndefine)(virSecretPtr secret);

1977
typedef int
1978 1979
(*virDrvConnectNumOfSecrets)(virConnectPtr conn);

1980
typedef int
1981 1982 1983 1984
(*virDrvConnectListSecrets)(virConnectPtr conn,
                            char **uuids,
                            int maxuuids);

1985
typedef int
1986 1987 1988
(*virDrvConnectListAllSecrets)(virConnectPtr conn,
                               virSecretPtr **secrets,
                               unsigned int flags);
1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004

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;
2005 2006
    virDrvSecretOpen secretOpen;
    virDrvSecretClose secretClose;
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
    virDrvConnectNumOfSecrets connectNumOfSecrets;
    virDrvConnectListSecrets connectListSecrets;
    virDrvConnectListAllSecrets connectListAllSecrets;
    virDrvSecretLookupByUUID secretLookupByUUID;
    virDrvSecretLookupByUsage secretLookupByUsage;
    virDrvSecretDefineXML secretDefineXML;
    virDrvSecretGetXMLDesc secretGetXMLDesc;
    virDrvSecretSetValue secretSetValue;
    virDrvSecretGetValue secretGetValue;
    virDrvSecretUndefine secretUndefine;
2017 2018
};

2019

2020 2021 2022 2023
typedef int
(*virDrvStreamSend)(virStreamPtr st,
                    const char *data,
                    size_t nbytes);
2024

2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042
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);
2043

2044 2045
typedef int
(*virDrvStreamFinish)(virStreamPtr st);
2046

2047 2048
typedef int
(*virDrvStreamAbort)(virStreamPtr st);
2049

2050 2051
typedef struct _virStreamDriver virStreamDriver;
typedef virStreamDriver *virStreamDriverPtr;
2052 2053

struct _virStreamDriver {
2054 2055 2056
    virDrvStreamSend streamSend;
    virDrvStreamRecv streamRecv;
    virDrvStreamEventAddCallback streamEventAddCallback;
2057 2058
    virDrvStreamEventUpdateCallback streamEventUpdateCallback;
    virDrvStreamEventRemoveCallback streamEventRemoveCallback;
2059 2060
    virDrvStreamFinish streamFinish;
    virDrvStreamAbort streamAbort;
2061 2062 2063
};


2064 2065 2066 2067
typedef virDrvConnectOpen virDrvNWFilterOpen;
typedef virDrvConnectClose virDrvNWFilterClose;


S
Stefan Berger 已提交
2068
typedef int
2069 2070
(*virDrvConnectNumOfNWFilters)(virConnectPtr conn);

S
Stefan Berger 已提交
2071
typedef int
2072 2073 2074 2075
(*virDrvConnectListNWFilters)(virConnectPtr conn,
                              char **const names,
                              int maxnames);

2076
typedef int
2077 2078 2079 2080
(*virDrvConnectListAllNWFilters)(virConnectPtr conn,
                                 virNWFilterPtr **filters,
                                 unsigned int flags);

S
Stefan Berger 已提交
2081
typedef virNWFilterPtr
2082 2083 2084
(*virDrvNWFilterLookupByName)(virConnectPtr conn,
                              const char *name);

S
Stefan Berger 已提交
2085
typedef virNWFilterPtr
2086 2087 2088
(*virDrvNWFilterLookupByUUID)(virConnectPtr conn,
                              const unsigned char *uuid);

S
Stefan Berger 已提交
2089
typedef virNWFilterPtr
2090 2091 2092
(*virDrvNWFilterDefineXML)(virConnectPtr conn,
                           const char *xmlDesc);

S
Stefan Berger 已提交
2093
typedef int
2094
(*virDrvNWFilterUndefine)(virNWFilterPtr nwfilter);
S
Stefan Berger 已提交
2095 2096

typedef char *
2097 2098
(*virDrvNWFilterGetXMLDesc)(virNWFilterPtr nwfilter,
                            unsigned int flags);
S
Stefan Berger 已提交
2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114


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 {
2115
    const char * name; /* the name of the driver */
2116 2117
    virDrvNWFilterOpen nwfilterOpen;
    virDrvNWFilterClose nwfilterClose;
2118
    virDrvConnectNumOfNWFilters connectNumOfNWFilters;
2119 2120 2121 2122 2123 2124 2125
    virDrvConnectListNWFilters connectListNWFilters;
    virDrvConnectListAllNWFilters connectListAllNWFilters;
    virDrvNWFilterLookupByName nwfilterLookupByName;
    virDrvNWFilterLookupByUUID nwfilterLookupByUUID;
    virDrvNWFilterDefineXML nwfilterDefineXML;
    virDrvNWFilterUndefine nwfilterUndefine;
    virDrvNWFilterGetXMLDesc nwfilterGetXMLDesc;
S
Stefan Berger 已提交
2126 2127 2128
};


2129 2130 2131 2132 2133 2134
/*
 * Registration
 * TODO: also need ways to (des)activate a given driver
 *       lookup based on the URI given in a virConnectOpen(ReadOnly)
 */
int virRegisterDriver(virDriverPtr);
2135
int virRegisterNetworkDriver(virNetworkDriverPtr);
D
Daniel Veillard 已提交
2136
int virRegisterInterfaceDriver(virInterfaceDriverPtr);
2137
int virRegisterStorageDriver(virStorageDriverPtr);
2138
int virRegisterNodeDeviceDriver(virNodeDeviceDriverPtr);
2139
int virRegisterSecretDriver(virSecretDriverPtr);
S
Stefan Berger 已提交
2140
int virRegisterNWFilterDriver(virNWFilterDriverPtr);
2141
# ifdef WITH_LIBVIRTD
2142
int virRegisterStateDriver(virStateDriverPtr);
2143
# endif
2144
void virDriverModuleInitialize(const char *defmoddir);
2145
void *virDriverLoadModule(const char *name);
2146 2147

#endif /* __VIR_DRIVER_H__ */