WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Clean up grant-table code after recent ch

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Clean up grant-table code after recent changes.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Oct 2007 17:41:47 -0700
Delivery-date: Thu, 04 Oct 2007 18:46:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1191490304 -3600
# Node ID 062fe1c7b09f1b3dc906ed6718dea8cd72c5416b
# Parent  9f9f9b68cd08a03fc8cfad9f5ab702e50b6b6463
Clean up grant-table code after recent changes.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/common/grant_table.c |   44 +++++++++++++++-----------------------------
 xen/include/xen/iocap.h  |    2 --
 2 files changed, 15 insertions(+), 31 deletions(-)

diff -r 9f9f9b68cd08 -r 062fe1c7b09f xen/common/grant_table.c
--- a/xen/common/grant_table.c  Thu Oct 04 10:26:21 2007 +0100
+++ b/xen/common/grant_table.c  Thu Oct 04 10:31:44 2007 +0100
@@ -332,19 +332,21 @@ __gnttab_map_grant_ref(
     if ( op->flags & GNTMAP_host_map ) 
     {
         /* Could be an iomem page for setting up permission */
-        if( iomem_page_test(frame, mfn_to_page(frame)) ) {
+        if ( iomem_page_test(frame, mfn_to_page(frame)) )
+        {
             is_iomem = 1;
-            if ( iomem_permit_access(ld, frame, frame) ) {
+            if ( iomem_permit_access(ld, frame, frame) )
+            {
                 gdprintk(XENLOG_WARNING, 
-                         "Could not permit access to grant frame %lx as 
iomem\n",
-                         frame);
+                         "Could not permit access to grant frame "
+                         "%lx as iomem\n", frame);
                 rc = GNTST_general_error;
                 goto undo_out;
             }
         }
     } 
 
-    if (!is_iomem ) 
+    if ( !is_iomem ) 
     {
         if ( unlikely(!mfn_valid(frame)) ||
              unlikely(!((op->flags & GNTMAP_readonly) ?
@@ -353,7 +355,8 @@ __gnttab_map_grant_ref(
                                           PGT_writable_page))))
         {
             if ( !rd->is_dying )
-                gdprintk(XENLOG_WARNING, "Could not pin grant frame %lx\n", 
frame);
+                gdprintk(XENLOG_WARNING,
+                         "Could not pin grant frame %lx\n", frame);
             rc = GNTST_general_error;
             goto undo_out;
         }
@@ -558,7 +561,8 @@ __gnttab_unmap_common_complete(struct gn
 
     rd = op->rd;
 
-    if ( rd == NULL ) { 
+    if ( rd == NULL )
+    { 
         /*
          * Suggests that __gntab_unmap_common failed in
          * rcu_lock_domain_by_id() or earlier, and so we have nothing
@@ -653,7 +657,8 @@ gnttab_unmap_grant_ref(
     struct gnttab_unmap_grant_ref op;
     struct gnttab_unmap_common common[GNTTAB_UNMAP_BATCH_SIZE];
 
-    while (count != 0) {
+    while ( count != 0 )
+    {
         c = min(count, (unsigned int)GNTTAB_UNMAP_BATCH_SIZE);
         partial_done = 0;
 
@@ -670,9 +675,7 @@ gnttab_unmap_grant_ref(
         flush_tlb_mask(current->domain->domain_dirty_cpumask);
 
         for ( i = 0; i < partial_done; i++ )
-        {
             __gnttab_unmap_common_complete(&(common[i]));
-        }
 
         count -= c;
         done += c;
@@ -684,9 +687,7 @@ fault:
     flush_tlb_mask(current->domain->domain_dirty_cpumask);
 
     for ( i = 0; i < partial_done; i++ )
-    {
         __gnttab_unmap_common_complete(&(common[i]));
-    }
     return -EFAULT;
 }
 
@@ -715,7 +716,8 @@ gnttab_unmap_and_replace(
     struct gnttab_unmap_and_replace op;
     struct gnttab_unmap_common common[GNTTAB_UNMAP_BATCH_SIZE];
 
-    while (count != 0) {
+    while ( count != 0 )
+    {
         c = min(count, (unsigned int)GNTTAB_UNMAP_BATCH_SIZE);
         partial_done = 0;
         
@@ -732,9 +734,7 @@ gnttab_unmap_and_replace(
         flush_tlb_mask(current->domain->domain_dirty_cpumask);
         
         for ( i = 0; i < partial_done; i++ )
-        {
             __gnttab_unmap_common_complete(&(common[i]));
-        }
 
         count -= c;
         done += c;
@@ -746,9 +746,7 @@ fault:
     flush_tlb_mask(current->domain->domain_dirty_cpumask);
 
     for ( i = 0; i < partial_done; i++ )
-    {
         __gnttab_unmap_common_complete(&(common[i]));
-    }
     return -EFAULT;    
 }
 
@@ -1427,9 +1425,6 @@ do_grant_table_op(
             guest_handle_cast(uop, gnttab_map_grant_ref_t);
         if ( unlikely(!guest_handle_okay(map, count)) )
             goto out;
-        rc = -EPERM;
-        if ( unlikely(!grant_operation_permitted(d)) )
-            goto out;
         rc = gnttab_map_grant_ref(map, count);
         break;
     }
@@ -1439,9 +1434,6 @@ do_grant_table_op(
             guest_handle_cast(uop, gnttab_unmap_grant_ref_t);
         if ( unlikely(!guest_handle_okay(unmap, count)) )
             goto out;
-        rc = -EPERM;
-        if ( unlikely(!grant_operation_permitted(d)) )
-            goto out;
         rc = gnttab_unmap_grant_ref(unmap, count);
         break;
     }
@@ -1450,9 +1442,6 @@ do_grant_table_op(
         XEN_GUEST_HANDLE(gnttab_unmap_and_replace_t) unmap =
             guest_handle_cast(uop, gnttab_unmap_and_replace_t);
         if ( unlikely(!guest_handle_okay(unmap, count)) )
-            goto out;
-        rc = -EPERM;
-        if ( unlikely(!grant_operation_permitted(d)) )
             goto out;
         rc = -ENOSYS;
         if ( unlikely(!replace_grant_supported()) )
@@ -1471,9 +1460,6 @@ do_grant_table_op(
         XEN_GUEST_HANDLE(gnttab_transfer_t) transfer =
             guest_handle_cast(uop, gnttab_transfer_t);
         if ( unlikely(!guest_handle_okay(transfer, count)) )
-            goto out;
-        rc = -EPERM;
-        if ( unlikely(!grant_operation_permitted(d)) )
             goto out;
         rc = gnttab_transfer(transfer, count);
         break;
diff -r 9f9f9b68cd08 -r 062fe1c7b09f xen/include/xen/iocap.h
--- a/xen/include/xen/iocap.h   Thu Oct 04 10:26:21 2007 +0100
+++ b/xen/include/xen/iocap.h   Thu Oct 04 10:31:44 2007 +0100
@@ -31,6 +31,4 @@
 #define multipage_allocation_permitted(d)               \
     (!rangeset_is_empty((d)->iomem_caps))
 
-#define grant_operation_permitted(d) (1)
-
 #endif /* __XEN_IOCAP_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Clean up grant-table code after recent changes., Xen patchbot-unstable <=