On Tue, Nov 17, 2020 at 01:10:57PM +0100, Shalini Chellathurai Saroja wrote:
Each AP card device can support upto 256 AP queues. AP queues are
also detected by udev, so add support for libvirt nodedev driver.
Signed-off-by: Farhan Ali <alifm(a)linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini(a)linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk(a)linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
---
docs/formatnode.html.in | 15 +++++++
docs/schemas/nodedev.rng | 25 +++++++++++
src/conf/node_device_conf.c | 66 ++++++++++++++++++++++++++++++
src/conf/node_device_conf.h | 9 ++++
src/conf/virnodedeviceobj.c | 1 +
src/node_device/node_device_udev.c | 30 ++++++++++++++
tools/virsh-nodedev.c | 1 +
7 files changed, 147 insertions(+)
...
+static int
+virNodeDevCapAPQueueParseXML(xmlXPathContextPtr ctxt,
+ virNodeDeviceDefPtr def,
+ xmlNodePtr node,
+ virNodeDevCapAPQueuePtr ap_queue)
+{
+ xmlNodePtr orig;
We could benefit from VIR_XPATH_NODE_AUTORESTORE(ctxt) here as well.
+ int ret = -1;
+ g_autofree char *adapter = NULL, *dom = NULL;
^One definition per line please.
+
+ orig = ctxt->node;
+ ctxt->node = node;
+
+ if (!(adapter = virXPathString("string(./ap-adapter[1])", ctxt))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("missing ap-adapter value for '%s'"),
def->name);
+ return -1;
+ }
+
+ if (virStrToLong_uip(adapter, NULL, 0, &ap_queue->ap_adapter) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid ap-adapter value '%s' for
'%s'"),
+ adapter, def->name);
+ goto out;
+ }
Like I mentioned in patch 1, we could extract ^this into a tiny static helper.
Regards,
Erik