qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: <qemu-devel@nongnu.org>, Christian Schoenebeck <qemu_oss@crudebyte.com>
Subject: Re: [PATCH] 9pfs: Fix some return statements in the synth backend
Date: Mon, 28 Nov 2022 10:37:28 +0100	[thread overview]
Message-ID: <20221128103728.2001332c@bahia> (raw)
In-Reply-To: <8735a3y1j9.fsf@pond.sub.org>

On Mon, 28 Nov 2022 08:35:22 +0100
Markus Armbruster <armbru@redhat.com> wrote:

> Greg Kurz <groug@kaod.org> writes:
> 
> > The qemu_v9fs_synth_mkdir() and qemu_v9fs_synth_add_file() functions
> > currently return a positive errno value on failure. This causes
> > checkpatch.pl to spit several errors like the one below:
> >
> > ERROR: return of an errno should typically be -ve (return -EAGAIN)
> > #79: FILE: hw/9pfs/9p-synth.c:79:
> > +        return EAGAIN;
> >
> > Simply change the sign. This has no consequence since callers
> > assert() the returned value to be equal to 0.
> 
> Out of curiosity: why is assert() appropriate?
> 

Most of the code base comes from the original synth backend which
was designed to expose QEMU internals to the guest using 9p. The
hope of the virtio-9p authors was that each QEMU subsystem would
create its own tree using these two functions (note that they
are declared extern). Of course these never happened and the synth
backend remained nearly dead code for years, until finally it got
re-used to implement 9p qtest. In this context, failure to create a
synthetic directory or file means the related test has a bug (e.g.
messing with the paths used by some other test). This code likely
needs improvements but we never got to it.

> > While here also get rid of the uneeded ret variables as suggested
> > by return_directly.cocci.
> >
> > Reported-by: Markus Armbruster <armbru@redhat.com>
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> 


  reply	other threads:[~2022-11-28  9:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 15:58 [PATCH] 9pfs: Fix some return statements in the synth backend Greg Kurz
2022-11-26 13:47 ` Christian Schoenebeck
2022-11-28  7:35 ` Markus Armbruster
2022-11-28  9:37   ` Greg Kurz [this message]
2022-11-28 10:18     ` Markus Armbruster
2022-11-28 14:21       ` Christian Schoenebeck

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=20221128103728.2001332c@bahia \
    --to=groug@kaod.org \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    /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).