From nobody Mon Feb 9 06:02:24 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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=1646229349; cv=none; d=zohomail.com; s=zohoarc; b=QMZMickyREcS3imdbryhRf3BNPMcjR5mHBu9Mpn+o9/Qrptot5D/ryJyufMrMbChK2c0Z8lz3T4X5HVuUxuuaugf61Lb51g8WEEA5GEEgnMDxL3vmJV6GGmKzyh7ht/YhftwusAZkL8Kq4/1ll9FfsFwIsbwoOrj0fkw1G2O3c0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646229349; 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=i3IHH1G6imDxzv3vp/InxO2CJdAwcDBARfolooJsWFc=; b=LuEuGWYfmqYrmmEeRvYBvpoXRq5Z+NBQutLmlp/kFOUXZXRqGRscaodxORmAyyom8lociGLfQlhQq2ULFd5KGYsgDCSdr2hkJ5V4lOSSIZ8SRfQrdAuLJ6ksNpdAFOiLcjm7nfxqZtKM8yFNlquAjhBvxcEYISMq5LY9KUUiKvM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1646229349653311.3799852546839; Wed, 2 Mar 2022 05:55:49 -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-446-74ssv447PtSalrE83g8B6g-1; Wed, 02 Mar 2022 08:55:47 -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 632021091DA2; Wed, 2 Mar 2022 13:55:42 +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 432248495C; Wed, 2 Mar 2022 13:55:42 +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 1634F1809CB3; Wed, 2 Mar 2022 13:55:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 222Dtexe017454 for ; Wed, 2 Mar 2022 08:55:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id AB87A832B4; Wed, 2 Mar 2022 13:55:40 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1078017B7D for ; Wed, 2 Mar 2022 13:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646229349; 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=i3IHH1G6imDxzv3vp/InxO2CJdAwcDBARfolooJsWFc=; b=OLo2SCNtPTQ7JxXZELMi3D9vKdDrN430vTgGosxKkxIRuQMoJukSLHS9G8NVKLJDqiGJfN X+txI1+jL3Et622jwPumQx/quaDgtuXmR4BbcDHU55BdH7C41j9jET0notCmJwG9SJSKyO IoeBs9hTHgBvchdHf02HTXTg7PQ2W8s= X-MC-Unique: 74ssv447PtSalrE83g8B6g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/23] virsh: Move 'virshDomainBlockJobToString' to virsh-util Date: Wed, 2 Mar 2022 14:55:07 +0100 Message-Id: <234cfcee30194db08b56ef85c511685193e25e5d.1646229194.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1646229361482100001 Content-Type: text/plain; charset="utf-8" The helper function is used in virshBlockJobInfo and also in the callbacks of cmdEvent. Upcoming patch is going to move out the event code into a helper so this needs to be in a shared place. Signed-off-by: Peter Krempa --- tools/virsh-domain.c | 19 ------------------- tools/virsh-util.c | 19 +++++++++++++++++++ tools/virsh-util.h | 5 +++++ 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 33984618eb..9c304dbf78 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2614,25 +2614,6 @@ static const vshCmdOptDef opts_blockjob[] =3D { {.name =3D NULL} }; -VIR_ENUM_DECL(virshDomainBlockJob); -VIR_ENUM_IMPL(virshDomainBlockJob, - VIR_DOMAIN_BLOCK_JOB_TYPE_LAST, - N_("Unknown job"), - N_("Block Pull"), - N_("Block Copy"), - N_("Block Commit"), - N_("Active Block Commit"), - N_("Backup"), -); - -static const char * -virshDomainBlockJobToString(int type) -{ - const char *str =3D virshDomainBlockJobTypeToString(type); - return str ? _(str) : _("Unknown job"); -} - - static bool virshBlockJobInfo(vshControl *ctl, virDomainPtr dom, diff --git a/tools/virsh-util.c b/tools/virsh-util.c index 8fb617fa3c..dc6ed7a86d 100644 --- a/tools/virsh-util.c +++ b/tools/virsh-util.c @@ -418,3 +418,22 @@ virshDomainGetXML(vshControl *ctl, return ret; } + + +VIR_ENUM_IMPL(virshDomainBlockJob, + VIR_DOMAIN_BLOCK_JOB_TYPE_LAST, + N_("Unknown job"), + N_("Block Pull"), + N_("Block Copy"), + N_("Block Commit"), + N_("Active Block Commit"), + N_("Backup"), +); + + +const char * +virshDomainBlockJobToString(int type) +{ + const char *str =3D virshDomainBlockJobTypeToString(type); + return str ? _(str) : _("Unknown job"); +} diff --git a/tools/virsh-util.h b/tools/virsh-util.h index 838935d5e8..4d4fe6c01e 100644 --- a/tools/virsh-util.h +++ b/tools/virsh-util.h @@ -151,3 +151,8 @@ virshDomainGetXML(vshControl *ctl, xmlXPathContextPtr *ctxt) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) G_GNUC_WARN_UNUSED_RESULT; + +VIR_ENUM_DECL(virshDomainBlockJob); + +const char * +virshDomainBlockJobToString(int type); --=20 2.35.1