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

#ifndef __VIR_DRIVER_H__
23
# define __VIR_DRIVER_H__
24

25
# include <unistd.h>
26

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


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

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

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

D
Daniel Veillard 已提交
66

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

135
typedef virDomainPtr
136 137 138 139
(*virDrvDomainCreateXML)(virConnectPtr conn,
                         const char *xmlDesc,
                         unsigned int flags);

140
typedef virDomainPtr
141 142 143
(*virDrvDomainLookupByID)(virConnectPtr conn,
                          int id);

144
typedef virDomainPtr
145 146 147
(*virDrvDomainLookupByUUID)(virConnectPtr conn,
                            const unsigned char *uuid);

148
typedef virDomainPtr
149 150 151
(*virDrvDomainLookupByName)(virConnectPtr conn,
                            const char *name);

152
typedef int
153 154
(*virDrvDomainSuspend)(virDomainPtr domain);

155
typedef int
156 157
(*virDrvDomainResume)(virDomainPtr domain);

158
typedef int
159 160 161 162 163
 (*virDrvDomainPMSuspendForDuration)(virDomainPtr,
                                     unsigned int target,
                                     unsigned long long duration,
                                     unsigned int flags);

164
typedef int
165 166 167
(*virDrvDomainPMWakeup)(virDomainPtr domain,
                        unsigned int flags);

168
typedef int
169 170
(*virDrvDomainShutdown)(virDomainPtr domain);

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

X
Xu He Jie 已提交
175
typedef int
176 177 178
(*virDrvDomainReset)(virDomainPtr domain,
                     unsigned int flags);

179
typedef int
180 181
(*virDrvDomainDestroy)(virDomainPtr domain);

182
typedef int
183 184 185
(*virDrvDomainDestroyFlags)(virDomainPtr domain,
                            unsigned int flags);

186
typedef char *
187
(*virDrvDomainGetOSType)(virDomainPtr domain);
G
Guido Günther 已提交
188 189

typedef char *
190 191
(*virDrvDomainGetHostname)(virDomainPtr domain,
                           unsigned int flags);
G
Guido Günther 已提交
192

193
typedef unsigned long long
194 195
(*virDrvDomainGetMaxMemory)(virDomainPtr domain);

196
typedef int
197 198 199
(*virDrvDomainSetMaxMemory)(virDomainPtr domain,
                            unsigned long memory);

200
typedef int
201 202 203
(*virDrvDomainSetMemory)(virDomainPtr domain,
                         unsigned long memory);

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

209
typedef int
210 211 212 213 214
(*virDrvDomainSetMemoryParameters)(virDomainPtr domain,
                                   virTypedParameterPtr params,
                                   int nparams,
                                   unsigned int flags);

215
typedef int
216 217 218 219 220
(*virDrvDomainGetMemoryParameters)(virDomainPtr domain,
                                   virTypedParameterPtr params,
                                   int *nparams,
                                   unsigned int flags);

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

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

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

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

245
typedef int
246 247 248
(*virDrvDomainGetInfo)(virDomainPtr domain,
                       virDomainInfoPtr info);

249
typedef int
250 251 252 253 254
(*virDrvDomainGetState)(virDomainPtr domain,
                        int *state,
                        int *reason,
                        unsigned int flags);

255
typedef int
256 257 258 259
(*virDrvDomainGetControlInfo)(virDomainPtr domain,
                              virDomainControlInfoPtr info,
                              unsigned int flags);

260
typedef int
261 262 263
(*virDrvDomainSave)(virDomainPtr domain,
                    const char *to);

264
typedef int
265 266 267 268 269
(*virDrvDomainSaveFlags)(virDomainPtr domain,
                         const char *to,
                         const char *dxml,
                         unsigned int flags);

270
typedef int
271 272 273
(*virDrvDomainRestore)(virConnectPtr conn,
                       const char *from);

274
typedef int
275 276 277 278 279
(*virDrvDomainRestoreFlags)(virConnectPtr conn,
                            const char *from,
                            const char *dxml,
                            unsigned int flags);

280
typedef char *
281 282 283 284
(*virDrvDomainSaveImageGetXMLDesc)(virConnectPtr conn,
                                   const char *file,
                                   unsigned int flags);

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

D
Daniel Veillard 已提交
291
typedef int
292 293 294 295
(*virDrvDomainCoreDump)(virDomainPtr domain,
                        const char *to,
                        unsigned int flags);

296
typedef char *
297 298 299 300 301
(*virDrvDomainScreenshot)(virDomainPtr domain,
                          virStreamPtr stream,
                          unsigned int screen,
                          unsigned int flags);

302
typedef char *
303 304 305
(*virDrvDomainGetXMLDesc)(virDomainPtr dom,
                          unsigned int flags);

306
typedef char *
307 308 309 310 311
(*virDrvConnectDomainXMLFromNative)(virConnectPtr conn,
                                    const char *nativeFormat,
                                    const char *nativeConfig,
                                    unsigned int flags);

312
typedef char *
313 314 315 316 317
(*virDrvConnectDomainXMLToNative)(virConnectPtr conn,
                                  const char *nativeFormat,
                                  const char *domainXml,
                                  unsigned int flags);

318
typedef int
319 320 321 322
(*virDrvConnectListDefinedDomains)(virConnectPtr conn,
                                   char **const names,
                                   int maxnames);

323
typedef int
324 325 326 327
(*virDrvConnectListAllDomains)(virConnectPtr conn,
                               virDomainPtr **domains,
                               unsigned int flags);

328
typedef int
329 330
(*virDrvConnectNumOfDefinedDomains)(virConnectPtr conn);

331
typedef int
332 333
(*virDrvDomainCreate)(virDomainPtr dom);

334
typedef int
335 336 337
(*virDrvDomainCreateWithFlags)(virDomainPtr dom,
                               unsigned int flags);

338
typedef virDomainPtr
339 340 341
(*virDrvDomainDefineXML)(virConnectPtr conn,
                         const char *xml);

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

O
Osier Yang 已提交
345
typedef int
346 347 348
(*virDrvDomainUndefineFlags)(virDomainPtr dom,
                             unsigned int flags);

349
typedef int
350 351 352
(*virDrvDomainSetVcpus)(virDomainPtr domain,
                        unsigned int nvcpus);

E
Eric Blake 已提交
353
typedef int
354 355 356 357
(*virDrvDomainSetVcpusFlags)(virDomainPtr domain,
                             unsigned int nvcpus,
                             unsigned int flags);

E
Eric Blake 已提交
358
typedef int
359 360 361
(*virDrvDomainGetVcpusFlags)(virDomainPtr domain,
                             unsigned int flags);

362
typedef int
363 364 365 366 367
(*virDrvDomainPinVcpu)(virDomainPtr domain,
                       unsigned int vcpu,
                       unsigned char *cpumap,
                       int maplen);

368
typedef int
369 370 371 372 373 374
(*virDrvDomainPinVcpuFlags)(virDomainPtr domain,
                            unsigned int vcpu,
                            unsigned char *cpumap,
                            int maplen,
                            unsigned int flags);

375
typedef int
376 377 378 379 380 381
(*virDrvDomainGetVcpuPinInfo)(virDomainPtr domain,
                              int ncpumaps,
                              unsigned char *cpumaps,
                              int maplen,
                              unsigned int flags);

382
typedef int
383 384 385 386
(*virDrvDomainPinEmulator)(virDomainPtr domain,
                           unsigned char *cpumap,
                           int maplen,
                           unsigned int flags);
387

388
typedef int
389 390 391 392 393
(*virDrvDomainGetEmulatorPinInfo)(virDomainPtr domain,
                                  unsigned char *cpumaps,
                                  int maplen,
                                  unsigned int flags);

394
typedef int
395 396 397 398 399
(*virDrvDomainGetVcpus)(virDomainPtr domain,
                        virVcpuInfoPtr info,
                        int maxinfo,
                        unsigned char *cpumaps,
                        int maplen);
400 401

typedef int
402 403 404 405 406 407
(*virDrvDomainGetMaxVcpus)(virDomainPtr domain);

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

M
Marcelo Cerri 已提交
408
typedef int
409 410 411
(*virDrvDomainGetSecurityLabelList)(virDomainPtr domain,
                                    virSecurityLabelPtr* seclabels);

412
typedef int
413 414 415
(*virDrvNodeGetSecurityModel)(virConnectPtr conn,
                              virSecurityModelPtr secmodel);

416
typedef int
417 418 419
(*virDrvDomainAttachDevice)(virDomainPtr domain,
                            const char *xml);

J
Jim Fehlig 已提交
420
typedef int
421 422 423 424
(*virDrvDomainAttachDeviceFlags)(virDomainPtr domain,
                                 const char *xml,
                                 unsigned int flags);

425
typedef int
426 427 428
(*virDrvDomainDetachDevice)(virDomainPtr domain,
                            const char *xml);

J
Jim Fehlig 已提交
429
typedef int
430 431 432 433
(*virDrvDomainDetachDeviceFlags)(virDomainPtr domain,
                                 const char *xml,
                                 unsigned int flags);

434
typedef int
435 436 437 438
(*virDrvDomainUpdateDeviceFlags)(virDomainPtr domain,
                                 const char *xml,
                                 unsigned int flags);

439
typedef int
440 441 442
(*virDrvDomainGetAutostart)(virDomainPtr domain,
                            int *autostart);

443
typedef int
444 445
(*virDrvDomainSetAutostart)(virDomainPtr domain,
                            int autostart);
446

447
typedef char *
448 449
(*virDrvDomainGetSchedulerType)(virDomainPtr domain,
                                int *nparams);
450

451
typedef int
452 453 454
(*virDrvDomainGetSchedulerParameters)(virDomainPtr domain,
                                      virTypedParameterPtr params,
                                      int *nparams);
455

456
typedef int
457 458 459 460
(*virDrvDomainGetSchedulerParametersFlags)(virDomainPtr domain,
                                           virTypedParameterPtr params,
                                           int *nparams,
                                           unsigned int flags);
461

462
typedef int
463 464 465
(*virDrvDomainSetSchedulerParameters)(virDomainPtr domain,
                                      virTypedParameterPtr params,
                                      int nparams);
466

467
typedef int
468 469 470 471
(*virDrvDomainSetSchedulerParametersFlags)(virDomainPtr domain,
                                           virTypedParameterPtr params,
                                           int nparams,
                                           unsigned int flags);
472

473
typedef int
474 475 476 477
(*virDrvDomainBlockStats)(virDomainPtr domain,
                          const char *path,
                          struct _virDomainBlockStats *stats);

478
typedef int
479 480 481 482 483 484
(*virDrvDomainBlockStatsFlags)(virDomainPtr domain,
                               const char *path,
                               virTypedParameterPtr params,
                               int *nparams,
                               unsigned int flags);

485
typedef int
486 487 488 489
(*virDrvDomainInterfaceStats)(virDomainPtr domain,
                              const char *path,
                              struct _virDomainInterfaceStats *stats);

490
typedef int
491 492 493 494 495 496
(*virDrvDomainSetInterfaceParameters)(virDomainPtr dom,
                                      const char *device,
                                      virTypedParameterPtr params,
                                      int nparams,
                                      unsigned int flags);

497
typedef int
498 499 500 501 502
(*virDrvDomainGetInterfaceParameters)(virDomainPtr dom,
                                      const char *device,
                                      virTypedParameterPtr params,
                                      int *nparams,
                                      unsigned int flags);
503

504
typedef int
505 506 507 508
(*virDrvDomainMemoryStats)(virDomainPtr domain,
                           struct _virDomainMemoryStat *stats,
                           unsigned int nr_stats,
                           unsigned int flags);
509

R
Richard W.M. Jones 已提交
510
typedef int
511 512 513 514 515 516 517
(*virDrvDomainBlockPeek)(virDomainPtr domain,
                         const char *path,
                         unsigned long long offset,
                         size_t size,
                         void *buffer,
                         unsigned int flags);

O
Osier Yang 已提交
518
typedef int
519 520 521 522 523
(*virDrvDomainBlockResize)(virDomainPtr domain,
                           const char *path,
                           unsigned long long size,
                           unsigned int flags);

R
Richard W.M. Jones 已提交
524
typedef int
525 526 527 528 529 530
(*virDrvDomainMemoryPeek)(virDomainPtr domain,
                          unsigned long long start,
                          size_t size,
                          void *buffer,
                          unsigned int flags);

531
typedef int
532 533 534 535
(*virDrvDomainGetBlockInfo)(virDomainPtr domain,
                            const char *path,
                            virDomainBlockInfoPtr info,
                            unsigned int flags);
R
Richard W.M. Jones 已提交
536

537
typedef int
538 539 540 541 542 543 544 545
(*virDrvDomainMigratePrepare)(virConnectPtr dconn,
                              char **cookie,
                              int *cookielen,
                              const char *uri_in,
                              char **uri_out,
                              unsigned long flags,
                              const char *dname,
                              unsigned long resource);
546 547

typedef int
548 549 550 551 552 553 554
(*virDrvDomainMigratePerform)(virDomainPtr domain,
                              const char *cookie,
                              int cookielen,
                              const char *uri,
                              unsigned long flags,
                              const char *dname,
                              unsigned long resource);
555 556

typedef virDomainPtr
557 558 559 560 561 562
(*virDrvDomainMigrateFinish)(virConnectPtr dconn,
                             const char *dname,
                             const char *cookie,
                             int cookielen,
                             const char *uri,
                             unsigned long flags);
563

564
typedef int
565 566 567 568 569
(*virDrvNodeGetCPUStats)(virConnectPtr conn,
                         int cpuNum,
                         virNodeCPUStatsPtr params,
                         int *nparams,
                         unsigned int flags);
570

571
typedef int
572 573 574 575 576
(*virDrvNodeGetMemoryStats)(virConnectPtr conn,
                            int cellNum,
                            virNodeMemoryStatsPtr params,
                            int *nparams,
                            unsigned int flags);
577

578
typedef int
579 580 581 582
(*virDrvNodeGetCellsFreeMemory)(virConnectPtr conn,
                                unsigned long long *freeMems,
                                int startCell,
                                int maxCells);
583

584
typedef unsigned long long
585
(*virDrvNodeGetFreeMemory)(virConnectPtr conn);
586

587
typedef int
588 589 590 591
(*virDrvConnectDomainEventRegister)(virConnectPtr conn,
                                    virConnectDomainEventCallback cb,
                                    void *opaque,
                                    virFreeCallback freecb);
592 593

typedef int
594 595
(*virDrvConnectDomainEventDeregister)(virConnectPtr conn,
                                      virConnectDomainEventCallback cb);
596

D
Daniel Veillard 已提交
597
typedef int
598 599 600 601 602 603 604 605 606
(*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 已提交
607 608

typedef virDomainPtr
609 610 611 612 613 614 615
(*virDrvDomainMigrateFinish2)(virConnectPtr dconn,
                              const char *dname,
                              const char *cookie,
                              int cookielen,
                              const char *uri,
                              unsigned long flags,
                              int retcode);
D
Daniel Veillard 已提交
616

617
typedef int
618 619
(*virDrvNodeDeviceDettach)(virNodeDevicePtr dev);

620 621 622 623 624
typedef int
(*virDrvNodeDeviceDetachFlags)(virNodeDevicePtr dev,
                               const char *driverName,
                               unsigned int flags);

625
typedef int
626 627
(*virDrvNodeDeviceReAttach)(virNodeDevicePtr dev);

628
typedef int
629
(*virDrvNodeDeviceReset)(virNodeDevicePtr dev);
630

C
Chris Lalancette 已提交
631
typedef int
632 633 634 635 636 637
(*virDrvDomainMigratePrepareTunnel)(virConnectPtr dconn,
                                    virStreamPtr st,
                                    unsigned long flags,
                                    const char *dname,
                                    unsigned long resource,
                                    const char *dom_xml);
C
Chris Lalancette 已提交
638

639
typedef int
640 641
(*virDrvConnectIsEncrypted)(virConnectPtr conn);

642
typedef int
643 644
(*virDrvConnectIsSecure)(virConnectPtr conn);

J
Jiri Denemark 已提交
645
typedef int
646 647
(*virDrvConnectIsAlive)(virConnectPtr conn);

648
typedef int
649 650
(*virDrvDomainIsActive)(virDomainPtr dom);

651
typedef int
652 653
(*virDrvDomainIsPersistent)(virDomainPtr dom);

O
Osier Yang 已提交
654
typedef int
655
(*virDrvDomainIsUpdated)(virDomainPtr dom);
656

J
Jiri Denemark 已提交
657
typedef int
658 659 660 661
(*virDrvConnectCompareCPU)(virConnectPtr conn,
                           const char *cpu,
                           unsigned int flags);

662
typedef char *
663 664 665 666
(*virDrvConnectBaselineCPU)(virConnectPtr conn,
                            const char **xmlCPUs,
                            unsigned int ncpus,
                            unsigned int flags);
J
Jiri Denemark 已提交
667

668
typedef int
669 670 671
(*virDrvDomainGetJobInfo)(virDomainPtr domain,
                          virDomainJobInfoPtr info);

672
typedef int
673 674 675 676 677
(*virDrvDomainGetJobStats)(virDomainPtr domain,
                           int *type,
                           virTypedParameterPtr *params,
                           int *nparams,
                           unsigned int flags);
678

679
typedef int
680
(*virDrvDomainAbortJob)(virDomainPtr domain);
681

682
typedef int
683 684 685 686
(*virDrvDomainMigrateSetMaxDowntime)(virDomainPtr domain,
                                     unsigned long long downtime,
                                     unsigned int flags);

687
typedef int
688 689 690 691
(*virDrvDomainMigrateGetCompressionCache)(virDomainPtr domain,
                                          unsigned long long *cacheSize,
                                          unsigned int flags);

692
typedef int
693 694 695
(*virDrvDomainMigrateSetCompressionCache)(virDomainPtr domain,
                                          unsigned long long cacheSize,
                                          unsigned int flags);
696

697
typedef int
698 699 700
(*virDrvDomainMigrateSetMaxSpeed)(virDomainPtr domain,
                                  unsigned long bandwidth,
                                  unsigned int flags);
701

702
typedef int
703 704 705
(*virDrvDomainMigrateGetMaxSpeed)(virDomainPtr domain,
                                  unsigned long *bandwidth,
                                  unsigned int flags);
706

707
typedef int
708 709 710 711 712 713
(*virDrvConnectDomainEventRegisterAny)(virConnectPtr conn,
                                       virDomainPtr dom,
                                       int eventID,
                                       virConnectDomainEventGenericCallback cb,
                                       void *opaque,
                                       virFreeCallback freecb);
714 715

typedef int
716 717
(*virDrvConnectDomainEventDeregisterAny)(virConnectPtr conn,
                                         int callbackID);
718

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

typedef int
724 725
(*virDrvDomainHasManagedSaveImage)(virDomainPtr domain,
                                   unsigned int flags);
726 727

typedef int
728 729
(*virDrvDomainManagedSaveRemove)(virDomainPtr domain,
                                 unsigned int flags);
730

C
Chris Lalancette 已提交
731
typedef virDomainSnapshotPtr
732 733 734
(*virDrvDomainSnapshotCreateXML)(virDomainPtr domain,
                                 const char *xmlDesc,
                                 unsigned int flags);
C
Chris Lalancette 已提交
735 736

typedef char *
737 738
(*virDrvDomainSnapshotGetXMLDesc)(virDomainSnapshotPtr snapshot,
                                  unsigned int flags);
C
Chris Lalancette 已提交
739 740

typedef int
741 742
(*virDrvDomainSnapshotNum)(virDomainPtr domain,
                           unsigned int flags);
C
Chris Lalancette 已提交
743 744

typedef int
745 746 747 748
(*virDrvDomainSnapshotListNames)(virDomainPtr domain,
                                 char **names,
                                 int nameslen,
                                 unsigned int flags);
C
Chris Lalancette 已提交
749

750
typedef int
751 752 753
(*virDrvDomainListAllSnapshots)(virDomainPtr domain,
                                virDomainSnapshotPtr **snaps,
                                unsigned int flags);
754

755
typedef int
756 757
(*virDrvDomainSnapshotNumChildren)(virDomainSnapshotPtr snapshot,
                                   unsigned int flags);
758 759

typedef int
760 761 762 763
(*virDrvDomainSnapshotListChildrenNames)(virDomainSnapshotPtr snapshot,
                                         char **names,
                                         int nameslen,
                                         unsigned int flags);
764

765
typedef int
766 767 768
(*virDrvDomainSnapshotListAllChildren)(virDomainSnapshotPtr snapshot,
                                       virDomainSnapshotPtr **snaps,
                                       unsigned int flags);
769

C
Chris Lalancette 已提交
770
typedef virDomainSnapshotPtr
771 772 773
(*virDrvDomainSnapshotLookupByName)(virDomainPtr domain,
                                    const char *name,
                                    unsigned int flags);
C
Chris Lalancette 已提交
774 775

typedef int
776 777
(*virDrvDomainHasCurrentSnapshot)(virDomainPtr domain,
                                  unsigned int flags);
C
Chris Lalancette 已提交
778

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

C
Chris Lalancette 已提交
783
typedef virDomainSnapshotPtr
784 785
(*virDrvDomainSnapshotCurrent)(virDomainPtr domain,
                               unsigned int flags);
C
Chris Lalancette 已提交
786

E
Eric Blake 已提交
787
typedef int
788 789
(*virDrvDomainSnapshotIsCurrent)(virDomainSnapshotPtr snapshot,
                                 unsigned int flags);
E
Eric Blake 已提交
790 791

typedef int
792 793
(*virDrvDomainSnapshotHasMetadata)(virDomainSnapshotPtr snapshot,
                                   unsigned int flags);
E
Eric Blake 已提交
794

C
Chris Lalancette 已提交
795
typedef int
796 797
(*virDrvDomainRevertToSnapshot)(virDomainSnapshotPtr snapshot,
                                unsigned int flags);
C
Chris Lalancette 已提交
798 799

typedef int
800 801
(*virDrvDomainSnapshotDelete)(virDomainSnapshotPtr snapshot,
                              unsigned int flags);
C
Chris Lalancette 已提交
802

C
Chris Lalancette 已提交
803
typedef int
804 805 806 807 808
(*virDrvDomainQemuMonitorCommand)(virDomainPtr domain,
                                  const char *cmd,
                                  char **result,
                                  unsigned int flags);

809
typedef char *
810 811 812 813
(*virDrvDomainQemuAgentCommand)(virDomainPtr domain,
                                const char *cmd,
                                int timeout,
                                unsigned int flags);
C
Chris Lalancette 已提交
814

815
/* Choice of unsigned int rather than pid_t is intentional.  */
816
typedef virDomainPtr
817 818 819
(*virDrvDomainQemuAttach)(virConnectPtr conn,
                          unsigned int pid_value,
                          unsigned int flags);
820

821
typedef int
822 823 824 825 826
(*virDrvDomainOpenConsole)(virDomainPtr dom,
                           const char *dev_name,
                           virStreamPtr st,
                           unsigned int flags);

827
typedef int
828 829 830 831
(*virDrvDomainOpenChannel)(virDomainPtr dom,
                           const char *name,
                           virStreamPtr st,
                           unsigned int flags);
832

833
typedef int
834 835 836 837
(*virDrvDomainOpenGraphics)(virDomainPtr dom,
                            unsigned int idx,
                            int fd,
                            unsigned int flags);
C
Chris Lalancette 已提交
838

839
typedef int
840 841
(*virDrvDomainInjectNMI)(virDomainPtr dom,
                         unsigned int flags);
842

843
typedef int
844 845 846 847 848 849
(*virDrvDomainSendKey)(virDomainPtr dom,
                       unsigned int codeset,
                       unsigned int holdtime,
                       unsigned int *keycodes,
                       int nkeycodes,
                       unsigned int flags);
850

851
typedef int
852 853 854 855
(*virDrvDomainSendProcessSignal)(virDomainPtr dom,
                                 long long pid_value,
                                 unsigned int signum,
                                 unsigned int flags);
856

857
typedef char *
858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903
(*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);
904

905
typedef virDomainPtr
906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928
(*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);
929 930

typedef int
931 932 933
(*virDrvDomainBlockJobAbort)(virDomainPtr dom,
                             const char *path,
                             unsigned int flags);
934 935

typedef int
936 937 938 939
(*virDrvDomainGetBlockJobInfo)(virDomainPtr dom,
                               const char *path,
                               virDomainBlockJobInfoPtr info,
                               unsigned int flags);
940 941

typedef int
942 943 944 945
(*virDrvDomainBlockJobSetSpeed)(virDomainPtr dom,
                                const char *path,
                                unsigned long bandwidth,
                                unsigned int flags);
946 947

typedef int
948 949 950 951 952
(*virDrvDomainBlockPull)(virDomainPtr dom,
                         const char *path,
                         unsigned long bandwidth,
                         unsigned int flags);

953
typedef int
954 955 956 957 958 959
(*virDrvDomainBlockRebase)(virDomainPtr dom,
                           const char *path,
                           const char *base,
                           unsigned long bandwidth,
                           unsigned int flags);

E
Eric Blake 已提交
960
typedef int
961 962 963 964 965 966
(*virDrvDomainBlockCommit)(virDomainPtr dom,
                           const char *disk,
                           const char *base,
                           const char *top,
                           unsigned long bandwidth,
                           unsigned int flags);
967

J
Jiri Denemark 已提交
968
typedef int
969 970 971
(*virDrvConnectSetKeepAlive)(virConnectPtr conn,
                             int interval,
                             unsigned int count);
972

973
typedef int
974 975 976 977 978 979
(*virDrvDomainSetBlockIoTune)(virDomainPtr dom,
                              const char *disk,
                              virTypedParameterPtr params,
                              int nparams,
                              unsigned int flags);

980
typedef int
981 982 983 984 985 986
(*virDrvDomainGetBlockIoTune)(virDomainPtr dom,
                              const char *disk,
                              virTypedParameterPtr params,
                              int *nparams,
                              unsigned int flags);

987
typedef int
988 989
(*virDrvDomainShutdownFlags)(virDomainPtr domain,
                             unsigned int flags);
990

991
typedef int
992 993 994 995 996 997
(*virDrvDomainGetCPUStats)(virDomainPtr domain,
                           virTypedParameterPtr params,
                           unsigned int nparams,
                           int start_cpu,
                           unsigned int ncpus,
                           unsigned int flags);
998

999
typedef int
1000 1001 1002 1003
(*virDrvDomainGetDiskErrors)(virDomainPtr dom,
                             virDomainDiskErrorPtr errors,
                             unsigned int maxerrors,
                             unsigned int flags);
1004

1005
typedef int
1006 1007 1008 1009 1010 1011
(*virDrvDomainSetMetadata)(virDomainPtr dom,
                           int type,
                           const char *metadata,
                           const char *key,
                           const char *uri,
                           unsigned int flags);
1012 1013

typedef char *
1014 1015 1016 1017
(*virDrvDomainGetMetadata)(virDomainPtr dom,
                           int type,
                           const char *uri,
                           unsigned int flags);
1018

1019
typedef int
1020 1021 1022 1023
(*virDrvNodeGetMemoryParameters)(virConnectPtr conn,
                                 virTypedParameterPtr params,
                                 int *nparams,
                                 unsigned int flags);
1024 1025

typedef int
1026 1027 1028 1029
(*virDrvNodeSetMemoryParameters)(virConnectPtr conn,
                                 virTypedParameterPtr params,
                                 int nparams,
                                 unsigned int flags);
1030

1031
typedef int
1032 1033 1034 1035 1036
(*virDrvNodeGetCPUMap)(virConnectPtr conn,
                       unsigned char **cpumap,
                       unsigned int *online,
                       unsigned int flags);

1037
typedef int
1038 1039 1040 1041
(*virDrvDomainFSTrim)(virDomainPtr dom,
                      const char *mountPoint,
                      unsigned long long minimum,
                      unsigned int flags);
1042

1043
typedef int
1044 1045 1046 1047 1048 1049
(*virDrvDomainLxcOpenNamespace)(virDomainPtr dom,
                                int **fdlist,
                                unsigned int flags);

typedef struct _virDriver virDriver;
typedef virDriver *virDriverPtr;
1050

1051 1052 1053 1054 1055
/**
 * _virDriver:
 *
 * Structure associated to a virtualization driver, defining the various
 * entry points for it.
1056 1057 1058 1059 1060 1061
 *
 * All drivers must support the following fields/methods:
 *  - no
 *  - name
 *  - open
 *  - close
1062 1063
 */
struct _virDriver {
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148
    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;
    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;
    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;
    virDrvDomainDefineXML domainDefineXML;
    virDrvDomainUndefine domainUndefine;
    virDrvDomainUndefineFlags domainUndefineFlags;
    virDrvDomainAttachDevice domainAttachDevice;
    virDrvDomainAttachDeviceFlags domainAttachDeviceFlags;
    virDrvDomainDetachDevice domainDetachDevice;
    virDrvDomainDetachDeviceFlags domainDetachDeviceFlags;
    virDrvDomainUpdateDeviceFlags domainUpdateDeviceFlags;
    virDrvDomainGetAutostart domainGetAutostart;
    virDrvDomainSetAutostart domainSetAutostart;
    virDrvDomainGetSchedulerType domainGetSchedulerType;
    virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
1149
    virDrvDomainGetSchedulerParametersFlags domainGetSchedulerParametersFlags;
1150
    virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
1151
    virDrvDomainSetSchedulerParametersFlags domainSetSchedulerParametersFlags;
1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173
    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;
1174
    virDrvNodeDeviceDetachFlags nodeDeviceDetachFlags;
1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188
    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;
1189 1190
    virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCache;
    virDrvDomainMigrateSetCompressionCache domainMigrateSetCompressionCache;
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203
    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;
1204
    virDrvDomainSnapshotListChildrenNames domainSnapshotListChildrenNames;
1205
    virDrvDomainSnapshotListAllChildren domainSnapshotListAllChildren;
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248
    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;
1249 1250
};

1251 1252 1253 1254

typedef virDrvConnectOpen virDrvNetworkOpen;
typedef virDrvConnectClose virDrvNetworkClose;

1255
typedef int
1256 1257
(*virDrvConnectNumOfNetworks)(virConnectPtr conn);

1258
typedef int
1259 1260 1261 1262
(*virDrvConnectListNetworks)(virConnectPtr conn,
                             char **const names,
                             int maxnames);

1263
typedef int
1264 1265
(*virDrvConnectNumOfDefinedNetworks)(virConnectPtr conn);

1266
typedef int
1267 1268 1269 1270
(*virDrvConnectListDefinedNetworks)(virConnectPtr conn,
                                    char **const names,
                                    int maxnames);

1271
typedef int
1272 1273 1274 1275
(*virDrvConnectListAllNetworks)(virConnectPtr conn,
                                virNetworkPtr **nets,
                                unsigned int flags);

1276
typedef virNetworkPtr
1277 1278 1279
(*virDrvNetworkLookupByUUID)(virConnectPtr conn,
                             const unsigned char *uuid);

1280
typedef virNetworkPtr
1281 1282 1283
(*virDrvNetworkLookupByName)(virConnectPtr conn,
                             const char *name);

1284
typedef virNetworkPtr
1285 1286 1287
(*virDrvNetworkCreateXML)(virConnectPtr conn,
                          const char *xmlDesc);

1288
typedef virNetworkPtr
1289 1290 1291
(*virDrvNetworkDefineXML)(virConnectPtr conn,
                          const char *xml);

1292
typedef int
1293 1294
(*virDrvNetworkUndefine)(virNetworkPtr network);

1295
typedef int
1296 1297 1298 1299 1300 1301 1302
(*virDrvNetworkUpdate)(virNetworkPtr network,
                       unsigned int command, /* virNetworkUpdateCommand */
                       unsigned int section, /* virNetworkUpdateSection */
                       int parentIndex,
                       const char *xml,
                       unsigned int flags);

1303
typedef int
1304 1305
(*virDrvNetworkCreate)(virNetworkPtr network);

1306
typedef int
1307 1308
(*virDrvNetworkDestroy)(virNetworkPtr network);

1309
typedef char *
1310 1311 1312
(*virDrvNetworkGetXMLDesc)(virNetworkPtr network,
                           unsigned int flags);

1313
typedef char *
1314 1315
(*virDrvNetworkGetBridgeName)(virNetworkPtr network);

1316
typedef int
1317 1318 1319
(*virDrvNetworkGetAutostart)(virNetworkPtr network,
                             int *autostart);

1320
typedef int
1321 1322
(*virDrvNetworkSetAutostart)(virNetworkPtr network,
                             int autostart);
1323

1324
typedef int
1325 1326
(*virDrvNetworkIsActive)(virNetworkPtr net);

1327
typedef int
1328
(*virDrvNetworkIsPersistent)(virNetworkPtr net);
1329 1330


1331 1332 1333 1334 1335 1336 1337 1338 1339

typedef struct _virNetworkDriver virNetworkDriver;
typedef virNetworkDriver *virNetworkDriverPtr;

/**
 * _virNetworkDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
1340 1341 1342 1343
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
1344 1345
 */
struct _virNetworkDriver {
1346
    const char * name; /* the name of the driver */
1347 1348
    virDrvNetworkOpen networkOpen;
    virDrvNetworkClose networkClose;
1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367
    virDrvConnectNumOfNetworks connectNumOfNetworks;
    virDrvConnectListNetworks connectListNetworks;
    virDrvConnectNumOfDefinedNetworks connectNumOfDefinedNetworks;
    virDrvConnectListDefinedNetworks connectListDefinedNetworks;
    virDrvConnectListAllNetworks connectListAllNetworks;
    virDrvNetworkLookupByUUID networkLookupByUUID;
    virDrvNetworkLookupByName networkLookupByName;
    virDrvNetworkCreateXML networkCreateXML;
    virDrvNetworkDefineXML networkDefineXML;
    virDrvNetworkUndefine networkUndefine;
    virDrvNetworkUpdate networkUpdate;
    virDrvNetworkCreate networkCreate;
    virDrvNetworkDestroy networkDestroy;
    virDrvNetworkGetXMLDesc networkGetXMLDesc;
    virDrvNetworkGetBridgeName networkGetBridgeName;
    virDrvNetworkGetAutostart networkGetAutostart;
    virDrvNetworkSetAutostart networkSetAutostart;
    virDrvNetworkIsActive networkIsActive;
    virDrvNetworkIsPersistent networkIsPersistent;
1368 1369
};

1370

1371 1372 1373
typedef virDrvConnectOpen virDrvInterfaceOpen;
typedef virDrvConnectClose virDrvInterfaceClose;

D
Daniel Veillard 已提交
1374
typedef int
1375 1376
(*virDrvConnectNumOfInterfaces)(virConnectPtr conn);

D
Daniel Veillard 已提交
1377
typedef int
1378 1379 1380 1381
(*virDrvConnectListInterfaces)(virConnectPtr conn,
                               char **const names,
                               int maxnames);

1382
typedef int
1383 1384
(*virDrvConnectNumOfDefinedInterfaces)(virConnectPtr conn);

1385
typedef int
1386 1387 1388 1389
(*virDrvConnectListDefinedInterfaces)(virConnectPtr conn,
                                      char **const names,
                                      int maxnames);

1390
typedef int
1391 1392 1393 1394
(*virDrvConnectListAllInterfaces)(virConnectPtr conn,
                                  virInterfacePtr **ifaces,
                                  unsigned int flags);

D
Daniel Veillard 已提交
1395
typedef virInterfacePtr
1396 1397 1398
(*virDrvInterfaceLookupByName)(virConnectPtr conn,
                               const char *name);

D
Daniel Veillard 已提交
1399
typedef virInterfacePtr
1400 1401
(*virDrvInterfaceLookupByMACString)(virConnectPtr conn,
                                    const char *mac);
D
Daniel Veillard 已提交
1402 1403

typedef char *
1404 1405
(*virDrvInterfaceGetXMLDesc)(virInterfacePtr iface,
                             unsigned int flags);
D
Daniel Veillard 已提交
1406 1407

typedef virInterfacePtr
1408 1409 1410 1411
(*virDrvInterfaceDefineXML)(virConnectPtr conn,
                            const char *xmlDesc,
                            unsigned int flags);

D
Daniel Veillard 已提交
1412
typedef int
1413 1414
(*virDrvInterfaceUndefine)(virInterfacePtr iface);

D
Daniel Veillard 已提交
1415
typedef int
1416 1417 1418
(*virDrvInterfaceCreate)(virInterfacePtr iface,
                         unsigned int flags);

D
Daniel Veillard 已提交
1419
typedef int
1420 1421
(*virDrvInterfaceDestroy)(virInterfacePtr iface,
                          unsigned int flags);
D
Daniel Veillard 已提交
1422

1423
typedef int
1424
(*virDrvInterfaceIsActive)(virInterfacePtr iface);
1425

1426
typedef int
1427 1428 1429
(*virDrvInterfaceChangeBegin)(virConnectPtr conn,
                              unsigned int flags);

1430
typedef int
1431 1432 1433
(*virDrvInterfaceChangeCommit)(virConnectPtr conn,
                               unsigned int flags);

1434
typedef int
1435 1436
(*virDrvInterfaceChangeRollback)(virConnectPtr conn,
                                 unsigned int flags);
1437

D
Daniel Veillard 已提交
1438 1439 1440 1441 1442 1443
typedef struct _virInterfaceDriver virInterfaceDriver;
typedef virInterfaceDriver *virInterfaceDriverPtr;

/**
 * _virInterfaceDriver:
 *
1444
 * Structure associated to a network interface driver, defining the various
D
Daniel Veillard 已提交
1445 1446 1447 1448 1449 1450 1451
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virInterfaceDriver {
1452
    const char *name; /* the name of the driver */
1453 1454
    virDrvInterfaceOpen interfaceOpen;
    virDrvInterfaceClose interfaceClose;
1455 1456 1457 1458 1459 1460
    virDrvConnectNumOfInterfaces connectNumOfInterfaces;
    virDrvConnectListInterfaces connectListInterfaces;
    virDrvConnectNumOfDefinedInterfaces connectNumOfDefinedInterfaces;
    virDrvConnectListDefinedInterfaces connectListDefinedInterfaces;
    virDrvConnectListAllInterfaces connectListAllInterfaces;
    virDrvInterfaceLookupByName interfaceLookupByName;
D
Daniel Veillard 已提交
1461
    virDrvInterfaceLookupByMACString interfaceLookupByMACString;
1462 1463 1464 1465 1466 1467 1468 1469 1470
    virDrvInterfaceGetXMLDesc interfaceGetXMLDesc;
    virDrvInterfaceDefineXML interfaceDefineXML;
    virDrvInterfaceUndefine interfaceUndefine;
    virDrvInterfaceCreate interfaceCreate;
    virDrvInterfaceDestroy interfaceDestroy;
    virDrvInterfaceIsActive interfaceIsActive;
    virDrvInterfaceChangeBegin interfaceChangeBegin;
    virDrvInterfaceChangeCommit interfaceChangeCommit;
    virDrvInterfaceChangeRollback interfaceChangeRollback;
D
Daniel Veillard 已提交
1471 1472
};

1473

1474 1475 1476 1477
typedef virDrvConnectOpen virDrvStorageOpen;
typedef virDrvConnectClose virDrvStorageClose;


1478
typedef int
1479 1480
(*virDrvConnectNumOfStoragePools)(virConnectPtr conn);

1481
typedef int
1482 1483 1484 1485
(*virDrvConnectListStoragePools)(virConnectPtr conn,
                                 char **const names,
                                 int maxnames);

1486
typedef int
1487 1488
(*virDrvConnectNumOfDefinedStoragePools)(virConnectPtr conn);

1489
typedef int
1490 1491 1492 1493
(*virDrvConnectListDefinedStoragePools)(virConnectPtr conn,
                                        char **const names,
                                        int maxnames);

1494
typedef int
1495 1496 1497 1498
(*virDrvConnectListAllStoragePools)(virConnectPtr conn,
                                    virStoragePoolPtr **pools,
                                    unsigned int flags);

1499
typedef char *
1500 1501 1502 1503 1504
(*virDrvConnectFindStoragePoolSources)(virConnectPtr conn,
                                       const char *type,
                                       const char *srcSpec,
                                       unsigned int flags);

1505
typedef virStoragePoolPtr
1506 1507 1508
(*virDrvStoragePoolLookupByName)(virConnectPtr conn,
                                 const char *name);

1509
typedef virStoragePoolPtr
1510 1511 1512
(*virDrvStoragePoolLookupByUUID)(virConnectPtr conn,
                                 const unsigned char *uuid);

1513
typedef virStoragePoolPtr
1514 1515
(*virDrvStoragePoolLookupByVolume)(virStorageVolPtr vol);

1516
typedef virStoragePoolPtr
1517 1518 1519 1520
(*virDrvStoragePoolCreateXML)(virConnectPtr conn,
                              const char *xmlDesc,
                              unsigned int flags);

1521
typedef virStoragePoolPtr
1522 1523 1524 1525
(*virDrvStoragePoolDefineXML)(virConnectPtr conn,
                              const char *xmlDesc,
                              unsigned int flags);

1526
typedef int
1527 1528
(*virDrvStoragePoolUndefine)(virStoragePoolPtr pool);

1529
typedef int
1530 1531 1532
(*virDrvStoragePoolBuild)(virStoragePoolPtr pool,
                          unsigned int flags);

1533
typedef int
1534 1535 1536
(*virDrvStoragePoolCreate)(virStoragePoolPtr pool,
                           unsigned int flags);

1537
typedef int
1538 1539
(*virDrvStoragePoolDestroy)(virStoragePoolPtr pool);

1540
typedef int
1541 1542 1543
(*virDrvStoragePoolDelete)(virStoragePoolPtr pool,
                           unsigned int flags);

1544
typedef int
1545 1546 1547
(*virDrvStoragePoolRefresh)(virStoragePoolPtr pool,
                            unsigned int flags);

1548
typedef int
1549 1550 1551
(*virDrvStoragePoolGetInfo)(virStoragePoolPtr vol,
                            virStoragePoolInfoPtr info);

1552
typedef char *
1553 1554 1555
(*virDrvStoragePoolGetXMLDesc)(virStoragePoolPtr pool,
                               unsigned int flags);

1556
typedef int
1557 1558 1559
(*virDrvStoragePoolGetAutostart)(virStoragePoolPtr pool,
                                 int *autostart);

1560
typedef int
1561 1562 1563
(*virDrvStoragePoolSetAutostart)(virStoragePoolPtr pool,
                                 int autostart);

1564
typedef int
1565 1566
(*virDrvStoragePoolNumOfVolumes)(virStoragePoolPtr pool);

1567
typedef int
1568 1569 1570 1571
(*virDrvStoragePoolListVolumes)(virStoragePoolPtr pool,
                                char **const names,
                                int maxnames);

1572
typedef int
1573 1574 1575
(*virDrvStoragePoolListAllVolumes)(virStoragePoolPtr pool,
                                   virStorageVolPtr **vols,
                                   unsigned int flags);
1576 1577

typedef virStorageVolPtr
1578 1579 1580
(*virDrvStorageVolLookupByName)(virStoragePoolPtr pool,
                                const char *name);

1581
typedef virStorageVolPtr
1582 1583
(*virDrvStorageVolLookupByKey)(virConnectPtr pool,
                               const char *key);
1584

1585 1586 1587
typedef virStorageVolPtr
(*virDrvStorageVolLookupByPath)(virConnectPtr pool,
                                const char *path);
1588 1589

typedef virStorageVolPtr
1590 1591 1592 1593
(*virDrvStorageVolCreateXML)(virStoragePoolPtr pool,
                             const char *xmldesc,
                             unsigned int flags);

1594
typedef int
1595 1596
(*virDrvStorageVolDelete)(virStorageVolPtr vol,
                          unsigned int flags);
1597

1598
typedef int
1599 1600 1601
(*virDrvStorageVolWipe)(virStorageVolPtr vol,
                        unsigned int flags);

1602
typedef int
1603 1604 1605
(*virDrvStorageVolWipePattern)(virStorageVolPtr vol,
                               unsigned int algorithm,
                               unsigned int flags);
1606

1607
typedef int
1608 1609 1610
(*virDrvStorageVolGetInfo)(virStorageVolPtr vol,
                           virStorageVolInfoPtr info);

1611
typedef char *
1612 1613 1614
(*virDrvStorageVolGetXMLDesc)(virStorageVolPtr pool,
                              unsigned int flags);

1615
typedef char *
1616
(*virDrvStorageVolGetPath)(virStorageVolPtr vol);
1617

1618
typedef virStorageVolPtr
1619 1620 1621
(*virDrvStorageVolCreateXMLFrom)(virStoragePoolPtr pool,
                                 const char *xmldesc,
                                 virStorageVolPtr clonevol,
1622
                                 unsigned int flags);
1623

1624
typedef int
1625 1626 1627 1628 1629 1630
(*virDrvStorageVolDownload)(virStorageVolPtr vol,
                            virStreamPtr stream,
                            unsigned long long offset,
                            unsigned long long length,
                            unsigned int flags);

1631
typedef int
1632 1633 1634 1635 1636
(*virDrvStorageVolUpload)(virStorageVolPtr vol,
                          virStreamPtr stream,
                          unsigned long long offset,
                          unsigned long long length,
                          unsigned int flags);
1637

1638
typedef int
1639 1640 1641 1642
(*virDrvStorageVolResize)(virStorageVolPtr vol,
                          unsigned long long capacity,
                          unsigned int flags);

1643
typedef int
1644 1645 1646 1647
(*virDrvStoragePoolIsActive)(virStoragePoolPtr pool);

typedef int
(*virDrvStoragePoolIsPersistent)(virStoragePoolPtr pool);
1648 1649


1650 1651 1652 1653 1654 1655 1656

typedef struct _virStorageDriver virStorageDriver;
typedef virStorageDriver *virStorageDriverPtr;

/**
 * _virStorageDriver:
 *
1657
 * Structure associated to a storage driver, defining the various
1658 1659 1660 1661 1662 1663 1664
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virStorageDriver {
1665
    const char * name; /* the name of the driver */
1666 1667
    virDrvStorageOpen storageOpen;
    virDrvStorageClose storageClose;
1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707
    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;
1708 1709
};

1710
# ifdef WITH_LIBVIRTD
1711

1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724
typedef int
(*virDrvStateInitialize)(bool privileged,
                         virStateInhibitCallback callback,
                         void *opaque);

typedef int
(*virDrvStateCleanup)(void);

typedef int
(*virDrvStateReload)(void);

typedef int
(*virDrvStateStop)(void);
1725 1726 1727 1728 1729

typedef struct _virStateDriver virStateDriver;
typedef virStateDriver *virStateDriverPtr;

struct _virStateDriver {
1730
    const char *name;
1731 1732 1733 1734
    virDrvStateInitialize stateInitialize;
    virDrvStateCleanup stateCleanup;
    virDrvStateReload stateReload;
    virDrvStateStop stateStop;
1735
};
1736
# endif
1737

1738

1739 1740 1741 1742
typedef virDrvConnectOpen virDrvNodeDeviceOpen;
typedef virDrvConnectClose virDrvNodeDeviceClose;


1743 1744 1745 1746
typedef int
(*virDrvNodeNumOfDevices)(virConnectPtr conn,
                          const char *cap,
                          unsigned int flags);
1747

1748 1749 1750 1751 1752 1753
typedef int
(*virDrvNodeListDevices)(virConnectPtr conn,
                         const char *cap,
                         char **const names,
                         int maxnames,
                         unsigned int flags);
1754

1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772
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);
1773

1774 1775
typedef char *
(*virDrvNodeDeviceGetParent)(virNodeDevicePtr dev);
1776

1777 1778
typedef int
(*virDrvNodeDeviceNumOfCaps)(virNodeDevicePtr dev);
1779

1780 1781 1782 1783
typedef int
(*virDrvNodeDeviceListCaps)(virNodeDevicePtr dev,
                            char **const names,
                            int maxnames);
1784

1785 1786 1787 1788
typedef virNodeDevicePtr
(*virDrvNodeDeviceCreateXML)(virConnectPtr conn,
                             const char *xmlDesc,
                             unsigned int flags);
1789

1790 1791
typedef int
(*virDrvNodeDeviceDestroy)(virNodeDevicePtr dev);
1792 1793


1794

1795 1796
typedef struct _virNodeDeviceDriver virNodeDeviceDriver;
typedef virNodeDeviceDriver *virNodeDeviceDriverPtr;
1797

1798
/**
1799
 * _virNodeDeviceDriver:
1800 1801 1802 1803 1804
 *
 * Structure associated with monitoring the devices
 * on a virtualized node.
 *
 */
1805
struct _virNodeDeviceDriver {
1806
    const char * name; /* the name of the driver */
1807 1808
    virDrvNodeDeviceOpen nodeDeviceOpen;
    virDrvNodeDeviceClose nodeDeviceClose;
1809 1810
    virDrvNodeNumOfDevices nodeNumOfDevices;
    virDrvNodeListDevices nodeListDevices;
1811 1812
    virDrvConnectListAllNodeDevices connectListAllNodeDevices;
    virDrvNodeDeviceLookupByName nodeDeviceLookupByName;
1813 1814 1815 1816 1817 1818 1819
    virDrvNodeDeviceLookupSCSIHostByWWN nodeDeviceLookupSCSIHostByWWN;
    virDrvNodeDeviceGetXMLDesc nodeDeviceGetXMLDesc;
    virDrvNodeDeviceGetParent nodeDeviceGetParent;
    virDrvNodeDeviceNumOfCaps nodeDeviceNumOfCaps;
    virDrvNodeDeviceListCaps nodeDeviceListCaps;
    virDrvNodeDeviceCreateXML nodeDeviceCreateXML;
    virDrvNodeDeviceDestroy nodeDeviceDestroy;
1820 1821
};

1822 1823
enum {
    /* This getValue call is inside libvirt, override the "private" flag.
E
Eric Blake 已提交
1824
       This flag cannot be set by outside callers. */
1825
    VIR_SECRET_GET_VALUE_INTERNAL_CALL = 1 << 0,
1826 1827
};

1828 1829 1830 1831
typedef virDrvConnectOpen virDrvSecretOpen;
typedef virDrvConnectClose virDrvSecretClose;


1832
typedef virSecretPtr
1833 1834 1835
(*virDrvSecretLookupByUUID)(virConnectPtr conn,
                            const unsigned char *uuid);

1836
typedef virSecretPtr
1837 1838 1839 1840
(*virDrvSecretLookupByUsage)(virConnectPtr conn,
                             int usageType,
                             const char *usageID);

1841
typedef virSecretPtr
1842 1843 1844 1845
(*virDrvSecretDefineXML)(virConnectPtr conn,
                         const char *xml,
                         unsigned int flags);

1846
typedef char *
1847 1848 1849
(*virDrvSecretGetXMLDesc)(virSecretPtr secret,
                          unsigned int flags);

1850
typedef int
1851 1852 1853 1854 1855
(*virDrvSecretSetValue)(virSecretPtr secret,
                        const unsigned char *value,
                        size_t value_size,
                        unsigned int flags);

1856
typedef unsigned char *
1857 1858 1859 1860 1861
(*virDrvSecretGetValue)(virSecretPtr secret,
                        size_t *value_size,
                        unsigned int flags,
                        unsigned int internalFlags);

1862
typedef int
1863 1864
(*virDrvSecretUndefine)(virSecretPtr secret);

1865
typedef int
1866 1867
(*virDrvConnectNumOfSecrets)(virConnectPtr conn);

1868
typedef int
1869 1870 1871 1872
(*virDrvConnectListSecrets)(virConnectPtr conn,
                            char **uuids,
                            int maxuuids);

1873
typedef int
1874 1875 1876
(*virDrvConnectListAllSecrets)(virConnectPtr conn,
                               virSecretPtr **secrets,
                               unsigned int flags);
1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892

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;
1893 1894
    virDrvSecretOpen secretOpen;
    virDrvSecretClose secretClose;
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904
    virDrvConnectNumOfSecrets connectNumOfSecrets;
    virDrvConnectListSecrets connectListSecrets;
    virDrvConnectListAllSecrets connectListAllSecrets;
    virDrvSecretLookupByUUID secretLookupByUUID;
    virDrvSecretLookupByUsage secretLookupByUsage;
    virDrvSecretDefineXML secretDefineXML;
    virDrvSecretGetXMLDesc secretGetXMLDesc;
    virDrvSecretSetValue secretSetValue;
    virDrvSecretGetValue secretGetValue;
    virDrvSecretUndefine secretUndefine;
1905 1906
};

1907

1908 1909 1910 1911
typedef int
(*virDrvStreamSend)(virStreamPtr st,
                    const char *data,
                    size_t nbytes);
1912

1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930
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);
1931

1932 1933
typedef int
(*virDrvStreamFinish)(virStreamPtr st);
1934

1935 1936
typedef int
(*virDrvStreamAbort)(virStreamPtr st);
1937

1938 1939
typedef struct _virStreamDriver virStreamDriver;
typedef virStreamDriver *virStreamDriverPtr;
1940 1941

struct _virStreamDriver {
1942 1943 1944
    virDrvStreamSend streamSend;
    virDrvStreamRecv streamRecv;
    virDrvStreamEventAddCallback streamEventAddCallback;
1945 1946
    virDrvStreamEventUpdateCallback streamEventUpdateCallback;
    virDrvStreamEventRemoveCallback streamEventRemoveCallback;
1947 1948
    virDrvStreamFinish streamFinish;
    virDrvStreamAbort streamAbort;
1949 1950 1951
};


1952 1953 1954 1955
typedef virDrvConnectOpen virDrvNWFilterOpen;
typedef virDrvConnectClose virDrvNWFilterClose;


S
Stefan Berger 已提交
1956
typedef int
1957 1958
(*virDrvConnectNumOfNWFilters)(virConnectPtr conn);

S
Stefan Berger 已提交
1959
typedef int
1960 1961 1962 1963
(*virDrvConnectListNWFilters)(virConnectPtr conn,
                              char **const names,
                              int maxnames);

1964
typedef int
1965 1966 1967 1968
(*virDrvConnectListAllNWFilters)(virConnectPtr conn,
                                 virNWFilterPtr **filters,
                                 unsigned int flags);

S
Stefan Berger 已提交
1969
typedef virNWFilterPtr
1970 1971 1972
(*virDrvNWFilterLookupByName)(virConnectPtr conn,
                              const char *name);

S
Stefan Berger 已提交
1973
typedef virNWFilterPtr
1974 1975 1976
(*virDrvNWFilterLookupByUUID)(virConnectPtr conn,
                              const unsigned char *uuid);

S
Stefan Berger 已提交
1977
typedef virNWFilterPtr
1978 1979 1980
(*virDrvNWFilterDefineXML)(virConnectPtr conn,
                           const char *xmlDesc);

S
Stefan Berger 已提交
1981
typedef int
1982
(*virDrvNWFilterUndefine)(virNWFilterPtr nwfilter);
S
Stefan Berger 已提交
1983 1984

typedef char *
1985 1986
(*virDrvNWFilterGetXMLDesc)(virNWFilterPtr nwfilter,
                            unsigned int flags);
S
Stefan Berger 已提交
1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002


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 {
2003
    const char * name; /* the name of the driver */
2004 2005
    virDrvNWFilterOpen nwfilterOpen;
    virDrvNWFilterClose nwfilterClose;
2006
    virDrvConnectNumOfNWFilters connectNumOfNWFilters;
2007 2008 2009 2010 2011 2012 2013
    virDrvConnectListNWFilters connectListNWFilters;
    virDrvConnectListAllNWFilters connectListAllNWFilters;
    virDrvNWFilterLookupByName nwfilterLookupByName;
    virDrvNWFilterLookupByUUID nwfilterLookupByUUID;
    virDrvNWFilterDefineXML nwfilterDefineXML;
    virDrvNWFilterUndefine nwfilterUndefine;
    virDrvNWFilterGetXMLDesc nwfilterGetXMLDesc;
S
Stefan Berger 已提交
2014 2015 2016
};


2017 2018 2019 2020 2021 2022
/*
 * Registration
 * TODO: also need ways to (des)activate a given driver
 *       lookup based on the URI given in a virConnectOpen(ReadOnly)
 */
int virRegisterDriver(virDriverPtr);
2023
int virRegisterNetworkDriver(virNetworkDriverPtr);
D
Daniel Veillard 已提交
2024
int virRegisterInterfaceDriver(virInterfaceDriverPtr);
2025
int virRegisterStorageDriver(virStorageDriverPtr);
2026
int virRegisterNodeDeviceDriver(virNodeDeviceDriverPtr);
2027
int virRegisterSecretDriver(virSecretDriverPtr);
S
Stefan Berger 已提交
2028
int virRegisterNWFilterDriver(virNWFilterDriverPtr);
2029
# ifdef WITH_LIBVIRTD
2030
int virRegisterStateDriver(virStateDriverPtr);
2031
# endif
2032
void virDriverModuleInitialize(const char *defmoddir);
2033
void *virDriverLoadModule(const char *name);
2034 2035

#endif /* __VIR_DRIVER_H__ */