From nobody Sun Nov 2 17:23:30 2025 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 1527975182669448.1163103948238; Sat, 2 Jun 2018 14:33:02 -0700 (PDT) Received: from localhost ([::1]:32844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPE8z-0000dw-Pq for importer@patchew.org; Sat, 02 Jun 2018 17:33:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPE6y-0007wc-Pm for qemu-devel@nongnu.org; Sat, 02 Jun 2018 17:30:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPE6x-0005nZ-LK for qemu-devel@nongnu.org; Sat, 02 Jun 2018 17:30:56 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:44208) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPE6x-0005nE-HD for qemu-devel@nongnu.org; Sat, 02 Jun 2018 17:30:55 -0400 Received: by mail-qt0-x243.google.com with SMTP id d3-v6so36437707qtp.11 for ; Sat, 02 Jun 2018 14:30:55 -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 k2-v6sm21366628qkl.95.2018.06.02.14.30.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Jun 2018 14:30:53 -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=2G+S6SvHzcMbaTH0krEmSFLlggs0zoKoJDi1DpZHPvI=; b=jYKjvqQe9+0mDirbBduEHCqTW1dEjH/X70gK0Br8YLntsvUnM+t08AXcqugh3PIWs/ qWUav4GETgYtaXXUPOUUrEN18DNeNgZrTDOhJpmt6lcQ0A2YH/b3m+oaGdPjUj24QZQ1 6QmJ0EAI11CtuY5aBKSUC4QeqAdjwosu/VZWrqd1p2Y/Qgbz4gBvl28t3saeCCNKxEjj yDQkmxkaSGrPxkHWlNPMYf4YtboLLzusIQmHWh0gQj/L4iN23f1QDx6WgQl71hpWLThl 6dKiEuEdqdDkpWrskr7WTLyTrXEeb0HC0vquGtLwVFXD8EUyjVu48jP2ib9EbRQ1N1Fk 1BPQ== 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=2G+S6SvHzcMbaTH0krEmSFLlggs0zoKoJDi1DpZHPvI=; b=LDB5yqop3JB8kp/FYkdC2KxxZF3lEXBBNH5Q+uefIX3ZxpdE/5HJfxN5Ymz/u2MV56 r6rYdrteG5C+2JvNqlkgHUUtuE8XSveZY+4+p3e+yLiAaia3oPjgZjsx9m0Tc1loesYg aRD46uA7xXnhSHNRL3guwyTXXP7wFHTStA3cFZDAfTENsE+nccpcolnbdBln55713+8W f3Vuddk0KYFFJZDCm3QzHw3F9GiudlSNG6Cco1EcrebVWNoM6zvlG249WvWD1eWb+v/S vmDp3cnn0Y81Ez5d/wZkU5n/seD3QAFtec+p04+jCsy+fgS6a5sGBqgCPdwbYOTg0PwX 5ePw== X-Gm-Message-State: APt69E2cC8SGd6rDsjC0w1Rz5ti4Ryr39oUm2n0T8g3CTnFJoMHJgGxp BMIHX9K7Vceg0Q2L3COGVkAgTR2F8U0= X-Google-Smtp-Source: ADUXVKIBbQEG2S8eGVftMfx1FNlxBgs9VdFxpFxkKQPX3DLY0hx7BLQude9UYtczMgtIx1FIWGG17Q== X-Received: by 2002:ac8:235c:: with SMTP id b28-v6mr15500146qtb.212.1527975054460; Sat, 02 Jun 2018 14:30:54 -0700 (PDT) From: Keno Fischer To: qemu-devel@nongnu.org Date: Sat, 2 Jun 2018 17:29:37 -0400 Message-Id: <15479c7ebdc70dd260f696cd4c3d2d0f2336f375.1527973524.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 v3 3/5] 9p: local: 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. Reorganize the code to avoid this warning. Signed-off-by: Keno Fischer --- hw/9pfs/9p-local.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 304ef72..828e8d6 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -1373,10 +1373,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 @@ -1395,32 +1395,21 @@ 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, Erro= r **errp) { +#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; + "failed to stat file system at '%s'", ctx->fs_roo= t); + return -1; } switch (stbuf.f_type) { case EXT2_SUPER_MAGIC: @@ -1431,6 +1420,23 @@ 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, errp) < 0) { + close(data->mountfd); + goto err; + } =20 if (ctx->export_flags & V9FS_SM_PASSTHROUGH) { ctx->xops =3D passthrough_xattr_ops; --=20 2.8.1