From nobody Tue Oct 22 22:29:45 2024 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=1694699863; cv=none; d=zohomail.com; s=zohoarc; b=AazGIxf5HotIFZLc1W29+AZVym8ZUfc0x7pQhFih1GOqwzA17EEScFAYsXkI/FKBGOgamSronHvw2tRFgdpp795SKAITtU8M73eeK5l9FAc0vZiktfmEUzV/YCTS+ZnorxhsfkxUpQ23JoQD45onMlIq3uxvK0um5Tkc3N1eW/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694699863; 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=NV0VJJp1zM8Gvt5VAdI16evdi3lSWqKFlpQBIeqB80U=; b=E8VMaaN32+RhV3xEv/LDvHtZYMmfD7QgcuLMOs5dlE2gijiC8PPnqBtuGrJPaC26lFZP0uDlbxzHhOoexk3JDgP6HF1NcBdwW3Zo/VjP5MQ2yDEE7ZeJDopJYe+Wm6geLPreQjzDYNhLGamrmuZ6DSMfjyTt4DSgSN4uV4aTmI0= 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 1694699863749393.5545335791097; Thu, 14 Sep 2023 06:57:43 -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-678-AKl-wLFVOXqmaiGZqQgu9g-1; Thu, 14 Sep 2023 09:57:39 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 69E3F1818E4B; Thu, 14 Sep 2023 13:57:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 535B71054FC0; Thu, 14 Sep 2023 13:57:37 +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 4073719466FE; Thu, 14 Sep 2023 13:56:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6B5C819452F4 for ; Thu, 14 Sep 2023 13:56:35 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6496140C6ECE; Thu, 14 Sep 2023 13:56:35 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C0F540C6EC0 for ; Thu, 14 Sep 2023 13:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694699862; 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=NV0VJJp1zM8Gvt5VAdI16evdi3lSWqKFlpQBIeqB80U=; b=Io67yM2At/12tbQa8Wk1JeMg8gC1NQdT4UM7qLRq1ABr8Y5VrwrH5IbpaYc5QmZGioiPwE 7vJz9qjkRkc/wifD5ZBQaO9lPP8rHYROdSyu4WOOypv+RQF7phWCQCHgCPXWYELhW9o2mN 3bt1LW4TLT5N3uUQPWDSNK+Y9fZ7wik= X-MC-Unique: AKl-wLFVOXqmaiGZqQgu9g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 17/20] virDomainWatchdogDef: Convert 'action' field to proper enum type Date: Thu, 14 Sep 2023 15:56:18 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1694699865180100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Convert the field and adjust the XML parser to use virXMLPropEnumDefault(). Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 17 ++++++----------- src/conf/domain_conf.h | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5c1712cb46..f48020f893 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12065,7 +12065,6 @@ virDomainWatchdogDefParseXML(virDomainXMLOption *xm= lopt, unsigned int flags) { virDomainWatchdogDef *def; - g_autofree char *action =3D NULL; =20 def =3D g_new0(virDomainWatchdogDef, 1); =20 @@ -12076,16 +12075,12 @@ virDomainWatchdogDefParseXML(virDomainXMLOption *= xmlopt, goto error; } =20 - action =3D virXMLPropString(node, "action"); - if (action =3D=3D NULL) { - def->action =3D VIR_DOMAIN_WATCHDOG_ACTION_RESET; - } else { - def->action =3D virDomainWatchdogActionTypeFromString(action); - if (def->action < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown watchdog action '%1$s'"), action); - goto error; - } + if (virXMLPropEnumDefault(node, "action", + virDomainWatchdogActionTypeFromString, + VIR_XML_PROP_NONE, + &def->action, + VIR_DOMAIN_WATCHDOG_ACTION_RESET) < 0) { + goto error; } =20 if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags)= < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e7c663b0e9..77e5b26957 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1760,7 +1760,7 @@ typedef enum { =20 struct _virDomainWatchdogDef { virDomainWatchdogModel model; - int action; + virDomainWatchdogAction action; virDomainDeviceInfo info; }; =20 --=20 2.41.0