qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: keno@juliacomputing.com
Cc: qemu-devel@nongnu.org, Keno Fischer <keno@alumni.harvard.edu>
Subject: Re: [Qemu-devel] [PATCH 02/13] 9p: Avoid warning if FS_IOC_GETVERSION is not defined
Date: Mon, 28 May 2018 15:52:28 +0200	[thread overview]
Message-ID: <20180528155228.3294c7f3@bahia.lan> (raw)
In-Reply-To: <a6ce15881bf120c8df68acfff6f2bd9c0745007b.1527310210.git.keno@alumni.harvard.edu>

On Sat, 26 May 2018 01:23:04 -0400
keno@juliacomputing.com wrote:

> From: Keno Fischer <keno@alumni.harvard.edu>
> 
> Signed-off-by: Keno Fischer <keno@juliacomputing.com>
> ---
>  hw/9pfs/9p-local.c | 39 +++++++++++++++++++--------------------
>  1 file changed, 19 insertions(+), 20 deletions(-)
> 
> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> index f6c7526..7592f8d 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;
>  }
>  
> +#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;
>  
> @@ -1397,15 +1397,11 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path,
>      err = ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen);
>      local_close(ctx, &fid_open);
>      return err;
> -#else
> -    errno = ENOTTY;
> -    return -1;
> -#endif
>  }
> +#endif
>  
>  static int local_init(FsContext *ctx, Error **errp)
>  {
> -    struct statfs stbuf;
>      LocalData *data = g_malloc(sizeof(*data));
>  
>      data->mountfd = open(ctx->fs_root, O_DIRECTORY | O_RDONLY);
> @@ -1415,20 +1411,23 @@ static int local_init(FsContext *ctx, Error **errp)
>      }
>  
>  #ifdef FS_IOC_GETVERSION
> -    /*
> -     * use ioc_getversion only if the ioctl is definied
> -     */
> -    if (fstatfs(data->mountfd, &stbuf) < 0) {
> -        close_preserve_errno(data->mountfd);

Hmm... I now realize that this path doesn't set errp, which means that
we could possibly fail the device realization without reporting any
error to the caller. Could you please fix this in a preparatory patch ?

> -        goto err;
> -    }
> -    switch (stbuf.f_type) {
> -    case EXT2_SUPER_MAGIC:
> -    case BTRFS_SUPER_MAGIC:
> -    case REISERFS_SUPER_MAGIC:
> -    case XFS_SUPER_MAGIC:
> -        ctx->exops.get_st_gen = local_ioc_getversion;
> -        break;
> +    {
> +        struct statfs stbuf;
> +        /*
> +        * use ioc_getversion only if the ioctl is definied
> +        */
> +        if (fstatfs(data->mountfd, &stbuf) < 0) {
> +            close_preserve_errno(data->mountfd);
> +            goto err;
> +        }
> +        switch (stbuf.f_type) {
> +        case EXT2_SUPER_MAGIC:
> +        case BTRFS_SUPER_MAGIC:
> +        case REISERFS_SUPER_MAGIC:
> +        case XFS_SUPER_MAGIC:
> +            ctx->exops.get_st_gen = local_ioc_getversion;
> +            break;
> +        }

Please move this to a separate local_ioc_getversion_init() function, that would
be empty if FS_IOC_GETVERSION is not defined.

>      }
>  #endif
>  

  reply	other threads:[~2018-05-28 13:52 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26  5:23 [Qemu-devel] [PATCH 00/13] 9p: Add support for Darwin keno
2018-05-26  5:23 ` [Qemu-devel] [PATCH 01/13] 9p: linux: Fix a couple Linux assumptions keno
2018-05-26  6:30   ` Philippe Mathieu-Daudé
2018-05-26 13:30     ` Peter Maydell
2018-05-26 16:17       ` Keno Fischer
2018-05-28 12:31   ` Greg Kurz
2018-05-26  5:23 ` [Qemu-devel] [PATCH 02/13] 9p: Avoid warning if FS_IOC_GETVERSION is not defined keno
2018-05-28 13:52   ` Greg Kurz [this message]
2018-05-26  5:23 ` [Qemu-devel] [PATCH 03/13] 9p: Move a couple xattr functions to 9p-util keno
2018-05-29 18:34   ` Greg Kurz
2018-05-31 16:14     ` Keno Fischer
2018-05-31 17:26       ` Greg Kurz
2018-05-31 17:39         ` Keno Fischer
2018-05-26  5:23 ` [Qemu-devel] [PATCH 04/13] 9p: darwin: Handle struct stat(fs) differences keno
2018-05-26  5:23 ` [Qemu-devel] [PATCH 05/13] 9p: darwin: Handle struct dirent differences keno
2018-05-29 20:25   ` Greg Kurz
2018-05-31 16:20     ` Keno Fischer
2018-05-31 19:16       ` Greg Kurz
2018-05-26  5:23 ` [Qemu-devel] [PATCH 06/13] 9p: darwin: Address minor differences keno
2018-05-29 21:09   ` Greg Kurz
2018-05-31 16:27     ` Keno Fischer
2018-05-31 19:22       ` Greg Kurz
2018-05-31 19:23         ` Keno Fischer
2018-05-31 19:49           ` Greg Kurz
2018-05-26  5:23 ` [Qemu-devel] [PATCH 07/13] 9p: darwin: Properly translate AT_REMOVEDIR flag keno
2018-05-29 20:43   ` Greg Kurz
2018-05-31 16:25     ` Keno Fischer
2018-05-31 19:44       ` Greg Kurz
2018-05-26  5:23 ` [Qemu-devel] [PATCH 08/13] 9p: darwin: Ignore O_{NOATIME, DIRECT} keno
2018-05-29 21:32   ` Greg Kurz
2018-05-31 16:35     ` Keno Fischer
2018-05-26  5:23 ` [Qemu-devel] [PATCH 09/13] 9p: darwin: Provide a compatibility definition for XATTR_SIZE_MAX keno
2018-05-26 13:34   ` Peter Maydell
2018-05-26 16:00     ` Keno Fischer
2018-05-26  5:23 ` [Qemu-devel] [PATCH 10/13] 9p: darwin: *xattr_nofollow implementations keno
2018-05-30 12:13   ` Greg Kurz
2018-05-26  5:23 ` [Qemu-devel] [PATCH 11/13] 9p: darwin: Mark mknod as unsupported keno
2018-05-30 12:20   ` Greg Kurz
2018-05-31 16:37     ` Keno Fischer
2018-05-31 19:56       ` Greg Kurz
2018-05-31 22:56         ` Keno Fischer
2018-05-31 23:06           ` Keno Fischer
2018-05-31 23:21             ` Keno Fischer
2018-05-26  5:23 ` [Qemu-devel] [PATCH 12/13] 9p: darwin: Provide a fallback implementation for utimensat keno
2018-05-30 12:14   ` Greg Kurz
2018-05-26  5:23 ` [Qemu-devel] [PATCH 13/13] 9p: darwin: configure: Allow VirtFS on Darwin keno
2018-05-28 12:59   ` Greg Kurz
2018-05-31 17:46     ` Keno Fischer
2018-05-31 19:57       ` Greg Kurz
2018-05-26  5:37 ` [Qemu-devel] [PATCH 00/13] 9p: Add support for Darwin no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180528155228.3294c7f3@bahia.lan \
    --to=groug@kaod.org \
    --cc=keno@alumni.harvard.edu \
    --cc=keno@juliacomputing.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).