提交 c0f6bb01 编写于 作者: R Ryan Moeller 提交者: Daniel P. Berrangé

bhyve: parse_command: slot, bus, func -> bus, slot, func

This *is* a no-op, but there was a period of sickening dread while
auditing to be sure that no actual confusion between bus and slot had
occurred. I hope to avoid that by following the conventional order.
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
Signed-off-by: NRyan Moeller <ryan@iXsystems.com>
上级 d0bd8275
...@@ -352,8 +352,8 @@ bhyveParseBhyveLPCArg(virDomainDefPtr def, ...@@ -352,8 +352,8 @@ bhyveParseBhyveLPCArg(virDomainDefPtr def,
static int static int
bhyveParsePCISlot(const char *slotdef, bhyveParsePCISlot(const char *slotdef,
unsigned *pcislot,
unsigned *bus, unsigned *bus,
unsigned *slot,
unsigned *function) unsigned *function)
{ {
/* slot[:function] | bus:slot:function */ /* slot[:function] | bus:slot:function */
...@@ -385,7 +385,7 @@ bhyveParsePCISlot(const char *slotdef, ...@@ -385,7 +385,7 @@ bhyveParsePCISlot(const char *slotdef,
} }
*bus = 0; *bus = 0;
*pcislot = 0; *slot = 0;
*function = 0; *function = 0;
switch (i + 1) { switch (i + 1) {
...@@ -393,12 +393,12 @@ bhyveParsePCISlot(const char *slotdef, ...@@ -393,12 +393,12 @@ bhyveParsePCISlot(const char *slotdef,
/* pcislot[:function] */ /* pcislot[:function] */
*function = values[1]; *function = values[1];
case 1: case 1:
*pcislot = values[0]; *slot = values[0];
break; break;
case 3: case 3:
/* bus:pcislot:function */ /* bus:pcislot:function */
*bus = values[0]; *bus = values[0];
*pcislot = values[1]; *slot = values[1];
*function = values[2]; *function = values[2];
break; break;
} }
...@@ -409,8 +409,8 @@ bhyveParsePCISlot(const char *slotdef, ...@@ -409,8 +409,8 @@ bhyveParsePCISlot(const char *slotdef,
static int static int
bhyveParsePCIDisk(virDomainDefPtr def, bhyveParsePCIDisk(virDomainDefPtr def,
unsigned caps G_GNUC_UNUSED, unsigned caps G_GNUC_UNUSED,
unsigned pcislot,
unsigned pcibus, unsigned pcibus,
unsigned pcislot,
unsigned function, unsigned function,
int bus, int bus,
int device, int device,
...@@ -430,8 +430,8 @@ bhyveParsePCIDisk(virDomainDefPtr def, ...@@ -430,8 +430,8 @@ bhyveParsePCIDisk(virDomainDefPtr def,
disk->device = device; disk->device = device;
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
disk->info.addr.pci.slot = pcislot;
disk->info.addr.pci.bus = pcibus; disk->info.addr.pci.bus = pcibus;
disk->info.addr.pci.slot = pcislot;
disk->info.addr.pci.function = function; disk->info.addr.pci.function = function;
if (STRPREFIX(config, "/dev/")) if (STRPREFIX(config, "/dev/"))
...@@ -480,8 +480,8 @@ static int ...@@ -480,8 +480,8 @@ static int
bhyveParsePCINet(virDomainDefPtr def, bhyveParsePCINet(virDomainDefPtr def,
virDomainXMLOptionPtr xmlopt, virDomainXMLOptionPtr xmlopt,
unsigned caps G_GNUC_UNUSED, unsigned caps G_GNUC_UNUSED,
unsigned pcislot, unsigned bus,
unsigned pcibus, unsigned slot,
unsigned function, unsigned function,
int model, int model,
const char *config) const char *config)
...@@ -503,8 +503,8 @@ bhyveParsePCINet(virDomainDefPtr def, ...@@ -503,8 +503,8 @@ bhyveParsePCINet(virDomainDefPtr def,
net->model = model; net->model = model;
net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
net->info.addr.pci.slot = pcislot; net->info.addr.pci.bus = bus;
net->info.addr.pci.bus = pcibus; net->info.addr.pci.slot = slot;
net->info.addr.pci.function = function; net->info.addr.pci.function = function;
if (!config) if (!config)
...@@ -565,7 +565,7 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def, ...@@ -565,7 +565,7 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def,
char *slotdef = NULL; char *slotdef = NULL;
char *emulation = NULL; char *emulation = NULL;
char *conf = NULL; char *conf = NULL;
unsigned pcislot, bus, function; unsigned bus, slot, function;
separator = strchr(arg, ','); separator = strchr(arg, ',');
...@@ -584,35 +584,35 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def, ...@@ -584,35 +584,35 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def,
emulation = g_strdup(separator); emulation = g_strdup(separator);
} }
if (bhyveParsePCISlot(slotdef, &pcislot, &bus, &function) < 0) if (bhyveParsePCISlot(slotdef, &bus, &slot, &function) < 0)
goto error; goto error;
if (STREQ(emulation, "ahci-cd")) if (STREQ(emulation, "ahci-cd"))
bhyveParsePCIDisk(def, caps, pcislot, bus, function, bhyveParsePCIDisk(def, caps, bus, slot, function,
VIR_DOMAIN_DISK_BUS_SATA, VIR_DOMAIN_DISK_BUS_SATA,
VIR_DOMAIN_DISK_DEVICE_CDROM, VIR_DOMAIN_DISK_DEVICE_CDROM,
nvirtiodisk, nvirtiodisk,
nahcidisk, nahcidisk,
conf); conf);
else if (STREQ(emulation, "ahci-hd")) else if (STREQ(emulation, "ahci-hd"))
bhyveParsePCIDisk(def, caps, pcislot, bus, function, bhyveParsePCIDisk(def, caps, bus, slot, function,
VIR_DOMAIN_DISK_BUS_SATA, VIR_DOMAIN_DISK_BUS_SATA,
VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_DISK,
nvirtiodisk, nvirtiodisk,
nahcidisk, nahcidisk,
conf); conf);
else if (STREQ(emulation, "virtio-blk")) else if (STREQ(emulation, "virtio-blk"))
bhyveParsePCIDisk(def, caps, pcislot, bus, function, bhyveParsePCIDisk(def, caps, bus, slot, function,
VIR_DOMAIN_DISK_BUS_VIRTIO, VIR_DOMAIN_DISK_BUS_VIRTIO,
VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_DISK,
nvirtiodisk, nvirtiodisk,
nahcidisk, nahcidisk,
conf); conf);
else if (STREQ(emulation, "virtio-net")) else if (STREQ(emulation, "virtio-net"))
bhyveParsePCINet(def, xmlopt, caps, pcislot, bus, function, bhyveParsePCINet(def, xmlopt, caps, bus, slot, function,
VIR_DOMAIN_NET_MODEL_VIRTIO, conf); VIR_DOMAIN_NET_MODEL_VIRTIO, conf);
else if (STREQ(emulation, "e1000")) else if (STREQ(emulation, "e1000"))
bhyveParsePCINet(def, xmlopt, caps, pcislot, bus, function, bhyveParsePCINet(def, xmlopt, caps, bus, slot, function,
VIR_DOMAIN_NET_MODEL_E1000, conf); VIR_DOMAIN_NET_MODEL_E1000, conf);
VIR_FREE(emulation); VIR_FREE(emulation);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册