xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dushyant Behl <myselfdushyantbehl@gmail.com>
To: xen-devel@lists.xen.org
Cc: David Scott <dave.scott@eu.citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Andres Lagar Cavilla <andres.lagarcavilla@gmail.com>,
	Dushyant Behl <myselfdushyantbehl@gmail.com>
Subject: [PATCH v3 2/3] tools/libxc/xc_mem_paging_setup.c: replacing deprecated function calls.
Date: Fri,  8 Aug 2014 02:10:11 +0530	[thread overview]
Message-ID: <1407444012-31830-3-git-send-email-myselfdushyantbehl@gmail.com> (raw)
In-Reply-To: <1407444012-31830-1-git-send-email-myselfdushyantbehl@gmail.com>

This patch replaces the calls to the deprecated function
xc_map_foreign_batch with the calls to xc_map_foreign_bulk
in tools/libxc/xc_mem_paging_ring_setup.c
The function xc_map_foreign_bulk has a cleaner error reporting
interface than xc_map_foreign_batch.

Signed-off-by: Dushyant Behl <myselfdushyantbehl@gmail.com>
Reviewed-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libxc/xc_mem_paging_setup.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/libxc/xc_mem_paging_setup.c b/tools/libxc/xc_mem_paging_setup.c
index bfb9a9b..9741dc9 100644
--- a/tools/libxc/xc_mem_paging_setup.c
+++ b/tools/libxc/xc_mem_paging_setup.c
@@ -43,7 +43,7 @@ int xc_mem_paging_ring_setup(xc_interface *xch,
                              uint32_t *evtchn_port,
                              mem_event_back_ring_t *back_ring)
 {
-    int rc;
+    int rc, err;
     uint64_t pfn;
     xen_pfn_t ring_pfn, mmap_pfn;
 
@@ -52,9 +52,9 @@ int xc_mem_paging_ring_setup(xc_interface *xch,
 
     ring_pfn = pfn;
     mmap_pfn = ring_pfn;
-    ring_page = xc_map_foreign_batch(xch, domain_id,
-                                        PROT_READ | PROT_WRITE, &mmap_pfn, 1);
-    if ( mmap_pfn & XEN_DOMCTL_PFINFO_XTAB )
+    ring_page = xc_map_foreign_bulk(xch, domain_id,
+                                    PROT_READ | PROT_WRITE, &mmap_pfn, &err, 1);
+    if ( (err != 0) || (ring_page == NULL) )
     {
         /* Map failed, populate ring page */
         rc = xc_domain_populate_physmap_exact(xch, domain_id,
@@ -66,10 +66,10 @@ int xc_mem_paging_ring_setup(xc_interface *xch,
         }
 
         mmap_pfn = ring_pfn;
-        ring_page = xc_map_foreign_batch(xch, domain_id,
-                                        PROT_READ | PROT_WRITE, &mmap_pfn, 1);
+        ring_page = xc_map_foreign_bulk(xch, domain_id, PROT_READ | PROT_WRITE,
+                                        &mmap_pfn, &err, 1);
 
-        if ( mmap_pfn & XEN_DOMCTL_PFINFO_XTAB )
+        if ( (err != 0) || (ring_page == NULL) )
         {
             PERROR("Could not map the ring page\n");
             return -1;
-- 
1.9.1

  parent reply	other threads:[~2014-08-07 20:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07 20:40 Refactoring mempaging code from xenpaging to libxc and few updates Dushyant Behl
2014-08-07 20:40 ` [PATCH v3 1/3] tools/libxc: refactored mempaging code from xenpaging to libxc Dushyant Behl
2014-08-07 20:40 ` Dushyant Behl [this message]
2014-08-07 20:40 ` [PATCH v3 3/3] tools/libxc/xc_mem_paging_setup.c: FIX- Race condition between initializing shared ring and mempaging Dushyant Behl
2014-08-08  2:37   ` Andres Lagar Cavilla
2014-08-13 16:28 ` Refactoring mempaging code from xenpaging to libxc and few updates Dushyant Behl
2014-08-13 20:54   ` Dushyant Behl

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=1407444012-31830-3-git-send-email-myselfdushyantbehl@gmail.com \
    --to=myselfdushyantbehl@gmail.com \
    --cc=andres.lagarcavilla@gmail.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dave.scott@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.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 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).