On 11/11/2017 08:33 PM, Eric Blake wrote:
This is a minimal implementation of an NBD forwarder; it lets us
convert between old and newstyle connections (great if a client
expects one style but the real server only provides the other),
or add TLS safety on top of a server without having to rewrite
that server. Right now, the real server is expected to live
on a named Unix socket, and the transactions are serialized
rather than interleaved; further enhancements could be made to
also permit TCP servers or more efficient transmission.
+/* Read an entire buffer, returning 0 on success or -1 with errno
set */
+static int read_full (int fd, void *buf, size_t len)
+{
+ ssize_t r;
+
+ while (len) {
+ r = read (fd, buf, len);
+ if (r < 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+ return -1;
Hmm, emacs picked TAB indentation, but it looks like we prefer spaces (I
certainly prefer it, but forgot to tell emacs my preferences, and the
project doesn't have an automatic .dir-locals.el). Do you need me to
resubmit with the TABs removed? Should we add a .dir-locals.el?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization:
qemu.org |
libvirt.org