From nobody Sun Feb 8 21:11:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1642698081; cv=none; d=zohomail.com; s=zohoarc; b=mCdFtjEE0hf/RcbGUHq30Y1Mmx6LKRDd6xLVX+P0yY8Nwb3ibQN7QErkOEchEmkm0b/Dx6RR9BxPQtX7FW6zvFhXdzl1KYNMykUYzDSPoGfEKhcrPfbQw05yb5kwCqlKk8tLK7WDiGiuKoWeVA4JosIMQ5B0TLtYJ4ka9T6Vv1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642698081; h=Content-Type:Content-Transfer-Encoding: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=ENho7nWKhS/NrX+akwMwX7eSu57fXVEWfCRsqdesGeg=; b=Vcw1fRiFnj5dtIhhw54yksWrk7ylpVpA9t8bZBbSOou8JB+mWtOenmy7seYkjkYUZJJzgJ/C6IyAWhKOyLsyHXGyXfNazPZm/uMAU1fHslKi0Y+YWLjJu/frDlXUbU77aIPJosP3u/iRxR1asHlUFit8DtkW2WqEOM6Clq6NSpI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1642698081749751.2326180109235; Thu, 20 Jan 2022 09:01:21 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-R-26KgKqPp2kebPyMxAARQ-1; Thu, 20 Jan 2022 12:01:18 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9165A36393; Thu, 20 Jan 2022 17:01: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 700BD7EBDD; Thu, 20 Jan 2022 17:01: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 3C1544A7C9; Thu, 20 Jan 2022 17:01:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KH0aDm029429 for ; Thu, 20 Jan 2022 12:00:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id D4ADB7EBFF; Thu, 20 Jan 2022 17:00:36 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F2C47EBDD for ; Thu, 20 Jan 2022 17:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642698080; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ENho7nWKhS/NrX+akwMwX7eSu57fXVEWfCRsqdesGeg=; b=Ag461Db4t4ef1yPg56YOzndZDqjibUSISwNi1j7Oj2vkpoLSgm+DC6hz+RDD3/BHa8GlBv lxSHXHjYpFzoXqHOHWOpU9u6pNfFuxqCYfa72uYeO8rtVRzV0ylhoMoaysWpKPwNVELZGS FfGGK6uZCP8Ve4yDMcf14ooDAVbytls= X-MC-Unique: R-26KgKqPp2kebPyMxAARQ-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 3/3] libxl: use virDomainJobData instead of virDomainJobInfo Date: Thu, 20 Jan 2022 17:59:50 +0100 Message-Id: <85c8a36d6733e7928973666a33bcd0aefcb00d27.1642697881.git.khanicov@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@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.12 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) X-ZM-MESSAGEID: 1642698083296100003 Content-Type: text/plain; charset="utf-8" This transition will make it easier for me in order to generalize jobs in the future as they will always use virDomainJobData and virDomainJobInfo will be only used in the public api.. Signed-off-by: Kristina Hanicova Reviewed-by: Jiri Denemark --- src/libxl/libxl_domain.c | 10 +++++----- src/libxl/libxl_domain.h | 3 ++- src/libxl/libxl_driver.c | 14 +++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index feca60f7d2..8f2feb328b 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -60,7 +60,7 @@ libxlDomainObjInitJob(libxlDomainObjPrivate *priv) if (virCondInit(&priv->job.cond) < 0) return -1; =20 - priv->job.current =3D g_new0(virDomainJobInfo, 1); + priv->job.current =3D virDomainJobDataInit(NULL); =20 return 0; } @@ -78,7 +78,7 @@ static void libxlDomainObjFreeJob(libxlDomainObjPrivate *priv) { ignore_value(virCondDestroy(&priv->job.cond)); - VIR_FREE(priv->job.current); + virDomainJobDataFree(priv->job.current); } =20 /* Give up waiting for mutex after 30 seconds */ @@ -119,7 +119,7 @@ libxlDomainObjBeginJob(libxlDriverPrivate *driver G_GNU= C_UNUSED, priv->job.active =3D job; priv->job.owner =3D virThreadSelfID(); priv->job.started =3D now; - priv->job.current->type =3D VIR_DOMAIN_JOB_UNBOUNDED; + priv->job.current->jobType =3D VIR_DOMAIN_JOB_UNBOUNDED; =20 return 0; =20 @@ -168,7 +168,7 @@ libxlDomainObjEndJob(libxlDriverPrivate *driver G_GNUC_= UNUSED, int libxlDomainJobUpdateTime(struct libxlDomainJobObj *job) { - virDomainJobInfoPtr jobInfo =3D job->current; + virDomainJobData *jobData =3D job->current; unsigned long long now; =20 if (!job->started) @@ -182,7 +182,7 @@ libxlDomainJobUpdateTime(struct libxlDomainJobObj *job) return 0; } =20 - jobInfo->timeElapsed =3D now - job->started; + jobData->timeElapsed =3D now - job->started; return 0; } =20 diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h index 981bfc2bca..475e4a6933 100644 --- a/src/libxl/libxl_domain.h +++ b/src/libxl/libxl_domain.h @@ -26,6 +26,7 @@ #include "libxl_conf.h" #include "virchrdev.h" #include "virenum.h" +#include "domain_job.h" =20 /* Only 1 job is allowed at any time * A job includes *all* libxl.so api, even those just querying @@ -46,7 +47,7 @@ struct libxlDomainJobObj { enum libxlDomainJob active; /* Currently running job */ int owner; /* Thread which set current job */ unsigned long long started; /* When the job started */ - virDomainJobInfoPtr current; /* Statistics for the current job = */ + virDomainJobData *current; /* Statistics for the current job */ }; =20 typedef struct _libxlDomainObjPrivate libxlDomainObjPrivate; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 2d9385654c..03d542299b 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -5212,7 +5212,11 @@ libxlDomainGetJobInfo(virDomainPtr dom, if (libxlDomainJobUpdateTime(&priv->job) < 0) goto cleanup; =20 - memcpy(info, priv->job.current, sizeof(virDomainJobInfo)); + /* setting only these two attributes is enough because libxl never sets + * anything else */ + memset(info, 0, sizeof(*info)); + info->type =3D priv->job.current->jobType; + info->timeElapsed =3D priv->job.current->timeElapsed; ret =3D 0; =20 cleanup: @@ -5229,7 +5233,7 @@ libxlDomainGetJobStats(virDomainPtr dom, { libxlDomainObjPrivate *priv; virDomainObj *vm; - virDomainJobInfoPtr jobInfo; + virDomainJobData *jobData; int ret =3D -1; int maxparams =3D 0; =20 @@ -5243,7 +5247,7 @@ libxlDomainGetJobStats(virDomainPtr dom, goto cleanup; =20 priv =3D vm->privateData; - jobInfo =3D priv->job.current; + jobData =3D priv->job.current; if (!priv->job.active) { *type =3D VIR_DOMAIN_JOB_NONE; *params =3D NULL; @@ -5260,10 +5264,10 @@ libxlDomainGetJobStats(virDomainPtr dom, =20 if (virTypedParamsAddULLong(params, nparams, &maxparams, VIR_DOMAIN_JOB_TIME_ELAPSED, - jobInfo->timeElapsed) < 0) + jobData->timeElapsed) < 0) goto cleanup; =20 - *type =3D jobInfo->type; + *type =3D jobData->jobType; ret =3D 0; =20 cleanup: --=20 2.34.1