qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Jeff Cody <jcody@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	mitake.hitoshi@lab.ntt.co.jp, namei.unix@gmail.com,
	kwolf@redhat.com, eblake@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 2/7] block/ssh: make compliant with coding guidelines
Date: Wed, 8 Nov 2017 11:38:15 +0000	[thread overview]
Message-ID: <20171108113815.GN2787@redhat.com> (raw)
In-Reply-To: <d02d1a7eca3797d6fb1b7395b74a5ae757e53e64.1510093478.git.jcody@redhat.com>

On Tue, Nov 07, 2017 at 05:27:19PM -0500, Jeff Cody wrote:
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>

This one is just simple coding style fixes, so:

Reviewed-by: Richard W.M. Jones <rjones@redhat.com>

Rich.

>  block/ssh.c | 32 ++++++++++++++++++--------------
>  1 file changed, 18 insertions(+), 14 deletions(-)
> 
> diff --git a/block/ssh.c b/block/ssh.c
> index de81ec8..39cacc1 100644
> --- a/block/ssh.c
> +++ b/block/ssh.c
> @@ -241,7 +241,7 @@ static int parse_uri(const char *filename, QDict *options, Error **errp)
>          goto err;
>      }
>  
> -    if(uri->user && strcmp(uri->user, "") != 0) {
> +    if (uri->user && strcmp(uri->user, "") != 0) {
>          qdict_put_str(options, "user", uri->user);
>      }
>  
> @@ -268,7 +268,7 @@ static int parse_uri(const char *filename, QDict *options, Error **errp)
>  
>   err:
>      if (uri) {
> -      uri_free(uri);
> +        uri_free(uri);
>      }
>      return -EINVAL;
>  }
> @@ -342,7 +342,7 @@ static int check_host_key_knownhosts(BDRVSSHState *s,
>      libssh2_knownhost_readfile(knh, knh_file, LIBSSH2_KNOWNHOST_FILE_OPENSSH);
>  
>      r = libssh2_knownhost_checkp(knh, host, port, hostkey, len,
> -                                 LIBSSH2_KNOWNHOST_TYPE_PLAIN|
> +                                 LIBSSH2_KNOWNHOST_TYPE_PLAIN |
>                                   LIBSSH2_KNOWNHOST_KEYENC_RAW,
>                                   &found);
>      switch (r) {
> @@ -405,15 +405,18 @@ static int compare_fingerprint(const unsigned char *fingerprint, size_t len,
>      unsigned c;
>  
>      while (len > 0) {
> -        while (*host_key_check == ':')
> +        while (*host_key_check == ':') {
>              host_key_check++;
> +        }
>          if (!qemu_isxdigit(host_key_check[0]) ||
> -            !qemu_isxdigit(host_key_check[1]))
> +            !qemu_isxdigit(host_key_check[1])) {
>              return 1;
> +        }
>          c = hex2decimal(host_key_check[0]) * 16 +
>              hex2decimal(host_key_check[1]);
> -        if (c - *fingerprint != 0)
> +        if (c - *fingerprint != 0) {
>              return c - *fingerprint;
> +        }
>          fingerprint++;
>          len--;
>          host_key_check += 2;
> @@ -433,8 +436,8 @@ check_host_key_hash(BDRVSSHState *s, const char *hash,
>          return -EINVAL;
>      }
>  
> -    if(compare_fingerprint((unsigned char *) fingerprint, fingerprint_len,
> -                           hash) != 0) {
> +    if (compare_fingerprint((unsigned char *) fingerprint, fingerprint_len,
> +                            hash) != 0) {
>          error_setg(errp, "remote host key does not match host_key_check '%s'",
>                     hash);
>          return -EPERM;
> @@ -507,7 +510,7 @@ static int authenticate(BDRVSSHState *s, const char *user, Error **errp)
>          goto out;
>      }
>  
> -    for(;;) {
> +    for (;;) {
>          r = libssh2_agent_get_identity(agent, &identity, prev_identity);
>          if (r == 1) {           /* end of list */
>              break;
> @@ -860,8 +863,8 @@ static int ssh_create(const char *filename, QemuOpts *opts, Error **errp)
>      }
>  
>      r = connect_to_ssh(&s, uri_options,
> -                       LIBSSH2_FXF_READ|LIBSSH2_FXF_WRITE|
> -                       LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC,
> +                       LIBSSH2_FXF_READ  | LIBSSH2_FXF_WRITE |
> +                       LIBSSH2_FXF_CREAT | LIBSSH2_FXF_TRUNC,
>                         0644, errp);
>      if (r < 0) {
>          ret = r;
> @@ -869,7 +872,7 @@ static int ssh_create(const char *filename, QemuOpts *opts, Error **errp)
>      }
>  
>      if (total_size > 0) {
> -        libssh2_sftp_seek64(s.sftp_handle, total_size-1);
> +        libssh2_sftp_seek64(s.sftp_handle, total_size - 1);
>          r2 = libssh2_sftp_write(s.sftp_handle, c, 1);
>          if (r2 < 0) {
>              sftp_error_setg(errp, &s, "truncate failed");
> @@ -1108,7 +1111,7 @@ static int ssh_write(BDRVSSHState *s, BlockDriverState *bs,
>           * works for me.
>           */
>          if (r == 0) {
> -            ssh_seek(s, offset + written, SSH_SEEK_WRITE|SSH_SEEK_FORCE);
> +            ssh_seek(s, offset + written, SSH_SEEK_WRITE | SSH_SEEK_FORCE);
>              co_yield(s, bs);
>              goto again;
>          }
> @@ -1122,8 +1125,9 @@ static int ssh_write(BDRVSSHState *s, BlockDriverState *bs,
>              end_of_vec = i->iov_base + i->iov_len;
>          }
>  
> -        if (offset + written > s->attrs.filesize)
> +        if (offset + written > s->attrs.filesize) {
>              s->attrs.filesize = offset + written;
> +        }
>      }
>  
>      return 0;
> -- 
> 2.9.5

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

  parent reply	other threads:[~2017-11-08 11:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 22:27 [Qemu-devel] [PATCH v3 0/7] Code cleanup and minor fixes (for 2.11) Jeff Cody
2017-11-07 22:27 ` [Qemu-devel] [PATCH v3 1/7] block/ssh: don't call libssh2_init() in block_init() Jeff Cody
2017-11-07 22:48   ` Eric Blake
2017-11-08 11:39   ` Richard W.M. Jones
2017-11-07 22:27 ` [Qemu-devel] [PATCH v3 2/7] block/ssh: make compliant with coding guidelines Jeff Cody
2017-11-08 10:50   ` [Qemu-devel] [Qemu-block] " Darren Kenny
2017-11-08 11:38   ` Richard W.M. Jones [this message]
2017-11-07 22:27 ` [Qemu-devel] [PATCH v3 3/7] block/sheepdog: remove spurious NULL check Jeff Cody
2017-11-08 10:48   ` [Qemu-devel] [Qemu-block] " Darren Kenny
2017-11-07 22:27 ` [Qemu-devel] [PATCH v3 4/7] block/sheepdog: code beautification Jeff Cody
2017-11-08 10:52   ` [Qemu-devel] [Qemu-block] " Darren Kenny
2017-11-07 22:27 ` [Qemu-devel] [PATCH v3 5/7] block/curl: check error return of curl_global_init() Jeff Cody
2017-11-08 10:51   ` [Qemu-devel] [Qemu-block] " Darren Kenny
2017-11-08 11:41   ` [Qemu-devel] " Richard W.M. Jones
2017-11-07 22:27 ` [Qemu-devel] [PATCH v3 6/7] block/curl: fix minor memory leaks Jeff Cody
2017-11-08  0:13   ` Eric Blake
2017-11-08  5:08   ` Philippe Mathieu-Daudé
2017-11-08 11:45   ` Richard W.M. Jones
2017-11-07 22:27 ` [Qemu-devel] [PATCH v3 7/7] block/curl: code cleanup to comply with coding style Jeff Cody
2017-11-08 10:47   ` [Qemu-devel] [Qemu-block] " Darren Kenny
2017-11-08 14:26     ` Eric Blake
2017-11-08 14:50       ` Darren Kenny
2017-11-08 15:04         ` Paolo Bonzini
2017-11-08 15:01     ` Paolo Bonzini
2017-11-08 11:46   ` [Qemu-devel] " Richard W.M. Jones
2017-12-18 21:05 ` [Qemu-devel] [PATCH v3 0/7] Code cleanup and minor fixes (for 2.11) Jeff Cody

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=20171108113815.GN2787@redhat.com \
    --to=rjones@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mitake.hitoshi@lab.ntt.co.jp \
    --cc=namei.unix@gmail.com \
    --cc=qemu-block@nongnu.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).