The parallel, serial, console and channel devices are all just
character devices. A lot of code needs todo the same thing to
all these devices. This provides an convenient API for iterating
over all of them.
* src/conf/domain_conf.c, src/conf/domain_conf.c,
src/libvirt_private.syms: Add virDomainChrDefForeach
}
+int virDomainChrDefForeach(virDomainDefPtr def,
+ bool abortOnError,
+ virDomainChrDefIterator iter,
+ void *opaque)
+{
+ int i;
+ int rc = 0;
+
+ for (i = 0 ; i < def->nserials ; i++) {
+ if ((iter)(def,
+ def->serials[i],
+ opaque) < 0)
+ rc = -1;
+
+ if (abortOnError && rc != 0)
+ goto done;
+ }
+
+ for (i = 0 ; i < def->nparallels ; i++) {
+ if ((iter)(def,
+ def->parallels[i],
+ opaque) < 0)
+ rc = -1;
+
+ if (abortOnError && rc != 0)
+ goto done;
+ }
+
+ for (i = 0 ; i < def->nchannels ; i++) {
+ if ((iter)(def,
+ def->channels[i],
+ opaque) < 0)
+ rc = -1;
+
+ if (abortOnError && rc != 0)
+ goto done;
+ }
+ if (def->console) {
+ if ((iter)(def,
+ def->console,
+ opaque) < 0)
+ rc = -1;
+
+ if (abortOnError && rc != 0)
+ goto done;
+ }
+
+done:
+ return rc;
+}
+
+
#endif /* ! PROXY */
char **const names,
int maxnames);
+typedef int (*virDomainChrDefIterator)(virDomainDefPtr def,
+ virDomainChrDefPtr dev,
+ void *opaque);
+
+int virDomainChrDefForeach(virDomainDefPtr def,
+ bool abortOnError,
+ virDomainChrDefIterator iter,
+ void *opaque);
+
VIR_ENUM_DECL(virDomainVirt)
VIR_ENUM_DECL(virDomainBoot)
virDomainSnapshotDefFormat;
virDomainSnapshotAssignDef;
virDomainObjAssignDef;
+virDomainChrDefForeach;
# domain_event.h