Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599902

Re: [PATCH v2 4/7] xen/9pfs: connect to the backend

From Stefano Stabellini <sstabellini@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 4/7] xen/9pfs: connect to the backend
Date 2017-03-13 23:40 +0100
Message-ID <tkGNc-7uk-31@gated-at.bofh.it> (permalink)
References <tiTER-5f2-11@gated-at.bofh.it> <tiTOx-5xN-3@gated-at.bofh.it> <tiTOy-5xN-19@gated-at.bofh.it> <tj8ue-7an-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 9 Mar 2017, Boris Ostrovsky wrote:
> > +
> > +static int xen_9pfs_front_alloc_dataring(struct xenbus_device *dev,
> > +		struct xen_9pfs_dataring *ring)
> > +{
> > +	int i;
> > +	int ret = -ENOMEM;
> > +
> > +	init_waitqueue_head(&ring->wq);
> > +	spin_lock_init(&ring->lock);
> > +	INIT_WORK(&ring->work, p9_xen_response);
> > +
> > +	ring->intf = (struct xen_9pfs_data_intf *) get_zeroed_page(GFP_KERNEL | __GFP_ZERO);
> > +	if (!ring->intf)
> > +		return ret;
> > +	ring->ref = gnttab_grant_foreign_access(dev->otherend_id, virt_to_gfn(ring->intf), 0);
> > +	ring->bytes = (void*)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
> > +			XEN_9PFS_RING_ORDER - (PAGE_SHIFT - XEN_PAGE_SHIFT));
> > +	if (ring->bytes == NULL)
> > +		goto out;
> > +	for (i = 0; i < (1 << XEN_9PFS_RING_ORDER); i++)
> > +		ring->intf->ref[i] = gnttab_grant_foreign_access(dev->otherend_id, virt_to_gfn(ring->bytes) + i, 0);
> 
> You need to handle gnttab_grant_foreign_access() returning an error. For
> ring->ref too.
> 
> (and maybe wrap the line above)

I'll do


> > +	ring->ring.in = ring->bytes;
> 
> ring->ring? Maybe 'dataring' for the top-level structure?

I changed it to ring->data


> BTW, do we really need 'bytes' member? It's always 'ring.in' AFAICT. You
> could make it a union with 'ring' (the second 'ring' ;-)) if you want to
> keep a pointer to the whole thing as a dedicated name.

You are right, I don't need bytes, I'll get rid of it

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/7] Xen transport for 9pfs frontend driver Stefano Stabellini <sstabellini@kernel.org> - 2017-03-09 01:00 +0100
  [PATCH v2 2/7] xen: introduce the header file for the Xen 9pfs transport protocol Stefano Stabellini <sstabellini@kernel.org> - 2017-03-09 01:10 +0100
  [PATCH v2 7/7] xen/9pfs: build 9pfs Xen transport driver Stefano Stabellini <sstabellini@kernel.org> - 2017-03-09 01:10 +0100
  [PATCH v2 1/7] xen: import new ring macros in ring.h Stefano Stabellini <sstabellini@kernel.org> - 2017-03-09 01:10 +0100
    [PATCH v2 6/7] xen/9pfs: receive responses Stefano Stabellini <sstabellini@kernel.org> - 2017-03-09 01:10 +0100
      Re: [PATCH v2 6/7] xen/9pfs: receive responses Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-03-09 17:00 +0100
    [PATCH v2 5/7] xen/9pfs: send requests to the backend Stefano Stabellini <sstabellini@kernel.org> - 2017-03-09 01:10 +0100
      Re: [PATCH v2 5/7] xen/9pfs: send requests to the backend Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-03-09 16:50 +0100
    [PATCH v2 3/7] xen/9pfs: introduce Xen 9pfs transport driver Stefano Stabellini <sstabellini@kernel.org> - 2017-03-09 01:10 +0100
      Re: [PATCH v2 3/7] xen/9pfs: introduce Xen 9pfs transport driver Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-03-09 16:40 +0100
        Re: [PATCH v2 3/7] xen/9pfs: introduce Xen 9pfs transport driver Stefano Stabellini <sstabellini@kernel.org> - 2017-03-13 22:50 +0100
    [PATCH v2 4/7] xen/9pfs: connect to the backend Stefano Stabellini <sstabellini@kernel.org> - 2017-03-09 01:10 +0100
      Re: [PATCH v2 4/7] xen/9pfs: connect to the backend Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-03-09 16:50 +0100
        Re: [PATCH v2 4/7] xen/9pfs: connect to the backend Stefano Stabellini <sstabellini@kernel.org> - 2017-03-13 23:40 +0100

csiph-web