All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] 9pfs-proxy: -retval vs errno vs -1
Date: Thu, 05 Mar 2015 00:26:07 +0300	[thread overview]
Message-ID: <54F7786F.2020409@msgid.tls.msk.ru> (raw)

Another interesting tidbit is in hw/9pfs/virtio-9p-proxy.c.

All filesystem methods use common v9fs_request() function,
which returns -errno.  So far so good.

Now, *all* places which call this function, does this:

    retval = v9fs_request(...);
    if (retval < 0) {
        errno = -retval;
    }
    return retval;

and *some* does this:

    retval = v9fs_request(...);
    if (retval < 0) {
        errno = -retval;
        retval = -1;
    }
    return retval;

So basically, *all* places sets errno in case of negative
return from v9fs_request(), but only some of them make the
return value to be -1 instead of original negative value.

So I've two questions here.

1. Why some filesystem methods return -1 while some return -errno?
2. Why can't v9fs_request() set errno itself?

Thanks,

/mjt

             reply	other threads:[~2015-03-04 21:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 21:26 Michael Tokarev [this message]
2015-03-06  5:52 ` [Qemu-devel] 9pfs-proxy: -retval vs errno vs -1 Aneesh Kumar K.V

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=54F7786F.2020409@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=aliguori@amazon.com \
    --cc=aneesh.kumar@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.