unsigned int flags)
{
if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex)
- virBufferAsprintf(buf, "<boot order='%d'/>\n", info->bootIndex);
+ virBufferAsprintf(buf, "<boot order='%u'/>\n", info->bootIndex);
if (info->alias &&
!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
virHashTablePtr bootHash)
{
char *order;
- int boot;
int ret = -1;
- order = virXMLPropString(node, "order");
- if (!order) {
+ if (!(order = virXMLPropString(node, "order"))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing boot order attribute"));
goto cleanup;
- } else if (virStrToLong_i(order, NULL, 10, &boot) < 0 ||
- boot <= 0) {
+ }
+
+ if (virStrToLong_uip(order, NULL, 10, &info->bootIndex) < 0 ||
+ info->bootIndex == 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("incorrect boot order '%s', expecting positive integer"),
order);
goto cleanup;
}
- info->bootIndex = boot;
ret = 0;
cleanup:
if (info->bootIndex == newinfo->bootIndex) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("boot order %d is already used by another device"),
+ _("boot order %u is already used by another device"),
newinfo->bootIndex);
return -1;
}
char *
qemuBuildDriveDevStr(const virDomainDef *def,
virDomainDiskDefPtr disk,
- int bootindex,
+ unsigned int bootindex,
virQEMUCapsPtr qemuCaps)
{
virBuffer opt = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&opt, ",drive=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
virBufferAsprintf(&opt, ",id=%s", disk->info.alias);
if (bootindex && virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX))
- virBufferAsprintf(&opt, ",bootindex=%d", bootindex);
+ virBufferAsprintf(&opt, ",bootindex=%u", bootindex);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKIO)) {
if (disk->blockio.logical_block_size > 0)
virBufferAsprintf(&opt, ",logical_block_size=%u",
bool emitBootindex)
{
size_t i;
- int bootCD = 0, bootFloppy = 0, bootDisk = 0;
+ unsigned int bootCD = 0;
+ unsigned int bootFloppy = 0;
+ unsigned int bootDisk = 0;
virBuffer fdc_opts = VIR_BUFFER_INITIALIZER;
char *fdc_opts_str = NULL;
for (i = 0; i < def->ndisks; i++) {
char *optstr;
- int bootindex = 0;
+ unsigned int bootindex = 0;
virDomainDiskDefPtr disk = def->disks[i];
bool withDeviceArg = false;
bool deviceFlagMasked = false;
VIR_FREE(optstr);
if (bootindex) {
- if (virAsprintf(&optstr, "bootindex%c=%d",
+ if (virAsprintf(&optstr, "bootindex%c=%u",
disk->info.addr.drive.unit
? 'B' : 'A',
bootindex) < 0)
qemuBuildNicDevStr(virDomainDefPtr def,
virDomainNetDefPtr net,
int vlan,
- int bootindex,
+ unsigned int bootindex,
size_t vhostfdSize,
virQEMUCapsPtr qemuCaps)
{
if (qemuBuildRomStr(&buf, &net->info, qemuCaps) < 0)
goto error;
if (bootindex && virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX))
- virBufferAsprintf(&buf, ",bootindex=%d", bootindex);
+ virBufferAsprintf(&buf, ",bootindex=%u", bootindex);
if (virBufferCheckError(&buf) < 0)
goto error;
char *
qemuBuildPCIHostdevDevStr(const virDomainDef *def,
virDomainHostdevDefPtr dev,
- int bootIndex, /* used iff dev->info->bootIndex == 0 */
+ unsigned int bootIndex, /* used iff dev->info->bootIndex == 0 */
const char *configfd,
virQEMUCapsPtr qemuCaps)
{
if (dev->info->bootIndex)
bootIndex = dev->info->bootIndex;
if (bootIndex)
- virBufferAsprintf(&buf, ",bootindex=%d", bootIndex);
+ virBufferAsprintf(&buf, ",bootindex=%u", bootIndex);
if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
goto error;
if (qemuBuildRomStr(&buf, dev->info, qemuCaps) < 0)
}
virBufferAsprintf(&buf, ",id=%s", dev->info->alias);
if (dev->info->bootIndex)
- virBufferAsprintf(&buf, ",bootindex=%d", dev->info->bootIndex);
+ virBufferAsprintf(&buf, ",bootindex=%u", dev->info->bootIndex);
if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
goto error;
dev->info->alias, dev->info->alias);
if (dev->info->bootIndex)
- virBufferAsprintf(&buf, ",bootindex=%d", dev->info->bootIndex);
+ virBufferAsprintf(&buf, ",bootindex=%u", dev->info->bootIndex);
if (virBufferCheckError(&buf) < 0)
goto error;
const virDomainDef *def,
virQEMUCapsPtr qemuCaps,
qemuBuildCommandLineCallbacksPtr callbacks,
- int *bootHostdevNet)
+ unsigned int *bootHostdevNet)
{
size_t i;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
char *configfd_name = NULL;
- int bootIndex = hostdev->info->bootIndex;
+ unsigned int bootIndex = hostdev->info->bootIndex;
/* bootNet will be non-0 if boot order was set and no other
* net devices were encountered
virDomainDefPtr def,
virDomainNetDefPtr net,
virQEMUCapsPtr qemuCaps,
- int bootindex)
+ unsigned int bootindex)
{
virBuffer chardev_buf = VIR_BUFFER_INITIALIZER;
virBuffer netdev_buf = VIR_BUFFER_INITIALIZER;
virDomainNetDefPtr net,
virQEMUCapsPtr qemuCaps,
int vlan,
- int bootindex,
+ unsigned int bootindex,
virNetDevVPortProfileOp vmop,
bool standalone,
size_t *nnicindexes,
bool emitBootindex,
size_t *nnicindexes,
int **nicindexes,
- int *bootHostdevNet)
+ unsigned int *bootHostdevNet)
{
size_t i;
int last_good_net = -1;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
virCommandAddArgList(cmd, "-net", "none", NULL);
} else {
- int bootNet = 0;
+ unsigned int bootNet = 0;
if (emitBootindex) {
/* convert <boot dev='network'/> to bootindex since we didn't emit
"supported by this version of QEMU"));
goto error;
}
- virBufferAsprintf(&buf, ",bootindex=%d", dev->info.bootIndex);
+ virBufferAsprintf(&buf, ",bootindex=%u", dev->info.bootIndex);
}
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
virCommandPtr cmd = NULL;
bool emitBootindex = false;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
- int bootHostdevNet = 0;
+ unsigned int bootHostdevNet = 0;
VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d "