Clean up grant-table code after recent changes.
authorKeir Fraser <keir@xensource.com>
Thu, 4 Oct 2007 09:31:44 +0000 (10:31 +0100)
committerKeir Fraser <keir@xensource.com>
Thu, 4 Oct 2007 09:31:44 +0000 (10:31 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/grant_table.c
xen/include/xen/iocap.h

index 440699ab6ff380917620c1a717397d3c90d24184..05d74cba0f3d36ebddec114a90b1c87bdb518285 100644 (file)
@@ -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 gnttab_unmap_common *op)
 
     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;
     }
@@ -1451,9 +1443,6 @@ do_grant_table_op(
             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()) )
             goto out;
@@ -1472,9 +1461,6 @@ do_grant_table_op(
             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;
     }
index 3818f7a3650a2efa7dc840c80ebbfb20a8f74db2..db461b9dcb0fa97eb4c1478c83bd5472dbfbf45b 100644 (file)
@@ -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__ */