All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Keir Fraser <keir@xen.org>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH] do_xen_version() cleanup
Date: Thu, 5 Mar 2015 15:10:17 +0000	[thread overview]
Message-ID: <54F871D9.6050302@citrix.com> (raw)
In-Reply-To: <54F87B5E0200007800066A4F@mail.emea.novell.com>


[-- Attachment #1.1: Type: text/plain, Size: 3338 bytes --]

On 05/03/15 14:50, Jan Beulich wrote:
> - use exisiting latched value of current->domain where available
> - use __copy_to_guest() instead of copy_to_guest() where possible
> - drop redundant inclusion of xen/config.h
> - drop pointless braces
> - consistenly use typedef names
> - formatting
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

If you are feeling more adventurous with cleanup, there are 4 bits of
tailing whitespace which could go, and the prototype could change a
signed "cmd" to an unsigned one.

>
> --- a/xen/common/kernel.c
> +++ b/xen/common/kernel.c
> @@ -4,7 +4,6 @@
>   * Copyright (c) 2002-2005 K A Fraser
>   */
>  
> -#include <xen/config.h>
>  #include <xen/init.h>
>  #include <xen/lib.h>
>  #include <xen/errno.h>
> @@ -233,9 +232,7 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
>      switch ( cmd )
>      {
>      case XENVER_version:
> -    {
>          return (xen_major_version() << 16) | xen_minor_version();
> -    }
>  
>      case XENVER_extraversion:
>      {
> @@ -250,7 +247,7 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
>  
>      case XENVER_compile_info:
>      {
> -        struct xen_compile_info info;
> +        xen_compile_info_t info;
>  
>          memset(&info, 0, sizeof(info));
>          safe_strcpy(info.compiler,       xen_compiler());
> @@ -279,6 +276,7 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
>          xen_platform_parameters_t params = {
>              .virt_start = HYPERVISOR_VIRT_START
>          };
> +
>          if ( copy_to_guest(arg, &params, 1) )
>              return -EFAULT;
>          return 0;
> @@ -310,11 +308,11 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
>              fi.submap = 0;
>              if ( VM_ASSIST(d, VMASST_TYPE_pae_extended_cr3) )
>                  fi.submap |= (1U << XENFEAT_pae_pgdir_above_4gb);
> -            if ( paging_mode_translate(current->domain) )
> +            if ( paging_mode_translate(d) )
>                  fi.submap |= 
>                      (1U << XENFEAT_writable_page_tables) |
>                      (1U << XENFEAT_auto_translated_physmap);
> -            if ( is_hardware_domain(current->domain) )
> +            if ( is_hardware_domain(d) )
>                  fi.submap |= 1U << XENFEAT_dom0;
>  #ifdef CONFIG_X86
>              switch ( d->guest_type )
> @@ -341,31 +339,25 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
>              return -EINVAL;
>          }
>  
> -        if ( copy_to_guest(arg, &fi, 1) )
> +        if ( __copy_to_guest(arg, &fi, 1) )
>              return -EFAULT;
>          return 0;
>      }
>  
>      case XENVER_pagesize:
> -    {
>          return (!guest_handle_is_null(arg) ? -EINVAL : PAGE_SIZE);
> -    }
>  
>      case XENVER_guest_handle:
> -    {
>          if ( copy_to_guest(arg, current->domain->handle,
>                             ARRAY_SIZE(current->domain->handle)) )
>              return -EFAULT;
>          return 0;
> -    }
>  
>      case XENVER_commandline:
> -    {
>          if ( copy_to_guest(arg, saved_cmdline, ARRAY_SIZE(saved_cmdline)) )
>              return -EFAULT;
>          return 0;
>      }
> -    }
>  
>      return -ENOSYS;
>  }
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 4196 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

      parent reply	other threads:[~2015-03-05 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 14:50 [PATCH] do_xen_version() cleanup Jan Beulich
2015-03-05 15:00 ` Tim Deegan
2015-03-05 15:10 ` Andrew Cooper [this message]

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=54F871D9.6050302@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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.