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] Replace grant-table typedefs with explicit structs.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Replace grant-table typedefs with explicit structs.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Apr 2006 17:00:15 +0000
Delivery-date: Fri, 14 Apr 2006 10:02:15 -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 kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID b055716f89c0741ea882fa23c8895ca4b53d3184
# Parent  5c477ad95dba71c0a73892db79d95bf465331b4d
Replace grant-table typedefs with explicit structs.
Reduce MAPTRACK_MAX_ENTRIES to something plausible.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 5c477ad95dba -r b055716f89c0 xen/arch/x86/audit.c
--- a/xen/arch/x86/audit.c      Fri Apr 14 13:40:30 2006
+++ b/xen/arch/x86/audit.c      Fri Apr 14 13:54:46 2006
@@ -639,7 +639,7 @@
     void scan_for_pfn_in_grant_table(struct domain *d, unsigned xmfn)
     {
         int i;
-        active_grant_entry_t *act = d->grant_table->active;
+        struct active_grant_entry *act = d->grant_table->active;
 
         spin_lock(&d->grant_table->lock);
 
diff -r 5c477ad95dba -r b055716f89c0 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Fri Apr 14 13:40:30 2006
+++ b/xen/common/grant_table.c  Fri Apr 14 13:54:46 2006
@@ -41,7 +41,7 @@
 
 static inline int
 get_maptrack_handle(
-    grant_table_t *t)
+    struct grant_table *t)
 {
     unsigned int h;
     if ( unlikely((h = t->maptrack_head) == (t->maptrack_limit - 1)) )
@@ -53,7 +53,7 @@
 
 static inline void
 put_maptrack_handle(
-    grant_table_t *t, int handle)
+    struct grant_table *t, int handle)
 {
     t->maptrack[handle].ref = t->maptrack_head;
     t->maptrack_head = handle;
@@ -76,7 +76,7 @@
     int            handle;
     unsigned long  frame = 0;
     int            rc = GNTST_okay;
-    active_grant_entry_t *act;
+    struct active_grant_entry *act;
 
     /* Entry details from @rd's shared grant table. */
     grant_entry_t *sha;
@@ -123,9 +123,9 @@
     /* Get a maptrack handle. */
     if ( unlikely((handle = get_maptrack_handle(ld->grant_table)) == -1) )
     {
-        int              i;
-        grant_mapping_t *new_mt;
-        grant_table_t   *lgt = ld->grant_table;
+        int                   i;
+        struct grant_mapping *new_mt;
+        struct grant_table   *lgt = ld->grant_table;
 
         if ( (lgt->maptrack_limit << 1) > MAPTRACK_MAX_ENTRIES )
         {
@@ -264,10 +264,9 @@
 
     TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom);
 
-    ld->grant_table->maptrack[handle].domid         = op->dom;
-    ld->grant_table->maptrack[handle].ref = op->ref;
-    ld->grant_table->maptrack[handle].flags =
-        (op->flags & MAPTRACK_GNTMAP_MASK);
+    ld->grant_table->maptrack[handle].domid = op->dom;
+    ld->grant_table->maptrack[handle].ref   = op->ref;
+    ld->grant_table->maptrack[handle].flags = op->flags;
 
     op->dev_bus_addr = (u64)frame << PAGE_SHIFT;
     op->handle       = handle;
@@ -326,9 +325,9 @@
     domid_t          dom;
     grant_ref_t      ref;
     struct domain   *ld, *rd;
-    active_grant_entry_t *act;
+    struct active_grant_entry *act;
     grant_entry_t   *sha;
-    grant_mapping_t *map;
+    struct grant_mapping *map;
     u16              flags;
     s16              rc = 0;
     unsigned long    frame;
@@ -534,12 +533,12 @@
 gnttab_prepare_for_transfer(
     struct domain *rd, struct domain *ld, grant_ref_t ref)
 {
-    grant_table_t *rgt;
-    grant_entry_t *sha;
-    domid_t        sdom;
-    u16            sflags;
-    u32            scombo, prev_scombo;
-    int            retries = 0;
+    struct grant_table *rgt;
+    struct grant_entry *sha;
+    domid_t             sdom;
+    u16                 sflags;
+    u32                 scombo, prev_scombo;
+    int                 retries = 0;
 
     if ( unlikely((rgt = rd->grant_table) == NULL) ||
          unlikely(ref >= NR_GRANT_ENTRIES) )
@@ -775,11 +774,11 @@
 grant_table_create(
     struct domain *d)
 {
-    grant_table_t *t;
-    int            i;
+    struct grant_table *t;
+    int                 i;
 
     BUG_ON(MAPTRACK_MAX_ENTRIES < NR_GRANT_ENTRIES);
-    if ( (t = xmalloc(grant_table_t)) == NULL )
+    if ( (t = xmalloc(struct grant_table)) == NULL )
         goto no_mem;
 
     /* Simple stuff. */
@@ -787,16 +786,16 @@
     spin_lock_init(&t->lock);
 
     /* Active grant table. */
-    if ( (t->active = xmalloc_array(active_grant_entry_t, NR_GRANT_ENTRIES))
-         == NULL )
+    t->active = xmalloc_array(struct active_grant_entry, NR_GRANT_ENTRIES);
+    if ( t->active == NULL )
         goto no_mem;
-    memset(t->active, 0, sizeof(active_grant_entry_t) * NR_GRANT_ENTRIES);
+    memset(t->active, 0, sizeof(struct active_grant_entry) * NR_GRANT_ENTRIES);
 
     /* Tracking of mapped foreign frames table */
     if ( (t->maptrack = alloc_xenheap_page()) == NULL )
         goto no_mem;
     t->maptrack_order = 0;
-    t->maptrack_limit = PAGE_SIZE / sizeof(grant_mapping_t);
+    t->maptrack_limit = PAGE_SIZE / sizeof(struct grant_mapping);
     memset(t->maptrack, 0, PAGE_SIZE);
     for ( i = 0; i < t->maptrack_limit; i++ )
         t->maptrack[i].ref = i+1;
@@ -829,13 +828,13 @@
 gnttab_release_mappings(
     struct domain *d)
 {
-    grant_table_t        *gt = d->grant_table;
-    grant_mapping_t      *map;
+    struct grant_table   *gt = d->grant_table;
+    struct grant_mapping *map;
     grant_ref_t           ref;
     grant_handle_t        handle;
     struct domain        *rd;
-    active_grant_entry_t *act;
-    grant_entry_t        *sha;
+    struct active_grant_entry *act;
+    struct grant_entry   *sha;
 
     BUG_ON(!test_bit(_DOMF_dying, &d->domain_flags));
 
@@ -912,7 +911,7 @@
 grant_table_destroy(
     struct domain *d)
 {
-    grant_table_t *t = d->grant_table;
+    struct grant_table *t = d->grant_table;
 
     if ( t == NULL )
         return;
diff -r 5c477ad95dba -r b055716f89c0 xen/include/xen/grant_table.h
--- a/xen/include/xen/grant_table.h     Fri Apr 14 13:40:30 2006
+++ b/xen/include/xen/grant_table.h     Fri Apr 14 13:54:46 2006
@@ -29,11 +29,11 @@
 #include <asm/grant_table.h>
 
 /* Active grant entry - used for shadowing GTF_permit_access grants. */
-typedef struct {
+struct active_grant_entry {
     u32           pin;    /* Reference count information.  */
     domid_t       domid;  /* Domain being granted access.  */
     unsigned long frame;  /* Frame being granted.          */
-} active_grant_entry_t;
+};
 
  /* Count of writable host-CPU mappings. */
 #define GNTPIN_hstw_shift    (0)
@@ -60,29 +60,30 @@
  * Tracks a mapping of another domain's grant reference. Each domain has a
  * table of these, indexes into which are returned as a 'mapping handle'.
  */
-typedef struct {
+struct grant_mapping {
     u32      ref;           /* grant ref */
     u16      flags;         /* 0-4: GNTMAP_* ; 5-15: unused */
     domid_t  domid;         /* granting domain */
-} grant_mapping_t;
-#define MAPTRACK_GNTMAP_MASK  0x1f
-#define MAPTRACK_MAX_ENTRIES  (~((u32)0))
+};
+
+/* Fairly arbitrary. [POLICY] */
+#define MAPTRACK_MAX_ENTRIES 16384
 
 /* Per-domain grant information. */
-typedef struct {
+struct grant_table {
     /* Shared grant table (see include/public/grant_table.h). */
-    grant_entry_t        *shared;
+    struct grant_entry   *shared;
     /* Active grant table. */
-    active_grant_entry_t *active;
+    struct active_grant_entry *active;
     /* Mapping tracking table. */
-    grant_mapping_t      *maptrack;
+    struct grant_mapping *maptrack;
     unsigned int          maptrack_head;
     unsigned int          maptrack_order;
     unsigned int          maptrack_limit;
     unsigned int          map_count;
     /* Lock protecting updates to active and shared grant tables. */
     spinlock_t            lock;
-} grant_table_t;
+};
 
 /* Create/destroy per-domain grant table context. */
 int grant_table_create(
diff -r 5c477ad95dba -r b055716f89c0 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Fri Apr 14 13:40:30 2006
+++ b/xen/include/xen/sched.h   Fri Apr 14 13:54:46 2006
@@ -125,7 +125,7 @@
     struct evtchn   *evtchn[NR_EVTCHN_BUCKETS];
     spinlock_t       evtchn_lock;
 
-    grant_table_t   *grant_table;
+    struct grant_table *grant_table;
 
     /*
      * Interrupt to event-channel mappings. Updates should be protected by the 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Replace grant-table typedefs with explicit structs., Xen patchbot -unstable <=