xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Bertrand Marquis <Bertrand.Marquis@arm.com>
To: Julien Grall <julien@xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <jgrall@amazon.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Xen-devel <xen-devel@lists.xenproject.org>, nd <nd@arm.com>
Subject: Re: [RESEND][PATCH v2 7/7] xen/guest_access: Fix coding style in xen/guest_access.h
Date: Fri, 31 Jul 2020 12:46:37 +0000	[thread overview]
Message-ID: <B4708E9E-BF20-4B02-803E-FDC7F97C55A1@arm.com> (raw)
In-Reply-To: <20200730181827.1670-8-julien@xen.org>



> On 30 Jul 2020, at 20:18, Julien Grall <julien@xen.org> wrote:
> 
> From: Julien Grall <jgrall@amazon.com>
> 
>    * Add space before and after operator
>    * Align \
>    * Format comments
> 
> No functional changes expected.
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

> ---
> xen/include/xen/guest_access.h | 36 +++++++++++++++++++---------------
> 1 file changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/xen/include/xen/guest_access.h b/xen/include/xen/guest_access.h
> index 4957b8d1f2b8..52fc7a063249 100644
> --- a/xen/include/xen/guest_access.h
> +++ b/xen/include/xen/guest_access.h
> @@ -18,20 +18,24 @@
> #define guest_handle_add_offset(hnd, nr) ((hnd).p += (nr))
> #define guest_handle_subtract_offset(hnd, nr) ((hnd).p -= (nr))
> 
> -/* Cast a guest handle (either XEN_GUEST_HANDLE or XEN_GUEST_HANDLE_PARAM)
> - * to the specified type of XEN_GUEST_HANDLE_PARAM. */
> +/*
> + * Cast a guest handle (either XEN_GUEST_HANDLE or XEN_GUEST_HANDLE_PARAM)
> + * to the specified type of XEN_GUEST_HANDLE_PARAM.
> + */
> #define guest_handle_cast(hnd, type) ({         \
>     type *_x = (hnd).p;                         \
> -    (XEN_GUEST_HANDLE_PARAM(type)) { _x };            \
> +    (XEN_GUEST_HANDLE_PARAM(type)) { _x };      \
> })
> 
> /* Cast a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */
> #define guest_handle_to_param(hnd, type) ({                  \
>     typeof((hnd).p) _x = (hnd).p;                            \
>     XEN_GUEST_HANDLE_PARAM(type) _y = { _x };                \
> -    /* type checking: make sure that the pointers inside     \
> +    /*                                                       \
> +     * type checking: make sure that the pointers inside     \
>      * XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of    \
> -     * the same type, then return hnd */                     \
> +     * the same type, then return hnd.                       \
> +     */                                                      \
>     (void)(&_x == &_y.p);                                    \
>     _y;                                                      \
> })
> @@ -106,13 +110,13 @@
>  * guest_handle_subrange_okay().
>  */
> 
> -#define __copy_to_guest_offset(hnd, off, ptr, nr) ({    \
> -    const typeof(*(ptr)) *_s = (ptr);                   \
> -    char (*_d)[sizeof(*_s)] = (void *)(hnd).p;          \
> -    /* Check that the handle is not for a const type */ \
> -    void *__maybe_unused _t = (hnd).p;                  \
> -    (void)((hnd).p == _s);                              \
> -    __raw_copy_to_guest(_d+(off), _s, sizeof(*_s)*(nr));\
> +#define __copy_to_guest_offset(hnd, off, ptr, nr) ({        \
> +    const typeof(*(ptr)) *_s = (ptr);                       \
> +    char (*_d)[sizeof(*_s)] = (void *)(hnd).p;              \
> +    /* Check that the handle is not for a const type */     \
> +    void *__maybe_unused _t = (hnd).p;                      \
> +    (void)((hnd).p == _s);                                  \
> +    __raw_copy_to_guest(_d + (off), _s, sizeof(*_s) * (nr));\
> })
> 
> #define __clear_guest_offset(hnd, off, nr) ({    \
> @@ -120,10 +124,10 @@
>     __raw_clear_guest(_d + (off), nr);           \
> })
> 
> -#define __copy_from_guest_offset(ptr, hnd, off, nr) ({  \
> -    const typeof(*(ptr)) *_s = (hnd).p;                 \
> -    typeof(*(ptr)) *_d = (ptr);                         \
> -    __raw_copy_from_guest(_d, _s+(off), sizeof(*_d)*(nr));\
> +#define __copy_from_guest_offset(ptr, hnd, off, nr) ({          \
> +    const typeof(*(ptr)) *_s = (hnd).p;                         \
> +    typeof(*(ptr)) *_d = (ptr);                                 \
> +    __raw_copy_from_guest(_d, _s + (off), sizeof (*_d) * (nr)); \
> })
> 
> #define __copy_field_to_guest(hnd, ptr, field) ({       \
> -- 
> 2.17.1
> 
> 



      parent reply	other threads:[~2020-07-31 12:47 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 18:18 [RESEND][PATCH v2 0/7] xen: Consolidate asm-*/guest_access.h in xen/guest_access.h Julien Grall
2020-07-30 18:18 ` [RESEND][PATCH v2 1/7] xen/guest_access: Add emacs magics Julien Grall
2020-07-31 13:04   ` Bertrand Marquis
2020-08-14 18:36     ` Julien Grall
2020-09-22 10:05   ` Volodymyr Babchuk
2020-07-30 18:18 ` [RESEND][PATCH v2 2/7] xen/arm: kernel: Re-order the includes Julien Grall
2020-07-30 19:36   ` Stefano Stabellini
2020-07-31 12:58   ` Bertrand Marquis
2020-07-30 18:18 ` [RESEND][PATCH v2 3/7] xen/arm: decode: " Julien Grall
2020-07-30 19:37   ` Stefano Stabellini
2020-08-14 18:40     ` Julien Grall
2020-07-30 18:18 ` [RESEND][PATCH v2 4/7] xen/arm: guestcopy: " Julien Grall
2020-07-30 19:37   ` Stefano Stabellini
2020-07-31 12:53   ` Bertrand Marquis
2020-07-31 12:56     ` Bertrand Marquis
2020-08-14 18:50     ` Julien Grall
2020-07-30 18:18 ` [RESEND][PATCH v2 5/7] xen: include xen/guest_access.h rather than asm/guest_access.h Julien Grall
2020-07-30 19:37   ` Stefano Stabellini
2020-07-31 11:36   ` Jan Beulich
2020-08-14 19:07     ` Julien Grall
2020-08-18  8:50       ` Jan Beulich
2020-08-18  8:58         ` Julien Grall
2020-08-18  9:05           ` Bertrand Marquis
2020-08-18  9:23             ` Julien Grall
2020-08-18  9:29               ` Bertrand Marquis
2020-08-18 11:32           ` Jan Beulich
2020-08-18 13:14             ` Julien Grall
2020-08-18 16:04               ` Jan Beulich
2020-08-18 16:20                 ` Julien Grall
2020-08-18 16:23                   ` Jan Beulich
2020-08-18 16:34                     ` Julien Grall
2020-07-31 12:45   ` Bertrand Marquis
2020-07-31 12:45   ` Bertrand Marquis
2020-09-18 18:39   ` Julien Grall
2020-09-21 15:32   ` Paul Durrant
2020-07-30 18:18 ` [RESEND][PATCH v2 6/7] xen/guest_access: Consolidate guest access helpers in xen/guest_access.h Julien Grall
2020-07-30 19:37   ` Stefano Stabellini
2020-08-14 19:10     ` Julien Grall
2020-07-31 11:45   ` Jan Beulich
2020-08-14 19:14     ` Julien Grall
2020-07-30 18:18 ` [RESEND][PATCH v2 7/7] xen/guest_access: Fix coding style " Julien Grall
2020-07-30 19:38   ` Stefano Stabellini
2020-07-31 11:41   ` Jan Beulich
2020-08-14 19:18     ` Julien Grall
2020-08-18  8:52       ` Jan Beulich
2020-08-18  9:03         ` Julien Grall
2020-07-31 12:46   ` Bertrand Marquis [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=B4708E9E-BF20-4B02-803E-FDC7F97C55A1@arm.com \
    --to=bertrand.marquis@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgrall@amazon.com \
    --cc=julien@xen.org \
    --cc=nd@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@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 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).