From nobody Mon Feb 9 00:30:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15278167877407.626520292665987; Thu, 31 May 2018 18:33:07 -0700 (PDT) Received: from localhost ([::1]:46909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOYwA-0006dS-MT for importer@patchew.org; Thu, 31 May 2018 21:33:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOYqv-0002xc-H6 for qemu-devel@nongnu.org; Thu, 31 May 2018 21:27:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOYqu-0002x7-J9 for qemu-devel@nongnu.org; Thu, 31 May 2018 21:27:37 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:39684) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOYqu-0002wq-FF for qemu-devel@nongnu.org; Thu, 31 May 2018 21:27:36 -0400 Received: by mail-qt0-x243.google.com with SMTP id p23-v6so5420032qtn.6 for ; Thu, 31 May 2018 18:27:36 -0700 (PDT) Received: from localhost.localdomain (96-86-104-61-static.hfc.comcastbusiness.net. [96.86.104.61]) by smtp.gmail.com with ESMTPSA id o68-v6sm2003842qkc.19.2018.05.31.18.27.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 31 May 2018 18:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=juliacomputing-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=pMnsnLDbSb64hFWTXM7nkBodAIa5H5oenqdRGktkS7M=; b=c6kXxciIJHK2LtmuDa0YNgIgldtZLKnQor53+ym8nE9LFgpdXHEsMDNiL0UpXcFXpC n0qIpZ5gQ0qdlpUZyEkUnEpnccekgGfAqNd4CcclW8hmRGkgWvIZYplRnf4H1TrpGWsh zgBPT0iONZ3fRy35km80l+vVetPcT3yGl76Os99+yy+B2PnV3j8+dxOIZx2z2Dym9Y/p I41CkOjMvFISfk4Mw1o/FqBZu2NcLwYQnvizekoiyIgIs38qa56CHTIe86O4d/Gn47D8 YqOlHneIjLdxUQefd9k5GVoKVzDd5QZ4BiPPF4twfBWDCMUtPt7OIMW45jj8+NJaAXir E0rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=pMnsnLDbSb64hFWTXM7nkBodAIa5H5oenqdRGktkS7M=; b=b2l8rjp2wkGKEfIqWpvLxShekzEllnzZEF9kzBUee+WvubaXXBkU/nAd0MjEDu9GcA CfvdtBj+nkFjngfjG+qc8RkTRufgOhJsH0WwwEZpwhPCoJVP6ZQxsoCzGI0QXc/TWsGP AWVo2lZ0faZuawqTN7IfYCEMpy/0qCssrMmWlygHvNblwDAnsMXMXxTq4VZ3//5MnubT N0ZkmVjUtTnR60Z57v8iINGMjwq/0yz2HHrQjIUKzO9lthf9s0RgRQDrTQmioeda836+ oYn46eqWHIE8VjFaUA6RaZaQzzXCY5HWZoitSg9DtNydFcDCychzCErOs4j6qVFX07Wo B6OQ== X-Gm-Message-State: APt69E3Asym/WQrdSHVH9Oh8RYqWzxdXa/X7yrponIBPrbPsGFDt1qmd jC4IseYqe8nF1f/V6iqtkiphHTzgXeg= X-Google-Smtp-Source: ADUXVKIleCVdEBXjp+631ZMuoV1mz2nvKuc3TRwIZ6UnoriR64qqG02TwXg7T9p5NwmczHZlnjmq/A== X-Received: by 2002:a0c:870a:: with SMTP id 10-v6mr8967571qvh.169.1527816455606; Thu, 31 May 2018 18:27:35 -0700 (PDT) From: Keno Fischer To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:26:01 -0400 Message-Id: <0758699faca2ee5526d2b64e0a5fdda7e7845cbc.1527814874.git.keno@juliacomputing.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [PATCH v2 06/20] 9p: Avoid warning if FS_IOC_GETVERSION is not defined X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keno Fischer , groug@kaod.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Both `stbuf` and `local_ioc_getversion` where unused when FS_IOC_GETVERSION was not defined, causing a compiler warning. Reorgnaize the code to avoid this warning. Signed-off-by: Keno Fischer --- Changes since v1: * As request in review, logic is factored into a local_ioc_getversion_init function. hw/9pfs/9p-local.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 576c8e3..6222891 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -1375,10 +1375,10 @@ static int local_unlinkat(FsContext *ctx, V9fsPath = *dir, return ret; } =20 +#ifdef FS_IOC_GETVERSION static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { -#ifdef FS_IOC_GETVERSION int err; V9fsFidOpenState fid_open; =20 @@ -1397,32 +1397,19 @@ static int local_ioc_getversion(FsContext *ctx, V9f= sPath *path, err =3D ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen); local_close(ctx, &fid_open); return err; -#else - errno =3D ENOTTY; - return -1; -#endif } +#endif =20 -static int local_init(FsContext *ctx, Error **errp) +static int local_ioc_getversion_init(FsContext *ctx, LocalData *data) { +#ifdef FS_IOC_GETVERSION struct statfs stbuf; - LocalData *data =3D g_malloc(sizeof(*data)); =20 - data->mountfd =3D open(ctx->fs_root, O_DIRECTORY | O_RDONLY); - if (data->mountfd =3D=3D -1) { - error_setg_errno(errp, errno, "failed to open '%s'", ctx->fs_root); - goto err; - } - -#ifdef FS_IOC_GETVERSION /* * use ioc_getversion only if the ioctl is definied */ if (fstatfs(data->mountfd, &stbuf) < 0) { - close_preserve_errno(data->mountfd); - error_setg_errno(errp, errno, - "failed to stat file system at '%s'", ctx->fs_root); - goto err; + return -1; } switch (stbuf.f_type) { case EXT2_SUPER_MAGIC: @@ -1433,6 +1420,26 @@ static int local_init(FsContext *ctx, Error **errp) break; } #endif + return 0; +} + +static int local_init(FsContext *ctx, Error **errp) +{ + LocalData *data =3D g_malloc(sizeof(*data)); + + data->mountfd =3D open(ctx->fs_root, O_DIRECTORY | O_RDONLY); + if (data->mountfd =3D=3D -1) { + error_setg_errno(errp, errno, "failed to open '%s'", ctx->fs_root); + goto err; + } + + if (local_ioc_getversion_init(ctx, data) < 0) { + close_preserve_errno(data->mountfd); + error_setg_errno(errp, errno, + "failed initialize ioc_getversion for file system at '%s'", + ctx->fs_root); + goto err; + } =20 if (ctx->export_flags & V9FS_SM_PASSTHROUGH) { ctx->xops =3D passthrough_xattr_ops; --=20 2.8.1