From nobody Thu May 16 00:54:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1609750471; cv=none; d=zohomail.com; s=zohoarc; b=AevdGd6z/VdD8bKYJ22sVDY/3BIHfvqnlurs4KqoKWRtGfevYDsjNqzqSrZ70bpe/g/68+ZsVZjxEvawqPcefGlumPFZSQaPscUDiA6/pCf1c88t1eCWKt4gyCI+gE0LsBd/k+cVRtgfxtxvLwJLYlgaTG4P7GkfLvQmVQ7UXSo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609750471; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ohcVqEas8x/LSQEPoEA3N8h+DrOQl+db+1I5mwRZBn4=; b=HoWTYOPYGpHiLON0mm9pSQTZMG3nuf6FEBDL67dfU0P/7H4T03r8KF0IVKUqhPqu2fNg1zRGlJqbNQF4m3WbiymfnYFAzd4VyRRe5sM2gB2cf9sPAiRWH8UUJcbLU8fsFJytpMvzFOukh18VWtIiYsaHFdmL6SdSS+oLDdxM9E8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1609750471093224.859317407989; Mon, 4 Jan 2021 00:54:31 -0800 (PST) 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-76-LMpRorsPMM6IsEsvZ9l-LA-1; Mon, 04 Jan 2021 03:54:27 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07C9B10054FF; Mon, 4 Jan 2021 08:54:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16EB95D756; Mon, 4 Jan 2021 08:54:20 +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 8B4CA180954D; Mon, 4 Jan 2021 08:54:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1048sEvR023115 for ; Mon, 4 Jan 2021 03:54:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8449C5D9D5; Mon, 4 Jan 2021 08:54:14 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id D11D45D9D3; Mon, 4 Jan 2021 08:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609750469; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ohcVqEas8x/LSQEPoEA3N8h+DrOQl+db+1I5mwRZBn4=; b=GzEzHDUTqbMEwouCF9Rz1HvfcoDMQ+EuuSK4eUjlLOdz7EnA6h78jdRi7mJ9I0oTbJQjp0 HX3s/gh2KDs7B7cZ0zJU7BuFvw8JSnIcDZ0CP0BRwDsC2Q7n/AF3+hS3n9NlcbOhfjIRVE e0gysESobuvZi3yaQ7fxi+Ukshh7bN8= X-MC-Unique: LMpRorsPMM6IsEsvZ9l-LA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu: Drop has_ccw_address from _qemuAgentDiskAddress Date: Mon, 4 Jan 2021 09:54:08 +0100 Message-Id: <03975775cf94cff3f2ca77c7e30953cde1c42095.1609750427.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: thuth@redhat.com 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.15 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In recent patches new mambers to _qemuAgentDiskAddress struct were introduced to keep optional CCW address sent by the guest agent. These two members are a struct to store CCW address into and a boolean to keep track whether the CCW address is valid. Well, we can hold the same information with a pointer - instead of storing the CCW address structure let's keep just a pointer to it. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- src/qemu/qemu_agent.c | 18 ++++++++++++------ src/qemu/qemu_agent.h | 3 +-- src/qemu/qemu_driver.c | 9 +++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index b155896e78..af0397e6e2 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1824,6 +1824,7 @@ qemuAgentDiskAddressFree(qemuAgentDiskAddressPtr info) g_free(info->serial); g_free(info->bus_type); g_free(info->devnode); + g_free(info->ccw_addr); g_free(info); } =20 @@ -1899,12 +1900,17 @@ qemuAgentGetDiskAddress(virJSONValuePtr json) GET_DISK_ADDR(pci, &addr->pci_controller.function, "function"); =20 if ((ccw =3D virJSONValueObjectGet(json, "ccw-address"))) { - addr->has_ccw_address =3D true; - GET_DISK_ADDR(ccw, &addr->ccw_addr.cssid, "cssid"); - if (addr->ccw_addr.cssid =3D=3D 0) /* Guest CSSID 0 is 0xfe on ho= st */ - addr->ccw_addr.cssid =3D 0xfe; - GET_DISK_ADDR(ccw, &addr->ccw_addr.ssid, "ssid"); - GET_DISK_ADDR(ccw, &addr->ccw_addr.devno, "devno"); + g_autofree virDomainDeviceCCWAddressPtr ccw_addr =3D NULL; + + ccw_addr =3D g_new0(virDomainDeviceCCWAddress, 1); + + GET_DISK_ADDR(ccw, &ccw_addr->cssid, "cssid"); + if (ccw_addr->cssid =3D=3D 0) /* Guest CSSID 0 is 0xfe on host */ + ccw_addr->cssid =3D 0xfe; + GET_DISK_ADDR(ccw, &ccw_addr->ssid, "ssid"); + GET_DISK_ADDR(ccw, &ccw_addr->devno, "devno"); + + addr->ccw_addr =3D g_steal_pointer(&ccw_addr); } #undef GET_DISK_ADDR =20 diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h index 4ea9b9dc1e..0d47230161 100644 --- a/src/qemu/qemu_agent.h +++ b/src/qemu/qemu_agent.h @@ -77,8 +77,7 @@ struct _qemuAgentDiskAddress { unsigned int target; unsigned int unit; char *devnode; - bool has_ccw_address; - virDomainDeviceCCWAddress ccw_addr; + virDomainDeviceCCWAddressPtr ccw_addr; }; void qemuAgentDiskAddressFree(qemuAgentDiskAddressPtr addr); G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuAgentDiskAddress, qemuAgentDiskAddressFr= ee); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 62b0852c33..a376824854 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18887,8 +18887,7 @@ qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent, =20 diskDef =3D virDomainDiskByAddress(vmdef, &agentdisk->pci_controller, - agentdisk->has_ccw_address ? - &agentdisk->ccw_addr : NULL, + agentdisk->ccw_addr, agentdisk->bus, agentdisk->target, agentdisk->unit); @@ -19931,8 +19930,7 @@ qemuAgentDiskInfoFormatParams(qemuAgentDiskInfoPtr = *info, /* match the disk to the target in the vm definition */ diskdef =3D virDomainDiskByAddress(vmdef, &info[i]->address->pci_contro= ller, - info[i]->address->has_ccw_add= ress ? - &info[i]->address->ccw_add= r : NULL, + info[i]->address->ccw_addr, info[i]->address->bus, info[i]->address->target, info[i]->address->unit); @@ -20017,8 +20015,7 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsi= nfo, /* match the disk to the target in the vm definition */ diskdef =3D virDomainDiskByAddress(vmdef, &d->pci_controller, - d->has_ccw_address ? - &d->ccw_addr : NULL, + d->ccw_addr, d->bus, d->target, d->unit); --=20 2.26.2