From nobody Sun Feb 8 05:41:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1598270444; cv=none; d=zohomail.com; s=zohoarc; b=OvBjcG6H8uT80TpJDapztkKGycftoyEGORNmi6N5EiJa220gD5LcWVgonHxcbwg1b69TZGT3MgGqhdlHEs6DDnHdD9SoVQjK2AZ38HCtU7pACUg8xQ27dFkbO3J0LHsXo/paJCBSKbU+ltgdBesYJCb+0i47GaM0yXIwFOT/BRA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598270444; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Hjgwo1WrY9GGx7zHqDXxHXykPz+YenHCCSyPRlIHLAQ=; b=jhh9zGkPzxHPScveaXnrSHX9EKosqGM8bseJubGvpIuu7CN6R1e5b9D8SN7PYcAZ2qXQq1aQhMjByNrpHNB9NZSTc/Qlqg+XWw0hpf2B0ZGgoWVpkKCLgiHxPJdQ72Rnwz0eGKEBbFJqHzhU+q+KhytgsvtFeo9joZua4facDUI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1598270444956655.086721094801; Mon, 24 Aug 2020 05:00:44 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-491-vwixLVkGOuq0edCu29PTkQ-1; Mon, 24 Aug 2020 08:00:16 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4349381F012; Mon, 24 Aug 2020 12:00:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F7745F707; Mon, 24 Aug 2020 12:00:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DD971EC23; Mon, 24 Aug 2020 12:00:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07OBxSPY029259 for ; Mon, 24 Aug 2020 07:59:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id A54602022792; Mon, 24 Aug 2020 11:59:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F9AB20227B0 for ; Mon, 24 Aug 2020 11:59:26 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C00AE888BE4 for ; Mon, 24 Aug 2020 11:59:26 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-nlLCvRUuOi-wdyFo6Tww3w-1; Mon, 24 Aug 2020 07:59:24 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07OBWLvj099466 for ; Mon, 24 Aug 2020 07:59:23 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 334bc73cjt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 24 Aug 2020 07:59:23 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07OBwH2G002855 for ; Mon, 24 Aug 2020 11:59:21 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03ams.nl.ibm.com with ESMTP id 332ujktahr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 24 Aug 2020 11:59:20 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07OBvmpw53805312 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2020 11:57:48 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC472A405C; Mon, 24 Aug 2020 11:59:17 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C3F2AA4054; Mon, 24 Aug 2020 11:59:17 +0000 (GMT) Received: from m46lp64.lnxne.boe (unknown [9.152.108.100]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 24 Aug 2020 11:59:17 +0000 (GMT) X-MC-Unique: vwixLVkGOuq0edCu29PTkQ-1 X-MC-Unique: nlLCvRUuOi-wdyFo6Tww3w-1 From: Bjoern Walk To: libvir-list@redhat.com Subject: [PATCH 1/5] node_device: refactor udevProcessCCW Date: Mon, 24 Aug 2020 13:59:11 +0200 Message-Id: <20200824115915.345646-2-bwalk@linux.ibm.com> In-Reply-To: <20200824115915.345646-1-bwalk@linux.ibm.com> References: <20200824115915.345646-1-bwalk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-24_08:2020-08-24, 2020-08-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 suspectscore=1 phishscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008240087 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.4 X-loop: libvir-list@redhat.com Cc: Bjoern Walk , Boris Fiuczynski X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Boris Fiuczynski Refactor out CCW address parsing for later reuse. Reviewed-by: Bjoern Walk Signed-off-by: Boris Fiuczynski Reviewed-by: Erik Skultety --- src/node_device/node_device_udev.c | 31 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index ff558efb..d478a673 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1058,27 +1058,38 @@ udevProcessMediatedDevice(struct udev_device *dev, =20 =20 static int -udevProcessCCW(struct udev_device *device, - virNodeDeviceDefPtr def) +udevGetCCWAddress(const char *sysfs_path, + virNodeDevCapDataPtr data) { - int online; char *p; - virNodeDevCapDataPtr data =3D &def->caps->data; - - /* process only online devices to keep the list sane */ - if (udevGetIntSysfsAttr(device, "online", &online, 0) < 0 || online != =3D 1) - return -1; =20 - if ((p =3D strrchr(def->sysfs_path, '/')) =3D=3D NULL || + if ((p =3D strrchr(sysfs_path, '/')) =3D=3D NULL || virStrToLong_ui(p + 1, &p, 16, &data->ccw_dev.cssid) < 0 || p =3D= =3D NULL || virStrToLong_ui(p + 1, &p, 16, &data->ccw_dev.ssid) < 0 || p =3D= =3D NULL || virStrToLong_ui(p + 1, &p, 16, &data->ccw_dev.devno) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse the CCW address from sysfs path:= '%s'"), - def->sysfs_path); + sysfs_path); return -1; } =20 + return 0; +} + + +static int +udevProcessCCW(struct udev_device *device, + virNodeDeviceDefPtr def) +{ + int online; + + /* process only online devices to keep the list sane */ + if (udevGetIntSysfsAttr(device, "online", &online, 0) < 0 || online != =3D 1) + return -1; + + if (udevGetCCWAddress(def->sysfs_path, &def->caps->data) < 0) + return -1; + if (udevGenerateDeviceName(device, def, NULL) !=3D 0) return -1; =20 --=20 2.24.1