Re: [Libguestfs] [nbdkit PATCH] nbd: Add new nbd forwarding plugin

Richard W.M. Jones
2017-11-14T10:17:01Z

On Sat, Nov 11, 2017 at 09:16:53PM -0600, Eric Blake
wrote:
> 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?

Don't worry about tabs vs spaces.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org