qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/7] block/ssh: don't call libssh2_init() in


From: Richard W.M. Jones
Subject: Re: [Qemu-devel] [PATCH v2 1/7] block/ssh: don't call libssh2_init() in block_init()
Date: Thu, 31 Aug 2017 08:46:20 +0100
User-agent: Mutt/1.5.20 (2009-12-10)

On Wed, Aug 30, 2017 at 02:40:16PM -0500, Eric Blake wrote:
> On 08/30/2017 11:56 AM, Jeff Cody wrote:
> > We don't need libssh2 failure to be fatal (we could just opt to not
> > register the driver on failure). But, it is probably a good idea to
> > avoid external library calls during the block_init(), and call the
> > libssh2 global init function on the first usage, returning any errors.
> > 
> > Signed-off-by: Jeff Cody <address@hidden>
> > ---
> >  block/ssh.c | 40 +++++++++++++++++++++++++++++-----------
> >  1 file changed, 29 insertions(+), 11 deletions(-)
> > 
> 
> > +static int ssh_state_init(BDRVSSHState *s, Error **errp)
> >  {
> > +    int ret;
> > +
> > +    if (!ssh_libinit_called) {
> > +        ret = libssh2_init(0);
> > +        if (ret) {
> > +            error_setg(errp, "libssh2 initialization failed with %d", ret);
> > +            return ret;
> 
> Do we know if this number is always positive or negative?

FWIW documentation says:

  "Returns 0 if succeeded, or a negative value for error."

I was holding off on reviewing this patch in general since there's a
libssh-based alternative driver under development, which should be
better.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v



reply via email to

[Prev in Thread] Current Thread [Next in Thread]