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-devel

[Xen-devel] [PATCH] grant-table: use page flag interfaces when copying a

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] grant-table: use page flag interfaces when copying a grant page
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 23 Feb 2010 17:24:22 +0000
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Ian Campbell <ian.campbell@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: Tue, 23 Feb 2010 09:26:21 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1266944896.11737.6496.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1266944896.11737.6496.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Use SetPage{Foreign,Reserved} instead of bit-bashing directly. Add an
accessor for the foreign page destructor.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 drivers/xen/grant-table.c  |    5 ++---
 include/linux/page-flags.h |    4 +++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 7079787..76fe621 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -556,10 +556,9 @@ int gnttab_copy_grant_page(grant_ref_t ref, struct page 
**pagep)
        }
 
        new_page->mapping = page->mapping;
-       new_page->index = page->index;
-       set_bit(PG_foreign, &new_page->flags);
+       SetPageForeign(new_page, _PageForeignDestructor(page));
        if (PageReserved(page))
-               set_bit(PG_reserved, &new_page->flags);
+               SetPageReserved(new_page);
        *pagep = new_page;
 
        SetPageForeign(page, gnttab_page_free);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 86325f9..b03950e 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -287,8 +287,10 @@ CLEARPAGEFLAG(Foreign, foreign)
        BUG_ON((dtor) == (void (*)(struct page *, unsigned int))0);     \
        (_page)->index = (long)(dtor);                                  \
 } while (0)
+#define _PageForeignDestructor(_page) \
+       ((void (*)(struct page *, unsigned int))(_page)->index)
 #define PageForeignDestructor(_page, order)    \
-       ((void (*)(struct page *, unsigned int))(_page)->index)(_page, order)
+       _PageForeignDestructor(_page)(_page, order)
 #else
 PAGEFLAG_FALSE(Foreign)
 #endif
-- 
1.5.6.5


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