From nobody Mon Feb 9 13:00:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1652437932399330.7756538901315; Fri, 13 May 2022 03:32:12 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-404-wvWl-obeN5iz6CIpC4SKiA-1; Fri, 13 May 2022 06:32:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7B52B8032E5; Fri, 13 May 2022 10:32:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67EDD40D2820; Fri, 13 May 2022 10:32:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 184111956B85; Fri, 13 May 2022 10:32:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5469C1932234 for ; Fri, 13 May 2022 10:32:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 33F17111F3DB; Fri, 13 May 2022 10:32:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F60E111F3D9 for ; Fri, 13 May 2022 10:31:31 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77E88811E76 for ; Fri, 13 May 2022 10:31:31 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-61-hmjl4xqfO-K0tNsFkcxYYw-1; Fri, 13 May 2022 06:31:29 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24D7UlIC006268 for ; Fri, 13 May 2022 10:31:29 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1k0s39xq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 13 May 2022 10:31:29 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24DAMkQk015757 for ; Fri, 13 May 2022 10:31:27 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 3fwgd90ewd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 13 May 2022 10:31:27 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24DAVOlh52167102 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 May 2022 10:31:24 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3116D11C052; Fri, 13 May 2022 10:31:24 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B09A11C058; Fri, 13 May 2022 10:31:24 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.93.141]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 May 2022 10:31:23 +0000 (GMT) X-MC-Unique: wvWl-obeN5iz6CIpC4SKiA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: hmjl4xqfO-K0tNsFkcxYYw-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH 14/17] nodedev: refactor css XML parsing from ccw XML parsing Date: Fri, 13 May 2022 12:31:13 +0200 Message-Id: <20220513103116.3751-15-fiuczy@linux.ibm.com> In-Reply-To: <20220513103116.3751-1-fiuczy@linux.ibm.com> References: <20220513103116.3751-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: PkREOZe-bZ-NYl_g-roT03cOGLgWjxTA X-Proofpoint-ORIG-GUID: PkREOZe-bZ-NYl_g-roT03cOGLgWjxTA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-13_04,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 bulkscore=0 clxscore=1015 impostorscore=0 mlxlogscore=738 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205130043 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1652437933201100005 Content-Type: text/plain; charset="utf-8"; x-default="true" In preparation for easier extension later. Signed-off-by: Boris Fiuczynski --- src/conf/node_device_conf.c | 40 +++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 8d160185eb..5aafcbb838 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1195,6 +1195,31 @@ virNodeDevCCWDeviceAddressParseXML(xmlXPathContextPt= r ctxt, return 0; } =20 + +static int +virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt, + virNodeDeviceDef *def, + xmlNodePtr node, + virNodeDevCapCCW *ccw_dev) +{ + VIR_XPATH_NODE_AUTORESTORE(ctxt) + g_autofree virCCWDeviceAddress *ccw_addr =3D NULL; + + ctxt->node =3D node; + + ccw_addr =3D g_new0(virCCWDeviceAddress, 1); + + if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr= ) < 0) + return -1; + + ccw_dev->cssid =3D ccw_addr->cssid; + ccw_dev->ssid =3D ccw_addr->ssid; + ccw_dev->devno =3D ccw_addr->devno; + + return 0; +} + + static int virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt, xmlNodePtr node, @@ -1223,7 +1248,7 @@ virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ct= xt, =20 =20 static int -virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt, +virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt, virNodeDeviceDef *def, xmlNodePtr node, virNodeDevCapCCW *ccw_dev) @@ -1232,19 +1257,12 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt, g_autofree xmlNodePtr *nodes =3D NULL; int n =3D 0; size_t i =3D 0; - g_autofree virCCWDeviceAddress *ccw_addr =3D NULL; =20 ctxt->node =3D node; =20 - ccw_addr =3D g_new0(virCCWDeviceAddress, 1); - - if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr= ) < 0) + if (virNodeDevCapCCWParseXML(ctxt, def, node, ccw_dev) < 0) return -1; =20 - ccw_dev->cssid =3D ccw_addr->cssid; - ccw_dev->ssid =3D ccw_addr->ssid; - ccw_dev->devno =3D ccw_addr->devno; - if ((n =3D virXPathNodeSet("./capability", ctxt, &nodes)) < 0) return -1; =20 @@ -2284,9 +2302,11 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, ret =3D virNodeDevCapMdevParseXML(ctxt, def, node, &caps->data.mde= v); break; case VIR_NODE_DEV_CAP_CCW_DEV: - case VIR_NODE_DEV_CAP_CSS_DEV: ret =3D virNodeDevCapCCWParseXML(ctxt, def, node, &caps->data.ccw_= dev); break; + case VIR_NODE_DEV_CAP_CSS_DEV: + ret =3D virNodeDevCapCSSParseXML(ctxt, def, node, &caps->data.ccw_= dev); + break; case VIR_NODE_DEV_CAP_AP_CARD: ret =3D virNodeDevCapAPCardParseXML(ctxt, def, node, &caps->data.ap_card); --=20 2.33.1