All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jürgen Groß" <jgross@suse.com>
To: Wei Liu <wei.liu2@citrix.com>, xen-devel@lists.xen.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>, ian.campbell@citrix.com
Subject: Re: [PATCH 4/5] libxc: minios: Introduce abstraction for files[]
Date: Thu, 26 Feb 2015 13:47:47 +0100	[thread overview]
Message-ID: <54EF15F3.8000608@suse.com> (raw)
In-Reply-To: <1424951781-14935-5-git-send-email-wei.liu2@citrix.com>

On 02/26/2015 12:56 PM, Wei Liu wrote:
> From: Ian Jackson <ian.jackson@eu.citrix.com>
>
> We are going to want to reuse this code for NetBSD rump kernels, where
> there is no gntmap device and we just want to call the MiniOS gntmap
> code directly.
>
> As part of this we want to abstract away the use of files[] inside the
> actual functions.  Do this with a #define whose definition we are
> going to make conditional in just a moment.
>
> No functional change in this patch.
>
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> ---
>   tools/libxc/xc_minios_privcmd.c | 15 +++++++--------
>   1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/tools/libxc/xc_minios_privcmd.c b/tools/libxc/xc_minios_privcmd.c
> index 7766b86..27d9076 100644
> --- a/tools/libxc/xc_minios_privcmd.c
> +++ b/tools/libxc/xc_minios_privcmd.c
> @@ -208,12 +208,14 @@ struct xc_osdep_ops xc_privcmd_ops = {
>       },
>   };
>
> +#define GNTMAP(h) (files[(int)(h)].gntmap)
> +
>   static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
>   {
>       int fd = alloc_fd(FTYPE_GNTMAP);
>       if ( fd == -1 )
>           return XC_OSDEP_OPEN_ERROR;
> -    gntmap_init(&files[fd].gntmap);
> +    gntmap_init(&GNTMAP(h));

GNTMAP(fd)?

Same multiple times below.


Juergen

>       return (xc_osdep_handle)fd;
>   }
>
> @@ -225,7 +227,7 @@ static int minios_gnttab_close(xc_gnttab *xcg, xc_osdep_handle h)
>
>   void minios_gnttab_close_fd(int fd)
>   {
> -    gntmap_fini(&files[fd].gntmap);
> +    gntmap_fini(&GNTMAP(h));
>       files[fd].type = FTYPE_NONE;
>   }
>
> @@ -235,7 +237,6 @@ static void *minios_gnttab_grant_map(xc_gnttab *xcg, xc_osdep_handle h,
>                                        uint32_t notify_offset,
>                                        evtchn_port_t notify_port)
>   {
> -    int fd = (int)h;
>       int stride = 1;
>       if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
>           stride = 0;
> @@ -243,7 +244,7 @@ static void *minios_gnttab_grant_map(xc_gnttab *xcg, xc_osdep_handle h,
>           errno = ENOSYS;
>           return NULL;
>       }
> -    return gntmap_map_grant_refs(&files[fd].gntmap,
> +    return gntmap_map_grant_refs(&GNTMAP(h),
>                                    count, domids, stride,
>                                    refs, prot & PROT_WRITE);
>   }
> @@ -252,9 +253,8 @@ static int minios_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
>                                   void *start_address,
>                                   uint32_t count)
>   {
> -    int fd = (int)h;
>       int ret;
> -    ret = gntmap_munmap(&files[fd].gntmap,
> +    ret = gntmap_munmap(&GNTMAP(h),
>                           (unsigned long) start_address,
>                           count);
>       if (ret < 0) {
> @@ -267,9 +267,8 @@ static int minios_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
>   static int minios_gnttab_set_max_grants(xc_gnttab *xcg, xc_osdep_handle h,
>                                uint32_t count)
>   {
> -    int fd = (int)h;
>       int ret;
> -    ret = gntmap_set_max_grants(&files[fd].gntmap,
> +    ret = gntmap_set_max_grants(&GNTMAP(h),
>                                   count);
>       if (ret < 0) {
>           errno = -ret;
>

  reply	other threads:[~2015-02-26 12:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26 11:56 [PATCH 0/5] Build libxc on rump kernels Wei Liu
2015-02-26 11:56 ` [PATCH 1/5] NetBSDRump: provide evtchn.h Wei Liu
2015-03-02 17:28   ` Ian Campbell
2015-03-02 17:31     ` Wei Liu
2015-03-02 17:40       ` Ian Campbell
2015-03-02 17:42         ` Wei Liu
2015-02-26 11:56 ` [PATCH 2/5] libxc: Split off xc_minios_privcmd.c Wei Liu
2015-02-26 13:08   ` Wei Liu
2015-02-26 13:09   ` Samuel Thibault
2015-03-02 17:31   ` Ian Campbell
2015-03-03 15:15     ` Wei Liu
2015-02-26 11:56 ` [PATCH 3/5] libxc: Split off xc_netbsd_user.c Wei Liu
2015-03-02 17:33   ` Ian Campbell
2015-03-03 15:20     ` Wei Liu
2015-02-26 11:56 ` [PATCH 4/5] libxc: minios: Introduce abstraction for files[] Wei Liu
2015-02-26 12:47   ` Jürgen Groß [this message]
2015-02-26 12:56     ` Wei Liu
2015-02-26 13:10   ` Samuel Thibault
2015-03-02 17:34   ` Ian Campbell
2015-03-02 17:37     ` Wei Liu
2015-02-26 11:56 ` [PATCH 5/5] libxc: rumpxen: Provide xc_osdep_info Wei Liu
2015-03-02 17:36   ` Ian Campbell
2015-03-03 15:36     ` Wei Liu

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=54EF15F3.8000608@suse.com \
    --to=jgross@suse.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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.