From nobody Sun Feb 8 18:31:58 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=1648819671; cv=none; d=zohomail.com; s=zohoarc; b=kLCbJrw0XdQT8ISKluDOo82KiL1JveOhLrGE7Hu6H3nsVYowqmUOLI0x65bI73paLEhotu7fpD5SV+ek+1OASchdDAUDVlssjPLDsOZGG1vz7+TsFxNc2Nfo94QJida1CpUaaYHZ68+gc2BYKTOSFRyLZyz48GYcSbaF5L6WtxU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648819671; 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=GdiPa6EVZLCgACac4GEObShbh8y8zmEdFiUKUJIuDYI=; b=jRqgPeFfPvrE+wlsmm/a+K+w4paioulGZCo86sotMaogU5ef+lreNuH4yzmCgOjgR3ZgK6t0TAjZ+bGkg/SffDopWXMIQXNotgELi7J38d7nAj1gHpAiHi+LU9rj2wtZUJekfmNAbRIpY2LVjNkg9a2CNzMXa7RXQ4EPXr1I7JA= 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 1648819671233266.1947098603158; Fri, 1 Apr 2022 06:27:51 -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-213-UxqP_WMcM8yDWAMYGfUS5Q-1; Fri, 01 Apr 2022 09:27:46 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0853B8117B0; Fri, 1 Apr 2022 13:27:44 +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 E594240CF8F4; Fri, 1 Apr 2022 13:27:43 +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 7371E1947BBF; Fri, 1 Apr 2022 13:27:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D33771949761 for ; Fri, 1 Apr 2022 13:27:41 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B2AE2C28104; Fri, 1 Apr 2022 13:27:41 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59D44C28103 for ; Fri, 1 Apr 2022 13:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648819670; 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=GdiPa6EVZLCgACac4GEObShbh8y8zmEdFiUKUJIuDYI=; b=QKXxRHdsqeVDZr/JginqXwzxb4jE7q5uB7dAH7MSAlI2E57kev/hvIZnM2z+5ekqAZXrVR /dmuAKVe05zw8OdZ2FZkrvaJNqgUO3v0RwXuyFENkDnIgs8GFf62Ul8tblsgaOzw+7gpZ1 LcUEK4+At86PTwrvxiNNK+AITFYiijA= X-MC-Unique: UxqP_WMcM8yDWAMYGfUS5Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] tools: use VIR_ELSIF more Date: Fri, 1 Apr 2022 15:27:36 +0200 Message-Id: <423e89c4f7c18a40633e683b31cd7745f976efc9.1648819564.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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 2.84 on 10.11.54.1 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1648819673180100003 Nobody pronounces the 'e' anyway. Signed-off-by: J=C3=A1n Tomko --- tools/virsh-checkpoint.c | 4 +- tools/virsh-completer-domain.c | 2 +- tools/virsh-domain-monitor.c | 10 +-- tools/virsh-domain.c | 144 +++++++++++++++--------------- tools/virsh-host.c | 8 +- tools/virsh-interface.c | 2 +- tools/virsh-network.c | 12 +-- tools/virsh-pool.c | 6 +- tools/virsh-secret.c | 4 +- tools/virsh-snapshot.c | 18 ++-- tools/virsh.c | 6 +- tools/virt-admin.c | 6 +- tools/virt-host-validate-bhyve.c | 6 +- tools/virt-host-validate-ch.c | 2 +- tools/virt-host-validate-common.c | 12 +-- tools/virt-host-validate-qemu.c | 2 +- tools/vsh-table.c | 2 +- tools/vsh.c | 28 +++--- 18 files changed, 137 insertions(+), 137 deletions(-) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index fd8cd8827f..9a2e11c7d6 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -166,7 +166,7 @@ virshParseCheckpointDiskspec(vshControl *ctl, for (i =3D 1; i < narray; i++) { if (!checkpoint && STRPREFIX(array[i], "checkpoint=3D")) checkpoint =3D array[i] + strlen("checkpoint=3D"); - else if (!bitmap && STRPREFIX(array[i], "bitmap=3D")) + VIR_ELSIF (!bitmap && STRPREFIX(array[i], "bitmap=3D")) bitmap =3D array[i] + strlen("bitmap=3D"); else goto cleanup; @@ -409,7 +409,7 @@ virshGetCheckpointParent(vshControl *ctl, /* API works, and virDomainCheckpointGetName will succeed */ *parent_name =3D g_strdup(virDomainCheckpointGetName(parent)); ret =3D 0; - } else if (last_error->code =3D=3D VIR_ERR_NO_DOMAIN_CHECKPOINT) { + } VIR_ELSIF (last_error->code =3D=3D VIR_ERR_NO_DOMAIN_CHECKPOINT) { /* API works, and we found a root with no parent */ ret =3D 0; } diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 620a3a8ddb..852f1729bb 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -759,7 +759,7 @@ virshDomainVcpulistViaAgentCompleter(vshControl *ctl, =20 cpulist[i] =3D g_strdup_printf("%zu", j++); } - } else if (disable) { + } VIR_ELSIF (disable) { lastcpu =3D virBitmapLastSetBit(onlineVcpus); cpulist =3D g_new0(char *, virBitmapCountBits(onlineVcpus) + 1= ); for (i =3D 0; i < virBitmapCountBits(onlineVcpus); i++) { diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index e66383af05..ef8e6c8aa1 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -418,7 +418,7 @@ cmdDomblkinfoGet(const virDomainBlockInfo *info, *cap =3D g_strdup("-"); *alloc =3D g_strdup("-"); *phy =3D g_strdup("-"); - } else if (!human) { + } VIR_ELSIF (!human) { *cap =3D g_strdup_printf("%llu", info->capacity); *alloc =3D g_strdup_printf("%llu", info->allocation); *phy =3D g_strdup_printf("%llu", info->physical); @@ -815,7 +815,7 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd) vshError(ctl, _("Interface (dev: %s) not found."), iface); =20 return false; - } else if (ninterfaces > 1) { + } VIR_ELSIF (ninterfaces > 1) { vshError(ctl, _("multiple matching interfaces found")); return false; } @@ -865,7 +865,7 @@ cmdDomControl(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s (%0.3fs)\n", virshDomainControlStateToString(info.state), info.stateTime / 1000.0); - } else if (info.state =3D=3D VIR_DOMAIN_CONTROL_ERROR && info.details = > 0) { + } VIR_ELSIF (info.state =3D=3D VIR_DOMAIN_CONTROL_ERROR && info.detail= s > 0) { vshPrint(ctl, "%s: %s\n", virshDomainControlStateToString(info.state), virshDomainControlErrorReasonToString(info.details)); @@ -1436,7 +1436,7 @@ cmdDomTime(vshControl *ctl, const vshCmd *cmd) if (rv < 0) { /* invalid integer format */ return false; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { /* valid integer to set */ doSet =3D true; } @@ -1511,7 +1511,7 @@ virshDomainSorter(const void *a, const void *b) if (ida !=3D inactive && idb !=3D inactive) { if (ida > idb) return 1; - else if (ida < idb) + VIR_ELSIF (ida < idb) return -1; } =20 diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index bbebd8fd72..58d2cdb703 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -561,7 +561,7 @@ cmdAttachDiskFormatAddress(vshControl *ctl, _("expecting a pci:0000.00.00.00 or ccw:00.0.0000 add= ress.")); return -1; } - } else if (STRPREFIX((const char *)target, "sd")) { + } VIR_ELSIF (STRPREFIX((const char *)target, "sd")) { if (diskAddr.type !=3D VIRSH_ADDRESS_TYPE_SCSI && diskAddr.type !=3D VIRSH_ADDRESS_TYPE_USB && diskAddr.type !=3D VIRSH_ADDRESS_TYPE_SATA) { @@ -569,7 +569,7 @@ cmdAttachDiskFormatAddress(vshControl *ctl, _("expecting a scsi:00.00.00 or usb:00.00 or sata:00.= 00.00 address.")); return -1; } - } else if (STRPREFIX((const char *)target, "hd")) { + } VIR_ELSIF (STRPREFIX((const char *)target, "hd")) { if (diskAddr.type !=3D VIRSH_ADDRESS_TYPE_IDE) { vshError(ctl, "%s", _("expecting an ide:00.00.00 address.")); return -1; @@ -1422,7 +1422,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) if ((rv =3D vshCommandOptScaledInt(ctl, cmd, #PARAM, &value, \ 1, ULLONG_MAX)) < 0) { \ goto interror; \ - } else if (rv > 0) { \ + } VIR_ELSIF (rv > 0) { \ if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, \ VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \ value) < 0) \ @@ -1440,7 +1440,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) #define VSH_ADD_IOTUNE(PARAM, CONST) \ if ((rv =3D vshCommandOptULongLong(ctl, cmd, #PARAM, &value)) < 0) { \ goto interror; \ - } else if (rv > 0) { \ + } VIR_ELSIF (rv > 0) { \ if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, \ VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \ value) < 0) \ @@ -1609,7 +1609,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) =20 if ((rv =3D vshCommandOptInt(ctl, cmd, "weight", &weight)) < 0) { goto cleanup; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (weight <=3D 0) { vshError(ctl, _("Invalid value of %d for I/O weight"), weight); goto cleanup; @@ -1623,7 +1623,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) if (rv < 0) { vshError(ctl, "%s", _("Unable to parse string parameter")); goto cleanup; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddString(¶ms, &nparams, &maxparams, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT, device_weight) < 0) @@ -1634,7 +1634,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) if (rv < 0) { vshError(ctl, "%s", _("Unable to parse string parameter")); goto cleanup; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddString(¶ms, &nparams, &maxparams, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS, device_riops) < 0) @@ -1645,7 +1645,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) if (rv < 0) { vshError(ctl, "%s", _("Unable to parse string parameter")); goto cleanup; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddString(¶ms, &nparams, &maxparams, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS, device_wiops) < 0) @@ -1656,7 +1656,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) if (rv < 0) { vshError(ctl, "%s", _("Unable to parse string parameter")); goto cleanup; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddString(¶ms, &nparams, &maxparams, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS, device_rbps) < 0) @@ -1667,7 +1667,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) if (rv < 0) { vshError(ctl, "%s", _("Unable to parse string parameter")); goto cleanup; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddString(¶ms, &nparams, &maxparams, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS, device_wbps) < 0) @@ -2211,7 +2211,7 @@ cmdBlockcommit(vshControl *ctl, const vshCmd *cmd) } =20 vshPrintExtra(ctl, "\n%s", _("Successfully pivoted")); - } else if (finish) { + } VIR_ELSIF (finish) { if (virDomainBlockJobAbort(dom, path, abort_flags) < 0) { vshError(ctl, _("failed to finish job for disk %s"), path); goto cleanup; @@ -2542,7 +2542,7 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd) } =20 vshPrintExtra(ctl, "\n%s", _("Successfully pivoted")); - } else if (finish) { + } VIR_ELSIF (finish) { if (virDomainBlockJobAbort(dom, path, abort_flags) < 0) { vshError(ctl, _("failed to finish job for disk %s"), path); goto cleanup; @@ -4106,7 +4106,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) if (rc < 0) { /* No managed save image to remove */ vshResetLibvirtError(); - } else if (rc > 0) { + } VIR_ELSIF (rc > 0) { if (virDomainManagedSaveRemove(dom, 0) < 0) { vshReportError(ctl); return false; @@ -4118,7 +4118,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) /* Prefer older API unless we have to pass a flag. */ if (nfds > 0) { rc =3D virDomainCreateWithFiles(dom, nfds, fds, flags); - } else if (flags !=3D 0) { + } VIR_ELSIF (flags !=3D 0) { rc =3D virDomainCreateWithFlags(dom, flags); } else { rc =3D virDomainCreate(dom); @@ -5555,7 +5555,7 @@ virshGenFileName(vshControl *ctl, virDomainPtr dom, c= onst char *mime) =20 if (STREQ(mime, "image/x-portable-pixmap")) ext =3D ".ppm"; - else if (STREQ(mime, "image/png")) + VIR_ELSIF (STREQ(mime, "image/png")) ext =3D ".png"; /* add mime type here */ =20 @@ -5886,13 +5886,13 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd) mode =3D *tmp; if (STREQ(mode, "acpi")) { flags |=3D VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN; - } else if (STREQ(mode, "agent")) { + } VIR_ELSIF (STREQ(mode, "agent")) { flags |=3D VIR_DOMAIN_SHUTDOWN_GUEST_AGENT; - } else if (STREQ(mode, "initctl")) { + } VIR_ELSIF (STREQ(mode, "initctl")) { flags |=3D VIR_DOMAIN_SHUTDOWN_INITCTL; - } else if (STREQ(mode, "signal")) { + } VIR_ELSIF (STREQ(mode, "signal")) { flags |=3D VIR_DOMAIN_SHUTDOWN_SIGNAL; - } else if (STREQ(mode, "paravirt")) { + } VIR_ELSIF (STREQ(mode, "paravirt")) { flags |=3D VIR_DOMAIN_SHUTDOWN_PARAVIRT; } else { vshError(ctl, _("Unknown mode %s value, expecting " @@ -5966,13 +5966,13 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd) mode =3D *tmp; if (STREQ(mode, "acpi")) { flags |=3D VIR_DOMAIN_REBOOT_ACPI_POWER_BTN; - } else if (STREQ(mode, "agent")) { + } VIR_ELSIF (STREQ(mode, "agent")) { flags |=3D VIR_DOMAIN_REBOOT_GUEST_AGENT; - } else if (STREQ(mode, "initctl")) { + } VIR_ELSIF (STREQ(mode, "initctl")) { flags |=3D VIR_DOMAIN_REBOOT_INITCTL; - } else if (STREQ(mode, "signal")) { + } VIR_ELSIF (STREQ(mode, "signal")) { flags |=3D VIR_DOMAIN_REBOOT_SIGNAL; - } else if (STREQ(mode, "paravirt")) { + } VIR_ELSIF (STREQ(mode, "paravirt")) { flags |=3D VIR_DOMAIN_REBOOT_PARAVIRT; } else { vshError(ctl, _("Unknown mode %s value, expecting " @@ -6176,7 +6176,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) if (rc =3D=3D 0) { if (virshDomainJobStatsToDomainJobInfo(params, nparams, &info) < 0) goto cleanup; - } else if (last_error->code =3D=3D VIR_ERR_NO_SUPPORT) { + } VIR_ELSIF (last_error->code =3D=3D VIR_ERR_NO_SUPPORT) { if (flags !=3D 0 || rawstats) { vshError(ctl, "%s", _("Optional flags or --rawstats are not supported by = the daemon")); @@ -6231,7 +6231,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_TIME_ELAPSED_NET, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-12llu ms\n", _("Time elapsed w/o network:"), value); } @@ -6261,7 +6261,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_MEMORY_BPS, &value)) < 0) { goto save_error; - } else if (rc && value) { + } VIR_ELSIF (rc && value) { val =3D vshPrettyCapacity(value, &unit); vshPrint(ctl, "%-17s %-.3lf %s/s\n", _("Memory bandwidth:"), val, unit); @@ -6271,7 +6271,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-12llu pages/s\n", _("Dirty rate:"), val= ue); } =20 @@ -6279,7 +6279,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-12llu bytes\n", _("Page size:"), value); } =20 @@ -6287,7 +6287,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_MEMORY_ITERATION, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-12llu\n", _("Iteration:"), value); } =20 @@ -6295,7 +6295,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_MEMORY_POSTCOPY_R= EQS, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-12llu\n", _("Postcopy requests:"), valu= e); } } @@ -6312,7 +6312,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_DISK_BPS, &value)) < 0) { goto save_error; - } else if (rc && value) { + } VIR_ELSIF (rc && value) { val =3D vshPrettyCapacity(value, &unit); vshPrint(ctl, "%-17s %-.3lf %s/s\n", _("File bandwidth:"), val, unit); @@ -6323,21 +6323,21 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_MEMORY_CONSTANT, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-12llu\n", _("Constant pages:"), value); } if ((rc =3D virTypedParamsGetULLong(params, nparams, VIR_DOMAIN_JOB_MEMORY_NORMAL, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-12llu\n", _("Normal pages:"), value); } if ((rc =3D virTypedParamsGetULLong(params, nparams, VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { val =3D vshPrettyCapacity(value, &unit); vshPrint(ctl, "%-17s %-.3lf %s\n", _("Normal data:"), val, unit); } @@ -6346,7 +6346,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_DOWNTIME, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { if (info.type =3D=3D VIR_DOMAIN_JOB_COMPLETED) { vshPrint(ctl, "%-17s %-12llu ms\n", _("Total downtime:"), value); @@ -6360,21 +6360,21 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_DOWNTIME_NET, &value)) < 0) goto save_error; - else if (rc) + VIR_ELSIF (rc) vshPrint(ctl, "%-17s %-12llu ms\n", _("Downtime w/o network:"), va= lue); =20 if ((rc =3D virTypedParamsGetULLong(params, nparams, VIR_DOMAIN_JOB_SETUP_TIME, &value)) < 0) goto save_error; - else if (rc) + VIR_ELSIF (rc) vshPrint(ctl, "%-17s %-12llu ms\n", _("Setup time:"), value); =20 if ((rc =3D virTypedParamsGetULLong(params, nparams, VIR_DOMAIN_JOB_COMPRESSION_CACHE, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { val =3D vshPrettyCapacity(value, &unit); vshPrint(ctl, "%-17s %-.3lf %s\n", _("Compression cache:"), val, u= nit); } @@ -6382,7 +6382,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_COMPRESSION_BYTES, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { val =3D vshPrettyCapacity(value, &unit); vshPrint(ctl, "%-17s %-.3lf %s\n", _("Compressed data:"), val, uni= t); } @@ -6390,21 +6390,21 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_COMPRESSION_PAGES, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-13llu\n", _("Compressed pages:"), value); } if ((rc =3D virTypedParamsGetULLong(params, nparams, VIR_DOMAIN_JOB_COMPRESSION_CACHE_MIS= SES, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-13llu\n", _("Compression cache misses:"), v= alue); } if ((rc =3D virTypedParamsGetULLong(params, nparams, VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-13llu\n", _("Compression overflows:"), valu= e); } =20 @@ -6412,7 +6412,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE, &ivalue)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { vshPrint(ctl, "%-17s %-13d\n", _("Auto converge throttle:"), ivalu= e); } =20 @@ -6420,7 +6420,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_DISK_TEMP_USED, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { val =3D vshPrettyCapacity(value, &unit); vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space use:"),= val, unit); } @@ -6429,7 +6429,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) VIR_DOMAIN_JOB_DISK_TEMP_TOTAL, &value)) < 0) { goto save_error; - } else if (rc) { + } VIR_ELSIF (rc) { val =3D vshPrettyCapacity(value, &unit); vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space total:"= ), val, unit); } @@ -6437,7 +6437,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) if ((rc =3D virTypedParamsGetString(params, nparams, VIR_DOMAIN_JOB_ER= RMSG, &svalue)) < 0) { goto save_error; - } else if (rc =3D=3D 1) { + } VIR_ELSIF (rc =3D=3D 1) { vshPrint(ctl, "%-17s %s\n", _("Error message:"), svalue); } =20 @@ -7972,7 +7972,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd) =20 if ((rv =3D vshCommandOptInt(ctl, cmd, "start", &cpu)) < 0) { goto cleanup; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (cpu < 0) { vshError(ctl, "%s", _("Invalid value for start CPU")); goto cleanup; @@ -7982,7 +7982,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd) =20 if ((rv =3D vshCommandOptInt(ctl, cmd, "count", &show_count)) < 0) { goto cleanup; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (show_count < 0) { vshError(ctl, "%s", _("Invalid value for number of CPUs to sho= w")); goto cleanup; @@ -8561,7 +8561,7 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd) vshPrintExtra(ctl, "%s\n", _("Metadata removed")); else vshPrintExtra(ctl, "%s\n", _("Metadata modified")); - } else if (edit) { + } VIR_ELSIF (edit) { #define EDIT_GET_XML \ virshDomainGetEditMetadata(ctl, dom, uri, flags) #define EDIT_NOT_CHANGED \ @@ -8787,7 +8787,7 @@ static int getSignalNumber(const char *signame) =20 if (STRPREFIX(p, "sig_")) p +=3D 4; - else if (STRPREFIX(p, "sig")) + VIR_ELSIF (STRPREFIX(p, "sig")) p +=3D 3; =20 return virshDomainProcessSignalTypeFromString(p); @@ -9036,7 +9036,7 @@ virshGetUpdatedMemoryXML(char **updatedMemoryXML, =20 if (nodeOpt) { xpath =3D g_strdup_printf("/domain/devices/memory[./target/node=3D= '%u']", node); - } else if (alias) { + } VIR_ELSIF (alias) { xpath =3D g_strdup_printf("/domain/devices/memory[./alias/@name=3D= '%s']", alias); } else { xpath =3D g_strdup("/domain/devices/memory"); @@ -9046,10 +9046,10 @@ virshGetUpdatedMemoryXML(char **updatedMemoryXML, if (nmems < 0) { vshSaveLibvirtError(); return -1; - } else if (nmems =3D=3D 0) { + } VIR_ELSIF (nmems =3D=3D 0) { vshError(ctl, _("no memory device found")); return -1; - } else if (nmems > 1) { + } VIR_ELSIF (nmems > 1) { vshError(ctl, _("multiple memory devices found, use --alias or --n= ode to select one")); return -1; } @@ -9696,7 +9696,7 @@ cmdDomSetLaunchSecState(vshControl * ctl, const vshCm= d * cmd) =20 if ((rv =3D vshCommandOptULongLong(ctl, cmd, "set-address", &setaddr))= < 0) { return false; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_= SET_ADDRESS, setaddr) < 0) @@ -10183,7 +10183,7 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *= cmd) judge =3D vshCommandOptInt(ctl, cmd, "timeout", &timeout); if (judge < 0) goto cleanup; - else if (judge > 0) + VIR_ELSIF (judge > 0) judge =3D 1; if (judge && timeout < 1) { vshError(ctl, "%s", _("timeout must be positive")); @@ -10514,7 +10514,7 @@ cmdDomXMLToNative(vshControl *ctl, const vshCmd *cm= d) =20 if (dom) { xmlData =3D virDomainGetXMLDesc(dom, flags); - } else if (xmlFile) { + } VIR_ELSIF (xmlFile) { if (virFileReadAll(xmlFile, VSH_MAX_XML_FILE, &xmlData) < 0) return false; } else { @@ -11018,7 +11018,7 @@ doMigrate(void *opaque) =20 if ((rv =3D vshCommandOptInt(ctl, cmd, "comp-mt-level", &intOpt)) < 0)= { goto out; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, intOpt) < 0) @@ -11027,7 +11027,7 @@ doMigrate(void *opaque) =20 if ((rv =3D vshCommandOptInt(ctl, cmd, "comp-mt-threads", &intOpt)) < = 0) { goto out; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, intOpt) < 0) @@ -11036,7 +11036,7 @@ doMigrate(void *opaque) =20 if ((rv =3D vshCommandOptInt(ctl, cmd, "comp-mt-dthreads", &intOpt)) <= 0) { goto out; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, intOpt) < 0) @@ -11045,7 +11045,7 @@ doMigrate(void *opaque) =20 if ((rv =3D vshCommandOptULongLong(ctl, cmd, "comp-xbzrle-cache", &ull= Opt)) < 0) { goto out; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_C= ACHE, ullOpt) < 0) @@ -11090,7 +11090,7 @@ doMigrate(void *opaque) =20 if ((rv =3D vshCommandOptInt(ctl, cmd, "auto-converge-initial", &intOp= t)) < 0) { goto out; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, intOpt) < 0) @@ -11099,7 +11099,7 @@ doMigrate(void *opaque) =20 if ((rv =3D vshCommandOptInt(ctl, cmd, "auto-converge-increment", &int= Opt)) < 0) { goto out; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, intOpt) < 0) @@ -11108,7 +11108,7 @@ doMigrate(void *opaque) =20 if ((rv =3D vshCommandOptULongLong(ctl, cmd, "postcopy-bandwidth", &ul= lOpt)) < 0) { goto out; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, ullOpt) < 0) @@ -11117,7 +11117,7 @@ doMigrate(void *opaque) =20 if ((rv =3D vshCommandOptInt(ctl, cmd, "parallel-connections", &intOpt= )) < 0) { goto out; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddInt(¶ms, &nparams, &maxparams, VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, intOpt) < 0) @@ -11126,7 +11126,7 @@ doMigrate(void *opaque) =20 if ((rv =3D vshCommandOptULongLong(ctl, cmd, "bandwidth", &ullOpt)) < = 0) { goto out; - } else if (rv > 0) { + } VIR_ELSIF (rv > 0) { if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, VIR_MIGRATE_PARAM_BANDWIDTH, ullOpt) < 0) @@ -11312,7 +11312,7 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd) live_flag =3D true; if (vshCommandOptUInt(ctl, cmd, "timeout", &timeout) < 0) { goto cleanup; - } else if (timeout > 0 && !live_flag) { + } VIR_ELSIF (timeout > 0 && !live_flag) { vshError(ctl, "%s", _("migrate: Unexpected timeout for offline migration")); goto cleanup; @@ -11325,7 +11325,7 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd) if (timeout > 0) { if (timeoutAction =3D=3D VIRSH_MIGRATE_TIMEOUT_DEFAULT) timeoutAction =3D VIRSH_MIGRATE_TIMEOUT_SUSPEND; - } else if (timeoutAction) { + } VIR_ELSIF (timeoutAction) { vshError(ctl, "%s", _("migrate: Unexpected --timeout-* option without --timeo= ut")); goto cleanup; @@ -11771,9 +11771,9 @@ virshGetOneDisplay(vshControl *ctl, /* Then host name or IP */ if (!listen_addr && !sockpath) virBufferAddLit(&buf, "localhost"); - else if (!sockpath && strchr(listen_addr, ':')) + VIR_ELSIF (!sockpath && strchr(listen_addr, ':')) virBufferAsprintf(&buf, "[%s]", listen_addr); - else if (sockpath) + VIR_ELSIF (sockpath) virBufferAsprintf(&buf, "%s", sockpath); else virBufferAsprintf(&buf, "%s", listen_addr); @@ -12524,7 +12524,7 @@ virshFindDisk(const char *doc, (tmp =3D virXMLPropString(cur, "dir")) || (tmp =3D virXMLPropString(cur, "name"))) { } - } else if (virXMLNodeNameEqual(cur, "target")) { + } VIR_ELSIF (virXMLNodeNameEqual(cur, "target")) { tmp =3D virXMLPropString(cur, "dev"); } =20 @@ -12600,7 +12600,7 @@ virshUpdateDiskXML(xmlNodePtr disk_node, =20 if (!source && virXMLNodeNameEqual(tmp, "source")) source =3D tmp; - else if (!target_node && virXMLNodeNameEqual(tmp, "target")) + VIR_ELSIF (!target_node && virXMLNodeNameEqual(tmp, "target")) target_node =3D tmp; =20 /* @@ -12619,7 +12619,7 @@ virshUpdateDiskXML(xmlNodePtr disk_node, /* forcibly switch to empty file cdrom */ source_block =3D false; new_source =3D NULL; - } else if (!new_source) { + } VIR_ELSIF (!new_source) { vshError(NULL, _("New disk media source was not specified")); return NULL; } diff --git a/tools/virsh-host.c b/tools/virsh-host.c index c537db1516..bccfb8ecf3 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -785,7 +785,7 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) if (i =3D=3D 0) { cpu_stats[field] =3D params[j].value; present[field] =3D true; - } else if (present[field]) { + } VIR_ELSIF (present[field]) { cpu_stats[field] =3D params[j].value - cpu_stats[field]; } } @@ -1488,7 +1488,7 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd) =20 if ((rc =3D vshCommandOptUInt(ctl, cmd, "shm-pages-to-scan", &value)) = < 0) { goto cleanup; - } else if (rc > 0) { + } VIR_ELSIF (rc > 0) { if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN, value) < 0) @@ -1497,7 +1497,7 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd) =20 if ((rc =3D vshCommandOptUInt(ctl, cmd, "shm-sleep-millisecs", &value)= ) < 0) { goto cleanup; - } else if (rc > 0) { + } VIR_ELSIF (rc > 0) { if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS, value) < 0) @@ -1506,7 +1506,7 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd) =20 if ((rc =3D vshCommandOptUInt(ctl, cmd, "shm-merge-across-nodes", &val= ue)) < 0) { goto cleanup; - } else if (rc > 0) { + } VIR_ELSIF (rc > 0) { if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODE= S, value) < 0) diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 2d65425a0d..3e13fcf85d 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -76,7 +76,7 @@ virshCommandOptInterfaceBy(vshControl *ctl, const vshCmd = *cmd, iface =3D virInterfaceLookupByName(priv->conn, n); =20 /* try it by MAC */ - } else if (is_mac && (flags & VIRSH_BYMAC)) { + } VIR_ELSIF (is_mac && (flags & VIRSH_BYMAC)) { vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface MAC\n", cmd->def->name, optname); iface =3D virInterfaceLookupByMACString(priv->conn, n); diff --git a/tools/virsh-network.c b/tools/virsh-network.c index a87c7b599e..fa8cde1c1e 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -768,13 +768,13 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd G_G= NUC_UNUSED) _("yes") : _("no"), NULL) < 0) goto cleanup; - } else if (optUUID) { + } VIR_ELSIF (optUUID) { if (virNetworkGetUUIDString(network, uuid) < 0) { vshError(ctl, "%s", _("Failed to get network's UUID")); goto cleanup; } vshPrint(ctl, "%s\n", uuid); - } else if (optName) { + } VIR_ELSIF (optName) { vshPrint(ctl, "%s\n", virNetworkGetName(network)); } } @@ -1044,10 +1044,10 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd) else vshPrintExtra(ctl, _("Updated network %s persistent config"), virNetworkGetName(network)); - } else if (live) { + } VIR_ELSIF (live) { vshPrintExtra(ctl, _("Updated network %s live state"), virNetworkGetName(network)); - } else if (virNetworkIsActive(network)) { + } VIR_ELSIF (virNetworkIsActive(network)) { vshPrintExtra(ctl, _("Updated network %s live state"), virNetworkGetName(network)); } else { @@ -1429,7 +1429,7 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *c= md) =20 if (lease->type =3D=3D VIR_IP_ADDR_TYPE_IPV4) typestr =3D "ipv4"; - else if (lease->type =3D=3D VIR_IP_ADDR_TYPE_IPV6) + VIR_ELSIF (lease->type =3D=3D VIR_IP_ADDR_TYPE_IPV6) typestr =3D "ipv6"; =20 cidr_format =3D g_strdup_printf("%s/%d", lease->ipaddr, lease->pre= fix); @@ -1769,7 +1769,7 @@ cmdNetworkPortList(vshControl *ctl, const vshCmd *cmd) if (optTable) { if (vshTableRowAppend(table, uuid, NULL) < 0) goto cleanup; - } else if (optUUID) { + } VIR_ELSIF (optUUID) { vshPrint(ctl, "%s\n", uuid); } } diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 4026f9beb3..0273445ae9 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -386,15 +386,15 @@ virshBuildPoolXML(vshControl *ctl, virBufferAddLit(&buf, "\n", adapterWwnn, adapterWwpn); - } else if (adapterName) { + } VIR_ELSIF (adapterName) { virBufferAsprintf(&buf, "\n", adapterName); } diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 0347a2e894..c5db56a90d 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -237,7 +237,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd) vshError(ctl, _("Passing secret value as command-line argument is = insecure!")); secret_val =3D g_strdup(base64); secret_len =3D strlen(secret_val); - } else if (filename) { + } VIR_ELSIF (filename) { ssize_t read_ret; if ((read_ret =3D virFileReadAll(filename, 1024, &secret_val)) < 0= ) { vshSaveLibvirtError(); @@ -245,7 +245,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd) } =20 secret_len =3D read_ret; - } else if (interactive) { + } VIR_ELSIF (interactive) { vshPrint(ctl, "%s", _("Enter new value for secret:")); fflush(stdout); =20 diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 3c0294ad68..2e4cdebda1 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -224,9 +224,9 @@ virshParseSnapshotMemspec(vshControl *ctl, virBuffer *b= uf, const char *str) for (i =3D 0; i < narray; i++) { if (!snapshot && STRPREFIX(array[i], "snapshot=3D")) snapshot =3D array[i] + strlen("snapshot=3D"); - else if (!file && STRPREFIX(array[i], "file=3D")) + VIR_ELSIF (!file && STRPREFIX(array[i], "file=3D")) file =3D array[i] + strlen("file=3D"); - else if (!file && *array[i] =3D=3D '/') + VIR_ELSIF (!file && *array[i] =3D=3D '/') file =3D array[i]; else goto cleanup; @@ -265,11 +265,11 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBuffer= *buf, const char *str) for (i =3D 1; i < narray; i++) { if (!snapshot && STRPREFIX(array[i], "snapshot=3D")) snapshot =3D array[i] + strlen("snapshot=3D"); - else if (!driver && STRPREFIX(array[i], "driver=3D")) + VIR_ELSIF (!driver && STRPREFIX(array[i], "driver=3D")) driver =3D array[i] + strlen("driver=3D"); - else if (!stype && STRPREFIX(array[i], "stype=3D")) + VIR_ELSIF (!stype && STRPREFIX(array[i], "stype=3D")) stype =3D array[i] + strlen("stype=3D"); - else if (!file && STRPREFIX(array[i], "file=3D")) + VIR_ELSIF (!file && STRPREFIX(array[i], "file=3D")) file =3D array[i] + strlen("file=3D"); else goto cleanup; @@ -281,7 +281,7 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBuffer *= buf, const char *str) if (stype) { if (STREQ(stype, "block")) { isFile =3D false; - } else if (STRNEQ(stype, "file")) { + } VIR_ELSIF (STRNEQ(stype, "file")) { vshError(ctl, _("Unknown storage type: '%s'"), stype); goto cleanup; } @@ -469,7 +469,7 @@ virshLookupSnapshot(vshControl *ctl, const vshCmd *cmd, =20 if (snapname) { *snap =3D virDomainSnapshotLookupByName(dom, snapname, 0); - } else if (current) { + } VIR_ELSIF (current) { *snap =3D virDomainSnapshotCurrent(dom, 0); } else { vshError(ctl, _("--%s or --current is required"), arg); @@ -565,7 +565,7 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) edited_name =3D virDomainSnapshotGetName(edited); if (STREQ(name, edited_name)) { vshPrintExtra(ctl, _("Snapshot %s edited.\n"), name); - } else if (clone_okay) { + } VIR_ELSIF (clone_okay) { vshPrintExtra(ctl, _("Snapshot %s cloned to %s.\n"), name, edited_name); } else { @@ -1245,7 +1245,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPt= r dom, virshDomainSnapshotFree); VIR_FREE(snaplist->snaps[i].parent); deleted++; - } else if (STREQ(snaplist->snaps[i].parent, fromname)) { + } VIR_ELSIF (STREQ(snaplist->snaps[i].parent, fromname)) { VIR_FREE(snaplist->snaps[i].parent); changed =3D true; } else { diff --git a/tools/virsh.c b/tools/virsh.c index bb80a1eb75..cc5e9d5a94 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -154,7 +154,7 @@ virshConnect(vshControl *ctl, const char *uri, bool rea= donly) err->code =3D=3D VIR_ERR_AUTH_UNAVAILABLE) { VIR_UNLESS ((pkagent =3D virPolkitAgentCreate())) goto cleanup; - } else if (err && err->domain =3D=3D VIR_FROM_POLKIT && + } VIR_ELSIF (err && err->domain =3D=3D VIR_FROM_POLKIT && err->code =3D=3D VIR_ERR_AUTH_FAILED) { authfail++; } else { @@ -215,7 +215,7 @@ virshReconnect(vshControl *ctl, const char *name, bool = readonly, bool force) ret =3D virConnectClose(priv->conn); if (ret < 0) vshError(ctl, "%s", _("Failed to disconnect from the hyperviso= r")); - else if (ret > 0) + VIR_ELSIF (ret > 0) vshError(ctl, "%s", _("One or more references were leaked afte= r " "disconnect from the hypervisor")); } @@ -406,7 +406,7 @@ virshDeinit(vshControl *ctl) ret =3D virConnectClose(priv->conn); if (ret < 0) vshError(ctl, "%s", _("Failed to disconnect from the hyperviso= r")); - else if (ret > 0) + VIR_ELSIF (ret > 0) vshError(ctl, "%s", _("One or more references were leaked afte= r " "disconnect from the hypervisor")); } diff --git a/tools/virt-admin.c b/tools/virt-admin.c index d162be0155..2f6b82a6fe 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -141,7 +141,7 @@ vshAdmDisconnect(vshControl *ctl) ret =3D virAdmConnectClose(priv->conn); if (ret < 0) vshError(ctl, "%s", _("Failed to disconnect from the admin server"= )); - else if (ret > 0) + VIR_ELSIF (ret > 0) vshError(ctl, "%s", _("One or more references were leaked after " "disconnect from the hypervisor")); priv->conn =3D NULL; @@ -491,7 +491,7 @@ cmdSrvThreadpoolSet(vshControl *ctl, const vshCmd *cmd) if ((rv =3D vshCommandOptUInt(ctl, cmd, NAME, &val)) < 0) { \ vshError(ctl, _("Unable to parse integer parameter '%s'"), NAME); \ goto cleanup; \ - } else if (rv > 0) { \ + } VIR_ELSIF (rv > 0) { \ if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, \ FIELD, val) < 0) \ goto save_error; \ @@ -899,7 +899,7 @@ cmdSrvClientsSet(vshControl *ctl, const vshCmd *cmd) if ((rv =3D vshCommandOptUInt(ctl, cmd, NAME, &val)) < 0) { \ vshError(ctl, _("Unable to parse integer parameter '%s'"), NAME); \ goto cleanup; \ - } else if (rv > 0) { \ + } VIR_ELSIF (rv > 0) { \ if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, \ FIELD, val) < 0) \ goto save_error; \ diff --git a/tools/virt-host-validate-bhyve.c b/tools/virt-host-validate-bh= yve.c index 2f0ec1e36c..16f345b3ed 100644 --- a/tools/virt-host-validate-bhyve.c +++ b/tools/virt-host-validate-bhyve.c @@ -60,11 +60,11 @@ int virHostValidateBhyve(void) =20 if (STREQ(stat.name, "vmm.ko")) vmm_loaded =3D true; - else if (STREQ(stat.name, "if_tap.ko")) + VIR_ELSIF (STREQ(stat.name, "if_tap.ko")) if_tap_loaded =3D true; - else if (STREQ(stat.name, "if_bridge.ko")) + VIR_ELSIF (STREQ(stat.name, "if_bridge.ko")) if_bridge_loaded =3D true; - else if (STREQ(stat.name, "nmdm.ko")) + VIR_ELSIF (STREQ(stat.name, "nmdm.ko")) nmdm_loaded =3D true; } =20 diff --git a/tools/virt-host-validate-ch.c b/tools/virt-host-validate-ch.c index 8b4bb88061..42a6e9110a 100644 --- a/tools/virt-host-validate-ch.c +++ b/tools/virt-host-validate-ch.c @@ -74,7 +74,7 @@ int virHostValidateCh(void) if (virHostValidateDeviceExists("CH", "/dev/kvm", VIR_HOST_VALIDAT= E_FAIL, kvmhint) < 0) ret =3D -1; - else if (virHostValidateDeviceAccessible("CH", "/dev/kvm", VIR_HOS= T_VALIDATE_FAIL, + VIR_ELSIF (virHostValidateDeviceAccessible("CH", "/dev/kvm", VIR_H= OST_VALIDATE_FAIL, _("Check /dev/kvm is worl= d writable or you are in " "a group that is allowe= d to access it")) < 0) ret =3D -1; diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-c= ommon.c index 25cd60888a..cb0a152ce9 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -344,7 +344,7 @@ int virHostValidateIOMMU(const char *hvname, =20 if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX)) isIntel =3D true; - else if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_= SVM)) + VIR_ELSIF (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLA= G_SVM)) isAMD =3D true; =20 if (isIntel) { @@ -358,7 +358,7 @@ int virHostValidateIOMMU(const char *hvname, "hardware platform"); return VIR_HOST_VALIDATE_FAILURE(level); } - } else if (isAMD) { + } VIR_ELSIF (isAMD) { if (access("/sys/firmware/acpi/tables/IVRS", F_OK) =3D=3D 0) { virHostMsgPass(); bootarg =3D "iommu=3Dpt iommu=3D1"; @@ -369,9 +369,9 @@ int virHostValidateIOMMU(const char *hvname, "hardware platform"); return VIR_HOST_VALIDATE_FAILURE(level); } - } else if (ARCH_IS_PPC64(arch)) { + } VIR_ELSIF (ARCH_IS_PPC64(arch)) { virHostMsgPass(); - } else if (ARCH_IS_S390(arch)) { + } VIR_ELSIF (ARCH_IS_S390(arch)) { g_autoptr(DIR) dir =3D NULL; =20 /* On s390x, we skip the IOMMU check if there are no PCI @@ -461,7 +461,7 @@ int virHostValidateSecureGuests(const char *hvname, =20 if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_FACIL= ITY_158)) hasFac158 =3D true; - else if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_= SEV)) + VIR_ELSIF (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLA= G_SEV)) hasAMDSev =3D true; =20 virHostMsgCheck(hvname, "%s", _("for secure guest support")); @@ -496,7 +496,7 @@ int virHostValidateSecureGuests(const char *hvname, "support for IBM Secure Execution"); return VIR_HOST_VALIDATE_FAILURE(level); } - } else if (hasAMDSev) { + } VIR_ELSIF (hasAMDSev) { if (virFileReadValueString(&mod_value, "/sys/module/kvm_amd/parame= ters/sev") < 0) { virHostMsgFail(level, "AMD Secure Encrypted Virtualization not= " "supported by the currently used kernel"= ); diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qem= u.c index b79c941153..a68e9564ab 100644 --- a/tools/virt-host-validate-qemu.c +++ b/tools/virt-host-validate-qemu.c @@ -81,7 +81,7 @@ int virHostValidateQEMU(void) VIR_HOST_VALIDATE_FAIL, kvmhint) <0) ret =3D -1; - else if (virHostValidateDeviceAccessible("QEMU", "/dev/kvm", + VIR_ELSIF (virHostValidateDeviceAccessible("QEMU", "/dev/kvm", VIR_HOST_VALIDATE_FAIL, _("Check /dev/kvm is worl= d writable or you are in " "a group that is allowe= d to access it")) < 0) diff --git a/tools/vsh-table.c b/tools/vsh-table.c index 67f5d24071..f60bba5810 100644 --- a/tools/vsh-table.c +++ b/tools/vsh-table.c @@ -242,7 +242,7 @@ vshTableSafeEncode(const char *s, size_t *width) *buf++ =3D *p; (*width)++; } - } else if (!iswprint(wc)) { + } VIR_ELSIF (!iswprint(wc)) { size_t i; for (i =3D 0; i < len; i++) { g_snprintf(buf, HEX_ENCODE_LENGTH + 1, "\\x%02x", p[i]= ); diff --git a/tools/vsh.c b/tools/vsh.c index ecd9d3fcb1..b3d74e32d2 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1051,7 +1051,7 @@ vshCommandOptStringReq(vshControl *ctl, /* this should not be propagated here, just to be sure */ if (ret =3D=3D -1) error =3D N_("Mandatory option not present"); - else if (arg && !*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK)) + VIR_ELSIF (arg && !*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_O= K)) error =3D N_("Option argument is empty"); =20 if (error) { @@ -1431,9 +1431,9 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) =20 vshCmddefOptParse(cmd, &opts_need_arg, &opts_required); VIR_FREE(tkdata); - } else if (data_only) { + } VIR_ELSIF (data_only) { goto get_data; - } else if (tkdata[0] =3D=3D '-' && tkdata[1] =3D=3D '-' && + } VIR_ELSIF (tkdata[0] =3D=3D '-' && tkdata[1] =3D=3D '-' && g_ascii_isalnum(tkdata[2])) { char *optstr =3D strchr(tkdata + 2, '=3D'); size_t opt_index =3D 0; @@ -1497,7 +1497,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) goto syntaxError; } } - } else if (tkdata[0] =3D=3D '-' && tkdata[1] =3D=3D '-' && + } VIR_ELSIF (tkdata[0] =3D=3D '-' && tkdata[1] =3D=3D '-' && tkdata[2] =3D=3D '\0') { VIR_FREE(tkdata); data_only =3D true; @@ -1686,7 +1686,7 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandPar= ser *parser, char **res, single_quote =3D !single_quote; p++; continue; - } else if (!single_quote && *p =3D=3D '\\') { /* escape */ + } VIR_ELSIF (!single_quote && *p =3D=3D '\\') { /* escape */ /* * The same as in shell, a \ in "" is an escaper, * but a \ in '' is not an escaper. @@ -1696,12 +1696,12 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandP= arser *parser, char **res, if (report) vshError(ctl, "%s", _("dangling \\")); return VSH_TK_ERROR; - } else if (*p =3D=3D '\n') { + } VIR_ELSIF (*p =3D=3D '\n') { /* Elide backslash-newline entirely */ p++; continue; } - } else if (!single_quote && *p =3D=3D '"') { /* double quote */ + } VIR_ELSIF (!single_quote && *p =3D=3D '"') { /* double quote */ double_quote =3D !double_quote; p++; continue; @@ -2357,7 +2357,7 @@ vshAskReedit(vshControl *ctl, const char *msg, bool r= elax_avail) _("? - print this help"), NULL); continue; - } else if (c =3D=3D 'y' || c =3D=3D 'n' || c =3D=3D 'f' || + } VIR_ELSIF (c =3D=3D 'y' || c =3D=3D 'n' || c =3D=3D 'f' || (relax_avail && c =3D=3D 'i')) { break; } @@ -2770,9 +2770,9 @@ vshReadlineParse(const char *text, int state) =20 VIR_UNLESS (cmd) { list =3D vshReadlineCommandGenerator(); - } else if (!opt || opt->type =3D=3D VSH_OT_BOOL) { + } VIR_ELSIF (!opt || opt->type =3D=3D VSH_OT_BOOL) { list =3D vshReadlineOptionsGenerator(cmd, partial); - } else if (opt && opt->completer) { + } VIR_ELSIF (opt && opt->completer) { list =3D opt->completer(autoCompleteOpaque, partial, opt->completer_flags); @@ -2866,7 +2866,7 @@ vshReadlineInit(vshControl *ctl) if (virStrToLong_i(histsize_str, NULL, 10, &max_history) < 0) { vshError(ctl, _("Bad $%s value."), histsize_env); return -1; - } else if (max_history > HISTSIZE_MAX || max_history < 0) { + } VIR_ELSIF (max_history > HISTSIZE_MAX || max_history < 0) { vshError(ctl, _("$%s value should be between 0 " "and %d"), histsize_env, HISTSIZE_MAX); @@ -3123,7 +3123,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) if (def->flags & VSH_CMD_FLAG_ALIAS) def =3D vshCmddefSearch(def->alias); return vshCmddefHelp(def); - } else if ((grp =3D vshCmdGrpSearch(name))) { + } VIR_ELSIF ((grp =3D vshCmdGrpSearch(name))) { return vshCmdGrpHelp(ctl, grp); } else { vshError(ctl, _("command or command group '%s' doesn't exist"), na= me); @@ -3239,9 +3239,9 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd) =20 if (xml) { virBufferEscapeString(&buf, "%s", curr); - } else if (shell) { + } VIR_ELSIF (shell) { virBufferEscapeShell(&buf, curr); - } else if (split) { + } VIR_ELSIF (split) { g_auto(GStrv) spl =3D NULL; GStrv n; =20 --=20 2.34.1