driver.h 76.1 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,
R
Roman Bogorodskiy 已提交
50
    VIR_DRV_BHYVE = 17,
51 52 53
} virDrvNo;


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

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

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

D
Daniel Veillard 已提交
68

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

309 310 311 312 313 314
typedef int
(*virDrvDomainCoreDumpWithFormat)(virDomainPtr domain,
                                  const char *to,
                                  unsigned int dumpformat,
                                  unsigned int flags);

315
typedef char *
316 317 318 319 320
(*virDrvDomainScreenshot)(virDomainPtr domain,
                          virStreamPtr stream,
                          unsigned int screen,
                          unsigned int flags);

321
typedef char *
322 323 324
(*virDrvDomainGetXMLDesc)(virDomainPtr dom,
                          unsigned int flags);

325
typedef char *
326 327 328 329 330
(*virDrvConnectDomainXMLFromNative)(virConnectPtr conn,
                                    const char *nativeFormat,
                                    const char *nativeConfig,
                                    unsigned int flags);

331
typedef char *
332 333 334 335 336
(*virDrvConnectDomainXMLToNative)(virConnectPtr conn,
                                  const char *nativeFormat,
                                  const char *domainXml,
                                  unsigned int flags);

337
typedef int
338 339 340 341
(*virDrvConnectListDefinedDomains)(virConnectPtr conn,
                                   char **const names,
                                   int maxnames);

342
typedef int
343 344 345 346
(*virDrvConnectListAllDomains)(virConnectPtr conn,
                               virDomainPtr **domains,
                               unsigned int flags);

347
typedef int
348 349
(*virDrvConnectNumOfDefinedDomains)(virConnectPtr conn);

350
typedef int
351 352
(*virDrvDomainCreate)(virDomainPtr dom);

353
typedef int
354 355
(*virDrvDomainCreateWithFlags)(virDomainPtr dom,
                               unsigned int flags);
356 357 358 359 360
typedef int
(*virDrvDomainCreateWithFiles)(virDomainPtr dom,
                               unsigned int nfiles,
                               int *files,
                               unsigned int flags);
361

362
typedef virDomainPtr
363 364 365
(*virDrvDomainDefineXML)(virConnectPtr conn,
                         const char *xml);

366
typedef int
367 368
(*virDrvDomainUndefine)(virDomainPtr dom);

O
Osier Yang 已提交
369
typedef int
370 371 372
(*virDrvDomainUndefineFlags)(virDomainPtr dom,
                             unsigned int flags);

373
typedef int
374 375 376
(*virDrvDomainSetVcpus)(virDomainPtr domain,
                        unsigned int nvcpus);

E
Eric Blake 已提交
377
typedef int
378 379 380 381
(*virDrvDomainSetVcpusFlags)(virDomainPtr domain,
                             unsigned int nvcpus,
                             unsigned int flags);

E
Eric Blake 已提交
382
typedef int
383 384 385
(*virDrvDomainGetVcpusFlags)(virDomainPtr domain,
                             unsigned int flags);

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

392
typedef int
393 394 395 396 397 398
(*virDrvDomainPinVcpuFlags)(virDomainPtr domain,
                            unsigned int vcpu,
                            unsigned char *cpumap,
                            int maplen,
                            unsigned int flags);

399
typedef int
400 401 402 403 404 405
(*virDrvDomainGetVcpuPinInfo)(virDomainPtr domain,
                              int ncpumaps,
                              unsigned char *cpumaps,
                              int maplen,
                              unsigned int flags);

406
typedef int
407 408 409 410
(*virDrvDomainPinEmulator)(virDomainPtr domain,
                           unsigned char *cpumap,
                           int maplen,
                           unsigned int flags);
411

412
typedef int
413 414 415 416 417
(*virDrvDomainGetEmulatorPinInfo)(virDomainPtr domain,
                                  unsigned char *cpumaps,
                                  int maplen,
                                  unsigned int flags);

418
typedef int
419 420 421 422 423
(*virDrvDomainGetVcpus)(virDomainPtr domain,
                        virVcpuInfoPtr info,
                        int maxinfo,
                        unsigned char *cpumaps,
                        int maplen);
424 425

typedef int
426 427 428 429 430 431
(*virDrvDomainGetMaxVcpus)(virDomainPtr domain);

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

M
Marcelo Cerri 已提交
432
typedef int
433 434 435
(*virDrvDomainGetSecurityLabelList)(virDomainPtr domain,
                                    virSecurityLabelPtr* seclabels);

436
typedef int
437 438 439
(*virDrvNodeGetSecurityModel)(virConnectPtr conn,
                              virSecurityModelPtr secmodel);

440
typedef int
441 442 443
(*virDrvDomainAttachDevice)(virDomainPtr domain,
                            const char *xml);

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

449
typedef int
450 451 452
(*virDrvDomainDetachDevice)(virDomainPtr domain,
                            const char *xml);

J
Jim Fehlig 已提交
453
typedef int
454 455 456 457
(*virDrvDomainDetachDeviceFlags)(virDomainPtr domain,
                                 const char *xml,
                                 unsigned int flags);

458
typedef int
459 460 461 462
(*virDrvDomainUpdateDeviceFlags)(virDomainPtr domain,
                                 const char *xml,
                                 unsigned int flags);

463
typedef int
464 465 466
(*virDrvDomainGetAutostart)(virDomainPtr domain,
                            int *autostart);

467
typedef int
468 469
(*virDrvDomainSetAutostart)(virDomainPtr domain,
                            int autostart);
470

471
typedef char *
472 473
(*virDrvDomainGetSchedulerType)(virDomainPtr domain,
                                int *nparams);
474

475
typedef int
476 477 478
(*virDrvDomainGetSchedulerParameters)(virDomainPtr domain,
                                      virTypedParameterPtr params,
                                      int *nparams);
479

480
typedef int
481 482 483 484
(*virDrvDomainGetSchedulerParametersFlags)(virDomainPtr domain,
                                           virTypedParameterPtr params,
                                           int *nparams,
                                           unsigned int flags);
485

486
typedef int
487 488 489
(*virDrvDomainSetSchedulerParameters)(virDomainPtr domain,
                                      virTypedParameterPtr params,
                                      int nparams);
490

491
typedef int
492 493 494 495
(*virDrvDomainSetSchedulerParametersFlags)(virDomainPtr domain,
                                           virTypedParameterPtr params,
                                           int nparams,
                                           unsigned int flags);
496

497
typedef int
498 499 500 501
(*virDrvDomainBlockStats)(virDomainPtr domain,
                          const char *path,
                          struct _virDomainBlockStats *stats);

502
typedef int
503 504 505 506 507 508
(*virDrvDomainBlockStatsFlags)(virDomainPtr domain,
                               const char *path,
                               virTypedParameterPtr params,
                               int *nparams,
                               unsigned int flags);

509
typedef int
510 511 512 513
(*virDrvDomainInterfaceStats)(virDomainPtr domain,
                              const char *path,
                              struct _virDomainInterfaceStats *stats);

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

521
typedef int
522 523 524 525 526
(*virDrvDomainGetInterfaceParameters)(virDomainPtr dom,
                                      const char *device,
                                      virTypedParameterPtr params,
                                      int *nparams,
                                      unsigned int flags);
527

528
typedef int
529 530 531 532
(*virDrvDomainMemoryStats)(virDomainPtr domain,
                           struct _virDomainMemoryStat *stats,
                           unsigned int nr_stats,
                           unsigned int flags);
533

R
Richard W.M. Jones 已提交
534
typedef int
535 536 537 538 539 540 541
(*virDrvDomainBlockPeek)(virDomainPtr domain,
                         const char *path,
                         unsigned long long offset,
                         size_t size,
                         void *buffer,
                         unsigned int flags);

O
Osier Yang 已提交
542
typedef int
543 544 545 546 547
(*virDrvDomainBlockResize)(virDomainPtr domain,
                           const char *path,
                           unsigned long long size,
                           unsigned int flags);

R
Richard W.M. Jones 已提交
548
typedef int
549 550 551 552 553 554
(*virDrvDomainMemoryPeek)(virDomainPtr domain,
                          unsigned long long start,
                          size_t size,
                          void *buffer,
                          unsigned int flags);

555
typedef int
556 557 558 559
(*virDrvDomainGetBlockInfo)(virDomainPtr domain,
                            const char *path,
                            virDomainBlockInfoPtr info,
                            unsigned int flags);
R
Richard W.M. Jones 已提交
560

561
typedef int
562 563 564 565 566 567 568 569
(*virDrvDomainMigratePrepare)(virConnectPtr dconn,
                              char **cookie,
                              int *cookielen,
                              const char *uri_in,
                              char **uri_out,
                              unsigned long flags,
                              const char *dname,
                              unsigned long resource);
570 571

typedef int
572 573 574 575 576 577 578
(*virDrvDomainMigratePerform)(virDomainPtr domain,
                              const char *cookie,
                              int cookielen,
                              const char *uri,
                              unsigned long flags,
                              const char *dname,
                              unsigned long resource);
579 580

typedef virDomainPtr
581 582 583 584 585 586
(*virDrvDomainMigrateFinish)(virConnectPtr dconn,
                             const char *dname,
                             const char *cookie,
                             int cookielen,
                             const char *uri,
                             unsigned long flags);
587

588
typedef int
589 590 591 592 593
(*virDrvNodeGetCPUStats)(virConnectPtr conn,
                         int cpuNum,
                         virNodeCPUStatsPtr params,
                         int *nparams,
                         unsigned int flags);
594

595
typedef int
596 597 598 599 600
(*virDrvNodeGetMemoryStats)(virConnectPtr conn,
                            int cellNum,
                            virNodeMemoryStatsPtr params,
                            int *nparams,
                            unsigned int flags);
601

602
typedef int
603 604 605 606
(*virDrvNodeGetCellsFreeMemory)(virConnectPtr conn,
                                unsigned long long *freeMems,
                                int startCell,
                                int maxCells);
607

608
typedef unsigned long long
609
(*virDrvNodeGetFreeMemory)(virConnectPtr conn);
610

611
typedef int
612 613 614 615
(*virDrvConnectDomainEventRegister)(virConnectPtr conn,
                                    virConnectDomainEventCallback cb,
                                    void *opaque,
                                    virFreeCallback freecb);
616 617

typedef int
618 619
(*virDrvConnectDomainEventDeregister)(virConnectPtr conn,
                                      virConnectDomainEventCallback cb);
620

D
Daniel Veillard 已提交
621
typedef int
622 623 624 625 626 627 628 629 630
(*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 已提交
631 632

typedef virDomainPtr
633 634 635 636 637 638 639
(*virDrvDomainMigrateFinish2)(virConnectPtr dconn,
                              const char *dname,
                              const char *cookie,
                              int cookielen,
                              const char *uri,
                              unsigned long flags,
                              int retcode);
D
Daniel Veillard 已提交
640

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

644 645 646 647 648
typedef int
(*virDrvNodeDeviceDetachFlags)(virNodeDevicePtr dev,
                               const char *driverName,
                               unsigned int flags);

649
typedef int
650 651
(*virDrvNodeDeviceReAttach)(virNodeDevicePtr dev);

652
typedef int
653
(*virDrvNodeDeviceReset)(virNodeDevicePtr dev);
654

C
Chris Lalancette 已提交
655
typedef int
656 657 658 659 660 661
(*virDrvDomainMigratePrepareTunnel)(virConnectPtr dconn,
                                    virStreamPtr st,
                                    unsigned long flags,
                                    const char *dname,
                                    unsigned long resource,
                                    const char *dom_xml);
C
Chris Lalancette 已提交
662

663
typedef int
664 665
(*virDrvConnectIsEncrypted)(virConnectPtr conn);

666
typedef int
667 668
(*virDrvConnectIsSecure)(virConnectPtr conn);

J
Jiri Denemark 已提交
669
typedef int
670 671
(*virDrvConnectIsAlive)(virConnectPtr conn);

672
typedef int
673 674
(*virDrvDomainIsActive)(virDomainPtr dom);

675
typedef int
676 677
(*virDrvDomainIsPersistent)(virDomainPtr dom);

O
Osier Yang 已提交
678
typedef int
679
(*virDrvDomainIsUpdated)(virDomainPtr dom);
680

J
Jiri Denemark 已提交
681
typedef int
682 683 684 685
(*virDrvConnectCompareCPU)(virConnectPtr conn,
                           const char *cpu,
                           unsigned int flags);

686
typedef char *
687 688 689 690
(*virDrvConnectBaselineCPU)(virConnectPtr conn,
                            const char **xmlCPUs,
                            unsigned int ncpus,
                            unsigned int flags);
J
Jiri Denemark 已提交
691

692 693 694 695 696 697
typedef int
(*virDrvConnectGetCPUModelNames)(virConnectPtr conn,
                                 const char *args,
                                 char ***models,
                                 unsigned int flags);

698
typedef int
699 700 701
(*virDrvDomainGetJobInfo)(virDomainPtr domain,
                          virDomainJobInfoPtr info);

702
typedef int
703 704 705 706 707
(*virDrvDomainGetJobStats)(virDomainPtr domain,
                           int *type,
                           virTypedParameterPtr *params,
                           int *nparams,
                           unsigned int flags);
708

709
typedef int
710
(*virDrvDomainAbortJob)(virDomainPtr domain);
711

712
typedef int
713 714 715 716
(*virDrvDomainMigrateSetMaxDowntime)(virDomainPtr domain,
                                     unsigned long long downtime,
                                     unsigned int flags);

717
typedef int
718 719 720 721
(*virDrvDomainMigrateGetCompressionCache)(virDomainPtr domain,
                                          unsigned long long *cacheSize,
                                          unsigned int flags);

722
typedef int
723 724 725
(*virDrvDomainMigrateSetCompressionCache)(virDomainPtr domain,
                                          unsigned long long cacheSize,
                                          unsigned int flags);
726

727
typedef int
728 729 730
(*virDrvDomainMigrateSetMaxSpeed)(virDomainPtr domain,
                                  unsigned long bandwidth,
                                  unsigned int flags);
731

732
typedef int
733 734 735
(*virDrvDomainMigrateGetMaxSpeed)(virDomainPtr domain,
                                  unsigned long *bandwidth,
                                  unsigned int flags);
736

737
typedef int
738 739 740 741 742 743
(*virDrvConnectDomainEventRegisterAny)(virConnectPtr conn,
                                       virDomainPtr dom,
                                       int eventID,
                                       virConnectDomainEventGenericCallback cb,
                                       void *opaque,
                                       virFreeCallback freecb);
744 745

typedef int
746 747
(*virDrvConnectDomainEventDeregisterAny)(virConnectPtr conn,
                                         int callbackID);
748

749
typedef int
750 751
(*virDrvDomainManagedSave)(virDomainPtr domain,
                           unsigned int flags);
752 753

typedef int
754 755
(*virDrvDomainHasManagedSaveImage)(virDomainPtr domain,
                                   unsigned int flags);
756 757

typedef int
758 759
(*virDrvDomainManagedSaveRemove)(virDomainPtr domain,
                                 unsigned int flags);
760

C
Chris Lalancette 已提交
761
typedef virDomainSnapshotPtr
762 763 764
(*virDrvDomainSnapshotCreateXML)(virDomainPtr domain,
                                 const char *xmlDesc,
                                 unsigned int flags);
C
Chris Lalancette 已提交
765 766

typedef char *
767 768
(*virDrvDomainSnapshotGetXMLDesc)(virDomainSnapshotPtr snapshot,
                                  unsigned int flags);
C
Chris Lalancette 已提交
769 770

typedef int
771 772
(*virDrvDomainSnapshotNum)(virDomainPtr domain,
                           unsigned int flags);
C
Chris Lalancette 已提交
773 774

typedef int
775 776 777 778
(*virDrvDomainSnapshotListNames)(virDomainPtr domain,
                                 char **names,
                                 int nameslen,
                                 unsigned int flags);
C
Chris Lalancette 已提交
779

780
typedef int
781 782 783
(*virDrvDomainListAllSnapshots)(virDomainPtr domain,
                                virDomainSnapshotPtr **snaps,
                                unsigned int flags);
784

785
typedef int
786 787
(*virDrvDomainSnapshotNumChildren)(virDomainSnapshotPtr snapshot,
                                   unsigned int flags);
788 789

typedef int
790 791 792 793
(*virDrvDomainSnapshotListChildrenNames)(virDomainSnapshotPtr snapshot,
                                         char **names,
                                         int nameslen,
                                         unsigned int flags);
794

795
typedef int
796 797 798
(*virDrvDomainSnapshotListAllChildren)(virDomainSnapshotPtr snapshot,
                                       virDomainSnapshotPtr **snaps,
                                       unsigned int flags);
799

C
Chris Lalancette 已提交
800
typedef virDomainSnapshotPtr
801 802 803
(*virDrvDomainSnapshotLookupByName)(virDomainPtr domain,
                                    const char *name,
                                    unsigned int flags);
C
Chris Lalancette 已提交
804 805

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

809
typedef virDomainSnapshotPtr
810 811
(*virDrvDomainSnapshotGetParent)(virDomainSnapshotPtr snapshot,
                                 unsigned int flags);
812

C
Chris Lalancette 已提交
813
typedef virDomainSnapshotPtr
814 815
(*virDrvDomainSnapshotCurrent)(virDomainPtr domain,
                               unsigned int flags);
C
Chris Lalancette 已提交
816

E
Eric Blake 已提交
817
typedef int
818 819
(*virDrvDomainSnapshotIsCurrent)(virDomainSnapshotPtr snapshot,
                                 unsigned int flags);
E
Eric Blake 已提交
820 821

typedef int
822 823
(*virDrvDomainSnapshotHasMetadata)(virDomainSnapshotPtr snapshot,
                                   unsigned int flags);
E
Eric Blake 已提交
824

C
Chris Lalancette 已提交
825
typedef int
826 827
(*virDrvDomainRevertToSnapshot)(virDomainSnapshotPtr snapshot,
                                unsigned int flags);
C
Chris Lalancette 已提交
828 829

typedef int
830 831
(*virDrvDomainSnapshotDelete)(virDomainSnapshotPtr snapshot,
                              unsigned int flags);
C
Chris Lalancette 已提交
832

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

839
typedef char *
840 841 842 843
(*virDrvDomainQemuAgentCommand)(virDomainPtr domain,
                                const char *cmd,
                                int timeout,
                                unsigned int flags);
C
Chris Lalancette 已提交
844

845
/* Choice of unsigned int rather than pid_t is intentional.  */
846
typedef virDomainPtr
847 848 849
(*virDrvDomainQemuAttach)(virConnectPtr conn,
                          unsigned int pid_value,
                          unsigned int flags);
850

851 852 853 854 855 856 857 858 859 860 861 862 863
typedef int
(*virDrvConnectDomainQemuMonitorEventRegister)(virConnectPtr conn,
                                               virDomainPtr dom,
                                               const char *event,
                                               virConnectDomainQemuMonitorEventCallback cb,
                                               void *opaque,
                                               virFreeCallback freecb,
                                               unsigned int flags);

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

864
typedef int
865 866 867 868 869
(*virDrvDomainOpenConsole)(virDomainPtr dom,
                           const char *dev_name,
                           virStreamPtr st,
                           unsigned int flags);

870
typedef int
871 872 873 874
(*virDrvDomainOpenChannel)(virDomainPtr dom,
                           const char *name,
                           virStreamPtr st,
                           unsigned int flags);
875

876
typedef int
877 878 879 880
(*virDrvDomainOpenGraphics)(virDomainPtr dom,
                            unsigned int idx,
                            int fd,
                            unsigned int flags);
C
Chris Lalancette 已提交
881

882
typedef int
883 884
(*virDrvDomainInjectNMI)(virDomainPtr dom,
                         unsigned int flags);
885

886
typedef int
887 888 889 890 891 892
(*virDrvDomainSendKey)(virDomainPtr dom,
                       unsigned int codeset,
                       unsigned int holdtime,
                       unsigned int *keycodes,
                       int nkeycodes,
                       unsigned int flags);
893

894
typedef int
895 896 897 898
(*virDrvDomainSendProcessSignal)(virDomainPtr dom,
                                 long long pid_value,
                                 unsigned int signum,
                                 unsigned int flags);
899

900
typedef char *
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 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946
(*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);
947

948
typedef virDomainPtr
949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971
(*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);
972 973

typedef int
974 975 976
(*virDrvDomainBlockJobAbort)(virDomainPtr dom,
                             const char *path,
                             unsigned int flags);
977 978

typedef int
979 980 981 982
(*virDrvDomainGetBlockJobInfo)(virDomainPtr dom,
                               const char *path,
                               virDomainBlockJobInfoPtr info,
                               unsigned int flags);
983 984

typedef int
985 986 987 988
(*virDrvDomainBlockJobSetSpeed)(virDomainPtr dom,
                                const char *path,
                                unsigned long bandwidth,
                                unsigned int flags);
989 990

typedef int
991 992 993 994 995
(*virDrvDomainBlockPull)(virDomainPtr dom,
                         const char *path,
                         unsigned long bandwidth,
                         unsigned int flags);

996
typedef int
997 998 999 1000 1001 1002
(*virDrvDomainBlockRebase)(virDomainPtr dom,
                           const char *path,
                           const char *base,
                           unsigned long bandwidth,
                           unsigned int flags);

E
Eric Blake 已提交
1003
typedef int
1004 1005 1006 1007 1008 1009
(*virDrvDomainBlockCommit)(virDomainPtr dom,
                           const char *disk,
                           const char *base,
                           const char *top,
                           unsigned long bandwidth,
                           unsigned int flags);
1010

J
Jiri Denemark 已提交
1011
typedef int
1012 1013 1014
(*virDrvConnectSetKeepAlive)(virConnectPtr conn,
                             int interval,
                             unsigned int count);
1015

1016
typedef int
1017 1018 1019 1020 1021 1022
(*virDrvDomainSetBlockIoTune)(virDomainPtr dom,
                              const char *disk,
                              virTypedParameterPtr params,
                              int nparams,
                              unsigned int flags);

1023
typedef int
1024 1025 1026 1027 1028 1029
(*virDrvDomainGetBlockIoTune)(virDomainPtr dom,
                              const char *disk,
                              virTypedParameterPtr params,
                              int *nparams,
                              unsigned int flags);

1030
typedef int
1031 1032
(*virDrvDomainShutdownFlags)(virDomainPtr domain,
                             unsigned int flags);
1033

1034
typedef int
1035 1036 1037 1038 1039 1040
(*virDrvDomainGetCPUStats)(virDomainPtr domain,
                           virTypedParameterPtr params,
                           unsigned int nparams,
                           int start_cpu,
                           unsigned int ncpus,
                           unsigned int flags);
1041

1042
typedef int
1043 1044 1045 1046
(*virDrvDomainGetDiskErrors)(virDomainPtr dom,
                             virDomainDiskErrorPtr errors,
                             unsigned int maxerrors,
                             unsigned int flags);
1047

1048
typedef int
1049 1050 1051 1052 1053 1054
(*virDrvDomainSetMetadata)(virDomainPtr dom,
                           int type,
                           const char *metadata,
                           const char *key,
                           const char *uri,
                           unsigned int flags);
1055 1056

typedef char *
1057 1058 1059 1060
(*virDrvDomainGetMetadata)(virDomainPtr dom,
                           int type,
                           const char *uri,
                           unsigned int flags);
1061

1062
typedef int
1063 1064 1065 1066
(*virDrvNodeGetMemoryParameters)(virConnectPtr conn,
                                 virTypedParameterPtr params,
                                 int *nparams,
                                 unsigned int flags);
1067 1068

typedef int
1069 1070 1071 1072
(*virDrvNodeSetMemoryParameters)(virConnectPtr conn,
                                 virTypedParameterPtr params,
                                 int nparams,
                                 unsigned int flags);
1073

1074
typedef int
1075 1076 1077 1078 1079
(*virDrvNodeGetCPUMap)(virConnectPtr conn,
                       unsigned char **cpumap,
                       unsigned int *online,
                       unsigned int flags);

1080
typedef int
1081 1082 1083 1084
(*virDrvDomainFSTrim)(virDomainPtr dom,
                      const char *mountPoint,
                      unsigned long long minimum,
                      unsigned int flags);
1085

1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097
typedef int
(*virDrvDomainGetTime)(virDomainPtr dom,
                       long long *seconds,
                       unsigned int *nseconds,
                       unsigned int flags);

typedef int
(*virDrvDomainSetTime)(virDomainPtr dom,
                       long long seconds,
                       unsigned int nseconds,
                       unsigned int flags);

1098
typedef int
1099 1100 1101 1102
(*virDrvDomainLxcOpenNamespace)(virDomainPtr dom,
                                int **fdlist,
                                unsigned int flags);

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 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163
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);

1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175
typedef int
(*virDrvDomainFSFreeze)(virDomainPtr dom,
                        const char **mountpoints,
                        unsigned int nmountpoints,
                        unsigned int flags);

typedef int
(*virDrvDomainFSThaw)(virDomainPtr dom,
                      const char **mountpoints,
                      unsigned int nmountpoints,
                      unsigned int flags);

1176 1177
typedef struct _virDriver virDriver;
typedef virDriver *virDriverPtr;
1178

1179 1180 1181 1182 1183
/**
 * _virDriver:
 *
 * Structure associated to a virtualization driver, defining the various
 * entry points for it.
1184 1185 1186 1187 1188 1189
 *
 * All drivers must support the following fields/methods:
 *  - no
 *  - name
 *  - open
 *  - close
1190 1191
 */
struct _virDriver {
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208
    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;
1209
    virDrvDomainCreateXMLWithFiles domainCreateXMLWithFiles;
1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228
    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;
1229
    virDrvDomainSetMemoryStatsPeriod domainSetMemoryStatsPeriod;
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245
    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;
1246
    virDrvDomainCoreDumpWithFormat domainCoreDumpWithFormat;
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267
    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;
1268
    virDrvDomainCreateWithFiles domainCreateWithFiles;
1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280
    virDrvDomainDefineXML domainDefineXML;
    virDrvDomainUndefine domainUndefine;
    virDrvDomainUndefineFlags domainUndefineFlags;
    virDrvDomainAttachDevice domainAttachDevice;
    virDrvDomainAttachDeviceFlags domainAttachDeviceFlags;
    virDrvDomainDetachDevice domainDetachDevice;
    virDrvDomainDetachDeviceFlags domainDetachDeviceFlags;
    virDrvDomainUpdateDeviceFlags domainUpdateDeviceFlags;
    virDrvDomainGetAutostart domainGetAutostart;
    virDrvDomainSetAutostart domainSetAutostart;
    virDrvDomainGetSchedulerType domainGetSchedulerType;
    virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
1281
    virDrvDomainGetSchedulerParametersFlags domainGetSchedulerParametersFlags;
1282
    virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
1283
    virDrvDomainSetSchedulerParametersFlags domainSetSchedulerParametersFlags;
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305
    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;
1306
    virDrvNodeDeviceDetachFlags nodeDeviceDetachFlags;
1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320
    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;
1321 1322
    virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCache;
    virDrvDomainMigrateSetCompressionCache domainMigrateSetCompressionCache;
1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335
    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;
1336
    virDrvDomainSnapshotListChildrenNames domainSnapshotListChildrenNames;
1337
    virDrvDomainSnapshotListAllChildren domainSnapshotListAllChildren;
1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348
    virDrvDomainSnapshotLookupByName domainSnapshotLookupByName;
    virDrvDomainHasCurrentSnapshot domainHasCurrentSnapshot;
    virDrvDomainSnapshotGetParent domainSnapshotGetParent;
    virDrvDomainSnapshotCurrent domainSnapshotCurrent;
    virDrvDomainSnapshotIsCurrent domainSnapshotIsCurrent;
    virDrvDomainSnapshotHasMetadata domainSnapshotHasMetadata;
    virDrvDomainRevertToSnapshot domainRevertToSnapshot;
    virDrvDomainSnapshotDelete domainSnapshotDelete;
    virDrvDomainQemuMonitorCommand domainQemuMonitorCommand;
    virDrvDomainQemuAttach domainQemuAttach;
    virDrvDomainQemuAgentCommand domainQemuAgentCommand;
1349 1350
    virDrvConnectDomainQemuMonitorEventRegister connectDomainQemuMonitorEventRegister;
    virDrvConnectDomainQemuMonitorEventDeregister connectDomainQemuMonitorEventDeregister;
1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382
    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;
1383 1384 1385 1386 1387 1388
    virDrvDomainMigrateBegin3Params domainMigrateBegin3Params;
    virDrvDomainMigratePrepare3Params domainMigratePrepare3Params;
    virDrvDomainMigratePrepareTunnel3Params domainMigratePrepareTunnel3Params;
    virDrvDomainMigratePerform3Params domainMigratePerform3Params;
    virDrvDomainMigrateFinish3Params domainMigrateFinish3Params;
    virDrvDomainMigrateConfirm3Params domainMigrateConfirm3Params;
1389
    virDrvConnectGetCPUModelNames connectGetCPUModelNames;
1390 1391
    virDrvDomainFSFreeze domainFSFreeze;
    virDrvDomainFSThaw domainFSThaw;
1392 1393
    virDrvDomainGetTime domainGetTime;
    virDrvDomainSetTime domainSetTime;
1394 1395
};

1396 1397 1398 1399

typedef virDrvConnectOpen virDrvNetworkOpen;
typedef virDrvConnectClose virDrvNetworkClose;

1400
typedef int
1401 1402
(*virDrvConnectNumOfNetworks)(virConnectPtr conn);

1403
typedef int
1404 1405 1406 1407
(*virDrvConnectListNetworks)(virConnectPtr conn,
                             char **const names,
                             int maxnames);

1408
typedef int
1409 1410
(*virDrvConnectNumOfDefinedNetworks)(virConnectPtr conn);

1411
typedef int
1412 1413 1414 1415
(*virDrvConnectListDefinedNetworks)(virConnectPtr conn,
                                    char **const names,
                                    int maxnames);

1416
typedef int
1417 1418 1419 1420
(*virDrvConnectListAllNetworks)(virConnectPtr conn,
                                virNetworkPtr **nets,
                                unsigned int flags);

1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432
typedef int
(*virDrvConnectNetworkEventRegisterAny)(virConnectPtr conn,
                                        virNetworkPtr dom,
                                        int eventID,
                                        virConnectNetworkEventGenericCallback cb,
                                        void *opaque,
                                        virFreeCallback freecb);

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

1433
typedef virNetworkPtr
1434 1435 1436
(*virDrvNetworkLookupByUUID)(virConnectPtr conn,
                             const unsigned char *uuid);

1437
typedef virNetworkPtr
1438 1439 1440
(*virDrvNetworkLookupByName)(virConnectPtr conn,
                             const char *name);

1441
typedef virNetworkPtr
1442 1443 1444
(*virDrvNetworkCreateXML)(virConnectPtr conn,
                          const char *xmlDesc);

1445
typedef virNetworkPtr
1446 1447 1448
(*virDrvNetworkDefineXML)(virConnectPtr conn,
                          const char *xml);

1449
typedef int
1450 1451
(*virDrvNetworkUndefine)(virNetworkPtr network);

1452
typedef int
1453 1454 1455 1456 1457 1458 1459
(*virDrvNetworkUpdate)(virNetworkPtr network,
                       unsigned int command, /* virNetworkUpdateCommand */
                       unsigned int section, /* virNetworkUpdateSection */
                       int parentIndex,
                       const char *xml,
                       unsigned int flags);

1460
typedef int
1461 1462
(*virDrvNetworkCreate)(virNetworkPtr network);

1463
typedef int
1464 1465
(*virDrvNetworkDestroy)(virNetworkPtr network);

1466
typedef char *
1467 1468 1469
(*virDrvNetworkGetXMLDesc)(virNetworkPtr network,
                           unsigned int flags);

1470
typedef char *
1471 1472
(*virDrvNetworkGetBridgeName)(virNetworkPtr network);

1473
typedef int
1474 1475 1476
(*virDrvNetworkGetAutostart)(virNetworkPtr network,
                             int *autostart);

1477
typedef int
1478 1479
(*virDrvNetworkSetAutostart)(virNetworkPtr network,
                             int autostart);
1480

1481
typedef int
1482 1483
(*virDrvNetworkIsActive)(virNetworkPtr net);

1484
typedef int
1485
(*virDrvNetworkIsPersistent)(virNetworkPtr net);
1486 1487


1488 1489 1490 1491 1492 1493 1494 1495 1496

typedef struct _virNetworkDriver virNetworkDriver;
typedef virNetworkDriver *virNetworkDriverPtr;

/**
 * _virNetworkDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
1497 1498 1499 1500
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
1501 1502
 */
struct _virNetworkDriver {
1503
    const char * name; /* the name of the driver */
1504 1505
    virDrvNetworkOpen networkOpen;
    virDrvNetworkClose networkClose;
1506 1507 1508 1509 1510
    virDrvConnectNumOfNetworks connectNumOfNetworks;
    virDrvConnectListNetworks connectListNetworks;
    virDrvConnectNumOfDefinedNetworks connectNumOfDefinedNetworks;
    virDrvConnectListDefinedNetworks connectListDefinedNetworks;
    virDrvConnectListAllNetworks connectListAllNetworks;
1511 1512
    virDrvConnectNetworkEventRegisterAny connectNetworkEventRegisterAny;
    virDrvConnectNetworkEventDeregisterAny connectNetworkEventDeregisterAny;
1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526
    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;
1527 1528
};

1529

1530 1531 1532
typedef virDrvConnectOpen virDrvInterfaceOpen;
typedef virDrvConnectClose virDrvInterfaceClose;

D
Daniel Veillard 已提交
1533
typedef int
1534 1535
(*virDrvConnectNumOfInterfaces)(virConnectPtr conn);

D
Daniel Veillard 已提交
1536
typedef int
1537 1538 1539 1540
(*virDrvConnectListInterfaces)(virConnectPtr conn,
                               char **const names,
                               int maxnames);

1541
typedef int
1542 1543
(*virDrvConnectNumOfDefinedInterfaces)(virConnectPtr conn);

1544
typedef int
1545 1546 1547 1548
(*virDrvConnectListDefinedInterfaces)(virConnectPtr conn,
                                      char **const names,
                                      int maxnames);

1549
typedef int
1550 1551 1552 1553
(*virDrvConnectListAllInterfaces)(virConnectPtr conn,
                                  virInterfacePtr **ifaces,
                                  unsigned int flags);

D
Daniel Veillard 已提交
1554
typedef virInterfacePtr
1555 1556 1557
(*virDrvInterfaceLookupByName)(virConnectPtr conn,
                               const char *name);

D
Daniel Veillard 已提交
1558
typedef virInterfacePtr
1559 1560
(*virDrvInterfaceLookupByMACString)(virConnectPtr conn,
                                    const char *mac);
D
Daniel Veillard 已提交
1561 1562

typedef char *
1563 1564
(*virDrvInterfaceGetXMLDesc)(virInterfacePtr iface,
                             unsigned int flags);
D
Daniel Veillard 已提交
1565 1566

typedef virInterfacePtr
1567 1568 1569 1570
(*virDrvInterfaceDefineXML)(virConnectPtr conn,
                            const char *xmlDesc,
                            unsigned int flags);

D
Daniel Veillard 已提交
1571
typedef int
1572 1573
(*virDrvInterfaceUndefine)(virInterfacePtr iface);

D
Daniel Veillard 已提交
1574
typedef int
1575 1576 1577
(*virDrvInterfaceCreate)(virInterfacePtr iface,
                         unsigned int flags);

D
Daniel Veillard 已提交
1578
typedef int
1579 1580
(*virDrvInterfaceDestroy)(virInterfacePtr iface,
                          unsigned int flags);
D
Daniel Veillard 已提交
1581

1582
typedef int
1583
(*virDrvInterfaceIsActive)(virInterfacePtr iface);
1584

1585
typedef int
1586 1587 1588
(*virDrvInterfaceChangeBegin)(virConnectPtr conn,
                              unsigned int flags);

1589
typedef int
1590 1591 1592
(*virDrvInterfaceChangeCommit)(virConnectPtr conn,
                               unsigned int flags);

1593
typedef int
1594 1595
(*virDrvInterfaceChangeRollback)(virConnectPtr conn,
                                 unsigned int flags);
1596

D
Daniel Veillard 已提交
1597 1598 1599 1600 1601 1602
typedef struct _virInterfaceDriver virInterfaceDriver;
typedef virInterfaceDriver *virInterfaceDriverPtr;

/**
 * _virInterfaceDriver:
 *
1603
 * Structure associated to a network interface driver, defining the various
D
Daniel Veillard 已提交
1604 1605 1606 1607 1608 1609 1610
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virInterfaceDriver {
1611
    const char *name; /* the name of the driver */
1612 1613
    virDrvInterfaceOpen interfaceOpen;
    virDrvInterfaceClose interfaceClose;
1614 1615 1616 1617 1618 1619
    virDrvConnectNumOfInterfaces connectNumOfInterfaces;
    virDrvConnectListInterfaces connectListInterfaces;
    virDrvConnectNumOfDefinedInterfaces connectNumOfDefinedInterfaces;
    virDrvConnectListDefinedInterfaces connectListDefinedInterfaces;
    virDrvConnectListAllInterfaces connectListAllInterfaces;
    virDrvInterfaceLookupByName interfaceLookupByName;
D
Daniel Veillard 已提交
1620
    virDrvInterfaceLookupByMACString interfaceLookupByMACString;
1621 1622 1623 1624 1625 1626 1627 1628 1629
    virDrvInterfaceGetXMLDesc interfaceGetXMLDesc;
    virDrvInterfaceDefineXML interfaceDefineXML;
    virDrvInterfaceUndefine interfaceUndefine;
    virDrvInterfaceCreate interfaceCreate;
    virDrvInterfaceDestroy interfaceDestroy;
    virDrvInterfaceIsActive interfaceIsActive;
    virDrvInterfaceChangeBegin interfaceChangeBegin;
    virDrvInterfaceChangeCommit interfaceChangeCommit;
    virDrvInterfaceChangeRollback interfaceChangeRollback;
D
Daniel Veillard 已提交
1630 1631
};

1632

1633 1634 1635 1636
typedef virDrvConnectOpen virDrvStorageOpen;
typedef virDrvConnectClose virDrvStorageClose;


1637
typedef int
1638 1639
(*virDrvConnectNumOfStoragePools)(virConnectPtr conn);

1640
typedef int
1641 1642 1643 1644
(*virDrvConnectListStoragePools)(virConnectPtr conn,
                                 char **const names,
                                 int maxnames);

1645
typedef int
1646 1647
(*virDrvConnectNumOfDefinedStoragePools)(virConnectPtr conn);

1648
typedef int
1649 1650 1651 1652
(*virDrvConnectListDefinedStoragePools)(virConnectPtr conn,
                                        char **const names,
                                        int maxnames);

1653
typedef int
1654 1655 1656 1657
(*virDrvConnectListAllStoragePools)(virConnectPtr conn,
                                    virStoragePoolPtr **pools,
                                    unsigned int flags);

1658
typedef char *
1659 1660 1661 1662 1663
(*virDrvConnectFindStoragePoolSources)(virConnectPtr conn,
                                       const char *type,
                                       const char *srcSpec,
                                       unsigned int flags);

1664
typedef virStoragePoolPtr
1665 1666 1667
(*virDrvStoragePoolLookupByName)(virConnectPtr conn,
                                 const char *name);

1668
typedef virStoragePoolPtr
1669 1670 1671
(*virDrvStoragePoolLookupByUUID)(virConnectPtr conn,
                                 const unsigned char *uuid);

1672
typedef virStoragePoolPtr
1673 1674
(*virDrvStoragePoolLookupByVolume)(virStorageVolPtr vol);

1675
typedef virStoragePoolPtr
1676 1677 1678 1679
(*virDrvStoragePoolCreateXML)(virConnectPtr conn,
                              const char *xmlDesc,
                              unsigned int flags);

1680
typedef virStoragePoolPtr
1681 1682 1683 1684
(*virDrvStoragePoolDefineXML)(virConnectPtr conn,
                              const char *xmlDesc,
                              unsigned int flags);

1685
typedef int
1686 1687
(*virDrvStoragePoolUndefine)(virStoragePoolPtr pool);

1688
typedef int
1689 1690 1691
(*virDrvStoragePoolBuild)(virStoragePoolPtr pool,
                          unsigned int flags);

1692
typedef int
1693 1694 1695
(*virDrvStoragePoolCreate)(virStoragePoolPtr pool,
                           unsigned int flags);

1696
typedef int
1697 1698
(*virDrvStoragePoolDestroy)(virStoragePoolPtr pool);

1699
typedef int
1700 1701 1702
(*virDrvStoragePoolDelete)(virStoragePoolPtr pool,
                           unsigned int flags);

1703
typedef int
1704 1705 1706
(*virDrvStoragePoolRefresh)(virStoragePoolPtr pool,
                            unsigned int flags);

1707
typedef int
1708 1709 1710
(*virDrvStoragePoolGetInfo)(virStoragePoolPtr vol,
                            virStoragePoolInfoPtr info);

1711
typedef char *
1712 1713 1714
(*virDrvStoragePoolGetXMLDesc)(virStoragePoolPtr pool,
                               unsigned int flags);

1715
typedef int
1716 1717 1718
(*virDrvStoragePoolGetAutostart)(virStoragePoolPtr pool,
                                 int *autostart);

1719
typedef int
1720 1721 1722
(*virDrvStoragePoolSetAutostart)(virStoragePoolPtr pool,
                                 int autostart);

1723
typedef int
1724 1725
(*virDrvStoragePoolNumOfVolumes)(virStoragePoolPtr pool);

1726
typedef int
1727 1728 1729 1730
(*virDrvStoragePoolListVolumes)(virStoragePoolPtr pool,
                                char **const names,
                                int maxnames);

1731
typedef int
1732 1733 1734
(*virDrvStoragePoolListAllVolumes)(virStoragePoolPtr pool,
                                   virStorageVolPtr **vols,
                                   unsigned int flags);
1735 1736

typedef virStorageVolPtr
1737 1738 1739
(*virDrvStorageVolLookupByName)(virStoragePoolPtr pool,
                                const char *name);

1740
typedef virStorageVolPtr
1741 1742
(*virDrvStorageVolLookupByKey)(virConnectPtr pool,
                               const char *key);
1743

1744 1745 1746
typedef virStorageVolPtr
(*virDrvStorageVolLookupByPath)(virConnectPtr pool,
                                const char *path);
1747 1748

typedef virStorageVolPtr
1749 1750 1751 1752
(*virDrvStorageVolCreateXML)(virStoragePoolPtr pool,
                             const char *xmldesc,
                             unsigned int flags);

1753
typedef int
1754 1755
(*virDrvStorageVolDelete)(virStorageVolPtr vol,
                          unsigned int flags);
1756

1757
typedef int
1758 1759 1760
(*virDrvStorageVolWipe)(virStorageVolPtr vol,
                        unsigned int flags);

1761
typedef int
1762 1763 1764
(*virDrvStorageVolWipePattern)(virStorageVolPtr vol,
                               unsigned int algorithm,
                               unsigned int flags);
1765

1766
typedef int
1767 1768 1769
(*virDrvStorageVolGetInfo)(virStorageVolPtr vol,
                           virStorageVolInfoPtr info);

1770
typedef char *
1771 1772 1773
(*virDrvStorageVolGetXMLDesc)(virStorageVolPtr pool,
                              unsigned int flags);

1774
typedef char *
1775
(*virDrvStorageVolGetPath)(virStorageVolPtr vol);
1776

1777
typedef virStorageVolPtr
1778 1779 1780
(*virDrvStorageVolCreateXMLFrom)(virStoragePoolPtr pool,
                                 const char *xmldesc,
                                 virStorageVolPtr clonevol,
1781
                                 unsigned int flags);
1782

1783
typedef int
1784 1785 1786 1787 1788 1789
(*virDrvStorageVolDownload)(virStorageVolPtr vol,
                            virStreamPtr stream,
                            unsigned long long offset,
                            unsigned long long length,
                            unsigned int flags);

1790
typedef int
1791 1792 1793 1794 1795
(*virDrvStorageVolUpload)(virStorageVolPtr vol,
                          virStreamPtr stream,
                          unsigned long long offset,
                          unsigned long long length,
                          unsigned int flags);
1796

1797
typedef int
1798 1799 1800 1801
(*virDrvStorageVolResize)(virStorageVolPtr vol,
                          unsigned long long capacity,
                          unsigned int flags);

1802
typedef int
1803 1804 1805 1806
(*virDrvStoragePoolIsActive)(virStoragePoolPtr pool);

typedef int
(*virDrvStoragePoolIsPersistent)(virStoragePoolPtr pool);
1807 1808


1809 1810 1811 1812 1813 1814 1815

typedef struct _virStorageDriver virStorageDriver;
typedef virStorageDriver *virStorageDriverPtr;

/**
 * _virStorageDriver:
 *
1816
 * Structure associated to a storage driver, defining the various
1817 1818 1819 1820 1821 1822 1823
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virStorageDriver {
1824
    const char * name; /* the name of the driver */
1825 1826
    virDrvStorageOpen storageOpen;
    virDrvStorageClose storageClose;
1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866
    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;
1867 1868
};

1869
# ifdef WITH_LIBVIRTD
1870

1871 1872 1873 1874 1875
typedef int
(*virDrvStateInitialize)(bool privileged,
                         virStateInhibitCallback callback,
                         void *opaque);

1876 1877 1878
typedef void
(*virDrvStateAutoStart)(void);

1879 1880 1881 1882 1883 1884 1885 1886
typedef int
(*virDrvStateCleanup)(void);

typedef int
(*virDrvStateReload)(void);

typedef int
(*virDrvStateStop)(void);
1887 1888 1889 1890 1891

typedef struct _virStateDriver virStateDriver;
typedef virStateDriver *virStateDriverPtr;

struct _virStateDriver {
1892
    const char *name;
1893
    virDrvStateInitialize stateInitialize;
1894
    virDrvStateAutoStart stateAutoStart;
1895 1896 1897
    virDrvStateCleanup stateCleanup;
    virDrvStateReload stateReload;
    virDrvStateStop stateStop;
1898
};
1899
# endif
1900

1901

1902 1903 1904 1905
typedef virDrvConnectOpen virDrvNodeDeviceOpen;
typedef virDrvConnectClose virDrvNodeDeviceClose;


1906 1907 1908 1909
typedef int
(*virDrvNodeNumOfDevices)(virConnectPtr conn,
                          const char *cap,
                          unsigned int flags);
1910

1911 1912 1913 1914 1915 1916
typedef int
(*virDrvNodeListDevices)(virConnectPtr conn,
                         const char *cap,
                         char **const names,
                         int maxnames,
                         unsigned int flags);
1917

1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935
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);
1936

1937 1938
typedef char *
(*virDrvNodeDeviceGetParent)(virNodeDevicePtr dev);
1939

1940 1941
typedef int
(*virDrvNodeDeviceNumOfCaps)(virNodeDevicePtr dev);
1942

1943 1944 1945 1946
typedef int
(*virDrvNodeDeviceListCaps)(virNodeDevicePtr dev,
                            char **const names,
                            int maxnames);
1947

1948 1949 1950 1951
typedef virNodeDevicePtr
(*virDrvNodeDeviceCreateXML)(virConnectPtr conn,
                             const char *xmlDesc,
                             unsigned int flags);
1952

1953 1954
typedef int
(*virDrvNodeDeviceDestroy)(virNodeDevicePtr dev);
1955 1956


1957

1958 1959
typedef struct _virNodeDeviceDriver virNodeDeviceDriver;
typedef virNodeDeviceDriver *virNodeDeviceDriverPtr;
1960

1961
/**
1962
 * _virNodeDeviceDriver:
1963 1964 1965 1966 1967
 *
 * Structure associated with monitoring the devices
 * on a virtualized node.
 *
 */
1968
struct _virNodeDeviceDriver {
1969
    const char * name; /* the name of the driver */
1970 1971
    virDrvNodeDeviceOpen nodeDeviceOpen;
    virDrvNodeDeviceClose nodeDeviceClose;
1972 1973
    virDrvNodeNumOfDevices nodeNumOfDevices;
    virDrvNodeListDevices nodeListDevices;
1974 1975
    virDrvConnectListAllNodeDevices connectListAllNodeDevices;
    virDrvNodeDeviceLookupByName nodeDeviceLookupByName;
1976 1977 1978 1979 1980 1981 1982
    virDrvNodeDeviceLookupSCSIHostByWWN nodeDeviceLookupSCSIHostByWWN;
    virDrvNodeDeviceGetXMLDesc nodeDeviceGetXMLDesc;
    virDrvNodeDeviceGetParent nodeDeviceGetParent;
    virDrvNodeDeviceNumOfCaps nodeDeviceNumOfCaps;
    virDrvNodeDeviceListCaps nodeDeviceListCaps;
    virDrvNodeDeviceCreateXML nodeDeviceCreateXML;
    virDrvNodeDeviceDestroy nodeDeviceDestroy;
1983 1984
};

1985 1986
enum {
    /* This getValue call is inside libvirt, override the "private" flag.
E
Eric Blake 已提交
1987
       This flag cannot be set by outside callers. */
1988
    VIR_SECRET_GET_VALUE_INTERNAL_CALL = 1 << 0,
1989 1990
};

1991 1992 1993 1994
typedef virDrvConnectOpen virDrvSecretOpen;
typedef virDrvConnectClose virDrvSecretClose;


1995
typedef virSecretPtr
1996 1997 1998
(*virDrvSecretLookupByUUID)(virConnectPtr conn,
                            const unsigned char *uuid);

1999
typedef virSecretPtr
2000 2001 2002 2003
(*virDrvSecretLookupByUsage)(virConnectPtr conn,
                             int usageType,
                             const char *usageID);

2004
typedef virSecretPtr
2005 2006 2007 2008
(*virDrvSecretDefineXML)(virConnectPtr conn,
                         const char *xml,
                         unsigned int flags);

2009
typedef char *
2010 2011 2012
(*virDrvSecretGetXMLDesc)(virSecretPtr secret,
                          unsigned int flags);

2013
typedef int
2014 2015 2016 2017 2018
(*virDrvSecretSetValue)(virSecretPtr secret,
                        const unsigned char *value,
                        size_t value_size,
                        unsigned int flags);

2019
typedef unsigned char *
2020 2021 2022 2023 2024
(*virDrvSecretGetValue)(virSecretPtr secret,
                        size_t *value_size,
                        unsigned int flags,
                        unsigned int internalFlags);

2025
typedef int
2026 2027
(*virDrvSecretUndefine)(virSecretPtr secret);

2028
typedef int
2029 2030
(*virDrvConnectNumOfSecrets)(virConnectPtr conn);

2031
typedef int
2032 2033 2034 2035
(*virDrvConnectListSecrets)(virConnectPtr conn,
                            char **uuids,
                            int maxuuids);

2036
typedef int
2037 2038 2039
(*virDrvConnectListAllSecrets)(virConnectPtr conn,
                               virSecretPtr **secrets,
                               unsigned int flags);
2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055

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;
2056 2057
    virDrvSecretOpen secretOpen;
    virDrvSecretClose secretClose;
2058 2059 2060 2061 2062 2063 2064 2065 2066 2067
    virDrvConnectNumOfSecrets connectNumOfSecrets;
    virDrvConnectListSecrets connectListSecrets;
    virDrvConnectListAllSecrets connectListAllSecrets;
    virDrvSecretLookupByUUID secretLookupByUUID;
    virDrvSecretLookupByUsage secretLookupByUsage;
    virDrvSecretDefineXML secretDefineXML;
    virDrvSecretGetXMLDesc secretGetXMLDesc;
    virDrvSecretSetValue secretSetValue;
    virDrvSecretGetValue secretGetValue;
    virDrvSecretUndefine secretUndefine;
2068 2069
};

2070

2071 2072 2073 2074
typedef int
(*virDrvStreamSend)(virStreamPtr st,
                    const char *data,
                    size_t nbytes);
2075

2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093
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);
2094

2095 2096
typedef int
(*virDrvStreamFinish)(virStreamPtr st);
2097

2098 2099
typedef int
(*virDrvStreamAbort)(virStreamPtr st);
2100

2101 2102
typedef struct _virStreamDriver virStreamDriver;
typedef virStreamDriver *virStreamDriverPtr;
2103 2104

struct _virStreamDriver {
2105 2106 2107
    virDrvStreamSend streamSend;
    virDrvStreamRecv streamRecv;
    virDrvStreamEventAddCallback streamEventAddCallback;
2108 2109
    virDrvStreamEventUpdateCallback streamEventUpdateCallback;
    virDrvStreamEventRemoveCallback streamEventRemoveCallback;
2110 2111
    virDrvStreamFinish streamFinish;
    virDrvStreamAbort streamAbort;
2112 2113 2114
};


2115 2116 2117 2118
typedef virDrvConnectOpen virDrvNWFilterOpen;
typedef virDrvConnectClose virDrvNWFilterClose;


S
Stefan Berger 已提交
2119
typedef int
2120 2121
(*virDrvConnectNumOfNWFilters)(virConnectPtr conn);

S
Stefan Berger 已提交
2122
typedef int
2123 2124 2125 2126
(*virDrvConnectListNWFilters)(virConnectPtr conn,
                              char **const names,
                              int maxnames);

2127
typedef int
2128 2129 2130 2131
(*virDrvConnectListAllNWFilters)(virConnectPtr conn,
                                 virNWFilterPtr **filters,
                                 unsigned int flags);

S
Stefan Berger 已提交
2132
typedef virNWFilterPtr
2133 2134 2135
(*virDrvNWFilterLookupByName)(virConnectPtr conn,
                              const char *name);

S
Stefan Berger 已提交
2136
typedef virNWFilterPtr
2137 2138 2139
(*virDrvNWFilterLookupByUUID)(virConnectPtr conn,
                              const unsigned char *uuid);

S
Stefan Berger 已提交
2140
typedef virNWFilterPtr
2141 2142 2143
(*virDrvNWFilterDefineXML)(virConnectPtr conn,
                           const char *xmlDesc);

S
Stefan Berger 已提交
2144
typedef int
2145
(*virDrvNWFilterUndefine)(virNWFilterPtr nwfilter);
S
Stefan Berger 已提交
2146 2147

typedef char *
2148 2149
(*virDrvNWFilterGetXMLDesc)(virNWFilterPtr nwfilter,
                            unsigned int flags);
S
Stefan Berger 已提交
2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165


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 {
2166
    const char * name; /* the name of the driver */
2167 2168
    virDrvNWFilterOpen nwfilterOpen;
    virDrvNWFilterClose nwfilterClose;
2169
    virDrvConnectNumOfNWFilters connectNumOfNWFilters;
2170 2171 2172 2173 2174 2175 2176
    virDrvConnectListNWFilters connectListNWFilters;
    virDrvConnectListAllNWFilters connectListAllNWFilters;
    virDrvNWFilterLookupByName nwfilterLookupByName;
    virDrvNWFilterLookupByUUID nwfilterLookupByUUID;
    virDrvNWFilterDefineXML nwfilterDefineXML;
    virDrvNWFilterUndefine nwfilterUndefine;
    virDrvNWFilterGetXMLDesc nwfilterGetXMLDesc;
S
Stefan Berger 已提交
2177 2178 2179
};


2180 2181 2182 2183 2184
/*
 * Registration
 * TODO: also need ways to (des)activate a given driver
 *       lookup based on the URI given in a virConnectOpen(ReadOnly)
 */
2185 2186 2187 2188 2189 2190 2191
int virRegisterDriver(virDriverPtr) ATTRIBUTE_RETURN_CHECK;
int virRegisterNetworkDriver(virNetworkDriverPtr) ATTRIBUTE_RETURN_CHECK;
int virRegisterInterfaceDriver(virInterfaceDriverPtr) ATTRIBUTE_RETURN_CHECK;
int virRegisterStorageDriver(virStorageDriverPtr) ATTRIBUTE_RETURN_CHECK;
int virRegisterNodeDeviceDriver(virNodeDeviceDriverPtr) ATTRIBUTE_RETURN_CHECK;
int virRegisterSecretDriver(virSecretDriverPtr) ATTRIBUTE_RETURN_CHECK;
int virRegisterNWFilterDriver(virNWFilterDriverPtr) ATTRIBUTE_RETURN_CHECK;
2192
# ifdef WITH_LIBVIRTD
2193
int virRegisterStateDriver(virStateDriverPtr) ATTRIBUTE_RETURN_CHECK;
2194
# endif
2195
void *virDriverLoadModule(const char *name);
2196 2197

#endif /* __VIR_DRIVER_H__ */