1 /*
2  * domain_conf.h: domain XML processing
3  *
4  * Copyright (C) 2006-2019 Red Hat, Inc.
5  * Copyright (C) 2006-2008 Daniel P. Berrange
6  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library.  If not, see
20  * <http://www.gnu.org/licenses/>.
21  */
22 
23 #pragma once
24 
25 #include <libxml/parser.h>
26 #include <libxml/tree.h>
27 #include <libxml/xpath.h>
28 
29 #include "internal.h"
30 #include "virconftypes.h"
31 #include "capabilities.h"
32 #include "storage_encryption_conf.h"
33 #include "cpu_conf.h"
34 #include "virthread.h"
35 #include "virhash.h"
36 #include "virsocketaddr.h"
37 #include "networkcommon_conf.h"
38 #include "nwfilter_params.h"
39 #include "numa_conf.h"
40 #include "virnetdevmacvlan.h"
41 #include "virsysinfo.h"
42 #include "virnetdev.h"
43 #include "virnetdevip.h"
44 #include "virnetdevvportprofile.h"
45 #include "virnetdevbandwidth.h"
46 #include "virnetdevvlan.h"
47 #include "virnetworkportdef.h"
48 #include "virobject.h"
49 #include "device_conf.h"
50 #include "virbitmap.h"
51 #include "storage_source_conf.h"
52 #include "virseclabel.h"
53 #include "virprocess.h"
54 #include "virgic.h"
55 #include "virperf.h"
56 #include "virtypedparam.h"
57 #include "virsavecookie.h"
58 #include "virresctrl.h"
59 #include "virenum.h"
60 
61 /* Flags for the 'type' field in virDomainDeviceDef */
62 typedef enum {
63     VIR_DOMAIN_DEVICE_NONE = 0,
64     VIR_DOMAIN_DEVICE_DISK,
65     VIR_DOMAIN_DEVICE_LEASE,
66     VIR_DOMAIN_DEVICE_FS,
67     VIR_DOMAIN_DEVICE_NET,
68     VIR_DOMAIN_DEVICE_INPUT,
69     VIR_DOMAIN_DEVICE_SOUND,
70     VIR_DOMAIN_DEVICE_VIDEO,
71     VIR_DOMAIN_DEVICE_HOSTDEV,
72     VIR_DOMAIN_DEVICE_WATCHDOG,
73     VIR_DOMAIN_DEVICE_CONTROLLER,
74     VIR_DOMAIN_DEVICE_GRAPHICS,
75     VIR_DOMAIN_DEVICE_HUB,
76     VIR_DOMAIN_DEVICE_REDIRDEV,
77     VIR_DOMAIN_DEVICE_SMARTCARD,
78     VIR_DOMAIN_DEVICE_CHR,
79     VIR_DOMAIN_DEVICE_MEMBALLOON,
80     VIR_DOMAIN_DEVICE_NVRAM,
81     VIR_DOMAIN_DEVICE_RNG,
82     VIR_DOMAIN_DEVICE_SHMEM,
83     VIR_DOMAIN_DEVICE_TPM,
84     VIR_DOMAIN_DEVICE_PANIC,
85     VIR_DOMAIN_DEVICE_MEMORY,
86     VIR_DOMAIN_DEVICE_IOMMU,
87     VIR_DOMAIN_DEVICE_VSOCK,
88     VIR_DOMAIN_DEVICE_AUDIO,
89 
90     VIR_DOMAIN_DEVICE_LAST
91 } virDomainDeviceType;
92 
93 struct _virDomainDeviceDef {
94     int type; /* enum virDomainDeviceType */
95     union {
96         virDomainDiskDef *disk;
97         virDomainControllerDef *controller;
98         virDomainLeaseDef *lease;
99         virDomainFSDef *fs;
100         virDomainNetDef *net;
101         virDomainInputDef *input;
102         virDomainSoundDef *sound;
103         virDomainVideoDef *video;
104         virDomainHostdevDef *hostdev;
105         virDomainWatchdogDef *watchdog;
106         virDomainGraphicsDef *graphics;
107         virDomainHubDef *hub;
108         virDomainRedirdevDef *redirdev;
109         virDomainSmartcardDef *smartcard;
110         virDomainChrDef *chr;
111         virDomainMemballoonDef *memballoon;
112         virDomainNVRAMDef *nvram;
113         virDomainRNGDef *rng;
114         virDomainShmemDef *shmem;
115         virDomainTPMDef *tpm;
116         virDomainPanicDef *panic;
117         virDomainMemoryDef *memory;
118         virDomainIOMMUDef *iommu;
119         virDomainVsockDef *vsock;
120         virDomainAudioDef *audio;
121     } data;
122 };
123 
124 /* Different types of hypervisor */
125 typedef enum {
126     VIR_DOMAIN_VIRT_NONE = 0,
127     VIR_DOMAIN_VIRT_QEMU,
128     VIR_DOMAIN_VIRT_KQEMU,
129     VIR_DOMAIN_VIRT_KVM,
130     VIR_DOMAIN_VIRT_XEN,
131     VIR_DOMAIN_VIRT_LXC,
132     VIR_DOMAIN_VIRT_UML,
133     VIR_DOMAIN_VIRT_OPENVZ,
134     VIR_DOMAIN_VIRT_TEST,
135     VIR_DOMAIN_VIRT_VMWARE,
136     VIR_DOMAIN_VIRT_HYPERV,
137     VIR_DOMAIN_VIRT_VBOX,
138     VIR_DOMAIN_VIRT_PHYP,
139     VIR_DOMAIN_VIRT_PARALLELS,
140     VIR_DOMAIN_VIRT_BHYVE,
141     VIR_DOMAIN_VIRT_VZ,
142     VIR_DOMAIN_VIRT_NVMM,
143 
144     VIR_DOMAIN_VIRT_LAST
145 } virDomainVirtType;
146 
147 typedef enum {
148     VIR_DOMAIN_OSTYPE_HVM,
149     VIR_DOMAIN_OSTYPE_XEN,
150     VIR_DOMAIN_OSTYPE_LINUX,
151     VIR_DOMAIN_OSTYPE_EXE,
152     VIR_DOMAIN_OSTYPE_UML,
153     VIR_DOMAIN_OSTYPE_XENPVH,
154 
155     VIR_DOMAIN_OSTYPE_LAST
156 } virDomainOSType;
157 VIR_ENUM_DECL(virDomainOS);
158 
159 
160 struct _virDomainHostdevOrigStates {
161     union {
162         struct {
163             /* Does the device need to unbind from stub when
164              * reattaching to host?
165              */
166             bool unbind_from_stub;
167 
168             /* Does it need to use remove_slot when reattaching
169              * the device to host?
170              */
171             bool remove_slot;
172 
173             /* Does it need to reprobe driver for the device when
174              * reattaching to host?
175              */
176             bool reprobe;
177         } pci;
178 
179         /* Perhaps 'usb' in future */
180     } states;
181 };
182 
183 struct _virDomainLeaseDef {
184     char *lockspace;
185     char *key;
186     char *path;
187     unsigned long long offset;
188 };
189 
190 
191 typedef enum {
192     VIR_DOMAIN_HOSTDEV_MODE_SUBSYS,
193     VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES,
194 
195     VIR_DOMAIN_HOSTDEV_MODE_LAST
196 } virDomainHostdevMode;
197 
198 typedef enum {
199     VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
200     VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
201     VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI,
202     VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST,
203     VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV,
204 
205     VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
206 } virDomainHostdevSubsysType;
207 
208 /* the backend driver used for PCI hostdev devices */
209 typedef enum {
210     VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* detect automatically, prefer VFIO */
211     VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM,    /* force legacy kvm style */
212     VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO,   /* force vfio */
213     VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN,    /* force legacy xen style, use pciback */
214 
215     VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST
216 } virDomainHostdevSubsysPCIBackendType;
217 
218 VIR_ENUM_DECL(virDomainHostdevSubsysPCIBackend);
219 
220 typedef enum {
221     VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE,
222     VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI,
223 
224     VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST,
225 } virDomainHostdevSCSIProtocolType;
226 
227 VIR_ENUM_DECL(virDomainHostdevSubsysSCSIProtocol);
228 
229 struct _virDomainHostdevSubsysUSB {
230     bool autoAddress; /* bus/device were filled automatically based
231                          on vendor/product */
232     unsigned bus;
233     unsigned device;
234 
235     unsigned vendor;
236     unsigned product;
237 };
238 
239 struct _virDomainHostdevSubsysPCI {
240     virPCIDeviceAddress addr; /* host address */
241     int backend; /* enum virDomainHostdevSubsysPCIBackendType */
242 };
243 
244 struct _virDomainHostdevSubsysSCSIHost {
245     char *adapter;
246     unsigned bus;
247     unsigned target;
248     unsigned long long unit;
249     virStorageSource *src;
250 };
251 
252 struct _virDomainHostdevSubsysSCSIiSCSI {
253     virStorageSource *src;
254 };
255 
256 struct _virDomainHostdevSubsysSCSI {
257     int protocol; /* enum virDomainHostdevSCSIProtocolType */
258     int sgio; /* enum virDomainDeviceSGIO */
259     int rawio; /* enum virTristateBool */
260     union {
261         virDomainHostdevSubsysSCSIHost host;
262         virDomainHostdevSubsysSCSIiSCSI iscsi;
263     } u;
264 };
265 
266 struct _virDomainHostdevSubsysMediatedDev {
267     int model;                          /* enum virMediatedDeviceModelType */
268     int display; /* virTristateSwitch */
269     char uuidstr[VIR_UUID_STRING_BUFLEN];   /* mediated device's uuid string */
270     int ramfb; /* virTristateSwitch */
271 };
272 
273 typedef enum {
274     VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_NONE,
275     VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST,
276 
277     VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_LAST,
278 } virDomainHostdevSubsysSCSIHostProtocolType;
279 
280 VIR_ENUM_DECL(virDomainHostdevSubsysSCSIHostProtocol);
281 
282 typedef enum {
283     VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_DEFAULT,
284     VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO,
285     VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL,
286     VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONAL,
287 
288     VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_LAST,
289 } virDomainHostdevSubsysSCSIVHostModelType;
290 
291 VIR_ENUM_DECL(virDomainHostdevSubsysSCSIVHostModel);
292 
293 struct _virDomainHostdevSubsysSCSIVHost {
294     int protocol; /* enum virDomainHostdevSubsysSCSIHostProtocolType */
295     char *wwpn;
296     int model; /* enum virDomainHostdevSubsysSCSIVHostModelType */
297 };
298 
299 struct _virDomainHostdevSubsys {
300     int type; /* enum virDomainHostdevSubsysType */
301     union {
302         virDomainHostdevSubsysUSB usb;
303         virDomainHostdevSubsysPCI pci;
304         virDomainHostdevSubsysSCSI scsi;
305         virDomainHostdevSubsysSCSIVHost scsi_host;
306         virDomainHostdevSubsysMediatedDev mdev;
307     } u;
308 };
309 
310 
311 typedef enum {
312     VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE,
313     VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC,
314     VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET,
315 
316     VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST
317 } virDomainHostdevCapsType;
318 
319 struct _virDomainHostdevCaps {
320     int type; /* enum virDOmainHostdevCapsType */
321     union {
322         struct {
323             char *block;
324         } storage;
325         struct {
326             char *chardev;
327         } misc;
328         struct {
329             char *ifname;
330             virNetDevIPInfo ip;
331         } net;
332     } u;
333 };
334 
335 
336 typedef enum {
337     VIR_DOMAIN_STARTUP_POLICY_DEFAULT = 0,
338     VIR_DOMAIN_STARTUP_POLICY_MANDATORY,
339     VIR_DOMAIN_STARTUP_POLICY_REQUISITE,
340     VIR_DOMAIN_STARTUP_POLICY_OPTIONAL,
341 
342     VIR_DOMAIN_STARTUP_POLICY_LAST
343 } virDomainStartupPolicy;
344 
345 /* basic device for direct passthrough */
346 struct _virDomainHostdevDef {
347     /* If 'parentnet' is non-NULL it means this host dev was
348      * not originally present in the XML. It was copied from
349      * a network interface for convenience when handling
350      * hostdevs internally. This hostdev should never be
351      * visible to the user except as part of the interface
352      */
353     virDomainNetDef *parentnet;
354 
355     int mode; /* enum virDomainHostdevMode */
356     virDomainStartupPolicy startupPolicy;
357     bool managed;
358     bool missing;
359     bool readonly;
360     bool shareable;
361     virTristateBool writeFiltering;
362     union {
363         virDomainHostdevSubsys subsys;
364         virDomainHostdevCaps caps;
365     } source;
366     virDomainHostdevOrigStates origstates;
367     virDomainNetTeamingInfo *teaming;
368     virDomainDeviceInfo *info; /* Guest address */
369 };
370 
371 
372 /* Types of disk frontend (guest view).  For backends (host view), see
373  * virStorageType in conf/storage_source_conf.h */
374 typedef enum {
375     VIR_DOMAIN_DISK_DEVICE_DISK,
376     VIR_DOMAIN_DISK_DEVICE_CDROM,
377     VIR_DOMAIN_DISK_DEVICE_FLOPPY,
378     VIR_DOMAIN_DISK_DEVICE_LUN,
379 
380     VIR_DOMAIN_DISK_DEVICE_LAST
381 } virDomainDiskDevice;
382 
383 typedef enum {
384     VIR_DOMAIN_DISK_BUS_NONE,
385     VIR_DOMAIN_DISK_BUS_IDE,
386     VIR_DOMAIN_DISK_BUS_FDC,
387     VIR_DOMAIN_DISK_BUS_SCSI,
388     VIR_DOMAIN_DISK_BUS_VIRTIO,
389     VIR_DOMAIN_DISK_BUS_XEN,
390     VIR_DOMAIN_DISK_BUS_USB,
391     VIR_DOMAIN_DISK_BUS_UML,
392     VIR_DOMAIN_DISK_BUS_SATA,
393     VIR_DOMAIN_DISK_BUS_SD,
394 
395     VIR_DOMAIN_DISK_BUS_LAST
396 } virDomainDiskBus;
397 
398 typedef enum {
399     VIR_DOMAIN_DISK_CACHE_DEFAULT,
400     VIR_DOMAIN_DISK_CACHE_DISABLE,
401     VIR_DOMAIN_DISK_CACHE_WRITETHRU,
402     VIR_DOMAIN_DISK_CACHE_WRITEBACK,
403     VIR_DOMAIN_DISK_CACHE_DIRECTSYNC,
404     VIR_DOMAIN_DISK_CACHE_UNSAFE,
405 
406     VIR_DOMAIN_DISK_CACHE_LAST
407 } virDomainDiskCache;
408 
409 typedef enum {
410     VIR_DOMAIN_DISK_ERROR_POLICY_DEFAULT,
411     VIR_DOMAIN_DISK_ERROR_POLICY_STOP,
412     VIR_DOMAIN_DISK_ERROR_POLICY_REPORT,
413     VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE,
414     VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE,
415 
416     VIR_DOMAIN_DISK_ERROR_POLICY_LAST
417 } virDomainDiskErrorPolicy;
418 
419 
420 typedef enum {
421     VIR_DOMAIN_DISK_TRAY_CLOSED = 0,
422     VIR_DOMAIN_DISK_TRAY_OPEN,
423 
424     VIR_DOMAIN_DISK_TRAY_LAST
425 } virDomainDiskTray;
426 
427 typedef enum {
428     VIR_DOMAIN_DISK_TRANS_DEFAULT = 0,
429     VIR_DOMAIN_DISK_TRANS_NONE,
430     VIR_DOMAIN_DISK_TRANS_AUTO,
431     VIR_DOMAIN_DISK_TRANS_LBA,
432 
433     VIR_DOMAIN_DISK_TRANS_LAST
434 } virDomainDiskGeometryTrans;
435 
436 typedef enum {
437     VIR_DOMAIN_DISK_IO_DEFAULT = 0,
438     VIR_DOMAIN_DISK_IO_NATIVE,
439     VIR_DOMAIN_DISK_IO_THREADS,
440     VIR_DOMAIN_DISK_IO_URING,
441 
442     VIR_DOMAIN_DISK_IO_LAST
443 } virDomainDiskIo;
444 
445 typedef enum {
446     VIR_DOMAIN_DEVICE_SGIO_DEFAULT = 0,
447     VIR_DOMAIN_DEVICE_SGIO_FILTERED,
448     VIR_DOMAIN_DEVICE_SGIO_UNFILTERED,
449 
450     VIR_DOMAIN_DEVICE_SGIO_LAST
451 } virDomainDeviceSGIO;
452 
453 typedef enum {
454     VIR_DOMAIN_DISK_DISCARD_DEFAULT = 0,
455     VIR_DOMAIN_DISK_DISCARD_UNMAP,
456     VIR_DOMAIN_DISK_DISCARD_IGNORE,
457 
458     VIR_DOMAIN_DISK_DISCARD_LAST
459 } virDomainDiskDiscard;
460 
461 typedef enum {
462     VIR_DOMAIN_DISK_DETECT_ZEROES_DEFAULT = 0,
463     VIR_DOMAIN_DISK_DETECT_ZEROES_OFF,
464     VIR_DOMAIN_DISK_DETECT_ZEROES_ON,
465     VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP,
466 
467     VIR_DOMAIN_DISK_DETECT_ZEROES_LAST
468 } virDomainDiskDetectZeroes;
469 
470 typedef enum {
471     VIR_DOMAIN_DISK_MODEL_DEFAULT = 0,
472     VIR_DOMAIN_DISK_MODEL_VIRTIO,
473     VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL,
474     VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL,
475 
476     VIR_DOMAIN_DISK_MODEL_LAST
477 } virDomainDiskModel;
478 
479 struct _virDomainBlockIoTuneInfo {
480     unsigned long long total_bytes_sec;
481     unsigned long long read_bytes_sec;
482     unsigned long long write_bytes_sec;
483     unsigned long long total_iops_sec;
484     unsigned long long read_iops_sec;
485     unsigned long long write_iops_sec;
486     unsigned long long total_bytes_sec_max;
487     unsigned long long read_bytes_sec_max;
488     unsigned long long write_bytes_sec_max;
489     unsigned long long total_iops_sec_max;
490     unsigned long long read_iops_sec_max;
491     unsigned long long write_iops_sec_max;
492     unsigned long long size_iops_sec;
493     char *group_name;
494     unsigned long long total_bytes_sec_max_length;
495     unsigned long long read_bytes_sec_max_length;
496     unsigned long long write_bytes_sec_max_length;
497     unsigned long long total_iops_sec_max_length;
498     unsigned long long read_iops_sec_max_length;
499     unsigned long long write_iops_sec_max_length;
500     /* Don't forget to update virDomainBlockIoTuneInfoCopy and
501      * virDomainBlockIoTuneInfoEqual. */
502 };
503 
504 
505 typedef enum {
506     VIR_DOMAIN_DISK_MIRROR_STATE_NONE = 0, /* No job, or job still not synced */
507     VIR_DOMAIN_DISK_MIRROR_STATE_READY, /* Job in second phase */
508     VIR_DOMAIN_DISK_MIRROR_STATE_ABORT, /* Job aborted, waiting for event */
509     VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT, /* Job pivoted, waiting for event */
510 
511     VIR_DOMAIN_DISK_MIRROR_STATE_LAST
512 } virDomainDiskMirrorState;
513 
514 typedef enum {
515     VIR_DOMAIN_MEMORY_SOURCE_NONE = 0,  /* No memory source defined */
516     VIR_DOMAIN_MEMORY_SOURCE_FILE,      /* Memory source is set as file */
517     VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS, /* Memory source is set as anonymous */
518     VIR_DOMAIN_MEMORY_SOURCE_MEMFD,     /* Memory source is set as memfd */
519 
520     VIR_DOMAIN_MEMORY_SOURCE_LAST,
521 } virDomainMemorySource;
522 
523 typedef enum {
524     VIR_DOMAIN_MEMORY_ALLOCATION_NONE = 0,  /* No memory allocation defined */
525     VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE, /* Memory allocation is set as immediate */
526     VIR_DOMAIN_MEMORY_ALLOCATION_ONDEMAND,  /* Memory allocation is set as ondemand */
527 
528     VIR_DOMAIN_MEMORY_ALLOCATION_LAST,
529 } virDomainMemoryAllocation;
530 
531 
532 /* Stores the virtual disk configuration */
533 struct _virDomainDiskDef {
534     virStorageSource *src; /* non-NULL.  XXX Allow NULL for empty cdrom? */
535 
536     virObject *privateData;
537 
538     virDomainDiskDevice device;
539     virDomainDiskBus bus;
540     char *dst;
541     virDomainDiskTray tray_status;
542     virTristateSwitch removable;
543     unsigned int rotation_rate;
544 
545     virStorageSource *mirror;
546     int mirrorState; /* enum virDomainDiskMirrorState */
547     int mirrorJob; /* virDomainBlockJobType */
548 
549     struct {
550         unsigned int cylinders;
551         unsigned int heads;
552         unsigned int sectors;
553         virDomainDiskGeometryTrans trans;
554     } geometry;
555 
556     struct {
557         unsigned int logical_block_size;
558         unsigned int physical_block_size;
559     } blockio;
560 
561     virDomainBlockIoTuneInfo blkdeviotune;
562 
563     char *driverName;
564 
565     char *serial;
566     char *wwn;
567     char *vendor;
568     char *product;
569     virDomainDiskCache cachemode;
570     virDomainDiskErrorPolicy error_policy;
571     virDomainDiskErrorPolicy rerror_policy;
572     virDomainDiskIo iomode;
573     virTristateSwitch ioeventfd;
574     virTristateSwitch event_idx;
575     virTristateSwitch copy_on_read;
576     unsigned int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */
577     virDomainStartupPolicy startupPolicy;
578     bool transient;
579     virTristateBool transientShareBacking;
580     virDomainDeviceInfo info;
581     virTristateBool rawio;
582     virDomainDeviceSGIO sgio;
583     virDomainDiskDiscard discard;
584     unsigned int iothread; /* unused = 0, > 0 specific thread # */
585     virDomainDiskDetectZeroes detect_zeroes;
586     char *domain_name; /* backend domain name */
587     unsigned int queues;
588     unsigned int queue_size;
589     virDomainDiskModel model;
590     virDomainVirtioOptions *virtio;
591 
592     bool diskElementAuth;
593     bool diskElementEnc;
594 };
595 
596 
597 typedef enum {
598     VIR_DOMAIN_CONTROLLER_TYPE_IDE,
599     VIR_DOMAIN_CONTROLLER_TYPE_FDC,
600     VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
601     VIR_DOMAIN_CONTROLLER_TYPE_SATA,
602     VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
603     VIR_DOMAIN_CONTROLLER_TYPE_CCID,
604     VIR_DOMAIN_CONTROLLER_TYPE_USB,
605     VIR_DOMAIN_CONTROLLER_TYPE_PCI,
606     VIR_DOMAIN_CONTROLLER_TYPE_XENBUS,
607     VIR_DOMAIN_CONTROLLER_TYPE_ISA,
608 
609     VIR_DOMAIN_CONTROLLER_TYPE_LAST
610 } virDomainControllerType;
611 
612 
613 typedef enum {
614     VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT = -1,
615     VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT,
616     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT,
617     VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE,
618     VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE,
619     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE,
620     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT,
621     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT,
622     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT,
623     VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS,
624     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS,
625 
626     VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST
627 } virDomainControllerModelPCI;
628 
629 typedef enum {
630     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE = 0,
631     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE,
632     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE,
633     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420,
634     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X3130_UPSTREAM,
635     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_XIO3130_DOWNSTREAM,
636     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB,
637     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB_PCIE,
638     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT,
639     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE,
640     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_PCI_BRIDGE,
641 
642     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST
643 } virDomainControllerPCIModelName;
644 
645 typedef enum {
646     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT = -1,
647     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO,
648     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC,
649     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC,
650     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068,
651     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI,
652     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
653     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI,
654     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078,
655     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL,
656     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL,
657     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_NCR53C90,
658     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DC390,
659     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AM53C974,
660 
661     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
662 } virDomainControllerModelSCSI;
663 
664 typedef enum {
665     VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT = -1,
666     VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI,
667     VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX4_UHCI,
668     VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI,
669     VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1,
670     VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1,
671     VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2,
672     VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3,
673     VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI,
674     VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI,
675     VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI,
676     VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1,
677     VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2,
678     VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI,
679     VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE,
680 
681     VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST
682 } virDomainControllerModelUSB;
683 
684 typedef enum {
685     VIR_DOMAIN_CONTROLLER_MODEL_IDE_DEFAULT = -1,
686     VIR_DOMAIN_CONTROLLER_MODEL_IDE_PIIX3,
687     VIR_DOMAIN_CONTROLLER_MODEL_IDE_PIIX4,
688     VIR_DOMAIN_CONTROLLER_MODEL_IDE_ICH6,
689 
690     VIR_DOMAIN_CONTROLLER_MODEL_IDE_LAST
691 } virDomainControllerModelIDE;
692 
693 typedef enum {
694     VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_DEFAULT = -1,
695     VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO,
696     VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL,
697     VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL,
698 
699     VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST
700 } virDomainControllerModelVirtioSerial;
701 
702 typedef enum {
703     VIR_DOMAIN_CONTROLLER_MODEL_ISA_DEFAULT = -1,
704 
705     VIR_DOMAIN_CONTROLLER_MODEL_ISA_LAST
706 } virDomainControllerModelISA;
707 
708 #define IS_USB2_CONTROLLER(ctrl) \
709     (((ctrl)->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) && \
710      ((ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1 || \
711       (ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1 || \
712       (ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2 || \
713       (ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3))
714 
715 struct _virDomainVirtioSerialOpts {
716     int ports;   /* -1 == undef */
717     int vectors; /* -1 == undef */
718 };
719 
720 struct _virDomainPCIControllerOpts {
721     bool pcihole64;
722     unsigned long pcihole64size;
723 
724     /* the exact controller name is in the "model" subelement, e.g.:
725      * <controller type='pci' model='pcie-root-port'>
726      *   <model name='ioh3420''/>
727      *   ...
728      */
729     virDomainControllerPCIModelName modelName;
730 
731     /* the following items are attributes of the "target" subelement
732      * of controller type='pci'. They are bits of configuration that
733      * are specified on the qemu commandline and are visible to the
734      * guest OS, so they must be preserved to ensure ABI
735      * compatibility.
736      */
737     int chassisNr; /* used by pci-bridge, -1 == unspecified */
738     /* chassis & port used by
739      * pcie-root-port/pcie-switch-downstream-port, -1 = unspecified */
740     int chassis;
741     int port;
742     int busNr; /* used by pci-expander-bus, -1 == unspecified */
743     int targetIndex; /* used by spapr-pci-host-bridge, -1 == unspecified */
744     /* numaNode is a *subelement* of target (to match existing
745      * item in memory target config) -1 == unspecified
746      */
747     int numaNode;
748     virTristateSwitch hotplug; /* 'off' to prevent hotplug/unplug, default 'on' */
749 };
750 
751 struct _virDomainUSBControllerOpts {
752     int ports;   /* -1 == undef */
753 };
754 
755 struct _virDomainXenbusControllerOpts {
756     int maxGrantFrames;   /* -1 == undef */
757     int maxEventChannels; /* -1 == undef */
758 };
759 
760 /* Stores the virtual disk controller configuration */
761 struct _virDomainControllerDef {
762     int type;
763     int idx;
764     int model; /* -1 == undef */
765     unsigned int queues;
766     unsigned int cmd_per_lun;
767     unsigned int max_sectors;
768     virTristateSwitch ioeventfd;
769     unsigned int iothread; /* unused = 0, > 0 specific thread # */
770     union {
771         virDomainVirtioSerialOpts vioserial;
772         virDomainPCIControllerOpts pciopts;
773         virDomainUSBControllerOpts usbopts;
774         virDomainXenbusControllerOpts xenbusopts;
775     } opts;
776     virDomainDeviceInfo info;
777     virDomainVirtioOptions *virtio;
778 };
779 
780 
781 /* Types of disk backends */
782 typedef enum {
783     VIR_DOMAIN_FS_TYPE_MOUNT, /* Mounts (binds) a host dir on a guest dir */
784     VIR_DOMAIN_FS_TYPE_BLOCK, /* Mounts a host block dev on a guest dir */
785     VIR_DOMAIN_FS_TYPE_FILE,  /* Loopback mounts a host file on a guest dir */
786     VIR_DOMAIN_FS_TYPE_TEMPLATE, /* Expands a OS template to a guest dir */
787     VIR_DOMAIN_FS_TYPE_RAM,   /* Mount a RAM filesystem on a guest dir */
788     VIR_DOMAIN_FS_TYPE_BIND,  /* Binds a guest dir to another guest dir */
789     VIR_DOMAIN_FS_TYPE_VOLUME, /* Mounts storage pool volume to a guest */
790 
791     VIR_DOMAIN_FS_TYPE_LAST
792 } virDomainFSType;
793 
794 /* Filesystem driver type */
795 typedef enum {
796     VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT = 0,
797     VIR_DOMAIN_FS_DRIVER_TYPE_PATH,
798     VIR_DOMAIN_FS_DRIVER_TYPE_HANDLE,
799     VIR_DOMAIN_FS_DRIVER_TYPE_LOOP,
800     VIR_DOMAIN_FS_DRIVER_TYPE_NBD,
801     VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP,
802     VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS,
803 
804     VIR_DOMAIN_FS_DRIVER_TYPE_LAST
805 } virDomainFSDriverType;
806 
807 /* Filesystem mount access mode  */
808 typedef enum {
809     VIR_DOMAIN_FS_ACCESSMODE_DEFAULT = 0,
810     VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH,
811     VIR_DOMAIN_FS_ACCESSMODE_MAPPED,
812     VIR_DOMAIN_FS_ACCESSMODE_SQUASH,
813 
814     VIR_DOMAIN_FS_ACCESSMODE_LAST
815 } virDomainFSAccessMode;
816 
817 /* Filesystem Write policy */
818 typedef enum {
819     VIR_DOMAIN_FS_WRPOLICY_DEFAULT = 0,
820     VIR_DOMAIN_FS_WRPOLICY_IMMEDIATE,
821 
822     VIR_DOMAIN_FS_WRPOLICY_LAST
823 } virDomainFSWrpolicy;
824 
825 /* How to handle exports containing multiple devices. */
826 typedef enum {
827     VIR_DOMAIN_FS_MULTIDEVS_DEFAULT = 0, /* Use QEMU's default setting */
828     VIR_DOMAIN_FS_MULTIDEVS_REMAP, /* Remap inodes from host to guest */
829     VIR_DOMAIN_FS_MULTIDEVS_FORBID, /* Prohibit more than one device */
830     VIR_DOMAIN_FS_MULTIDEVS_WARN, /* Just log a warning if multiple devices */
831 
832     VIR_DOMAIN_FS_MULTIDEVS_LAST
833 } virDomainFSMultidevs;
834 
835 VIR_ENUM_DECL(virDomainFSMultidevs);
836 
837 typedef enum {
838     VIR_DOMAIN_FS_MODEL_DEFAULT = 0,
839     VIR_DOMAIN_FS_MODEL_VIRTIO,
840     VIR_DOMAIN_FS_MODEL_VIRTIO_TRANSITIONAL,
841     VIR_DOMAIN_FS_MODEL_VIRTIO_NON_TRANSITIONAL,
842 
843     VIR_DOMAIN_FS_MODEL_LAST
844 } virDomainFSModel;
845 
846 typedef enum {
847     VIR_DOMAIN_FS_CACHE_MODE_DEFAULT = 0,
848     VIR_DOMAIN_FS_CACHE_MODE_NONE,
849     VIR_DOMAIN_FS_CACHE_MODE_ALWAYS,
850 
851     VIR_DOMAIN_FS_CACHE_MODE_LAST
852 } virDomainFSCacheMode;
853 
854 typedef enum {
855     VIR_DOMAIN_FS_SANDBOX_MODE_DEFAULT = 0,
856     VIR_DOMAIN_FS_SANDBOX_MODE_NAMESPACE,
857     VIR_DOMAIN_FS_SANDBOX_MODE_CHROOT,
858 
859     VIR_DOMAIN_FS_SANDBOX_MODE_LAST
860 } virDomainFSSandboxMode;
861 
862 struct _virDomainFSDef {
863     int type;
864     virDomainFSDriverType fsdriver;
865     int accessmode; /* enum virDomainFSAccessMode */
866     int format; /* virStorageFileFormat */
867     virDomainFSWrpolicy wrpolicy;
868     int model; /* virDomainFSModel */
869     unsigned int fmode;
870     unsigned int dmode;
871     int multidevs; /* virDomainFSMultidevs */
872     unsigned long long usage; /* in bytes */
873     virStorageSource *src;
874     char *sock;
875     char *dst;
876     bool readonly;
877     virDomainDeviceInfo info;
878     unsigned long long space_hard_limit; /* in bytes */
879     unsigned long long space_soft_limit; /* in bytes */
880     bool symlinksResolved;
881     char *binary;
882     unsigned long long queue_size;
883     virTristateSwitch xattr;
884     virDomainFSCacheMode cache;
885     virTristateSwitch posix_lock;
886     virTristateSwitch flock;
887     virDomainFSSandboxMode sandbox;
888     virDomainVirtioOptions *virtio;
889     virObject *privateData;
890 };
891 
892 
893 /* network config types */
894 typedef enum {
895     VIR_DOMAIN_NET_TYPE_USER,
896     VIR_DOMAIN_NET_TYPE_ETHERNET,
897     VIR_DOMAIN_NET_TYPE_VHOSTUSER,
898     VIR_DOMAIN_NET_TYPE_SERVER,
899     VIR_DOMAIN_NET_TYPE_CLIENT,
900     VIR_DOMAIN_NET_TYPE_MCAST,
901     VIR_DOMAIN_NET_TYPE_NETWORK,
902     VIR_DOMAIN_NET_TYPE_BRIDGE,
903     VIR_DOMAIN_NET_TYPE_INTERNAL,
904     VIR_DOMAIN_NET_TYPE_DIRECT,
905     VIR_DOMAIN_NET_TYPE_HOSTDEV,
906     VIR_DOMAIN_NET_TYPE_UDP,
907     VIR_DOMAIN_NET_TYPE_VDPA,
908 
909     VIR_DOMAIN_NET_TYPE_LAST
910 } virDomainNetType;
911 
912 /* network model types */
913 typedef enum {
914     VIR_DOMAIN_NET_MODEL_UNKNOWN,
915     VIR_DOMAIN_NET_MODEL_NETFRONT,
916     VIR_DOMAIN_NET_MODEL_RTL8139,
917     VIR_DOMAIN_NET_MODEL_VIRTIO,
918     VIR_DOMAIN_NET_MODEL_E1000,
919     VIR_DOMAIN_NET_MODEL_E1000E,
920     VIR_DOMAIN_NET_MODEL_VIRTIO_TRANSITIONAL,
921     VIR_DOMAIN_NET_MODEL_VIRTIO_NON_TRANSITIONAL,
922     VIR_DOMAIN_NET_MODEL_USB_NET,
923     VIR_DOMAIN_NET_MODEL_SPAPR_VLAN,
924     VIR_DOMAIN_NET_MODEL_LAN9118,
925     VIR_DOMAIN_NET_MODEL_SMC91C111,
926     VIR_DOMAIN_NET_MODEL_VLANCE,
927     VIR_DOMAIN_NET_MODEL_VMXNET,
928     VIR_DOMAIN_NET_MODEL_VMXNET2,
929     VIR_DOMAIN_NET_MODEL_VMXNET3,
930     VIR_DOMAIN_NET_MODEL_AM79C970A,
931     VIR_DOMAIN_NET_MODEL_AM79C973,
932     VIR_DOMAIN_NET_MODEL_82540EM,
933     VIR_DOMAIN_NET_MODEL_82545EM,
934     VIR_DOMAIN_NET_MODEL_82543GC,
935 
936     VIR_DOMAIN_NET_MODEL_LAST
937 } virDomainNetModelType;
938 
939 /* the backend driver used for virtio interfaces */
940 typedef enum {
941     VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT, /* prefer kernel, fall back to user */
942     VIR_DOMAIN_NET_BACKEND_TYPE_QEMU,    /* userland */
943     VIR_DOMAIN_NET_BACKEND_TYPE_VHOST,   /* kernel */
944 
945     VIR_DOMAIN_NET_BACKEND_TYPE_LAST
946 } virDomainNetBackendType;
947 
948 /* the TX algorithm used for virtio interfaces */
949 typedef enum {
950     VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT, /* default for this version of qemu */
951     VIR_DOMAIN_NET_VIRTIO_TX_MODE_IOTHREAD,
952     VIR_DOMAIN_NET_VIRTIO_TX_MODE_TIMER,
953 
954     VIR_DOMAIN_NET_VIRTIO_TX_MODE_LAST
955 } virDomainNetVirtioTxModeType;
956 
957 /* whether a mac address should be marked as generated in the esx driver or not*/
958 typedef enum {
959     VIR_DOMAIN_NET_MAC_TYPE_DEFAULT = 0, /* generated */
960     VIR_DOMAIN_NET_MAC_TYPE_GENERATED,
961     VIR_DOMAIN_NET_MAC_TYPE_STATIC,
962 
963     VIR_DOMAIN_NET_MAC_TYPE_LAST
964 } virDomainNetMacType;
965 
966 /* the type of teaming device */
967 typedef enum {
968     VIR_DOMAIN_NET_TEAMING_TYPE_NONE,
969     VIR_DOMAIN_NET_TEAMING_TYPE_PERSISTENT,
970     VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT,
971 
972     VIR_DOMAIN_NET_TEAMING_TYPE_LAST
973 } virDomainNetTeamingType;
974 
975 struct _virDomainNetTeamingInfo {
976         virDomainNetTeamingType type;
977         char *persistent; /* alias name of persistent device */
978 };
979 
980 /* link interface states */
981 typedef enum {
982         VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT = 0, /* Default link state (up) */
983         VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP,          /* Link is up. ("cable" connected) */
984         VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN ,       /* Link is down. ("cable" disconnected) */
985 
986         VIR_DOMAIN_NET_INTERFACE_LINK_STATE_LAST
987 } virDomainNetInterfaceLinkState;
988 
989 /* Config that was actually used to bring up interface, after
990  * resolving network reference. This is private data, only used within
991  * libvirt, but still must maintain backward compatibility, because
992  * different versions of libvirt may read the same data file.
993  */
994 struct _virDomainActualNetDef {
995     virDomainNetType type;
996     union {
997         struct {
998             char *brname;
999             int macTableManager; /* enum virNetworkBridgeMACTableManagerType */
1000         } bridge;
1001         struct {
1002             char *linkdev;
1003             int mode; /* enum virMacvtapMode from util/macvtap.h */
1004         } direct;
1005         struct {
1006             virDomainHostdevDef def;
1007         } hostdev;
1008     } data;
1009     virNetDevVPortProfile *virtPortProfile;
1010     virNetDevBandwidth *bandwidth;
1011     virNetDevVlan vlan;
1012     virTristateBool trustGuestRxFilters;
1013     virTristateBool isolatedPort;
1014     unsigned int class_id; /* class ID for bandwidth 'floor' */
1015 };
1016 
1017 /* Stores the virtual network interface configuration */
1018 struct _virDomainNetDef {
1019     virDomainNetType type;
1020     virMacAddr mac;
1021     bool mac_generated; /* true if mac was *just now* auto-generated by libvirt */
1022     virDomainNetMacType mac_type;
1023     virTristateBool mac_check;
1024     int model; /* virDomainNetModelType */
1025     char *modelstr;
1026     union {
1027         struct {
1028             virDomainNetBackendType name; /* which driver backend to use */
1029             virDomainNetVirtioTxModeType txmode;
1030             virTristateSwitch ioeventfd;
1031             virTristateSwitch event_idx;
1032             unsigned int queues; /* Multiqueue virtio-net */
1033             unsigned int rx_queue_size;
1034             unsigned int tx_queue_size;
1035             struct {
1036                 virTristateSwitch csum;
1037                 virTristateSwitch gso;
1038                 virTristateSwitch tso4;
1039                 virTristateSwitch tso6;
1040                 virTristateSwitch ecn;
1041                 virTristateSwitch ufo;
1042                 virTristateSwitch mrg_rxbuf;
1043             } host;
1044             struct {
1045                 virTristateSwitch csum;
1046                 virTristateSwitch tso4;
1047                 virTristateSwitch tso6;
1048                 virTristateSwitch ecn;
1049                 virTristateSwitch ufo;
1050             } guest;
1051         } virtio;
1052     } driver;
1053     struct {
1054         char *tap;
1055         char *vhost;
1056     } backend;
1057     virDomainNetTeamingInfo *teaming;
1058     union {
1059         virDomainChrSourceDef *vhostuser;
1060         struct {
1061             char *address;
1062             int port;
1063             char *localaddr;
1064             int localport;
1065         } socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */
1066         struct {
1067             char *name;
1068             char *portgroup;
1069             unsigned char portid[VIR_UUID_BUFLEN];
1070             /* actual has info about the currently used physical
1071              * device (if the network is of type
1072              * bridge/private/vepa/passthrough). This is saved in the
1073              * domain state, but never written to persistent config,
1074              * since it needs to be re-allocated whenever the domain
1075              * is restarted. It is also never shown to the user, and
1076              * the user cannot specify it in XML documents.
1077              *
1078              * This information is populated from the virNetworkPort
1079              * object associated with the portid UUID above.
1080              */
1081             virDomainActualNetDef *actual;
1082         } network;
1083         struct {
1084             char *devicepath;
1085         } vdpa;
1086         struct {
1087             char *brname;
1088         } bridge;
1089         struct {
1090             char *name;
1091         } internal;
1092         struct {
1093             char *linkdev;
1094             int mode; /* enum virMacvtapMode from util/macvtap.h */
1095         } direct;
1096         struct {
1097             virDomainHostdevDef def;
1098         } hostdev;
1099     } data;
1100     /* virtPortProfile is used by network/bridge/direct/hostdev */
1101     virNetDevVPortProfile *virtPortProfile;
1102     struct {
1103         bool sndbuf_specified;
1104         unsigned long sndbuf;
1105     } tune;
1106     char *script;
1107     char *downscript;
1108     char *domain_name; /* backend domain name */
1109     char *ifname; /* interface name on the host (<target dev='x'/>) */
1110     int managed_tap; /* enum virTristateBool - ABSENT == YES */
1111     virNetDevIPInfo hostIP;
1112     char *ifname_guest_actual;
1113     char *ifname_guest;
1114     virNetDevIPInfo guestIP;
1115     virDomainDeviceInfo info;
1116     char *filter;
1117     GHashTable *filterparams;
1118     virNetDevBandwidth *bandwidth;
1119     virNetDevVlan vlan;
1120     virTristateBool trustGuestRxFilters;
1121     virTristateBool isolatedPort;
1122     int linkstate;
1123     unsigned int mtu;
1124     virNetDevCoalesce *coalesce;
1125     virDomainVirtioOptions *virtio;
1126     virObject *privateData;
1127 };
1128 
1129 typedef enum {
1130     VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT = 0,
1131     VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED,
1132     VIR_DOMAIN_CHR_DEVICE_STATE_DISCONNECTED,
1133 
1134     VIR_DOMAIN_CHR_DEVICE_STATE_LAST
1135 } virDomainChrDeviceState;
1136 
1137 VIR_ENUM_DECL(virDomainChrDeviceState);
1138 
1139 typedef enum {
1140     VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL = 0,
1141     VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL,
1142     VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE,
1143     VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL,
1144 
1145     VIR_DOMAIN_CHR_DEVICE_TYPE_LAST
1146 } virDomainChrDeviceType;
1147 
1148 typedef enum {
1149     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE = 0,
1150     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA,
1151     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB,
1152     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI,
1153     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO,
1154     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM,
1155     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP,
1156 
1157     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST
1158 } virDomainChrSerialTargetType;
1159 
1160 typedef enum {
1161     VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE = 0,
1162     VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD,
1163     VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,
1164     VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN,
1165 
1166     VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST
1167 } virDomainChrChannelTargetType;
1168 
1169 typedef enum {
1170     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE  = 0,
1171     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL,
1172     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN,
1173     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML,
1174     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO,
1175     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC,
1176     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ,
1177     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP,
1178     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM,
1179 
1180     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST
1181 } virDomainChrConsoleTargetType;
1182 
1183 typedef enum {
1184     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE = 0,
1185     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL,
1186     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL,
1187     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL,
1188     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY,
1189     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011,
1190     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE,
1191     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE,
1192     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A,
1193 
1194     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST
1195 } virDomainChrSerialTargetModel;
1196 
1197 VIR_ENUM_DECL(virDomainChrSerialTargetModel);
1198 
1199 typedef enum {
1200     VIR_DOMAIN_CHR_TYPE_NULL,
1201     VIR_DOMAIN_CHR_TYPE_VC,
1202     VIR_DOMAIN_CHR_TYPE_PTY,
1203     VIR_DOMAIN_CHR_TYPE_DEV,
1204     VIR_DOMAIN_CHR_TYPE_FILE,
1205     VIR_DOMAIN_CHR_TYPE_PIPE,
1206     VIR_DOMAIN_CHR_TYPE_STDIO,
1207     VIR_DOMAIN_CHR_TYPE_UDP,
1208     VIR_DOMAIN_CHR_TYPE_TCP,
1209     VIR_DOMAIN_CHR_TYPE_UNIX,
1210     VIR_DOMAIN_CHR_TYPE_SPICEVMC,
1211     VIR_DOMAIN_CHR_TYPE_SPICEPORT,
1212     VIR_DOMAIN_CHR_TYPE_NMDM,
1213 
1214     VIR_DOMAIN_CHR_TYPE_LAST
1215 } virDomainChrType;
1216 
1217 typedef enum {
1218     VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW = 0,
1219     VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET,
1220     VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNETS, /* secure telnet */
1221     VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS,
1222 
1223     VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST
1224 } virDomainChrTcpProtocol;
1225 
1226 typedef enum {
1227     VIR_DOMAIN_CHR_SPICEVMC_VDAGENT,
1228     VIR_DOMAIN_CHR_SPICEVMC_SMARTCARD,
1229     VIR_DOMAIN_CHR_SPICEVMC_USBREDIR,
1230 
1231     VIR_DOMAIN_CHR_SPICEVMC_LAST
1232 } virDomainChrSpicevmcName;
1233 
1234 
1235 struct _virDomainChrSourceReconnectDef {
1236     virTristateBool enabled;
1237     unsigned int timeout;
1238 };
1239 
1240 
1241 /* The host side information for a character device.  */
1242 struct _virDomainChrSourceDef {
1243     virObject parent;
1244     int type; /* virDomainChrType */
1245     virObject *privateData;
1246     union {
1247         /* no <source> for null, vc, stdio */
1248         struct {
1249             char *path;
1250             virTristateSwitch append;
1251         } file; /* pty, file, pipe, or device */
1252         struct {
1253             char *master;
1254             char *slave;
1255         } nmdm;
1256         struct {
1257             char *host;
1258             char *service;
1259             bool listen;
1260             int protocol;
1261             bool tlscreds;
1262             virTristateBool haveTLS;
1263             bool tlsFromConfig;
1264             virDomainChrSourceReconnectDef reconnect;
1265         } tcp;
1266         struct {
1267             char *bindHost;
1268             char *bindService;
1269             char *connectHost;
1270             char *connectService;
1271         } udp;
1272         struct {
1273             char *path;
1274             bool listen;
1275             virDomainChrSourceReconnectDef reconnect;
1276         } nix;
1277         int spicevmc;
1278         struct {
1279             char *channel;
1280         } spiceport;
1281     } data;
1282     char *logfile;
1283     virTristateSwitch logappend;
1284 
1285     size_t nseclabels;
1286     virSecurityDeviceLabelDef **seclabels;
1287 };
1288 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainChrSourceDef, virObjectUnref);
1289 
1290 /* A complete character device, both host and domain views.  */
1291 struct _virDomainChrDef {
1292     int deviceType; /* enum virDomainChrDeviceType */
1293 
1294     int targetType; /* enum virDomainChrConsoleTargetType ||
1295                        enum virDomainChrChannelTargetType ||
1296                        enum virDomainChrSerialTargetType according to deviceType */
1297     int targetModel; /* enum virDomainChrSerialTargetModel */
1298 
1299     union {
1300         int port; /* parallel, serial, console */
1301         virSocketAddr *addr; /* guestfwd */
1302         char *name; /* virtio */
1303     } target;
1304 
1305     virDomainChrDeviceState state;
1306 
1307     virDomainChrSourceDef *source;
1308 
1309     virDomainDeviceInfo info;
1310 };
1311 
1312 typedef enum {
1313     VIR_DOMAIN_SMARTCARD_TYPE_HOST,
1314     VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES,
1315     VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH,
1316 
1317     VIR_DOMAIN_SMARTCARD_TYPE_LAST
1318 } virDomainSmartcardType;
1319 
1320 #define VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES 3
1321 #define VIR_DOMAIN_SMARTCARD_DEFAULT_DATABASE "/etc/pki/nssdb"
1322 
1323 struct _virDomainSmartcardDef {
1324     virDomainSmartcardType type;
1325     union {
1326         /* no extra data for 'host' */
1327         struct {
1328             char *file[VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES];
1329             char *database;
1330         } cert; /* 'host-certificates' */
1331         virDomainChrSourceDef *passthru; /* 'passthrough' */
1332     } data;
1333 
1334     virDomainDeviceInfo info;
1335 };
1336 
1337 struct _virDomainHubDef {
1338     int type;
1339     virDomainDeviceInfo info;
1340 };
1341 
1342 typedef enum {
1343     VIR_DOMAIN_TPM_MODEL_DEFAULT,
1344     VIR_DOMAIN_TPM_MODEL_TIS,
1345     VIR_DOMAIN_TPM_MODEL_CRB,
1346     VIR_DOMAIN_TPM_MODEL_SPAPR,
1347     VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY,
1348 
1349     VIR_DOMAIN_TPM_MODEL_LAST
1350 } virDomainTPMModel;
1351 
1352 typedef enum {
1353     VIR_DOMAIN_TPM_TYPE_PASSTHROUGH,
1354     VIR_DOMAIN_TPM_TYPE_EMULATOR,
1355 
1356     VIR_DOMAIN_TPM_TYPE_LAST
1357 } virDomainTPMBackendType;
1358 
1359 typedef enum {
1360     VIR_DOMAIN_TPM_VERSION_DEFAULT,
1361     VIR_DOMAIN_TPM_VERSION_1_2,
1362     VIR_DOMAIN_TPM_VERSION_2_0,
1363 
1364     VIR_DOMAIN_TPM_VERSION_LAST
1365 } virDomainTPMVersion;
1366 
1367 typedef enum {
1368     VIR_DOMAIN_TPM_PCR_BANK_SHA1,
1369     VIR_DOMAIN_TPM_PCR_BANK_SHA256,
1370     VIR_DOMAIN_TPM_PCR_BANK_SHA384,
1371     VIR_DOMAIN_TPM_PCR_BANK_SHA512,
1372 
1373     VIR_DOMAIN_TPM_PCR_BANK_LAST
1374 } virDomainPcrBank;
1375 
1376 #define VIR_DOMAIN_TPM_DEFAULT_DEVICE "/dev/tpm0"
1377 
1378 struct _virDomainTPMDef {
1379     int type; /* virDomainTPMBackendType */
1380     virDomainDeviceInfo info;
1381     int model; /* virDomainTPMModel */
1382     int version; /* virDomainTPMVersion */
1383     union {
1384         struct {
1385             virDomainChrSourceDef *source;
1386         } passthrough;
1387         struct {
1388             virDomainChrSourceDef *source;
1389             char *storagepath;
1390             char *logfile;
1391             unsigned char secretuuid[VIR_UUID_BUFLEN];
1392             bool hassecretuuid;
1393             bool persistent_state;
1394             unsigned int activePcrBanks;
1395         } emulator;
1396     } data;
1397 };
1398 
1399 typedef enum {
1400     VIR_DOMAIN_INPUT_TYPE_MOUSE,
1401     VIR_DOMAIN_INPUT_TYPE_TABLET,
1402     VIR_DOMAIN_INPUT_TYPE_KBD,
1403     VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH,
1404     VIR_DOMAIN_INPUT_TYPE_EVDEV,
1405 
1406     VIR_DOMAIN_INPUT_TYPE_LAST
1407 } virDomainInputType;
1408 
1409 typedef enum {
1410     VIR_DOMAIN_INPUT_BUS_PS2,
1411     VIR_DOMAIN_INPUT_BUS_USB,
1412     VIR_DOMAIN_INPUT_BUS_XEN,
1413     VIR_DOMAIN_INPUT_BUS_PARALLELS, /* pseudo device for VNC in containers */
1414     VIR_DOMAIN_INPUT_BUS_VIRTIO,
1415     VIR_DOMAIN_INPUT_BUS_NONE,
1416 
1417     VIR_DOMAIN_INPUT_BUS_LAST
1418 } virDomainInputBus;
1419 
1420 typedef enum {
1421     VIR_DOMAIN_INPUT_MODEL_DEFAULT = 0,
1422     VIR_DOMAIN_INPUT_MODEL_VIRTIO,
1423     VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL,
1424     VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL,
1425 
1426     VIR_DOMAIN_INPUT_MODEL_LAST
1427 } virDomainInputModel;
1428 
1429 typedef enum {
1430     VIR_DOMAIN_INPUT_SOURCE_GRAB_DEFAULT,
1431     VIR_DOMAIN_INPUT_SOURCE_GRAB_ALL,
1432 
1433     VIR_DOMAIN_INPUT_SOURCE_GRAB_LAST
1434 } virDomainInputSourceGrab;
1435 
1436 typedef enum {
1437     VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_DEFAULT,
1438     VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_CTRL_CTRL,
1439     VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_ALT_ALT,
1440     VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_SHIFT_SHIFT,
1441     VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_META_META,
1442     VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_SCROLLLOCK,
1443     VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_CTRL_SCROLLLOCK,
1444 
1445     VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_LAST
1446 } virDomainInputSourceGrabToggle;
1447 
1448 struct _virDomainInputDef {
1449     int type;
1450     int bus;
1451     int model; /* virDomainInputModel */
1452     struct {
1453         char *evdev;
1454         virDomainInputSourceGrab grab;
1455         virDomainInputSourceGrabToggle grabToggle;
1456         virTristateSwitch repeat;
1457     } source;
1458     virDomainDeviceInfo info;
1459     virDomainVirtioOptions *virtio;
1460 };
1461 
1462 typedef enum {
1463     VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
1464     VIR_DOMAIN_SOUND_CODEC_TYPE_MICRO,
1465     VIR_DOMAIN_SOUND_CODEC_TYPE_OUTPUT,
1466 
1467     VIR_DOMAIN_SOUND_CODEC_TYPE_LAST
1468 } virDomainSoundCodecType;
1469 
1470 typedef enum {
1471     VIR_DOMAIN_SOUND_MODEL_SB16,
1472     VIR_DOMAIN_SOUND_MODEL_ES1370,
1473     VIR_DOMAIN_SOUND_MODEL_PCSPK,
1474     VIR_DOMAIN_SOUND_MODEL_AC97,
1475     VIR_DOMAIN_SOUND_MODEL_ICH6,
1476     VIR_DOMAIN_SOUND_MODEL_ICH9,
1477     VIR_DOMAIN_SOUND_MODEL_USB,
1478     VIR_DOMAIN_SOUND_MODEL_ICH7,
1479 
1480     VIR_DOMAIN_SOUND_MODEL_LAST
1481 } virDomainSoundModel;
1482 
1483 struct _virDomainSoundCodecDef {
1484     int type;
1485     int cad;
1486 };
1487 
1488 struct _virDomainSoundDef {
1489     virDomainSoundModel model;
1490     virDomainDeviceInfo info;
1491 
1492     size_t ncodecs;
1493     virDomainSoundCodecDef **codecs;
1494 
1495     unsigned int audioId;
1496 };
1497 
1498 typedef enum {
1499     VIR_DOMAIN_AUDIO_TYPE_NONE,
1500     VIR_DOMAIN_AUDIO_TYPE_ALSA,
1501     VIR_DOMAIN_AUDIO_TYPE_COREAUDIO,
1502     VIR_DOMAIN_AUDIO_TYPE_JACK,
1503     VIR_DOMAIN_AUDIO_TYPE_OSS,
1504     VIR_DOMAIN_AUDIO_TYPE_PULSEAUDIO,
1505     VIR_DOMAIN_AUDIO_TYPE_SDL,
1506     VIR_DOMAIN_AUDIO_TYPE_SPICE,
1507     VIR_DOMAIN_AUDIO_TYPE_FILE,
1508 
1509     VIR_DOMAIN_AUDIO_TYPE_LAST
1510 } virDomainAudioType;
1511 
1512 typedef enum {
1513     VIR_DOMAIN_AUDIO_SDL_DRIVER_DEFAULT,
1514     VIR_DOMAIN_AUDIO_SDL_DRIVER_ESD,
1515     VIR_DOMAIN_AUDIO_SDL_DRIVER_ALSA,
1516     VIR_DOMAIN_AUDIO_SDL_DRIVER_ARTS,
1517     VIR_DOMAIN_AUDIO_SDL_DRIVER_PULSEAUDIO,
1518 
1519     VIR_DOMAIN_AUDIO_SDL_DRIVER_LAST
1520 } virDomainAudioSDLDriver;
1521 
1522 typedef enum {
1523     VIR_DOMAIN_AUDIO_FORMAT_DEFAULT,
1524     VIR_DOMAIN_AUDIO_FORMAT_U8,
1525     VIR_DOMAIN_AUDIO_FORMAT_S8,
1526     VIR_DOMAIN_AUDIO_FORMAT_U16,
1527     VIR_DOMAIN_AUDIO_FORMAT_S16,
1528     VIR_DOMAIN_AUDIO_FORMAT_U32,
1529     VIR_DOMAIN_AUDIO_FORMAT_S32,
1530     VIR_DOMAIN_AUDIO_FORMAT_F32,
1531 
1532     VIR_DOMAIN_AUDIO_FORMAT_LAST
1533 } virDomainAudioFormat;
1534 
1535 typedef struct _virDomainAudioIOCommon virDomainAudioIOCommon;
1536 struct _virDomainAudioIOCommon {
1537     virTristateBool mixingEngine;
1538     virTristateBool fixedSettings;
1539     unsigned int frequency;
1540     unsigned int channels;
1541     unsigned int voices;
1542     virDomainAudioFormat format;
1543     unsigned int bufferLength; /* milliseconds */
1544 };
1545 
1546 typedef struct _virDomainAudioIOALSA virDomainAudioIOALSA;
1547 struct _virDomainAudioIOALSA {
1548     char *dev;
1549 };
1550 
1551 typedef struct _virDomainAudioIOCoreAudio virDomainAudioIOCoreAudio;
1552 struct _virDomainAudioIOCoreAudio {
1553     unsigned int bufferCount;
1554 };
1555 
1556 typedef struct _virDomainAudioIOJack virDomainAudioIOJack;
1557 struct _virDomainAudioIOJack {
1558     char *serverName;
1559     char *clientName;
1560     char *connectPorts;
1561     virTristateBool exactName;
1562 };
1563 
1564 typedef struct _virDomainAudioIOOSS virDomainAudioIOOSS;
1565 struct _virDomainAudioIOOSS {
1566     char *dev;
1567     unsigned int bufferCount;
1568     virTristateBool tryPoll;
1569 };
1570 
1571 typedef struct _virDomainAudioIOPulseAudio virDomainAudioIOPulseAudio;
1572 struct _virDomainAudioIOPulseAudio {
1573     char *name;
1574     char *streamName;
1575     unsigned int latency;
1576 };
1577 
1578 typedef struct _virDomainAudioIOSDL virDomainAudioIOSDL;
1579 struct _virDomainAudioIOSDL {
1580     unsigned int bufferCount;
1581 };
1582 
1583 struct _virDomainAudioDef {
1584     virDomainAudioType type;
1585 
1586     unsigned int id;
1587 
1588     unsigned int timerPeriod;
1589 
1590     virDomainAudioIOCommon input;
1591     virDomainAudioIOCommon output;
1592     union {
1593         struct {
1594             virDomainAudioIOALSA input;
1595             virDomainAudioIOALSA output;
1596         } alsa;
1597         struct {
1598             virDomainAudioIOCoreAudio input;
1599             virDomainAudioIOCoreAudio output;
1600         } coreaudio;
1601         struct {
1602             virDomainAudioIOJack input;
1603             virDomainAudioIOJack output;
1604         } jack;
1605         struct {
1606             virDomainAudioIOOSS input;
1607             virDomainAudioIOOSS output;
1608             virTristateBool tryMMap;
1609             virTristateBool exclusive;
1610             bool dspPolicySet;
1611             int dspPolicy;
1612         } oss;
1613         struct {
1614             virDomainAudioIOPulseAudio input;
1615             virDomainAudioIOPulseAudio output;
1616             char *serverName;
1617         } pulseaudio;
1618         struct {
1619             virDomainAudioIOSDL input;
1620             virDomainAudioIOSDL output;
1621             virDomainAudioSDLDriver driver;
1622         } sdl;
1623         struct {
1624             char *path;
1625         } file;
1626     } backend;
1627 };
1628 
1629 typedef enum {
1630     VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB,
1631     VIR_DOMAIN_WATCHDOG_MODEL_IB700,
1632     VIR_DOMAIN_WATCHDOG_MODEL_DIAG288,
1633 
1634     VIR_DOMAIN_WATCHDOG_MODEL_LAST
1635 } virDomainWatchdogModel;
1636 
1637 typedef enum {
1638     VIR_DOMAIN_WATCHDOG_ACTION_RESET,
1639     VIR_DOMAIN_WATCHDOG_ACTION_SHUTDOWN,
1640     VIR_DOMAIN_WATCHDOG_ACTION_POWEROFF,
1641     VIR_DOMAIN_WATCHDOG_ACTION_PAUSE,
1642     VIR_DOMAIN_WATCHDOG_ACTION_DUMP,
1643     VIR_DOMAIN_WATCHDOG_ACTION_NONE,
1644     VIR_DOMAIN_WATCHDOG_ACTION_INJECTNMI,
1645 
1646     VIR_DOMAIN_WATCHDOG_ACTION_LAST
1647 } virDomainWatchdogAction;
1648 
1649 struct _virDomainWatchdogDef {
1650     int model;
1651     int action;
1652     virDomainDeviceInfo info;
1653 };
1654 
1655 
1656 /* the backend driver used for virtio interfaces */
1657 typedef enum {
1658     VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT = 0,
1659     VIR_DOMAIN_VIDEO_BACKEND_TYPE_QEMU,
1660     VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER,
1661 
1662     VIR_DOMAIN_VIDEO_BACKEND_TYPE_LAST
1663 } virDomainVideoBackendType;
1664 
1665 
1666 typedef enum {
1667     VIR_DOMAIN_VIDEO_TYPE_DEFAULT,
1668     VIR_DOMAIN_VIDEO_TYPE_VGA,
1669     VIR_DOMAIN_VIDEO_TYPE_CIRRUS,
1670     VIR_DOMAIN_VIDEO_TYPE_VMVGA,
1671     VIR_DOMAIN_VIDEO_TYPE_XEN,
1672     VIR_DOMAIN_VIDEO_TYPE_VBOX,
1673     VIR_DOMAIN_VIDEO_TYPE_QXL,
1674     VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in containers */
1675     VIR_DOMAIN_VIDEO_TYPE_VIRTIO,
1676     VIR_DOMAIN_VIDEO_TYPE_GOP,
1677     VIR_DOMAIN_VIDEO_TYPE_NONE,
1678     VIR_DOMAIN_VIDEO_TYPE_BOCHS,
1679     VIR_DOMAIN_VIDEO_TYPE_RAMFB,
1680 
1681     VIR_DOMAIN_VIDEO_TYPE_LAST
1682 } virDomainVideoType;
1683 
1684 
1685 typedef enum {
1686     VIR_DOMAIN_VIDEO_VGACONF_IO = 0,
1687     VIR_DOMAIN_VIDEO_VGACONF_ON,
1688     VIR_DOMAIN_VIDEO_VGACONF_OFF,
1689 
1690     VIR_DOMAIN_VIDEO_VGACONF_LAST
1691 } virDomainVideoVGAConf;
1692 
1693 VIR_ENUM_DECL(virDomainVideoVGAConf);
1694 
1695 struct _virDomainVideoAccelDef {
1696     int accel2d; /* enum virTristateBool */
1697     int accel3d; /* enum virTristateBool */
1698     char *rendernode;
1699 };
1700 
1701 struct _virDomainVideoResolutionDef {
1702     unsigned int x;
1703     unsigned int y;
1704 };
1705 
1706 struct _virDomainVideoDriverDef {
1707     virDomainVideoVGAConf vgaconf;
1708     char *vhost_user_binary;
1709 };
1710 
1711 struct _virDomainVideoDef {
1712     virObject *privateData;
1713 
1714     int type;   /* enum virDomainVideoType */
1715     unsigned int ram;  /* kibibytes (multiples of 1024) */
1716     unsigned int vram; /* kibibytes (multiples of 1024) */
1717     unsigned int vram64; /* kibibytes (multiples of 1024) */
1718     unsigned int vgamem; /* kibibytes (multiples of 1024) */
1719     unsigned int heads;
1720     bool primary;
1721     virDomainVideoAccelDef *accel;
1722     virDomainVideoResolutionDef *res;
1723     virDomainVideoDriverDef *driver;
1724     virDomainDeviceInfo info;
1725     virDomainVirtioOptions *virtio;
1726     virDomainVideoBackendType backend;
1727 };
1728 
1729 /* graphics console modes */
1730 typedef enum {
1731     VIR_DOMAIN_GRAPHICS_TYPE_SDL,
1732     VIR_DOMAIN_GRAPHICS_TYPE_VNC,
1733     VIR_DOMAIN_GRAPHICS_TYPE_RDP,
1734     VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP,
1735     VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
1736     VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS,
1737 
1738     VIR_DOMAIN_GRAPHICS_TYPE_LAST
1739 } virDomainGraphicsType;
1740 
1741 typedef enum {
1742     VIR_DOMAIN_GRAPHICS_VNC_SHARE_DEFAULT = 0,
1743     VIR_DOMAIN_GRAPHICS_VNC_SHARE_ALLOW_EXCLUSIVE,
1744     VIR_DOMAIN_GRAPHICS_VNC_SHARE_FORCE_SHARED,
1745     VIR_DOMAIN_GRAPHICS_VNC_SHARE_IGNORE,
1746 
1747     VIR_DOMAIN_GRAPHICS_VNC_SHARE_LAST
1748 } virDomainGraphicsVNCSharePolicy;
1749 
1750 typedef enum {
1751     VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_DEFAULT = 0,
1752     VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_FAIL,
1753     VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_DISCONNECT,
1754     VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_KEEP,
1755 
1756     VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST
1757 } virDomainGraphicsAuthConnectedType;
1758 
1759 struct _virDomainGraphicsAuthDef {
1760     char *passwd;
1761     bool expires; /* Whether there is an expiry time set */
1762     time_t validTo;  /* seconds since epoch */
1763     int connected; /* action if connected */
1764 };
1765 
1766 typedef enum {
1767     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MAIN,
1768     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_DISPLAY,
1769     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_INPUT,
1770     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_CURSOR,
1771     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_PLAYBACK,
1772     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_RECORD,
1773     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_SMARTCARD,
1774     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_USBREDIR,
1775 
1776     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST
1777 } virDomainGraphicsSpiceChannelName;
1778 
1779 typedef enum {
1780     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY,
1781     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE,
1782     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE,
1783 
1784     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_LAST
1785 } virDomainGraphicsSpiceChannelMode;
1786 
1787 typedef enum {
1788     VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_DEFAULT = 0,
1789     VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_GLZ,
1790     VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_LZ,
1791     VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_QUIC,
1792     VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_GLZ,
1793     VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_LZ,
1794     VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_OFF,
1795 
1796     VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_LAST
1797 } virDomainGraphicsSpiceImageCompression;
1798 
1799 typedef enum {
1800     VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_DEFAULT = 0,
1801     VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_AUTO,
1802     VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_NEVER,
1803     VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_ALWAYS,
1804 
1805     VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_LAST
1806 } virDomainGraphicsSpiceJpegCompression;
1807 
1808 typedef enum {
1809     VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_DEFAULT = 0,
1810     VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_AUTO,
1811     VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_NEVER,
1812     VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_ALWAYS,
1813 
1814     VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_LAST
1815 } virDomainGraphicsSpiceZlibCompression;
1816 
1817 typedef enum {
1818     VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0,
1819     VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER,
1820     VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT,
1821 
1822     VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST
1823 } virDomainGraphicsSpiceMouseMode;
1824 
1825 typedef enum {
1826     VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0,
1827     VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_FILTER,
1828     VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_ALL,
1829     VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_OFF,
1830 
1831     VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST
1832 } virDomainGraphicsSpiceStreamingMode;
1833 
1834 typedef enum {
1835     VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE = 0,
1836     VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS,
1837     VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK,
1838     VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET,
1839 
1840     VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
1841 } virDomainGraphicsListenType;
1842 
1843 typedef enum {
1844     VIR_DOMAIN_HUB_TYPE_USB,
1845 
1846     VIR_DOMAIN_HUB_TYPE_LAST
1847 } virDomainHubType;
1848 
1849 struct _virDomainGraphicsListenDef {
1850     virDomainGraphicsListenType type;
1851     char *address;
1852     char *network;
1853     char *socket;
1854     bool fromConfig;    /* true if the @address is config file originated */
1855     bool autoGenerated;
1856 };
1857 
1858 struct _virDomainGraphicsDef {
1859     virObject *privateData;
1860 
1861     /* Port value discipline:
1862      * Value -1 is legacy syntax indicating that it should be auto-allocated.
1863      * Value 0 means port wasn't specified in XML at all.
1864      * Positive value is actual port number given in XML.
1865      */
1866     virDomainGraphicsType type;
1867     union {
1868         struct {
1869             int port;
1870             bool portReserved;
1871             int websocket;
1872             bool websocketGenerated;
1873             bool autoport;
1874             char *keymap;
1875             virDomainGraphicsAuthDef auth;
1876             virDomainGraphicsVNCSharePolicy sharePolicy;
1877             virTristateBool powerControl;
1878             unsigned int audioId;
1879         } vnc;
1880         struct {
1881             char *display;
1882             char *xauth;
1883             bool fullscreen;
1884             virTristateBool gl;
1885         } sdl;
1886         struct {
1887             int port;
1888             bool autoport;
1889             bool replaceUser;
1890             bool multiUser;
1891         } rdp;
1892         struct {
1893             char *display;
1894             bool fullscreen;
1895         } desktop;
1896         struct {
1897             int port;
1898             int tlsPort;
1899             bool portReserved;
1900             bool tlsPortReserved;
1901             virDomainGraphicsSpiceMouseMode mousemode;
1902             char *keymap;
1903             virDomainGraphicsAuthDef auth;
1904             bool autoport;
1905             int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST];
1906             virDomainGraphicsSpiceChannelMode defaultMode;
1907             int image;
1908             int jpeg;
1909             int zlib;
1910             virTristateSwitch playback;
1911             int streaming;
1912             virTristateBool copypaste;
1913             virTristateBool filetransfer;
1914             virTristateBool gl;
1915             char *rendernode;
1916         } spice;
1917         struct {
1918             char *rendernode;
1919         } egl_headless;
1920     } data;
1921     /* nListens, listens, and *port are only useful if type is vnc,
1922      * rdp, or spice. They've been extracted from the union only to
1923      * simplify parsing code.*/
1924     size_t nListens;
1925     virDomainGraphicsListenDef *listens;
1926 };
1927 
1928 typedef enum {
1929     VIR_DOMAIN_REDIRDEV_BUS_USB,
1930 
1931     VIR_DOMAIN_REDIRDEV_BUS_LAST
1932 } virDomainRedirdevBus;
1933 
1934 struct _virDomainRedirdevDef {
1935     int bus; /* enum virDomainRedirdevBus */
1936 
1937     virDomainChrSourceDef *source;
1938 
1939     virDomainDeviceInfo info; /* Guest address */
1940 };
1941 
1942 struct _virDomainRedirFilterUSBDevDef {
1943     int usbClass;
1944     int vendor;
1945     int product;
1946     int version;
1947     bool allow;
1948 };
1949 
1950 struct _virDomainRedirFilterDef {
1951     size_t nusbdevs;
1952     virDomainRedirFilterUSBDevDef **usbdevs;
1953 };
1954 
1955 typedef enum {
1956     VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
1957     VIR_DOMAIN_MEMBALLOON_MODEL_XEN,
1958     VIR_DOMAIN_MEMBALLOON_MODEL_NONE,
1959     VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL,
1960     VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL,
1961 
1962     VIR_DOMAIN_MEMBALLOON_MODEL_LAST
1963 } virDomainMemballoonModel;
1964 
1965 struct _virDomainMemballoonDef {
1966     virDomainMemballoonModel model;
1967     virDomainDeviceInfo info;
1968     int period; /* seconds between collections */
1969     virTristateSwitch autodeflate;
1970     virTristateSwitch free_page_reporting;
1971     virDomainVirtioOptions *virtio;
1972 };
1973 
1974 struct _virDomainNVRAMDef {
1975     virDomainDeviceInfo info;
1976 };
1977 
1978 typedef enum {
1979     VIR_DOMAIN_SHMEM_MODEL_IVSHMEM,
1980     VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN,
1981     VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_DOORBELL,
1982 
1983     VIR_DOMAIN_SHMEM_MODEL_LAST
1984 } virDomainShmemModel;
1985 
1986 typedef enum {
1987     VIR_DOMAIN_SHMEM_ROLE_DEFAULT,
1988     VIR_DOMAIN_SHMEM_ROLE_MASTER,
1989     VIR_DOMAIN_SHMEM_ROLE_PEER,
1990 
1991     VIR_DOMAIN_SHMEM_ROLE_LAST
1992 } virDomainShmemRole;
1993 
1994 struct _virDomainShmemDef {
1995     char *name;
1996     unsigned long long size;
1997     virDomainShmemModel model;
1998     virDomainShmemRole role;
1999     struct {
2000         bool enabled;
2001         virDomainChrSourceDef *chr;
2002     } server;
2003     struct {
2004         bool enabled;
2005         unsigned vectors;
2006         virTristateSwitch ioeventfd;
2007     } msi;
2008     virDomainDeviceInfo info;
2009 };
2010 
2011 typedef enum {
2012     VIR_DOMAIN_SMBIOS_NONE = 0,
2013     VIR_DOMAIN_SMBIOS_EMULATE,
2014     VIR_DOMAIN_SMBIOS_HOST,
2015     VIR_DOMAIN_SMBIOS_SYSINFO,
2016 
2017     VIR_DOMAIN_SMBIOS_LAST
2018 } virDomainSmbiosMode;
2019 
2020 
2021 #define VIR_DOMAIN_MAX_BOOT_DEVS 4
2022 
2023 typedef enum {
2024     VIR_DOMAIN_BOOT_FLOPPY,
2025     VIR_DOMAIN_BOOT_CDROM,
2026     VIR_DOMAIN_BOOT_DISK,
2027     VIR_DOMAIN_BOOT_NET,
2028 
2029     VIR_DOMAIN_BOOT_LAST
2030 } virDomainBootOrder;
2031 
2032 typedef enum {
2033     VIR_DOMAIN_FEATURE_ACPI,
2034     VIR_DOMAIN_FEATURE_APIC,
2035     VIR_DOMAIN_FEATURE_PAE,
2036     VIR_DOMAIN_FEATURE_HAP,
2037     VIR_DOMAIN_FEATURE_VIRIDIAN,
2038     VIR_DOMAIN_FEATURE_PRIVNET,
2039     VIR_DOMAIN_FEATURE_HYPERV,
2040     VIR_DOMAIN_FEATURE_KVM,
2041     VIR_DOMAIN_FEATURE_PVSPINLOCK,
2042     VIR_DOMAIN_FEATURE_CAPABILITIES,
2043     VIR_DOMAIN_FEATURE_PMU,
2044     VIR_DOMAIN_FEATURE_VMPORT,
2045     VIR_DOMAIN_FEATURE_GIC,
2046     VIR_DOMAIN_FEATURE_SMM,
2047     VIR_DOMAIN_FEATURE_IOAPIC,
2048     VIR_DOMAIN_FEATURE_HPT,
2049     VIR_DOMAIN_FEATURE_VMCOREINFO,
2050     VIR_DOMAIN_FEATURE_HTM,
2051     VIR_DOMAIN_FEATURE_NESTED_HV,
2052     VIR_DOMAIN_FEATURE_MSRS,
2053     VIR_DOMAIN_FEATURE_CCF_ASSIST,
2054     VIR_DOMAIN_FEATURE_XEN,
2055     VIR_DOMAIN_FEATURE_CFPC,
2056     VIR_DOMAIN_FEATURE_SBBC,
2057     VIR_DOMAIN_FEATURE_IBS,
2058 
2059     VIR_DOMAIN_FEATURE_LAST
2060 } virDomainFeature;
2061 
2062 #define VIR_DOMAIN_HYPERV_VENDOR_ID_MAX 12
2063 
2064 typedef enum {
2065     VIR_DOMAIN_HYPERV_RELAXED = 0,
2066     VIR_DOMAIN_HYPERV_VAPIC,
2067     VIR_DOMAIN_HYPERV_SPINLOCKS,
2068     VIR_DOMAIN_HYPERV_VPINDEX,
2069     VIR_DOMAIN_HYPERV_RUNTIME,
2070     VIR_DOMAIN_HYPERV_SYNIC,
2071     VIR_DOMAIN_HYPERV_STIMER,
2072     VIR_DOMAIN_HYPERV_RESET,
2073     VIR_DOMAIN_HYPERV_VENDOR_ID,
2074     VIR_DOMAIN_HYPERV_FREQUENCIES,
2075     VIR_DOMAIN_HYPERV_REENLIGHTENMENT,
2076     VIR_DOMAIN_HYPERV_TLBFLUSH,
2077     VIR_DOMAIN_HYPERV_IPI,
2078     VIR_DOMAIN_HYPERV_EVMCS,
2079 
2080     VIR_DOMAIN_HYPERV_LAST
2081 } virDomainHyperv;
2082 
2083 typedef enum {
2084     VIR_DOMAIN_KVM_HIDDEN = 0,
2085     VIR_DOMAIN_KVM_DEDICATED,
2086     VIR_DOMAIN_KVM_POLLCONTROL,
2087     VIR_DOMAIN_KVM_PVIPI,
2088 
2089     VIR_DOMAIN_KVM_LAST
2090 } virDomainKVM;
2091 
2092 typedef enum {
2093     VIR_DOMAIN_MSRS_UNKNOWN = 0,
2094 
2095     VIR_DOMAIN_MSRS_LAST
2096 } virDomainMsrs;
2097 
2098 typedef enum {
2099     VIR_DOMAIN_MSRS_UNKNOWN_IGNORE = 0,
2100     VIR_DOMAIN_MSRS_UNKNOWN_FAULT,
2101 
2102     VIR_DOMAIN_MSRS_UNKNOWN_LAST
2103 } virDomainMsrsUnknown;
2104 
2105 typedef enum {
2106     VIR_DOMAIN_XEN_E820_HOST = 0,
2107     VIR_DOMAIN_XEN_PASSTHROUGH,
2108 
2109     VIR_DOMAIN_XEN_LAST
2110 } virDomainXen;
2111 
2112 typedef enum {
2113     VIR_DOMAIN_XEN_PASSTHROUGH_MODE_DEFAULT = 0,
2114     VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT,
2115     VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT,
2116 
2117     VIR_DOMAIN_XEN_PASSTHROUGH_MODE_LAST
2118 } virDomainXenPassthroughMode;
2119 
2120 typedef enum {
2121     VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT = 0,
2122     VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW,
2123     VIR_DOMAIN_CAPABILITIES_POLICY_DENY,
2124 
2125     VIR_DOMAIN_CAPABILITIES_POLICY_LAST
2126 } virDomainCapabilitiesPolicy;
2127 
2128 /* The capabilities are ordered alphabetically to help check for new ones */
2129 typedef enum {
2130     VIR_DOMAIN_PROCES_CAPS_FEATURE_AUDIT_CONTROL = 0,
2131     VIR_DOMAIN_PROCES_CAPS_FEATURE_AUDIT_WRITE,
2132     VIR_DOMAIN_PROCES_CAPS_FEATURE_BLOCK_SUSPEND,
2133     VIR_DOMAIN_PROCES_CAPS_FEATURE_CHOWN,
2134     VIR_DOMAIN_PROCES_CAPS_FEATURE_DAC_OVERRIDE,
2135     VIR_DOMAIN_PROCES_CAPS_FEATURE_DAC_READ_SEARCH,
2136     VIR_DOMAIN_PROCES_CAPS_FEATURE_FOWNER,
2137     VIR_DOMAIN_PROCES_CAPS_FEATURE_FSETID,
2138     VIR_DOMAIN_PROCES_CAPS_FEATURE_IPC_LOCK,
2139     VIR_DOMAIN_PROCES_CAPS_FEATURE_IPC_OWNER,
2140     VIR_DOMAIN_PROCES_CAPS_FEATURE_KILL,
2141     VIR_DOMAIN_PROCES_CAPS_FEATURE_LEASE,
2142     VIR_DOMAIN_PROCES_CAPS_FEATURE_LINUX_IMMUTABLE,
2143     VIR_DOMAIN_PROCES_CAPS_FEATURE_MAC_ADMIN,
2144     VIR_DOMAIN_PROCES_CAPS_FEATURE_MAC_OVERRIDE,
2145     VIR_DOMAIN_PROCES_CAPS_FEATURE_MKNOD,
2146     VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_ADMIN,
2147     VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_BIND_SERVICE,
2148     VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_BROADCAST,
2149     VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_RAW,
2150     VIR_DOMAIN_PROCES_CAPS_FEATURE_SETGID,
2151     VIR_DOMAIN_PROCES_CAPS_FEATURE_SETFCAP,
2152     VIR_DOMAIN_PROCES_CAPS_FEATURE_SETPCAP,
2153     VIR_DOMAIN_PROCES_CAPS_FEATURE_SETUID,
2154     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_ADMIN,
2155     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_BOOT,
2156     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_CHROOT,
2157     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_MODULE,
2158     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_NICE,
2159     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_PACCT,
2160     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_PTRACE,
2161     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_RAWIO,
2162     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_RESOURCE,
2163     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_TIME,
2164     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_TTY_CONFIG,
2165     VIR_DOMAIN_PROCES_CAPS_FEATURE_SYSLOG,
2166     VIR_DOMAIN_PROCES_CAPS_FEATURE_WAKE_ALARM,
2167     VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST
2168 } virDomainProcessCapsFeature;
2169 
2170 typedef enum {
2171     VIR_DOMAIN_LOCK_FAILURE_DEFAULT,
2172     VIR_DOMAIN_LOCK_FAILURE_POWEROFF,
2173     VIR_DOMAIN_LOCK_FAILURE_RESTART,
2174     VIR_DOMAIN_LOCK_FAILURE_PAUSE,
2175     VIR_DOMAIN_LOCK_FAILURE_IGNORE,
2176 
2177     VIR_DOMAIN_LOCK_FAILURE_LAST
2178 } virDomainLockFailureAction;
2179 
2180 VIR_ENUM_DECL(virDomainLockFailure);
2181 
2182 struct _virDomainBIOSDef {
2183     int useserial; /* enum virTristateBool */
2184     /* reboot-timeout parameters */
2185     bool rt_set;
2186     int rt_delay;
2187 };
2188 
2189 typedef enum {
2190     VIR_DOMAIN_LOADER_TYPE_NONE = 0,
2191     VIR_DOMAIN_LOADER_TYPE_ROM,
2192     VIR_DOMAIN_LOADER_TYPE_PFLASH,
2193 
2194     VIR_DOMAIN_LOADER_TYPE_LAST
2195 } virDomainLoader;
2196 
2197 VIR_ENUM_DECL(virDomainLoader);
2198 
2199 struct _virDomainLoaderDef {
2200     char *path;
2201     virTristateBool readonly;
2202     virDomainLoader type;
2203     virTristateBool secure;
2204     char *nvram;    /* path to non-volatile RAM */
2205     char *templt;   /* user override of path to master nvram */
2206 };
2207 
2208 void virDomainLoaderDefFree(virDomainLoaderDef *loader);
2209 
2210 typedef enum {
2211     VIR_DOMAIN_IOAPIC_NONE = 0,
2212     VIR_DOMAIN_IOAPIC_QEMU,
2213     VIR_DOMAIN_IOAPIC_KVM,
2214 
2215     VIR_DOMAIN_IOAPIC_LAST
2216 } virDomainIOAPIC;
2217 
2218 VIR_ENUM_DECL(virDomainIOAPIC);
2219 
2220 typedef enum {
2221     VIR_DOMAIN_HPT_RESIZING_NONE = 0,
2222     VIR_DOMAIN_HPT_RESIZING_ENABLED,
2223     VIR_DOMAIN_HPT_RESIZING_DISABLED,
2224     VIR_DOMAIN_HPT_RESIZING_REQUIRED,
2225 
2226     VIR_DOMAIN_HPT_RESIZING_LAST
2227 } virDomainHPTResizing;
2228 
2229 VIR_ENUM_DECL(virDomainHPTResizing);
2230 
2231 typedef enum {
2232     VIR_DOMAIN_CFPC_NONE = 0,
2233     VIR_DOMAIN_CFPC_BROKEN,
2234     VIR_DOMAIN_CFPC_WORKAROUND,
2235     VIR_DOMAIN_CFPC_FIXED,
2236 
2237     VIR_DOMAIN_CFPC_LAST
2238 } virDomainCFPC;
2239 
2240 VIR_ENUM_DECL(virDomainCFPC);
2241 
2242 typedef enum {
2243     VIR_DOMAIN_SBBC_NONE = 0,
2244     VIR_DOMAIN_SBBC_BROKEN,
2245     VIR_DOMAIN_SBBC_WORKAROUND,
2246     VIR_DOMAIN_SBBC_FIXED,
2247 
2248     VIR_DOMAIN_SBBC_LAST
2249 } virDomainSBBC;
2250 
2251 VIR_ENUM_DECL(virDomainSBBC);
2252 
2253 typedef enum {
2254     VIR_DOMAIN_IBS_NONE = 0,
2255     VIR_DOMAIN_IBS_BROKEN,
2256     VIR_DOMAIN_IBS_WORKAROUND,
2257     VIR_DOMAIN_IBS_FIXEDIBS,
2258     VIR_DOMAIN_IBS_FIXEDCCD,
2259     VIR_DOMAIN_IBS_FIXEDNA,
2260 
2261     VIR_DOMAIN_IBS_LAST
2262 } virDomainIBS;
2263 
2264 VIR_ENUM_DECL(virDomainIBS);
2265 
2266 /* Operating system configuration data & machine / arch */
2267 struct _virDomainOSEnv {
2268     char *name;
2269     char *value;
2270 };
2271 
2272 typedef enum {
2273     VIR_DOMAIN_OS_DEF_FIRMWARE_NONE = 0,
2274     VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS = VIR_DOMAIN_LOADER_TYPE_ROM,
2275     VIR_DOMAIN_OS_DEF_FIRMWARE_EFI = VIR_DOMAIN_LOADER_TYPE_PFLASH,
2276 
2277     VIR_DOMAIN_OS_DEF_FIRMWARE_LAST
2278 } virDomainOsDefFirmware;
2279 
2280 G_STATIC_ASSERT((int)VIR_DOMAIN_OS_DEF_FIRMWARE_LAST == (int)VIR_DOMAIN_LOADER_TYPE_LAST);
2281 
2282 VIR_ENUM_DECL(virDomainOsDefFirmware);
2283 
2284 typedef enum {
2285     VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_ENROLLED_KEYS,
2286     VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_SECURE_BOOT,
2287 
2288     VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_LAST
2289 } virDomainOsDefFirmwareFeature;
2290 
2291 VIR_ENUM_DECL(virDomainOsDefFirmwareFeature);
2292 
2293 struct _virDomainOSDef {
2294     int type;
2295     virDomainOsDefFirmware firmware;
2296     int *firmwareFeatures;
2297     virArch arch;
2298     char *machine;
2299     size_t nBootDevs;
2300     int bootDevs[VIR_DOMAIN_BOOT_LAST];
2301     int bootmenu; /* enum virTristateBool */
2302     unsigned int bm_timeout;
2303     bool bm_timeout_set;
2304     char *init;
2305     char **initargv;
2306     virDomainOSEnv **initenv;
2307     char *initdir;
2308     char *inituser;
2309     char *initgroup;
2310     char *kernel;
2311     char *initrd;
2312     char *cmdline;
2313     char *dtb;
2314     char *root;
2315     char *slic_table;
2316     virDomainLoaderDef *loader;
2317     char *bootloader;
2318     char *bootloaderArgs;
2319     int smbios_mode;
2320 
2321     virDomainBIOSDef bios;
2322 };
2323 
2324 typedef enum {
2325     VIR_DOMAIN_TIMER_NAME_PLATFORM = 0,
2326     VIR_DOMAIN_TIMER_NAME_PIT,
2327     VIR_DOMAIN_TIMER_NAME_RTC,
2328     VIR_DOMAIN_TIMER_NAME_HPET,
2329     VIR_DOMAIN_TIMER_NAME_TSC,
2330     VIR_DOMAIN_TIMER_NAME_KVMCLOCK,
2331     VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK,
2332     VIR_DOMAIN_TIMER_NAME_ARMVTIMER,
2333 
2334     VIR_DOMAIN_TIMER_NAME_LAST
2335 } virDomainTimerNameType;
2336 
2337 typedef enum {
2338     VIR_DOMAIN_TIMER_TRACK_BOOT = 0,
2339     VIR_DOMAIN_TIMER_TRACK_GUEST,
2340     VIR_DOMAIN_TIMER_TRACK_WALL,
2341     VIR_DOMAIN_TIMER_TRACK_REALTIME,
2342 
2343     VIR_DOMAIN_TIMER_TRACK_LAST
2344 } virDomainTimerTrackType;
2345 
2346 typedef enum {
2347     VIR_DOMAIN_TIMER_TICKPOLICY_DELAY = 0,
2348     VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP,
2349     VIR_DOMAIN_TIMER_TICKPOLICY_MERGE,
2350     VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD,
2351 
2352     VIR_DOMAIN_TIMER_TICKPOLICY_LAST
2353 } virDomainTimerTickpolicyType;
2354 
2355 typedef enum {
2356     VIR_DOMAIN_TIMER_MODE_AUTO = 0,
2357     VIR_DOMAIN_TIMER_MODE_NATIVE,
2358     VIR_DOMAIN_TIMER_MODE_EMULATE,
2359     VIR_DOMAIN_TIMER_MODE_PARAVIRT,
2360     VIR_DOMAIN_TIMER_MODE_SMPSAFE,
2361 
2362     VIR_DOMAIN_TIMER_MODE_LAST
2363 } virDomainTimerModeType;
2364 
2365 typedef enum {
2366     VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC = 0,
2367     VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO,
2368 
2369     VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST
2370 } virDomainCpuPlacementMode;
2371 
2372 struct _virDomainThreadSchedParam {
2373     virProcessSchedPolicy policy;
2374     int priority;
2375 };
2376 
2377 struct _virDomainTimerCatchupDef {
2378     unsigned long threshold;
2379     unsigned long slew;
2380     unsigned long limit;
2381 };
2382 
2383 struct _virDomainTimerDef {
2384     int name;
2385     int present;    /* unspecified = -1, no = 0, yes = 1 */
2386     int tickpolicy; /* none|catchup|merge|discard */
2387 
2388     virDomainTimerCatchupDef catchup;
2389 
2390     /* track is only valid for name='platform|rtc' */
2391     int track;  /* boot|guest|wall */
2392 
2393     /* frequency & mode are only valid for name='tsc' */
2394     unsigned long long frequency; /* in Hz, unspecified = 0 */
2395     int mode;       /* auto|native|emulate|paravirt */
2396 };
2397 
2398 typedef enum {
2399     VIR_DOMAIN_CLOCK_OFFSET_UTC = 0,
2400     VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME = 1,
2401     VIR_DOMAIN_CLOCK_OFFSET_VARIABLE = 2,
2402     VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE = 3,
2403 
2404     VIR_DOMAIN_CLOCK_OFFSET_LAST
2405 } virDomainClockOffsetType;
2406 
2407 typedef enum {
2408     VIR_DOMAIN_CLOCK_BASIS_UTC = 0,
2409     VIR_DOMAIN_CLOCK_BASIS_LOCALTIME = 1,
2410 
2411     VIR_DOMAIN_CLOCK_BASIS_LAST
2412 } virDomainClockBasis;
2413 
2414 struct _virDomainClockDef {
2415     int offset;
2416 
2417     union {
2418         /* Bug-compatibility-mode for Xen utc|localtime */
2419         int utc_reset;
2420         /* Adjustment in seconds, relative to UTC or LOCALTIME, when
2421          * offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE */
2422         struct {
2423             long long adjustment;
2424             int basis;
2425 
2426             /* domain start-time adjustment. This is a
2427              * private/internal read-only value that only exists when
2428              * a domain is running, and only if the clock
2429              * offset='variable'
2430              */
2431             long long adjustment0;
2432         } variable;
2433 
2434         /* Timezone name, when
2435          * offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME */
2436         char *timezone;
2437     } data;
2438 
2439     size_t ntimers;
2440     virDomainTimerDef **timers;
2441 };
2442 
2443 
2444 struct _virBlkioDevice {
2445     char *path;
2446     unsigned int weight;
2447     unsigned int riops;
2448     unsigned int wiops;
2449     unsigned long long rbps;
2450     unsigned long long wbps;
2451 };
2452 
2453 typedef enum {
2454     VIR_DOMAIN_RNG_MODEL_VIRTIO,
2455     VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL,
2456     VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL,
2457 
2458     VIR_DOMAIN_RNG_MODEL_LAST
2459 } virDomainRNGModel;
2460 
2461 typedef enum {
2462     VIR_DOMAIN_RNG_BACKEND_RANDOM,
2463     VIR_DOMAIN_RNG_BACKEND_EGD,
2464     VIR_DOMAIN_RNG_BACKEND_BUILTIN,
2465 
2466     VIR_DOMAIN_RNG_BACKEND_LAST
2467 } virDomainRNGBackend;
2468 
2469 struct _virDomainRNGDef {
2470     int model;
2471     int backend;
2472     unsigned int rate; /* bytes per period */
2473     unsigned int period; /* milliseconds */
2474 
2475     union {
2476         char *file; /* file name for 'random' source */
2477         virDomainChrSourceDef *chardev; /* a char backend for the EGD source */
2478     } source;
2479 
2480     virDomainDeviceInfo info;
2481     virDomainVirtioOptions *virtio;
2482 };
2483 
2484 typedef enum {
2485     VIR_DOMAIN_MEMORY_MODEL_NONE,
2486     VIR_DOMAIN_MEMORY_MODEL_DIMM, /* dimm hotpluggable memory device */
2487     VIR_DOMAIN_MEMORY_MODEL_NVDIMM, /* nvdimm memory device */
2488     VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM, /* virtio-pmem memory device */
2489     VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM, /* virtio-mem memory device */
2490 
2491     VIR_DOMAIN_MEMORY_MODEL_LAST
2492 } virDomainMemoryModel;
2493 
2494 struct _virDomainMemoryDef {
2495     virDomainMemoryAccess access;
2496     virTristateBool discard;
2497 
2498     /* source */
2499     virBitmap *sourceNodes;
2500     unsigned long long pagesize; /* kibibytes */
2501     char *nvdimmPath; /* valid for NVDIMM an VIRTIO_PMEM */
2502     unsigned long long alignsize; /* kibibytes; valid only for NVDIMM */
2503     bool nvdimmPmem; /* valid only for NVDIMM */
2504 
2505     /* target */
2506     virDomainMemoryModel model;
2507     int targetNode;
2508     unsigned long long size; /* kibibytes */
2509     unsigned long long labelsize; /* kibibytes; valid only for NVDIMM */
2510     unsigned long long blocksize; /* kibibytes; valid only for VIRTIO_MEM */
2511     unsigned long long requestedsize; /* kibibytes; valid only for VIRTIO_MEM */
2512     unsigned long long currentsize; /* kibibytes, valid for VIRTIO_MEM and
2513                                        active domain only, only to report never
2514                                        parse */
2515     bool readonly; /* valid only for NVDIMM */
2516 
2517     /* required for QEMU NVDIMM ppc64 support */
2518     unsigned char *uuid; /* VIR_UUID_BUFLEN bytes long */
2519 
2520     virDomainDeviceInfo info;
2521 };
2522 
2523 void virDomainMemoryDefFree(virDomainMemoryDef *def);
2524 
2525 struct _virDomainIdMapEntry {
2526     unsigned int start;
2527     unsigned int target;
2528     unsigned int count;
2529 };
2530 
2531 struct _virDomainIdMapDef {
2532     size_t nuidmap;
2533     virDomainIdMapEntry *uidmap;
2534 
2535     size_t ngidmap;
2536     virDomainIdMapEntry *gidmap;
2537 };
2538 
2539 
2540 typedef enum {
2541     VIR_DOMAIN_PANIC_MODEL_DEFAULT,
2542     VIR_DOMAIN_PANIC_MODEL_ISA,
2543     VIR_DOMAIN_PANIC_MODEL_PSERIES,
2544     VIR_DOMAIN_PANIC_MODEL_HYPERV,
2545     VIR_DOMAIN_PANIC_MODEL_S390,
2546 
2547     VIR_DOMAIN_PANIC_MODEL_LAST
2548 } virDomainPanicModel;
2549 
2550 struct _virDomainPanicDef {
2551     int model; /* virDomainPanicModel */
2552     virDomainDeviceInfo info;
2553 };
2554 
2555 
2556 void virBlkioDeviceArrayClear(virBlkioDevice *deviceWeights,
2557                               int ndevices);
2558 
2559 struct _virDomainResourceDef {
2560     char *partition;
2561     char *appid;
2562 };
2563 
2564 struct _virDomainHugePage {
2565     virBitmap *nodemask;        /* guest's NUMA node mask */
2566     unsigned long long size;    /* hugepage size in KiB */
2567 };
2568 
2569 #define VIR_DOMAIN_CPUMASK_LEN 16384
2570 
2571 struct _virDomainIOThreadIDDef {
2572     bool autofill;
2573     unsigned int iothread_id;
2574     int thread_id;
2575     virBitmap *cpumask;
2576 
2577     virDomainThreadSchedParam sched;
2578 };
2579 
2580 void virDomainIOThreadIDDefFree(virDomainIOThreadIDDef *def);
2581 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainIOThreadIDDef, virDomainIOThreadIDDefFree);
2582 
2583 
2584 struct _virDomainCputune {
2585     unsigned long long shares;
2586     bool sharesSpecified;
2587     unsigned long long period;
2588     long long quota;
2589     unsigned long long global_period;
2590     long long global_quota;
2591     unsigned long long emulator_period;
2592     long long emulator_quota;
2593     unsigned long long iothread_period;
2594     long long iothread_quota;
2595     virBitmap *emulatorpin;
2596     virDomainThreadSchedParam *emulatorsched;
2597 };
2598 
2599 
2600 struct _virDomainResctrlMonDef {
2601     virBitmap *vcpus;
2602     virResctrlMonitorType tag;
2603     virResctrlMonitor *instance;
2604 };
2605 
2606 struct _virDomainResctrlDef {
2607     virBitmap *vcpus;
2608     virResctrlAlloc *alloc;
2609 
2610     virDomainResctrlMonDef **monitors;
2611     size_t nmonitors;
2612 };
2613 
2614 
2615 struct _virDomainVcpuDef {
2616     bool online;
2617     virTristateBool hotpluggable;
2618     unsigned int order;
2619 
2620     virBitmap *cpumask;
2621 
2622     virDomainThreadSchedParam sched;
2623 
2624     virObject *privateData;
2625 };
2626 
2627 struct _virDomainBlkiotune {
2628     unsigned int weight;
2629 
2630     size_t ndevices;
2631     virBlkioDevice *devices;
2632 };
2633 
2634 struct _virDomainMemtune {
2635     /* total memory size including memory modules in kibibytes, this field
2636      * should be accessed only via accessors */
2637     unsigned long long total_memory;
2638     unsigned long long cur_balloon; /* in kibibytes, capped at ulong thanks
2639                                        to virDomainGetInfo */
2640 
2641     virDomainHugePage *hugepages;
2642     size_t nhugepages;
2643 
2644     /* maximum supported memory for a guest, for hotplugging */
2645     unsigned long long max_memory; /* in kibibytes */
2646     unsigned int memory_slots; /* maximum count of RAM memory slots */
2647 
2648     bool nosharepages;
2649     bool locked;
2650     int dump_core; /* enum virTristateSwitch */
2651     unsigned long long hard_limit; /* in kibibytes, limit at off_t bytes */
2652     unsigned long long soft_limit; /* in kibibytes, limit at off_t bytes */
2653     unsigned long long min_guarantee; /* in kibibytes, limit at off_t bytes */
2654     unsigned long long swap_hard_limit; /* in kibibytes, limit at off_t bytes */
2655 
2656     int source; /* enum virDomainMemorySource */
2657     int access; /* enum virDomainMemoryAccess */
2658     int allocation; /* enum virDomainMemoryAllocation */
2659 
2660     virTristateBool discard;
2661 };
2662 
2663 struct _virDomainPowerManagement {
2664     /* These options are of type enum virTristateBool */
2665     int s3;
2666     int s4;
2667 };
2668 
2669 struct _virDomainPerfDef {
2670     /* These options are of type enum virTristateBool */
2671     int events[VIR_PERF_EVENT_LAST];
2672 };
2673 
2674 struct _virDomainKeyWrapDef {
2675     virTristateSwitch aes;
2676     virTristateSwitch dea;
2677 };
2678 
2679 typedef enum {
2680     VIR_DOMAIN_LAUNCH_SECURITY_NONE,
2681     VIR_DOMAIN_LAUNCH_SECURITY_SEV,
2682     VIR_DOMAIN_LAUNCH_SECURITY_PV,
2683 
2684     VIR_DOMAIN_LAUNCH_SECURITY_LAST,
2685 } virDomainLaunchSecurity;
2686 
2687 
2688 struct _virDomainSEVDef {
2689     char *dh_cert;
2690     char *session;
2691     unsigned int policy;
2692     bool haveCbitpos;
2693     unsigned int cbitpos;
2694     bool haveReducedPhysBits;
2695     unsigned int reduced_phys_bits;
2696 };
2697 
2698 struct _virDomainSecDef {
2699     virDomainLaunchSecurity sectype;
2700     union {
2701         virDomainSEVDef sev;
2702     } data;
2703 };
2704 
2705 void virDomainSecDefFree(virDomainSecDef *def);
2706 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainSecDef, virDomainSecDefFree);
2707 
2708 typedef enum {
2709     VIR_DOMAIN_IOMMU_MODEL_INTEL,
2710     VIR_DOMAIN_IOMMU_MODEL_SMMUV3,
2711 
2712     VIR_DOMAIN_IOMMU_MODEL_LAST
2713 } virDomainIOMMUModel;
2714 
2715 struct _virDomainIOMMUDef {
2716     virDomainIOMMUModel model;
2717     virTristateSwitch intremap;
2718     virTristateSwitch caching_mode;
2719     virTristateSwitch eim;
2720     virTristateSwitch iotlb;
2721     unsigned int aw_bits;
2722 };
2723 
2724 typedef enum {
2725     VIR_DOMAIN_VSOCK_MODEL_DEFAULT,
2726     VIR_DOMAIN_VSOCK_MODEL_VIRTIO,
2727     VIR_DOMAIN_VSOCK_MODEL_VIRTIO_TRANSITIONAL,
2728     VIR_DOMAIN_VSOCK_MODEL_VIRTIO_NON_TRANSITIONAL,
2729 
2730     VIR_DOMAIN_VSOCK_MODEL_LAST
2731 } virDomainVsockModel;
2732 
2733 struct _virDomainVsockDef {
2734     virObject *privateData;
2735 
2736     virDomainVsockModel model;
2737     unsigned int guest_cid;
2738     virTristateBool auto_cid;
2739 
2740     virDomainDeviceInfo info;
2741     virDomainVirtioOptions *virtio;
2742 };
2743 
2744 struct _virDomainVirtioOptions {
2745     virTristateSwitch iommu;
2746     virTristateSwitch ats;
2747     virTristateSwitch packed;
2748     virTristateSwitch page_per_vq;
2749 };
2750 
2751 
2752 #define SCSI_SUPER_WIDE_BUS_MAX_CONT_UNIT 64
2753 #define SCSI_WIDE_BUS_MAX_CONT_UNIT 16
2754 #define SCSI_NARROW_BUS_MAX_CONT_UNIT 7
2755 
2756 
2757 /*
2758  * Guest VM main configuration
2759  *
2760  * NB: if adding to this struct, virDomainDefCheckABIStability
2761  * may well need an update
2762  */
2763 struct _virDomainDef {
2764     int virtType; /* enum virDomainVirtType */
2765     int id;
2766     unsigned char uuid[VIR_UUID_BUFLEN];
2767 
2768     unsigned char genid[VIR_UUID_BUFLEN];
2769     bool genidRequested;
2770     bool genidGenerated;
2771 
2772     char *name;
2773     char *title;
2774     char *description;
2775 
2776     virDomainBlkiotune blkio;
2777     virDomainMemtune mem;
2778 
2779     virDomainVcpuDef **vcpus;
2780     size_t maxvcpus;
2781     /* set if the vcpu definition was specified individually */
2782     bool individualvcpus;
2783     virDomainCpuPlacementMode placement_mode;
2784     virBitmap *cpumask;
2785 
2786     size_t niothreadids;
2787     virDomainIOThreadIDDef **iothreadids;
2788 
2789     virDomainCputune cputune;
2790 
2791     virDomainResctrlDef **resctrls;
2792     size_t nresctrls;
2793 
2794     virDomainNuma *numa;
2795     virDomainResourceDef *resource;
2796     virDomainIdMapDef idmap;
2797 
2798     /* These 3 are based on virDomainLifeCycleAction enum flags */
2799     int onReboot;
2800     int onPoweroff;
2801     int onCrash;
2802 
2803     int onLockFailure; /* enum virDomainLockFailureAction */
2804 
2805     virDomainPowerManagement pm;
2806 
2807     virDomainPerfDef perf;
2808 
2809     virDomainOSDef os;
2810     char *emulator;
2811     /* Most {caps_,hyperv_,kvm_,}feature options utilize a virTristateSwitch
2812      * to handle support. A few assign specific data values to the option.
2813      * See virDomainDefFeaturesCheckABIStability() for details. */
2814     int features[VIR_DOMAIN_FEATURE_LAST];
2815     int caps_features[VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST];
2816     int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
2817     int kvm_features[VIR_DOMAIN_KVM_LAST];
2818     int msrs_features[VIR_DOMAIN_MSRS_LAST];
2819     int xen_features[VIR_DOMAIN_XEN_LAST];
2820     virDomainXenPassthroughMode xen_passthrough_mode;
2821     unsigned int hyperv_spinlocks;
2822     virTristateSwitch hyperv_stimer_direct;
2823     virGICVersion gic_version;
2824     virDomainHPTResizing hpt_resizing;
2825     unsigned long long hpt_maxpagesize; /* Stored in KiB */
2826     char *hyperv_vendor_id;
2827     virTristateSwitch apic_eoi;
2828 
2829     bool tseg_specified;
2830     unsigned long long tseg_size;
2831 
2832     virDomainClockDef clock;
2833 
2834     size_t ngraphics;
2835     virDomainGraphicsDef **graphics;
2836 
2837     size_t ndisks;
2838     virDomainDiskDef **disks;
2839 
2840     size_t ncontrollers;
2841     virDomainControllerDef **controllers;
2842 
2843     size_t nfss;
2844     virDomainFSDef **fss;
2845 
2846     size_t nnets;
2847     virDomainNetDef **nets;
2848 
2849     size_t ninputs;
2850     virDomainInputDef **inputs;
2851 
2852     size_t nsounds;
2853     virDomainSoundDef **sounds;
2854 
2855     size_t naudios;
2856     virDomainAudioDef **audios;
2857 
2858     size_t nvideos;
2859     virDomainVideoDef **videos;
2860 
2861     size_t nhostdevs;
2862     virDomainHostdevDef **hostdevs;
2863 
2864     size_t nredirdevs;
2865     virDomainRedirdevDef **redirdevs;
2866 
2867     size_t nsmartcards;
2868     virDomainSmartcardDef **smartcards;
2869 
2870     size_t nserials;
2871     virDomainChrDef **serials;
2872 
2873     size_t nparallels;
2874     virDomainChrDef **parallels;
2875 
2876     size_t nchannels;
2877     virDomainChrDef **channels;
2878 
2879     size_t nconsoles;
2880     virDomainChrDef **consoles;
2881 
2882     size_t nleases;
2883     virDomainLeaseDef **leases;
2884 
2885     size_t nhubs;
2886     virDomainHubDef **hubs;
2887 
2888     size_t nseclabels;
2889     virSecurityLabelDef **seclabels;
2890 
2891     size_t nrngs;
2892     virDomainRNGDef **rngs;
2893 
2894     size_t nshmems;
2895     virDomainShmemDef **shmems;
2896 
2897     size_t nmems;
2898     virDomainMemoryDef **mems;
2899 
2900     size_t npanics;
2901     virDomainPanicDef **panics;
2902 
2903     size_t nsysinfo;
2904     virSysinfoDef **sysinfo;
2905 
2906     /* At maximum 2 TPMs on the domain if a TPM Proxy is present. */
2907     size_t ntpms;
2908     virDomainTPMDef **tpms;
2909 
2910     /* Only 1 */
2911     virDomainWatchdogDef *watchdog;
2912     virDomainMemballoonDef *memballoon;
2913     virDomainNVRAMDef *nvram;
2914     virCPUDef *cpu;
2915     virDomainRedirFilterDef *redirfilter;
2916     virDomainIOMMUDef *iommu;
2917     virDomainVsockDef *vsock;
2918 
2919     void *namespaceData;
2920     virXMLNamespace ns;
2921 
2922     virDomainKeyWrapDef *keywrap;
2923 
2924     /* launch security e.g. SEV */
2925     virDomainSecDef *sec;
2926 
2927     /* Application-specific custom metadata */
2928     xmlNodePtr metadata;
2929 
2930     /* internal fields */
2931     bool postParseFailed; /* set to true if one of the custom post parse
2932                              callbacks failed for a non-critical reason
2933                              (was not able to fill in some data) and thus
2934                              should be re-run before starting */
2935 
2936     unsigned int scsiBusMaxUnit;
2937 };
2938 
2939 
2940 unsigned long long virDomainDefGetMemoryInitial(const virDomainDef *def);
2941 void virDomainDefSetMemoryTotal(virDomainDef *def, unsigned long long size);
2942 unsigned long long virDomainDefGetMemoryTotal(const virDomainDef *def);
2943 bool virDomainDefHasMemoryHotplug(const virDomainDef *def);
2944 
2945 typedef enum {
2946     VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_AES,
2947     VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_DEA,
2948 
2949     VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_LAST
2950 } virDomainKeyWrapCipherName;
2951 
2952 typedef enum {
2953     VIR_DOMAIN_TAINT_CUSTOM_ARGV,      /* Custom ARGV passthrough from XML */
2954     VIR_DOMAIN_TAINT_CUSTOM_MONITOR,   /* Custom monitor commands issued */
2955     VIR_DOMAIN_TAINT_HIGH_PRIVILEGES,  /* Running with undesirably high privileges */
2956     VIR_DOMAIN_TAINT_SHELL_SCRIPTS,    /* Network configuration using opaque shell scripts */
2957     VIR_DOMAIN_TAINT_DISK_PROBING,     /* Relying on potentially unsafe disk format probing */
2958     VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH,  /* Externally launched guest domain */
2959     VIR_DOMAIN_TAINT_HOST_CPU,         /* Host CPU passthrough in use after migration */
2960     VIR_DOMAIN_TAINT_HOOK,             /* Domain (possibly) changed via hook script */
2961     VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */
2962     VIR_DOMAIN_TAINT_CUSTOM_DTB,       /* Custom device tree blob was specified */
2963     VIR_DOMAIN_TAINT_CUSTOM_GA_COMMAND, /* Custom guest agent command */
2964     VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, /* custom hypervisor feature control */
2965     VIR_DOMAIN_TAINT_DEPRECATED_CONFIG,  /* Configuration that is marked deprecated */
2966 
2967     VIR_DOMAIN_TAINT_LAST
2968 } virDomainTaintFlags;
2969 
2970 typedef enum {
2971     DOMAIN_DEVICE_ITERATE_ALL_CONSOLES = 1 << 0,
2972     DOMAIN_DEVICE_ITERATE_MISSING_INFO = 1 << 1,
2973 } virDomainDeviceIterateFlags;
2974 
2975 /* Guest VM runtime state */
2976 typedef struct _virDomainStateReason virDomainStateReason;
2977 struct _virDomainStateReason {
2978     int state;
2979     int reason;
2980 };
2981 
2982 struct _virDomainObj {
2983     virObjectLockable parent;
2984     virCond cond;
2985 
2986     pid_t pid;
2987     virDomainStateReason state;
2988 
2989     unsigned int autostart : 1;
2990     unsigned int persistent : 1;
2991     unsigned int updated : 1;
2992     unsigned int removing : 1;
2993 
2994     virDomainDef *def; /* The current definition */
2995     virDomainDef *newDef; /* New definition to activate at shutdown */
2996 
2997     virDomainSnapshotObjList *snapshots;
2998 
2999     bool hasManagedSave;
3000 
3001     virDomainCheckpointObjList *checkpoints;
3002 
3003     void *privateData;
3004     void (*privateDataFreeFunc)(void *);
3005 
3006     int taint;
3007     size_t ndeprecations;
3008     char **deprecations;
3009 
3010     unsigned long long originalMemlock; /* Original RLIMIT_MEMLOCK, zero if no
3011                                          * restore will be required later */
3012 };
3013 
3014 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainObj, virObjectUnref);
3015 
3016 
3017 typedef bool (*virDomainObjListACLFilter)(virConnectPtr conn,
3018                                           virDomainDef *def);
3019 
3020 
3021 /* NB: Any new flag to this list be considered to be set in
3022  * virt-aa-helper code if the flag prevents parsing. */
3023 typedef enum {
3024     VIR_DOMAIN_DEF_FEATURE_WIDE_SCSI = (1 << 0),
3025     VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG = (1 << 1),
3026     VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN = (1 << 2),
3027     VIR_DOMAIN_DEF_FEATURE_NAME_SLASH = (1 << 3),
3028     VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS = (1 << 4),
3029     VIR_DOMAIN_DEF_FEATURE_USER_ALIAS = (1 << 5),
3030     VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER = (1 << 6),
3031     VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT = (1 << 7),
3032     VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING = (1 << 8),
3033 } virDomainDefFeatures;
3034 
3035 
3036 /* Called after everything else has been parsed, for adjusting basics.
3037  * This has similar semantics to virDomainDefPostParseCallback, but no
3038  * parseOpaque is used. This callback is run prior to
3039  * virDomainDefPostParseCallback. */
3040 typedef int (*virDomainDefPostParseBasicCallback)(virDomainDef *def,
3041                                                   void *opaque);
3042 
3043 /* Called once after everything else has been parsed, for adjusting
3044  * overall domain defaults.
3045  * @parseOpaque is opaque data passed by virDomainDefParse* caller,
3046  * @opaque is opaque data set by driver (usually pointer to driver
3047  * private data). Non-fatal failures should be reported by returning 1. In
3048  * cases when that is allowed, such failure is translated to a success return
3049  * value and the failure is noted in def->postParseFailed. Drivers should then
3050  * re-run the post parse callback when attempting to use such definition. */
3051 typedef int (*virDomainDefPostParseCallback)(virDomainDef *def,
3052                                              unsigned int parseFlags,
3053                                              void *opaque,
3054                                              void *parseOpaque);
3055 /* Called once per device, for adjusting per-device settings while
3056  * leaving the overall domain otherwise unchanged.
3057  * @parseOpaque is opaque data passed by virDomainDefParse* caller,
3058  * @opaque is opaque data set by driver (usually pointer to driver
3059  * private data). */
3060 typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDef *dev,
3061                                                    const virDomainDef *def,
3062                                                    unsigned int parseFlags,
3063                                                    void *opaque,
3064                                                    void *parseOpaque);
3065 /* Drive callback for assigning device addresses, called at the end
3066  * of parsing, after all defaults and implicit devices have been added.
3067  * @parseOpaque is opaque data passed by virDomainDefParse* caller,
3068  * @opaque is opaque data set by driver (usually pointer to driver
3069  * private data). */
3070 typedef int (*virDomainDefAssignAddressesCallback)(virDomainDef *def,
3071                                                    unsigned int parseFlags,
3072                                                    void *opaque,
3073                                                    void *parseOpaque);
3074 
3075 typedef int (*virDomainDefPostParseDataAlloc)(const virDomainDef *def,
3076                                               unsigned int parseFlags,
3077                                               void *opaque,
3078                                               void **parseOpaque);
3079 typedef void (*virDomainDefPostParseDataFree)(void *parseOpaque);
3080 
3081 /* Called in appropriate places where the domain conf parser can return failure
3082  * for configurations that were previously accepted. This shall not modify the
3083  * config. */
3084 typedef int (*virDomainDefValidateCallback)(const virDomainDef *def,
3085                                             void *opaque,
3086                                             void *parseOpaque);
3087 
3088 /* Called once per device, for adjusting per-device settings while
3089  * leaving the overall domain otherwise unchanged.  */
3090 typedef int (*virDomainDeviceDefValidateCallback)(const virDomainDeviceDef *dev,
3091                                                   const virDomainDef *def,
3092                                                   void *opaque,
3093                                                   void *parseOpaque);
3094 
3095 struct _virDomainDefParserConfig {
3096     /* driver domain definition callbacks */
3097     virDomainDefPostParseBasicCallback domainPostParseBasicCallback;
3098     virDomainDefPostParseDataAlloc domainPostParseDataAlloc;
3099     virDomainDefPostParseCallback domainPostParseCallback;
3100     virDomainDeviceDefPostParseCallback devicesPostParseCallback;
3101     virDomainDefAssignAddressesCallback assignAddressesCallback;
3102     virDomainDefPostParseDataFree domainPostParseDataFree;
3103 
3104     /* validation callbacks */
3105     virDomainDefValidateCallback domainValidateCallback;
3106     virDomainDeviceDefValidateCallback deviceValidateCallback;
3107 
3108     /* private data for the callbacks */
3109     void *priv;
3110     virFreeCallback privFree;
3111 
3112     /* data */
3113     unsigned int features; /* virDomainDefFeatures */
3114     unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
3115     virArch defArch;
3116     const char *netPrefix;
3117     const char *defSecModel;
3118 };
3119 
3120 typedef void *(*virDomainXMLPrivateDataAllocFunc)(void *);
3121 typedef void (*virDomainXMLPrivateDataFreeFunc)(void *);
3122 typedef virObject *(*virDomainXMLPrivateDataNewFunc)(void);
3123 typedef int (*virDomainXMLPrivateDataFormatFunc)(virBuffer *,
3124                                                  virDomainObj *);
3125 typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr,
3126                                                 virDomainObj *,
3127                                                 virDomainDefParserConfig *);
3128 
3129 typedef void *(*virDomainXMLPrivateDataGetParseOpaqueFunc)(virDomainObj *vm);
3130 
3131 typedef int (*virDomainXMLPrivateDataDiskParseFunc)(xmlXPathContextPtr ctxt,
3132                                                     virDomainDiskDef *disk);
3133 typedef int (*virDomainXMLPrivateDataDiskFormatFunc)(virDomainDiskDef *disk,
3134                                                      virBuffer *buf);
3135 
3136 typedef int (*virDomainXMLPrivateDataStorageSourceParseFunc)(xmlXPathContextPtr ctxt,
3137                                                              virStorageSource *src);
3138 typedef int (*virDomainXMLPrivateDataStorageSourceFormatFunc)(virStorageSource *src,
3139                                                               virBuffer *buf);
3140 
3141 
3142 struct _virDomainXMLPrivateDataCallbacks {
3143     virDomainXMLPrivateDataAllocFunc  alloc;
3144     virDomainXMLPrivateDataFreeFunc   free;
3145     /* note that private data for devices are not copied when using
3146      * virDomainDefCopy and similar functions */
3147     virDomainXMLPrivateDataNewFunc    diskNew;
3148     virDomainXMLPrivateDataDiskParseFunc diskParse;
3149     virDomainXMLPrivateDataDiskFormatFunc diskFormat;
3150     virDomainXMLPrivateDataNewFunc    vcpuNew;
3151     virDomainXMLPrivateDataNewFunc    chrSourceNew;
3152     virDomainXMLPrivateDataNewFunc    vsockNew;
3153     virDomainXMLPrivateDataNewFunc    graphicsNew;
3154     virDomainXMLPrivateDataNewFunc    networkNew;
3155     virDomainXMLPrivateDataNewFunc    videoNew;
3156     virDomainXMLPrivateDataNewFunc    fsNew;
3157     virDomainXMLPrivateDataFormatFunc format;
3158     virDomainXMLPrivateDataParseFunc  parse;
3159     /* following function shall return a pointer which will be used as the
3160      * 'parseOpaque' argument for virDomainDefPostParse */
3161     virDomainXMLPrivateDataGetParseOpaqueFunc getParseOpaque;
3162     virDomainXMLPrivateDataStorageSourceParseFunc storageParse;
3163     virDomainXMLPrivateDataStorageSourceFormatFunc storageFormat;
3164 };
3165 
3166 typedef bool (*virDomainABIStabilityDomain)(const virDomainDef *src,
3167                                             const virDomainDef *dst);
3168 
3169 struct _virDomainABIStability {
3170     virDomainABIStabilityDomain domain;
3171 };
3172 
3173 virDomainXMLOption *virDomainXMLOptionNew(virDomainDefParserConfig *config,
3174                                           virDomainXMLPrivateDataCallbacks *priv,
3175                                           virXMLNamespace *xmlns,
3176                                           virDomainABIStability *abi,
3177                                           virSaveCookieCallbacks *saveCookie);
3178 
3179 virSaveCookieCallbacks *
3180 virDomainXMLOptionGetSaveCookie(virDomainXMLOption *xmlopt);
3181 
3182 typedef int (*virDomainMomentPostParseCallback)(virDomainMomentDef *def);
3183 
3184 void virDomainXMLOptionSetMomentPostParse(virDomainXMLOption *xmlopt,
3185                                           virDomainMomentPostParseCallback cb);
3186 int virDomainXMLOptionRunMomentPostParse(virDomainXMLOption *xmlopt,
3187                                          virDomainMomentDef *def);
3188 
3189 void virDomainNetGenerateMAC(virDomainXMLOption *xmlopt, virMacAddr *mac);
3190 
3191 virXMLNamespace *
3192 virDomainXMLOptionGetNamespace(virDomainXMLOption *xmlopt)
3193     ATTRIBUTE_NONNULL(1);
3194 
3195 /* This structure holds various callbacks and data needed
3196  * while parsing and creating domain XMLs */
3197 struct _virDomainXMLOption {
3198     virObject parent;
3199 
3200     /* XML parser callbacks and defaults */
3201     virDomainDefParserConfig config;
3202 
3203     /* domain private data management callbacks */
3204     virDomainXMLPrivateDataCallbacks privateData;
3205 
3206     /* XML namespace callbacks */
3207     virXMLNamespace ns;
3208 
3209     /* ABI stability callbacks */
3210     virDomainABIStability abi;
3211 
3212     /* Private data for save image stored in snapshot XML */
3213     virSaveCookieCallbacks saveCookie;
3214 
3215     /* Snapshot postparse callbacks */
3216     virDomainMomentPostParseCallback momentPostParse;
3217 };
3218 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainXMLOption, virObjectUnref);
3219 
3220 struct virDomainDefPostParseDeviceIteratorData {
3221     virDomainXMLOption *xmlopt;
3222     void *parseOpaque;
3223     unsigned int parseFlags;
3224 };
3225 
3226 bool
3227 virDomainSCSIDriveAddressIsUsed(const virDomainDef *def,
3228                                 const virDomainDeviceDriveAddress *addr);
3229 
3230 int virDomainDefPostParse(virDomainDef *def,
3231                           unsigned int parseFlags,
3232                           virDomainXMLOption *xmlopt,
3233                           void *parseOpaque);
3234 bool virDomainDefHasUSB(const virDomainDef *def);
3235 
3236 bool virDomainDeviceAliasIsUserAlias(const char *aliasStr);
3237 
3238 static inline bool
virDomainObjIsActive(virDomainObj * dom)3239 virDomainObjIsActive(virDomainObj *dom)
3240 {
3241     return dom->def->id != -1;
3242 }
3243 
3244 int virDomainObjCheckActive(virDomainObj *dom);
3245 
3246 int virDomainDefSetVcpusMax(virDomainDef *def,
3247                             unsigned int vcpus,
3248                             virDomainXMLOption *xmlopt);
3249 bool virDomainDefHasVcpusOffline(const virDomainDef *def);
3250 unsigned int virDomainDefGetVcpusMax(const virDomainDef *def);
3251 int virDomainDefSetVcpus(virDomainDef *def, unsigned int vcpus);
3252 unsigned int virDomainDefGetVcpus(const virDomainDef *def);
3253 virBitmap *virDomainDefGetOnlineVcpumap(const virDomainDef *def);
3254 virDomainVcpuDef *virDomainDefGetVcpu(virDomainDef *def, unsigned int vcpu)
3255     G_GNUC_WARN_UNUSED_RESULT;
3256 void virDomainDefVcpuOrderClear(virDomainDef *def);
3257 int  virDomainDefGetVcpusTopology(const virDomainDef *def,
3258                                   unsigned int *maxvcpus);
3259 
3260 virDomainObj *virDomainObjNew(virDomainXMLOption *caps)
3261     ATTRIBUTE_NONNULL(1);
3262 
3263 void virDomainObjEndAPI(virDomainObj **vm);
3264 
3265 bool virDomainObjTaint(virDomainObj *obj,
3266                        virDomainTaintFlags taint);
3267 void virDomainObjDeprecation(virDomainObj *obj,
3268                              const char *msg);
3269 
3270 void virDomainObjBroadcast(virDomainObj *vm);
3271 int virDomainObjWait(virDomainObj *vm);
3272 int virDomainObjWaitUntil(virDomainObj *vm,
3273                           unsigned long long whenms);
3274 
3275 void virDomainPanicDefFree(virDomainPanicDef *panic);
3276 void virDomainResourceDefFree(virDomainResourceDef *resource);
3277 void virDomainGraphicsDefFree(virDomainGraphicsDef *def);
3278 const char *virDomainInputDefGetPath(virDomainInputDef *input);
3279 void virDomainInputDefFree(virDomainInputDef *def);
3280 virDomainDiskDef *virDomainDiskDefNew(virDomainXMLOption *xmlopt);
3281 void virDomainDiskDefFree(virDomainDiskDef *def);
3282 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainDiskDef, virDomainDiskDefFree);
3283 void virDomainLeaseDefFree(virDomainLeaseDef *def);
3284 int virDomainDiskGetType(virDomainDiskDef *def);
3285 void virDomainDiskSetType(virDomainDiskDef *def, int type);
3286 const char *virDomainDiskGetSource(virDomainDiskDef const *def);
3287 void virDomainDiskSetSource(virDomainDiskDef *def, const char *src);
3288 void virDomainDiskEmptySource(virDomainDiskDef *def);
3289 const char *virDomainDiskGetDriver(const virDomainDiskDef *def);
3290 void virDomainDiskSetDriver(virDomainDiskDef *def, const char *name);
3291 int virDomainDiskGetFormat(virDomainDiskDef *def);
3292 void virDomainDiskSetFormat(virDomainDiskDef *def, int format);
3293 virDomainControllerDef *
3294 virDomainDeviceFindSCSIController(const virDomainDef *def,
3295                                   const virDomainDeviceDriveAddress *addr);
3296 virDomainDiskDef *virDomainDiskFindByBusAndDst(virDomainDef *def,
3297                                                int bus,
3298                                                char *dst);
3299 
3300 virDomainControllerDef *virDomainControllerDefNew(virDomainControllerType type);
3301 void virDomainControllerDefFree(virDomainControllerDef *def);
3302 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainControllerDef, virDomainControllerDefFree);
3303 bool virDomainControllerIsPSeriesPHB(const virDomainControllerDef *cont);
3304 
3305 virDomainFSDef *virDomainFSDefNew(virDomainXMLOption *xmlopt);
3306 void virDomainFSDefFree(virDomainFSDef *def);
3307 void virDomainActualNetDefFree(virDomainActualNetDef *def);
3308 virDomainIOMMUDef *virDomainIOMMUDefNew(void);
3309 void virDomainIOMMUDefFree(virDomainIOMMUDef *iommu);
3310 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainIOMMUDef, virDomainIOMMUDefFree);
3311 virDomainVsockDef *virDomainVsockDefNew(virDomainXMLOption *xmlopt);
3312 void virDomainVsockDefFree(virDomainVsockDef *vsock);
3313 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVsockDef, virDomainVsockDefFree);
3314 void virDomainNetTeamingInfoFree(virDomainNetTeamingInfo *teaming);
3315 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetTeamingInfo, virDomainNetTeamingInfoFree);
3316 void virDomainNetDefFree(virDomainNetDef *def);
3317 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetDef, virDomainNetDefFree);
3318 void virDomainSmartcardDefFree(virDomainSmartcardDef *def);
3319 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainSmartcardDef, virDomainSmartcardDefFree);
3320 void virDomainChrDefFree(virDomainChrDef *def);
3321 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainChrDef, virDomainChrDefFree);
3322 int virDomainChrSourceDefCopy(virDomainChrSourceDef *dest,
3323                               virDomainChrSourceDef *src);
3324 void virDomainSoundCodecDefFree(virDomainSoundCodecDef *def);
3325 ssize_t virDomainSoundDefFind(const virDomainDef *def,
3326                               const virDomainSoundDef *sound);
3327 void virDomainSoundDefFree(virDomainSoundDef *def);
3328 virDomainSoundDef *virDomainSoundDefRemove(virDomainDef *def, size_t idx);
3329 void virDomainAudioDefFree(virDomainAudioDef *def);
3330 void virDomainMemballoonDefFree(virDomainMemballoonDef *def);
3331 void virDomainNVRAMDefFree(virDomainNVRAMDef *def);
3332 void virDomainWatchdogDefFree(virDomainWatchdogDef *def);
3333 virDomainVideoDef *virDomainVideoDefNew(virDomainXMLOption *xmlopt);
3334 void virDomainVideoDefFree(virDomainVideoDef *def);
3335 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVideoDef, virDomainVideoDefFree);
3336 void virDomainVideoDefClear(virDomainVideoDef *def);
3337 virDomainHostdevDef *virDomainHostdevDefNew(void);
3338 void virDomainHostdevDefClear(virDomainHostdevDef *def);
3339 void virDomainHostdevDefFree(virDomainHostdevDef *def);
3340 void virDomainHubDefFree(virDomainHubDef *def);
3341 void virDomainRedirdevDefFree(virDomainRedirdevDef *def);
3342 void virDomainRedirFilterDefFree(virDomainRedirFilterDef *def);
3343 void virDomainShmemDefFree(virDomainShmemDef *def);
3344 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainShmemDef, virDomainShmemDefFree);
3345 void virDomainDeviceDefFree(virDomainDeviceDef *def);
3346 
3347 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainDeviceDef, virDomainDeviceDefFree);
3348 virDomainDeviceDef *virDomainDeviceDefCopy(virDomainDeviceDef *src,
3349                                            const virDomainDef *def,
3350                                            virDomainXMLOption *xmlopt,
3351                                            void *parseOpaque);
3352 virDomainDeviceInfo *virDomainDeviceGetInfo(const virDomainDeviceDef *device);
3353 void virDomainDeviceSetData(virDomainDeviceDef *device,
3354                             void *devicedata);
3355 void virDomainTPMDefFree(virDomainTPMDef *def);
3356 
3357 typedef int (*virDomainDeviceInfoCallback)(virDomainDef *def,
3358                                            virDomainDeviceDef *dev,
3359                                            virDomainDeviceInfo *info,
3360                                            void *opaque);
3361 
3362 int virDomainDeviceInfoIterate(virDomainDef *def,
3363                                virDomainDeviceInfoCallback cb,
3364                                void *opaque);
3365 
3366 bool virDomainDefHasDeviceAddress(virDomainDef *def,
3367                                   virDomainDeviceInfo *info)
3368     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3369 
3370 void virDomainDefFree(virDomainDef *vm);
3371 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainDef, virDomainDefFree);
3372 
3373 virDomainChrSourceDef *
3374 virDomainChrSourceDefNew(virDomainXMLOption *xmlopt);
3375 
3376 virDomainChrDef *virDomainChrDefNew(virDomainXMLOption *xmlopt);
3377 
3378 int virDomainDeviceInfoIterateFlags(virDomainDef *def,
3379                                     virDomainDeviceInfoCallback cb,
3380                                     unsigned int iteratorFlags,
3381                                     void *opaque);
3382 
3383 virDomainGraphicsDef *
3384 virDomainGraphicsDefNew(virDomainXMLOption *xmlopt);
3385 
3386 virDomainNetDef *
3387 virDomainNetDefNew(virDomainXMLOption *xmlopt);
3388 
3389 virDomainDef *virDomainDefNew(virDomainXMLOption *xmlopt);
3390 
3391 void virDomainObjAssignDef(virDomainObj *domain,
3392                            virDomainDef **def,
3393                            bool live,
3394                            virDomainDef **oldDef);
3395 int virDomainObjSetDefTransient(virDomainXMLOption *xmlopt,
3396                                 virDomainObj *domain,
3397                                 void *parseOpaque);
3398 void virDomainObjRemoveTransientDef(virDomainObj *domain);
3399 virDomainDef *
3400 virDomainObjGetPersistentDef(virDomainXMLOption *xmlopt,
3401                              virDomainObj *domain,
3402                              void *parseOpaque);
3403 
3404 int virDomainObjUpdateModificationImpact(virDomainObj *vm,
3405                                          unsigned int *flags);
3406 
3407 int virDomainObjGetDefs(virDomainObj *vm,
3408                         unsigned int flags,
3409                         virDomainDef **liveDef,
3410                         virDomainDef **persDef);
3411 virDomainDef *virDomainObjGetOneDefState(virDomainObj *vm,
3412                                          unsigned int flags,
3413                                          bool *state);
3414 virDomainDef *virDomainObjGetOneDef(virDomainObj *vm, unsigned int flags);
3415 
3416 virDomainDef *virDomainDefCopy(virDomainDef *src,
3417                                virDomainXMLOption *xmlopt,
3418                                void *parseOpaque,
3419                                bool migratable);
3420 virDomainDef *virDomainObjCopyPersistentDef(virDomainObj *dom,
3421                                             virDomainXMLOption *xmlopt,
3422                                             void *parseOpaque);
3423 
3424 typedef enum {
3425     /* parse internal domain status information */
3426     VIR_DOMAIN_DEF_PARSE_STATUS          = 1 << 0,
3427     /* Parse only parts of the XML that would be present in an inactive libvirt
3428      * XML. Note that the flag does not imply that ABI incompatible
3429      * transformations can be used, since it's used to strip runtime info when
3430      * restoring save images/migration. */
3431     VIR_DOMAIN_DEF_PARSE_INACTIVE        = 1 << 1,
3432     /* parse <actual> element */
3433     VIR_DOMAIN_DEF_PARSE_ACTUAL_NET      = 1 << 2,
3434     /* parse original states of host PCI device */
3435     VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES = 1 << 3,
3436     /* internal flag passed to device info sub-parser to allow using <rom> */
3437     VIR_DOMAIN_DEF_PARSE_ALLOW_ROM       = 1 << 4,
3438     /* internal flag passed to device info sub-parser to allow specifying boot order */
3439     VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT      = 1 << 5,
3440     /* perform RNG schema validation on the passed XML document */
3441     VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA = 1 << 6,
3442     /* allow updates in post parse callback that would break ABI otherwise */
3443     VIR_DOMAIN_DEF_PARSE_ABI_UPDATE = 1 << 7,
3444     /* skip definition validation checks meant to be executed on define time only */
3445     VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE = 1 << 8,
3446     /* skip parsing of security labels */
3447     VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL        = 1 << 9,
3448     /* Allows updates in post parse callback for incoming persistent migration
3449      * that would break ABI otherwise.  This should be used only if it's safe
3450      * to do such change. */
3451     VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION = 1 << 10,
3452     /* Allows to ignore certain failures in the post parse callbacks, which
3453      * may happen due to missing packages and can be fixed by re-running the
3454      * post parse callbacks before starting. Failure of the post parse callback
3455      * is recorded as def->postParseFail */
3456     VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL = 1 << 11,
3457 } virDomainDefParseFlags;
3458 
3459 typedef enum {
3460     VIR_DOMAIN_DEF_FORMAT_SECURE          = 1 << 0,
3461     VIR_DOMAIN_DEF_FORMAT_INACTIVE        = 1 << 1,
3462     VIR_DOMAIN_DEF_FORMAT_MIGRATABLE      = 1 << 2,
3463     /* format internal domain status information */
3464     VIR_DOMAIN_DEF_FORMAT_STATUS          = 1 << 3,
3465     /* format <actual> element */
3466     VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET      = 1 << 4,
3467     /* format original states of host PCI device */
3468     VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES = 1 << 5,
3469     VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM       = 1 << 6,
3470     VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT      = 1 << 7,
3471     VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST    = 1 << 8,
3472 } virDomainDefFormatFlags;
3473 
3474 /* Use these flags to skip specific domain ABI consistency checks done
3475  * in virDomainDefCheckABIStabilityFlags.
3476  */
3477 typedef enum {
3478     /* Set when domain lock must be released and there exists the possibility
3479      * that some external action could alter the value, such as cur_balloon. */
3480     VIR_DOMAIN_DEF_ABI_CHECK_SKIP_VOLATILE = 1 << 0,
3481 } virDomainDefABICheckFlags;
3482 
3483 virDomainDeviceDef *virDomainDeviceDefParse(const char *xmlStr,
3484                                             const virDomainDef *def,
3485                                             virDomainXMLOption *xmlopt,
3486                                             void *parseOpaque,
3487                                             unsigned int flags);
3488 virDomainDiskDef *virDomainDiskDefParse(const char *xmlStr,
3489                                         virDomainXMLOption *xmlopt,
3490                                         unsigned int flags);
3491 virStorageSource *virDomainDiskDefParseSource(const char *xmlStr,
3492                                               virDomainXMLOption *xmlopt,
3493                                               unsigned int flags);
3494 virDomainDef *virDomainDefParseString(const char *xmlStr,
3495                                       virDomainXMLOption *xmlopt,
3496                                       void *parseOpaque,
3497                                       unsigned int flags);
3498 virDomainDef *virDomainDefParseFile(const char *filename,
3499                                     virDomainXMLOption *xmlopt,
3500                                     void *parseOpaque,
3501                                     unsigned int flags);
3502 virDomainDef *virDomainDefParseNode(xmlDocPtr doc,
3503                                     xmlNodePtr root,
3504                                     virDomainXMLOption *xmlopt,
3505                                     void *parseOpaque,
3506                                     unsigned int flags);
3507 virDomainObj *virDomainObjParseNode(xmlDocPtr xml,
3508                                     xmlNodePtr root,
3509                                     virDomainXMLOption *xmlopt,
3510                                     unsigned int flags);
3511 virDomainObj *virDomainObjParseFile(const char *filename,
3512                                     virDomainXMLOption *xmlopt,
3513                                     unsigned int flags);
3514 
3515 bool virDomainDefCheckABIStability(virDomainDef *src,
3516                                    virDomainDef *dst,
3517                                    virDomainXMLOption *xmlopt);
3518 
3519 bool virDomainDefCheckABIStabilityFlags(virDomainDef *src,
3520                                         virDomainDef *dst,
3521                                         virDomainXMLOption *xmlopt,
3522                                         unsigned int flags);
3523 
3524 int virDomainDefAddImplicitDevices(virDomainDef *def,
3525                                    virDomainXMLOption *xmlopt);
3526 
3527 virDomainIOThreadIDDef *virDomainIOThreadIDFind(const virDomainDef *def,
3528                                                 unsigned int iothread_id);
3529 virDomainIOThreadIDDef *virDomainIOThreadIDAdd(virDomainDef *def,
3530                                                unsigned int iothread_id);
3531 void virDomainIOThreadIDDel(virDomainDef *def, unsigned int iothread_id);
3532 
3533 /* When extending this list, remember that libvirt 1.2.12-5.0.0 had a
3534  * bug that silently ignored unknown flags.  A new flag to add
3535  * information is okay as long as clients still work when an older
3536  * server omits the requested output, but a new flag to suppress
3537  * information could result in a security hole when older libvirt
3538  * supplies the sensitive information in spite of the flag. */
3539 #define VIR_DOMAIN_XML_COMMON_FLAGS \
3540     (VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_INACTIVE | \
3541      VIR_DOMAIN_XML_MIGRATABLE)
3542 unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);
3543 
3544 char *virDomainDefFormat(virDomainDef *def,
3545                          virDomainXMLOption *xmlopt,
3546                          unsigned int flags)
3547     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
3548 char *virDomainObjFormat(virDomainObj *obj,
3549                          virDomainXMLOption *xmlopt,
3550                          unsigned int flags)
3551     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
3552 int virDomainDefFormatInternal(virDomainDef *def,
3553                                virDomainXMLOption *xmlopt,
3554                                virBuffer *buf,
3555                                unsigned int flags)
3556     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
3557     ATTRIBUTE_NONNULL(3);
3558 int virDomainDefFormatInternalSetRootName(virDomainDef *def,
3559                                           virDomainXMLOption *xmlopt,
3560                                           virBuffer *buf,
3561                                           const char *rootname,
3562                                           unsigned int flags)
3563     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
3564     ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
3565 
3566 int virDomainDiskSourceFormat(virBuffer *buf,
3567                               virStorageSource *src,
3568                               const char *element,
3569                               int policy,
3570                               bool attrIndex,
3571                               unsigned int flags,
3572                               bool skipAuth,
3573                               bool skipEnc,
3574                               virDomainXMLOption *xmlopt);
3575 
3576 int
3577 virDomainDiskBackingStoreFormat(virBuffer *buf,
3578                                 virStorageSource *src,
3579                                 virDomainXMLOption *xmlopt,
3580                                 unsigned int flags);
3581 
3582 int virDomainNetDefFormat(virBuffer *buf,
3583                           virDomainNetDef *def,
3584                           virDomainXMLOption *xmlopt,
3585                           unsigned int flags);
3586 
3587 typedef enum {
3588     VIR_DOMAIN_DEVICE_ACTION_ATTACH,
3589     VIR_DOMAIN_DEVICE_ACTION_DETACH,
3590     VIR_DOMAIN_DEVICE_ACTION_UPDATE,
3591 } virDomainDeviceAction;
3592 
3593 int virDomainDefCompatibleDevice(virDomainDef *def,
3594                                  virDomainDeviceDef *dev,
3595                                  virDomainDeviceDef *oldDev,
3596                                  virDomainDeviceAction action,
3597                                  bool live);
3598 
3599 void virDomainRNGDefFree(virDomainRNGDef *def);
3600 
3601 int virDomainDiskIndexByAddress(virDomainDef *def,
3602                                 virPCIDeviceAddress *pci_controller,
3603                                 virDomainDeviceCCWAddress *ccw_addr,
3604                                 unsigned int bus, unsigned int target,
3605                                 unsigned int unit);
3606 virDomainDiskDef *virDomainDiskByAddress(virDomainDef *def,
3607                                          virPCIDeviceAddress *pci_controller,
3608                                          virDomainDeviceCCWAddress *ccw_addr,
3609                                          unsigned int bus,
3610                                          unsigned int target,
3611                                          unsigned int unit);
3612 int virDomainDiskIndexByName(virDomainDef *def, const char *name,
3613                              bool allow_ambiguous);
3614 virDomainDiskDef *virDomainDiskByName(virDomainDef *def,
3615                                       const char *name,
3616                                       bool allow_ambiguous);
3617 virDomainDiskDef *
3618 virDomainDiskByTarget(virDomainDef *def,
3619                       const char *dst);
3620 
3621 void virDomainDiskInsert(virDomainDef *def, virDomainDiskDef *disk);
3622 int virDomainStorageNetworkParseHost(xmlNodePtr hostnode,
3623                                      virStorageNetHostDef *host);
3624 int virDomainDiskDefAssignAddress(virDomainXMLOption *xmlopt,
3625                                   virDomainDiskDef *def,
3626                                   const virDomainDef *vmdef);
3627 
3628 virDomainDiskDef *
3629 virDomainDiskRemove(virDomainDef *def, size_t i);
3630 virDomainDiskDef *
3631 virDomainDiskRemoveByName(virDomainDef *def, const char *name);
3632 
3633 int virDomainNetFindIdx(virDomainDef *def, virDomainNetDef *net);
3634 virDomainNetDef *virDomainNetFind(virDomainDef *def, const char *device);
3635 virDomainNetDef *virDomainNetFindByName(virDomainDef *def, const char *ifname);
3636 bool virDomainHasNet(virDomainDef *def, virDomainNetDef *net);
3637 int virDomainNetInsert(virDomainDef *def, virDomainNetDef *net);
3638 int virDomainNetUpdate(virDomainDef *def, size_t netidx, virDomainNetDef *newnet);
3639 int virDomainNetDHCPInterfaces(virDomainDef *def, virDomainInterfacePtr **ifaces);
3640 int virDomainNetARPInterfaces(virDomainDef *def, virDomainInterfacePtr **ifaces);
3641 virDomainNetDef *virDomainNetRemove(virDomainDef *def, size_t i);
3642 virDomainNetDef *virDomainNetRemoveByObj(virDomainDef *def, virDomainNetDef *net);
3643 void virDomainNetRemoveHostdev(virDomainDef *def, virDomainNetDef *net);
3644 
3645 int virDomainHostdevInsert(virDomainDef *def, virDomainHostdevDef *hostdev);
3646 virDomainHostdevDef *
3647 virDomainHostdevRemove(virDomainDef *def, size_t i);
3648 int virDomainHostdevFind(virDomainDef *def, virDomainHostdevDef *match,
3649                          virDomainHostdevDef **found);
3650 int virDomainHostdevMatch(virDomainHostdevDef *a,
3651                           virDomainHostdevDef *b);
3652 
3653 virDomainGraphicsListenDef *
3654 virDomainGraphicsGetListen(virDomainGraphicsDef *def, size_t i);
3655 int virDomainGraphicsListenAppendAddress(virDomainGraphicsDef *def,
3656                                          const char *address)
3657             ATTRIBUTE_NONNULL(1);
3658 int virDomainGraphicsListenAppendSocket(virDomainGraphicsDef *def,
3659                                         const char *socket)
3660             ATTRIBUTE_NONNULL(1);
3661 
3662 virDomainNetType virDomainNetGetActualType(const virDomainNetDef *iface);
3663 const char *virDomainNetGetActualBridgeName(const virDomainNetDef *iface);
3664 int virDomainNetGetActualBridgeMACTableManager(const virDomainNetDef *iface);
3665 const char *virDomainNetGetActualDirectDev(const virDomainNetDef *iface);
3666 int virDomainNetGetActualDirectMode(const virDomainNetDef *iface);
3667 virDomainHostdevDef *virDomainNetGetActualHostdev(virDomainNetDef *iface);
3668 const virNetDevVPortProfile *
3669 virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface);
3670 bool
3671 virDomainNetDefIsOvsport(const virDomainNetDef *net);
3672 const virNetDevBandwidth *
3673 virDomainNetGetActualBandwidth(const virDomainNetDef *iface);
3674 const virNetDevVlan *virDomainNetGetActualVlan(const virDomainNetDef *iface);
3675 bool virDomainNetGetActualTrustGuestRxFilters(const virDomainNetDef *iface);
3676 virTristateBool
3677 virDomainNetGetActualPortOptionsIsolated(const virDomainNetDef *iface);
3678 const char *virDomainNetGetModelString(const virDomainNetDef *net);
3679 int virDomainNetSetModelString(virDomainNetDef *et,
3680                                const char *model);
3681 bool virDomainNetIsVirtioModel(const virDomainNetDef *net);
3682 int virDomainNetAppendIPAddress(virDomainNetDef *def,
3683                                 const char *address,
3684                                 int family,
3685                                 unsigned int prefix);
3686 
3687 void virDomainControllerInsert(virDomainDef *def, virDomainControllerDef *controller);
3688 void virDomainControllerInsertPreAlloced(virDomainDef *def,
3689                                          virDomainControllerDef *controller);
3690 int virDomainControllerFind(const virDomainDef *def, int type, int idx);
3691 int virDomainControllerFindByType(virDomainDef *def, int type);
3692 int virDomainControllerFindByCCWAddress(virDomainDef *def,
3693                                         virDomainDeviceCCWAddress *addr);
3694 int virDomainControllerFindByPCIAddress(virDomainDef *def,
3695                                         virPCIDeviceAddress *addr);
3696 int virDomainControllerFindUnusedIndex(virDomainDef const *def, int type);
3697 virDomainControllerDef *virDomainControllerRemove(virDomainDef *def, size_t i);
3698 const char *virDomainControllerAliasFind(const virDomainDef *def,
3699                                          int type, int idx)
3700     ATTRIBUTE_NONNULL(1);
3701 
3702 int virDomainLeaseIndex(virDomainDef *def,
3703                         virDomainLeaseDef *lease);
3704 void virDomainLeaseInsert(virDomainDef *def, virDomainLeaseDef *lease);
3705 void virDomainLeaseInsertPreAlloc(virDomainDef *def);
3706 void virDomainLeaseInsertPreAlloced(virDomainDef *def,
3707                                     virDomainLeaseDef *lease);
3708 virDomainLeaseDef *
3709 virDomainLeaseRemoveAt(virDomainDef *def, size_t i);
3710 virDomainLeaseDef *
3711 virDomainLeaseRemove(virDomainDef *def,
3712                      virDomainLeaseDef *lease);
3713 
3714 void
3715 virDomainChrGetDomainPtrs(const virDomainDef *vmdef,
3716                           virDomainChrDeviceType type,
3717                           const virDomainChrDef ***arrPtr,
3718                           size_t *cntPtr)
3719     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
3720 virDomainChrDef *
3721 virDomainChrFind(virDomainDef *def,
3722                  virDomainChrDef *target);
3723 bool
3724 virDomainChrEquals(virDomainChrDef *src,
3725                    virDomainChrDef *tgt);
3726 int
3727 virDomainChrPreAlloc(virDomainDef *vmdef,
3728                      virDomainChrDef *chr);
3729 void
3730 virDomainChrInsertPreAlloced(virDomainDef *vmdef,
3731                              virDomainChrDef *chr);
3732 virDomainChrDef *
3733 virDomainChrRemove(virDomainDef *vmdef,
3734                    virDomainChrDef *chr);
3735 
3736 ssize_t virDomainRNGFind(virDomainDef *def, virDomainRNGDef *rng);
3737 virDomainRNGDef *virDomainRNGRemove(virDomainDef *def, size_t idx);
3738 
3739 ssize_t virDomainRedirdevDefFind(virDomainDef *def,
3740                                  virDomainRedirdevDef *redirdev);
3741 virDomainRedirdevDef *virDomainRedirdevDefRemove(virDomainDef *def, size_t idx);
3742 
3743 int virDomainDefSave(virDomainDef *def,
3744                      virDomainXMLOption *xmlopt,
3745                      const char *configDir)
3746     G_GNUC_WARN_UNUSED_RESULT
3747     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
3748     ATTRIBUTE_NONNULL(3);
3749 
3750 int virDomainObjSave(virDomainObj *obj,
3751                      virDomainXMLOption *xmlopt,
3752                      const char *statusDir)
3753     G_GNUC_WARN_UNUSED_RESULT
3754     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
3755     ATTRIBUTE_NONNULL(3);
3756 
3757 typedef void (*virDomainLoadConfigNotify)(virDomainObj *dom,
3758                                           int newDomain,
3759                                           void *opaque);
3760 
3761 int virDomainDeleteConfig(const char *configDir,
3762                           const char *autostartDir,
3763                           virDomainObj *dom);
3764 
3765 char *virDomainConfigFile(const char *dir,
3766                           const char *name);
3767 
3768 int virDiskNameToBusDeviceIndex(virDomainDiskDef *disk,
3769                                 int *busIdx,
3770                                 int *devIdx);
3771 
3772 virDomainFSDef *virDomainGetFilesystemForTarget(virDomainDef *def,
3773                                                   const char *target);
3774 int virDomainFSInsert(virDomainDef *def, virDomainFSDef *fs);
3775 int virDomainFSIndexByName(virDomainDef *def, const char *name);
3776 virDomainFSDef *virDomainFSRemove(virDomainDef *def, size_t i);
3777 ssize_t virDomainFSDefFind(virDomainDef *def,
3778                            virDomainFSDef *fs);
3779 
3780 unsigned int virDomainVideoDefaultRAM(const virDomainDef *def,
3781                                       const virDomainVideoType type);
3782 
3783 typedef int (*virDomainSmartcardDefIterator)(virDomainDef *def,
3784                                              virDomainSmartcardDef *dev,
3785                                              void *opaque);
3786 
3787 int virDomainSmartcardDefForeach(virDomainDef *def,
3788                                  bool abortOnError,
3789                                  virDomainSmartcardDefIterator iter,
3790                                  void *opaque);
3791 
3792 typedef int (*virDomainChrDefIterator)(virDomainDef *def,
3793                                        virDomainChrDef *dev,
3794                                        void *opaque);
3795 
3796 int virDomainChrDefForeach(virDomainDef *def,
3797                            bool abortOnError,
3798                            virDomainChrDefIterator iter,
3799                            void *opaque);
3800 
3801 typedef int (*virDomainUSBDeviceDefIterator)(virDomainDeviceInfo *info,
3802                                              void *opaque);
3803 int virDomainUSBDeviceDefForeach(virDomainDef *def,
3804                                  virDomainUSBDeviceDefIterator iter,
3805                                  void *opaque,
3806                                  bool skipHubs);
3807 
3808 void
3809 virDomainObjSetState(virDomainObj *obj, virDomainState state, int reason)
3810         ATTRIBUTE_NONNULL(1);
3811 virDomainState
3812 virDomainObjGetState(virDomainObj *obj, int *reason)
3813         ATTRIBUTE_NONNULL(1);
3814 
3815 virSecurityLabelDef *
3816 virDomainDefGetSecurityLabelDef(const virDomainDef *def, const char *model);
3817 
3818 virSecurityDeviceLabelDef *
3819 virDomainChrSourceDefGetSecurityLabelDef(virDomainChrSourceDef *def,
3820                                          const char *model);
3821 
3822 typedef const char* (*virEventActionToStringFunc)(int type);
3823 typedef int (*virEventActionFromStringFunc)(const char *type);
3824 
3825 int virDomainMemoryInsert(virDomainDef *def, virDomainMemoryDef *mem)
3826     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3827 virDomainMemoryDef *virDomainMemoryRemove(virDomainDef *def, int idx)
3828     ATTRIBUTE_NONNULL(1);
3829 int virDomainMemoryFindByDef(virDomainDef *def, virDomainMemoryDef *mem)
3830     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3831 int virDomainMemoryFindInactiveByDef(virDomainDef *def,
3832                                      virDomainMemoryDef *mem)
3833     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3834 virDomainMemoryDef *
3835 virDomainMemoryFindByDeviceInfo(virDomainDef *dev,
3836                                 virDomainDeviceInfo *info,
3837                                 int *pos)
3838     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3839 
3840 virDomainMemoryDef *
3841 virDomainMemoryFindByDeviceAlias(virDomainDef *def,
3842                                  const char *alias)
3843     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3844 
3845 int virDomainShmemDefInsert(virDomainDef *def, virDomainShmemDef *shmem)
3846     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3847 bool virDomainShmemDefEquals(virDomainShmemDef *src, virDomainShmemDef *dst)
3848     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3849 ssize_t virDomainShmemDefFind(virDomainDef *def, virDomainShmemDef *shmem)
3850     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3851 virDomainShmemDef *virDomainShmemDefRemove(virDomainDef *def, size_t idx)
3852     ATTRIBUTE_NONNULL(1);
3853 ssize_t virDomainInputDefFind(const virDomainDef *def,
3854                               const virDomainInputDef *input)
3855     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3856 bool virDomainVsockDefEquals(const virDomainVsockDef *a,
3857                              const virDomainVsockDef *b)
3858     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
3859 
3860 VIR_ENUM_DECL(virDomainTaint);
3861 VIR_ENUM_DECL(virDomainTaintMessage);
3862 VIR_ENUM_DECL(virDomainVirt);
3863 VIR_ENUM_DECL(virDomainBoot);
3864 VIR_ENUM_DECL(virDomainFeature);
3865 VIR_ENUM_DECL(virDomainCapabilitiesPolicy);
3866 VIR_ENUM_DECL(virDomainProcessCapsFeature);
3867 VIR_ENUM_DECL(virDomainLifecycle);
3868 VIR_ENUM_DECL(virDomainLifecycleAction);
3869 VIR_ENUM_DECL(virDomainDevice);
3870 VIR_ENUM_DECL(virDomainDiskDevice);
3871 VIR_ENUM_DECL(virDomainDiskGeometryTrans);
3872 VIR_ENUM_DECL(virDomainDiskBus);
3873 VIR_ENUM_DECL(virDomainDiskCache);
3874 VIR_ENUM_DECL(virDomainDiskErrorPolicy);
3875 VIR_ENUM_DECL(virDomainDiskIo);
3876 VIR_ENUM_DECL(virDomainDeviceSGIO);
3877 VIR_ENUM_DECL(virDomainDiskTray);
3878 VIR_ENUM_DECL(virDomainDiskDiscard);
3879 VIR_ENUM_DECL(virDomainDiskDetectZeroes);
3880 VIR_ENUM_DECL(virDomainDiskModel);
3881 VIR_ENUM_DECL(virDomainDiskMirrorState);
3882 VIR_ENUM_DECL(virDomainController);
3883 VIR_ENUM_DECL(virDomainControllerModelPCI);
3884 VIR_ENUM_DECL(virDomainControllerPCIModelName);
3885 VIR_ENUM_DECL(virDomainControllerModelSCSI);
3886 VIR_ENUM_DECL(virDomainControllerModelUSB);
3887 VIR_ENUM_DECL(virDomainControllerModelIDE);
3888 VIR_ENUM_DECL(virDomainControllerModelVirtioSerial);
3889 VIR_ENUM_DECL(virDomainControllerModelISA);
3890 VIR_ENUM_DECL(virDomainFS);
3891 VIR_ENUM_DECL(virDomainFSDriver);
3892 VIR_ENUM_DECL(virDomainFSAccessMode);
3893 VIR_ENUM_DECL(virDomainFSWrpolicy);
3894 VIR_ENUM_DECL(virDomainFSModel);
3895 VIR_ENUM_DECL(virDomainFSCacheMode);
3896 VIR_ENUM_DECL(virDomainFSSandboxMode);
3897 VIR_ENUM_DECL(virDomainNet);
3898 VIR_ENUM_DECL(virDomainNetBackend);
3899 VIR_ENUM_DECL(virDomainNetVirtioTxMode);
3900 VIR_ENUM_DECL(virDomainNetMacType);
3901 VIR_ENUM_DECL(virDomainNetTeaming);
3902 VIR_ENUM_DECL(virDomainNetInterfaceLinkState);
3903 VIR_ENUM_DECL(virDomainNetModel);
3904 VIR_ENUM_DECL(virDomainChrDevice);
3905 VIR_ENUM_DECL(virDomainChrChannelTarget);
3906 VIR_ENUM_DECL(virDomainChrConsoleTarget);
3907 VIR_ENUM_DECL(virDomainChrSerialTarget);
3908 VIR_ENUM_DECL(virDomainSmartcard);
3909 VIR_ENUM_DECL(virDomainChr);
3910 VIR_ENUM_DECL(virDomainChrTcpProtocol);
3911 VIR_ENUM_DECL(virDomainChrSpicevmc);
3912 VIR_ENUM_DECL(virDomainSoundCodec);
3913 VIR_ENUM_DECL(virDomainSoundModel);
3914 VIR_ENUM_DECL(virDomainAudioFormat);
3915 VIR_ENUM_DECL(virDomainAudioType);
3916 VIR_ENUM_DECL(virDomainAudioSDLDriver);
3917 VIR_ENUM_DECL(virDomainKeyWrapCipherName);
3918 VIR_ENUM_DECL(virDomainMemballoonModel);
3919 VIR_ENUM_DECL(virDomainSmbiosMode);
3920 VIR_ENUM_DECL(virDomainWatchdogModel);
3921 VIR_ENUM_DECL(virDomainWatchdogAction);
3922 VIR_ENUM_DECL(virDomainPanicModel);
3923 VIR_ENUM_DECL(virDomainVideo);
3924 VIR_ENUM_DECL(virDomainVideoBackend);
3925 VIR_ENUM_DECL(virDomainHostdevMode);
3926 VIR_ENUM_DECL(virDomainHostdevSubsys);
3927 VIR_ENUM_DECL(virDomainHostdevCaps);
3928 VIR_ENUM_DECL(virDomainHub);
3929 VIR_ENUM_DECL(virDomainRedirdevBus);
3930 VIR_ENUM_DECL(virDomainInput);
3931 VIR_ENUM_DECL(virDomainInputBus);
3932 VIR_ENUM_DECL(virDomainInputModel);
3933 VIR_ENUM_DECL(virDomainInputSourceGrab);
3934 VIR_ENUM_DECL(virDomainInputSourceGrabToggle);
3935 VIR_ENUM_DECL(virDomainGraphics);
3936 VIR_ENUM_DECL(virDomainGraphicsListen);
3937 VIR_ENUM_DECL(virDomainGraphicsAuthConnected);
3938 VIR_ENUM_DECL(virDomainGraphicsSpiceChannelName);
3939 VIR_ENUM_DECL(virDomainGraphicsSpiceChannelMode);
3940 VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression);
3941 VIR_ENUM_DECL(virDomainGraphicsSpiceJpegCompression);
3942 VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression);
3943 VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode);
3944 VIR_ENUM_DECL(virDomainGraphicsSpiceMouseMode);
3945 VIR_ENUM_DECL(virDomainGraphicsVNCSharePolicy);
3946 VIR_ENUM_DECL(virDomainHyperv);
3947 VIR_ENUM_DECL(virDomainKVM);
3948 VIR_ENUM_DECL(virDomainXen);
3949 VIR_ENUM_DECL(virDomainXenPassthroughMode);
3950 VIR_ENUM_DECL(virDomainMsrsUnknown);
3951 VIR_ENUM_DECL(virDomainRNGModel);
3952 VIR_ENUM_DECL(virDomainRNGBackend);
3953 VIR_ENUM_DECL(virDomainTPMModel);
3954 VIR_ENUM_DECL(virDomainTPMBackend);
3955 VIR_ENUM_DECL(virDomainTPMVersion);
3956 VIR_ENUM_DECL(virDomainTPMPcrBank);
3957 VIR_ENUM_DECL(virDomainMemoryModel);
3958 VIR_ENUM_DECL(virDomainMemoryBackingModel);
3959 VIR_ENUM_DECL(virDomainMemorySource);
3960 VIR_ENUM_DECL(virDomainMemoryAllocation);
3961 VIR_ENUM_DECL(virDomainIOMMUModel);
3962 VIR_ENUM_DECL(virDomainVsockModel);
3963 VIR_ENUM_DECL(virDomainShmemModel);
3964 VIR_ENUM_DECL(virDomainShmemRole);
3965 VIR_ENUM_DECL(virDomainLaunchSecurity);
3966 /* from libvirt.h */
3967 VIR_ENUM_DECL(virDomainState);
3968 VIR_ENUM_DECL(virDomainNostateReason);
3969 VIR_ENUM_DECL(virDomainRunningReason);
3970 VIR_ENUM_DECL(virDomainBlockedReason);
3971 VIR_ENUM_DECL(virDomainPausedReason);
3972 VIR_ENUM_DECL(virDomainShutdownReason);
3973 VIR_ENUM_DECL(virDomainShutoffReason);
3974 VIR_ENUM_DECL(virDomainCrashedReason);
3975 VIR_ENUM_DECL(virDomainPMSuspendedReason);
3976 
3977 const char *virDomainStateReasonToString(virDomainState state, int reason);
3978 int virDomainStateReasonFromString(virDomainState state, const char *reason);
3979 
3980 VIR_ENUM_DECL(virDomainSeclabel);
3981 VIR_ENUM_DECL(virDomainClockOffset);
3982 VIR_ENUM_DECL(virDomainClockBasis);
3983 
3984 VIR_ENUM_DECL(virDomainTimerName);
3985 VIR_ENUM_DECL(virDomainTimerTrack);
3986 VIR_ENUM_DECL(virDomainTimerTickpolicy);
3987 VIR_ENUM_DECL(virDomainTimerMode);
3988 VIR_ENUM_DECL(virDomainCpuPlacementMode);
3989 
3990 VIR_ENUM_DECL(virDomainStartupPolicy);
3991 
3992 virDomainControllerDef *
3993 virDomainDefAddController(virDomainDef *def, int type, int idx, int model);
3994 int
3995 virDomainDefAddUSBController(virDomainDef *def, int idx, int model);
3996 int
3997 virDomainDefMaybeAddController(virDomainDef *def,
3998                                int type,
3999                                int idx,
4000                                int model);
4001 int
4002 virDomainDefMaybeAddInput(virDomainDef *def,
4003                           int type,
4004                           int bus);
4005 
4006 char *virDomainDefGetDefaultEmulator(virDomainDef *def, virCaps *caps);
4007 
4008 int virDomainDefFindDevice(virDomainDef *def,
4009                            const char *devAlias,
4010                            virDomainDeviceDef *dev,
4011                            bool reportError);
4012 
4013 virDomainAudioDef *
4014 virDomainDefFindAudioByID(const virDomainDef *def,
4015                           int id);
4016 bool
4017 virDomainSoundModelSupportsCodecs(virDomainSoundDef *def);
4018 bool
4019 virDomainAudioIOCommonIsSet(virDomainAudioIOCommon *common);
4020 
4021 const char *virDomainChrSourceDefGetPath(virDomainChrSourceDef *chr);
4022 
4023 void virDomainChrSourceDefClear(virDomainChrSourceDef *def);
4024 
4025 char *virDomainObjGetMetadata(virDomainObj *vm,
4026                               int type,
4027                               const char *uri,
4028                               unsigned int flags);
4029 
4030 int virDomainObjSetMetadata(virDomainObj *vm,
4031                             int type,
4032                             const char *metadata,
4033                             const char *key,
4034                             const char *uri,
4035                             virDomainXMLOption *xmlopt,
4036                             const char *stateDir,
4037                             const char *configDir,
4038                             unsigned int flags);
4039 
4040 int
4041 virDomainParseMemory(const char *xpath,
4042                      const char *units_xpath,
4043                      xmlXPathContextPtr ctxt,
4044                      unsigned long long *mem,
4045                      bool required,
4046                      bool capped);
4047 
4048 bool virDomainDefNeedsPlacementAdvice(virDomainDef *def)
4049     ATTRIBUTE_NONNULL(1);
4050 
4051 int virDomainDiskDefCheckDuplicateInfo(const virDomainDiskDef *a,
4052                                        const virDomainDiskDef *b)
4053     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
4054 
4055 virStorageSource *
4056 virDomainStorageSourceParseBase(const char *type,
4057                                 const char *format,
4058                                 const char *index)
4059     G_GNUC_WARN_UNUSED_RESULT;
4060 
4061 int virDomainStorageSourceParse(xmlNodePtr node,
4062                                 xmlXPathContextPtr ctxt,
4063                                 virStorageSource *src,
4064                                 unsigned int flags,
4065                                 virDomainXMLOption *xmlopt)
4066     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
4067 
4068 int
4069 virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
4070                                virStorageSource *src,
4071                                unsigned int flags,
4072                                virDomainXMLOption *xmlopt)
4073     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
4074 
4075 int virDomainDefGetVcpuPinInfoHelper(virDomainDef *def,
4076                                      int maplen,
4077                                      int ncpumaps,
4078                                      unsigned char *cpumaps,
4079                                      virBitmap *hostcpus,
4080                                      virBitmap *autoCpuset)
4081     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) G_GNUC_WARN_UNUSED_RESULT;
4082 
4083 bool virDomainDefHasMemballoon(const virDomainDef *def) ATTRIBUTE_NONNULL(1);
4084 
4085 char *virDomainDefGetShortName(const virDomainDef *def) ATTRIBUTE_NONNULL(1);
4086 
4087 int
4088 virDomainGetBlkioParametersAssignFromDef(virDomainDef *def,
4089                                          virTypedParameterPtr params,
4090                                          int *nparams,
4091                                          int maxparams);
4092 
4093 void virDomainDiskSetBlockIOTune(virDomainDiskDef *disk,
4094                                  virDomainBlockIoTuneInfo *info);
4095 
4096 bool
4097 virDomainNetTypeSharesHostView(const virDomainNetDef *net);
4098 
4099 bool
4100 virDomainDefLifecycleActionAllowed(virDomainLifecycle type,
4101                                    virDomainLifecycleAction action);
4102 
4103 virNetworkPortDef *
4104 virDomainNetDefToNetworkPort(virDomainDef *dom,
4105                              virDomainNetDef *iface);
4106 
4107 int
4108 virDomainNetDefActualFromNetworkPort(virDomainNetDef *iface,
4109                                      virNetworkPortDef *port);
4110 
4111 virNetworkPortDef *
4112 virDomainNetDefActualToNetworkPort(virDomainDef *dom,
4113                                    virDomainNetDef *iface);
4114 
4115 int
4116 virDomainNetAllocateActualDevice(virConnectPtr conn,
4117                                  virDomainDef *dom,
4118                                  virDomainNetDef *iface)
4119     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
4120 
4121 void
4122 virDomainNetNotifyActualDevice(virConnectPtr conn,
4123                                virDomainDef *dom,
4124                                virDomainNetDef *iface)
4125     ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
4126 
4127 int
4128 virDomainNetReleaseActualDevice(virConnectPtr conn,
4129                                 virDomainDef *dom,
4130                                 virDomainNetDef *iface)
4131     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
4132 
4133 int
4134 virDomainNetBandwidthUpdate(virDomainNetDef *iface,
4135                             virNetDevBandwidth *newBandwidth)
4136     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
4137 
4138 int
4139 virDomainNetResolveActualType(virDomainNetDef *iface)
4140     ATTRIBUTE_NONNULL(1);
4141 
4142 
4143 int virDomainDiskTranslateSourcePool(virDomainDiskDef *def);
4144 
4145 int
4146 virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard,
4147                                  virDomainDiskDetectZeroes detect_zeroes);
4148 
4149 bool
4150 virDomainDefHasManagedPR(const virDomainDef *def);
4151 
4152 bool
4153 virDomainDefHasNVMeDisk(const virDomainDef *def);
4154 
4155 bool
4156 virDomainDefHasVFIOHostdev(const virDomainDef *def);
4157 
4158 bool
4159 virDomainDefHasMdevHostdev(const virDomainDef *def);
4160 
4161 bool
4162 virDomainDefHasVDPANet(const virDomainDef *def);
4163 
4164 bool
4165 virDomainDefHasOldStyleUEFI(const virDomainDef *def);
4166 
4167 bool
4168 virDomainDefHasOldStyleROUEFI(const virDomainDef *def);
4169 
4170 bool
4171 virDomainGraphicsDefHasOpenGL(const virDomainDef *def);
4172 
4173 bool
4174 virDomainGraphicsSupportsRenderNode(const virDomainGraphicsDef *graphics);
4175 
4176 const char *
4177 virDomainGraphicsGetRenderNode(const virDomainGraphicsDef *graphics);
4178 
4179 bool
4180 virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics);
4181 
4182 bool
4183 virDomainBlockIoTuneInfoHasBasic(const virDomainBlockIoTuneInfo *iotune);
4184 
4185 bool
4186 virDomainBlockIoTuneInfoHasMax(const virDomainBlockIoTuneInfo *iotune);
4187 
4188 bool
4189 virDomainBlockIoTuneInfoHasMaxLength(const virDomainBlockIoTuneInfo *iotune);
4190 
4191 bool
4192 virDomainBlockIoTuneInfoHasAny(const virDomainBlockIoTuneInfo *iotune);
4193 
4194 void
4195 virDomainBlockIoTuneInfoCopy(const virDomainBlockIoTuneInfo *src,
4196                              virDomainBlockIoTuneInfo *dst);
4197 
4198 bool
4199 virDomainBlockIoTuneInfoEqual(const virDomainBlockIoTuneInfo *a,
4200                               const virDomainBlockIoTuneInfo *b);
4201 
4202 bool
4203 virDomainDriveAddressIsUsedByDisk(const virDomainDef *def,
4204                                   virDomainDiskBus bus_type,
4205                                   const virDomainDeviceDriveAddress *addr);
4206 
4207 bool
4208 virHostdevIsSCSIDevice(const virDomainHostdevDef *hostdev)
4209     ATTRIBUTE_NONNULL(1);
4210 bool
4211 virHostdevIsMdevDevice(const virDomainHostdevDef *hostdev)
4212     ATTRIBUTE_NONNULL(1);
4213 bool
4214 virHostdevIsVFIODevice(const virDomainHostdevDef *hostdev)
4215     ATTRIBUTE_NONNULL(1);
4216 
4217 int
4218 virDomainObjGetMessages(virDomainObj *vm,
4219                         char ***msgs,
4220                         unsigned int flags);
4221