From nobody Sun Feb 8 11:06:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1600885027; cv=none; d=zohomail.com; s=zohoarc; b=CM2EEgfTcJJ6iXwkR0M3bVjxEe56wWtWIhjOKOpp7/LoHojc3a58yyBCD+HVU1kW2GZU6RgbJJQ0+9xlYvBpV0+rifGjdTwre+TeX8EZ4CJvuuN1YjT512Itsv+zuuHiDwuyyC17yr1XO0B9gjkKy1ck/5cwQS21v7w5molGWrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600885027; 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=0DJjjaKcIkgTLK/bE1tPJtNJ9tMhaSaQQ1dLlgZpa+M=; b=GgahxhO1TgjNegVk5FHFgDMgD6kSmygU19G79+GJaUY0sGP4kgM38VexgxHj2HWsjfjhh7zO98tzK7RvCo5k6sHJNW2Y6cPiUnd6r+a2GsTlXeZWNOCsEmggeC4XUGBwTC3DgLRMngeLEHvUHwHy8HdvzhwKT16YGLpV9aek4fs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1600885027145527.3986980959014; Wed, 23 Sep 2020 11:17:07 -0700 (PDT) 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-567-MNx88KaBMXyq6aF9mjp7mA-1; Wed, 23 Sep 2020 14:15:39 -0400 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 D0DA2191E2A6; Wed, 23 Sep 2020 18:15:32 +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 B08106198B; Wed, 23 Sep 2020 18:15:32 +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 799AE183D053; Wed, 23 Sep 2020 18:15:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08NIFHGE018176 for ; Wed, 23 Sep 2020 14:15:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8C79778816; Wed, 23 Sep 2020 18:15:17 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13CD3702E7 for ; Wed, 23 Sep 2020 18:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600885025; 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=0DJjjaKcIkgTLK/bE1tPJtNJ9tMhaSaQQ1dLlgZpa+M=; b=EXzyCvrdgOuOIsHM5gfM7M13Z6rsFhRdPtpu5UfwPeg5YG2YKaFLyYxUPRO5gPapdWQRVq ohnwMjXdVoVVUDpLxrZT29yc8Onk/SNOCoQt6VcQmZ9iDHyhj2KSs4AHzoLMGLCziRIn9y 0+fpeVuq9DUqpJKWGf0Ht3TA12zFf4E= X-MC-Unique: MNx88KaBMXyq6aF9mjp7mA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 11/14] storage: createFileDir: use less ternary operators Date: Wed, 23 Sep 2020 20:15:00 +0200 Message-Id: <1e7f3b4759f2dede28fb7dca16da2482804325a0.1600884543.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Introduce separate variables and if conditions with spaces around them to make the function call easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/storage/storage_util.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 93c24ab6bc..49ecbc5344 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -1997,6 +1997,8 @@ createFileDir(virStoragePoolObjPtr pool, unsigned int flags) { virStoragePoolDefPtr def =3D virStoragePoolObjGetDef(pool); + mode_t permmode =3D VIR_STORAGE_DEFAULT_VOL_PERM_MODE; + unsigned int flags =3D 0; =20 virCheckFlags(0, -1); =20 @@ -2013,15 +2015,17 @@ createFileDir(virStoragePoolObjPtr pool, return -1; } =20 + if (vol->target.perms->mode !=3D (mode_t)-1) + permmode =3D vol->target.perms->mode; + + if (def->type =3D=3D VIR_STORAGE_POOL_NETFS) + flags |=3D VIR_DIR_CREATE_AS_UID; =20 if (virDirCreate(vol->target.path, - (vol->target.perms->mode =3D=3D (mode_t)-1 ? - VIR_STORAGE_DEFAULT_VOL_PERM_MODE : - vol->target.perms->mode), + permmode, vol->target.perms->uid, vol->target.perms->gid, - (def->type =3D=3D VIR_STORAGE_POOL_NETFS - ? VIR_DIR_CREATE_AS_UID : 0)) < 0) { + flags) < 0) { return -1; } =20 --=20 2.26.2