static int virLXCProcessEnsureRootFS(virDomainObjPtr vm) { virDomainFSDefPtr root = virDomainGetFilesystemForTarget(vm->def, "/"); if (root) return 0; if (VIR_ALLOC(root) < 0) goto error; root->type = VIR_DOMAIN_FS_TYPE_MOUNT; if (VIR_STRDUP(root->src, "/") < 0 || VIR_STRDUP(root->dst, "/") < 0) goto error; if (VIR_INSERT_ELEMENT(vm->def->fss, 0, vm->def->nfss, root) < 0) goto error; return 0; error: virDomainFSDefFree(root); return -1; }
/* virDomainVirtioSerialAddrSetAddController * * Adds virtio serial ports of the existing controller * to the address set. */ int virDomainVirtioSerialAddrSetAddController(virDomainVirtioSerialAddrSetPtr addrs, virDomainControllerDefPtr cont) { int ret = -1; int ports; virDomainVirtioSerialControllerPtr cnt = NULL; ssize_t insertAt; if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) return 0; ports = cont->opts.vioserial.ports; if (ports == -1) ports = VIR_DOMAIN_DEFAULT_VIRTIO_SERIAL_PORTS; VIR_DEBUG("Adding virtio serial controller index %u with %d" " ports to the address set", cont->idx, ports); if (VIR_ALLOC(cnt) < 0) goto cleanup; if (!(cnt->ports = virBitmapNew(ports))) goto cleanup; cnt->idx = cont->idx; if ((insertAt = virDomainVirtioSerialAddrPlaceController(addrs, cnt)) < -1) goto cleanup; if (VIR_INSERT_ELEMENT(addrs->controllers, insertAt, addrs->ncontrollers, cnt) < 0) goto cleanup; ret = 0; cleanup: virDomainVirtioSerialControllerFree(cnt); return ret; }