All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Wen Congyang <wency@cn.fujitsu.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen devel <xen-devel@lists.xen.org>,
	Ross Lagerwall <ross.lagerwall@citrix.com>
Subject: Re: [PATCH] tools/libxl: Fix the errno
Date: Fri, 20 Mar 2015 11:03:23 +0000	[thread overview]
Message-ID: <1426849403.21742.131.camel@citrix.com> (raw)
In-Reply-To: <550BD79A.7020603@cn.fujitsu.com>

On Fri, 2015-03-20 at 16:17 +0800, Wen Congyang wrote:
> After commit 6d896e13, we should pass -errno on read failure.

Hrm, this means that 6d896e13 was a more subtle interface change than I
was expecting (I'd forgotten that errno wasn't negative in userspace).

This means that someone needs to audit all of the callbacks and check
that they do the right thing. But...

I'm not at all convinced that this is true for the bootloader ones: They
treat -1 as pollhup, which is not the same as -EPERM, which is because
the same callback is reused as callback_pollhup, with a comment:
       /* pollhup gets called with errnoval==-1 which is not otherwise
        * possible since errnos are nonnegative, so it's unambiguous */
which is now no longer true.

Do the new callers actually need the number of bytes read/written or was
this just something which seemed like a good idea since it was in hand?

If it isn't needed then lets go back to the old semantics and pass 0 on
EOF or bytes_to_read have been read (essentially "0 bytes left to
read"), I expect the recipient of the callback should know (or could
remember) the initial value of bytes_to_read? 

Otherwise I think the only sensible approach would be to add a new
parameter to the callback for the number of bytes and but errnoval back
to the old semantics.

Or perhaps requiring a separater callback vs. pollhup_callback could
solve this too, they would have different prototypes.

Please can one of you look into this ASAP, otherwise I think we should
revert until it can get fixed.

Ian.

  parent reply	other threads:[~2015-03-20 11:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20  8:17 [PATCH] tools/libxl: Fix the errno Wen Congyang
2015-03-20  8:25 ` Ross Lagerwall
2015-03-20  8:39   ` Wen Congyang
2015-03-20 11:03 ` Ian Campbell [this message]
2015-03-20 11:15   ` Ian Campbell
2015-03-20 16:02     ` Ross Lagerwall
2015-03-20 16:09       ` Ian Campbell

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=1426849403.21742.131.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=wency@cn.fujitsu.com \
    --cc=xen-devel@lists.xen.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.