[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Replace &foo[0] with foo where the latter seems cleaner



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 72f9c751d3ea1f17ff513cd7fc2cbe671a9af7c9
# Parent  b550a93c6459c4f0f2a86b61a08768d040482d88
Replace &foo[0] with foo where the latter seems cleaner
(which is usually, and particularly when its an argument
to one of the bitops functions).

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

diff -r b550a93c6459 -r 72f9c751d3ea xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Wed Apr 19 17:24:49 2006
+++ b/xen/arch/x86/domain_build.c       Wed Apr 19 17:32:20 2006
@@ -443,7 +443,7 @@
     v->arch.guest_table = mk_pagetable((unsigned long)l3start);
 #else
     l2start = l2tab = (l2_pgentry_t *)mpt_alloc; mpt_alloc += PAGE_SIZE;
-    memcpy(l2tab, &idle_pg_table[0], PAGE_SIZE);
+    memcpy(l2tab, idle_pg_table, PAGE_SIZE);
     l2tab[LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT] =
         l2e_from_paddr((unsigned long)l2start, __PAGE_HYPERVISOR);
     v->arch.guest_table = mk_pagetable((unsigned long)l2start);
@@ -569,7 +569,7 @@
     /* WARNING: The new domain must have its 'processor' field filled in! */
     maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l4_page_table;
     l4start = l4tab = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
-    memcpy(l4tab, &idle_pg_table[0], PAGE_SIZE);
+    memcpy(l4tab, idle_pg_table, PAGE_SIZE);
     l4tab[l4_table_offset(LINEAR_PT_VIRT_START)] =
         l4e_from_paddr(__pa(l4start), __PAGE_HYPERVISOR);
     l4tab[l4_table_offset(PERDOMAIN_VIRT_START)] =
diff -r b550a93c6459 -r 72f9c751d3ea xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Wed Apr 19 17:24:49 2006
+++ b/xen/arch/x86/irq.c        Wed Apr 19 17:32:20 2006
@@ -198,7 +198,7 @@
     {
         d = action->guest[i];
         if ( (action->ack_type != ACKTYPE_NONE) &&
-             !test_and_set_bit(irq, &d->pirq_mask[0]) )
+             !test_and_set_bit(irq, d->pirq_mask) )
             action->in_flight++;
         send_guest_pirq(d, irq);
     }
@@ -285,7 +285,7 @@
         ASSERT(action->ack_type == ACKTYPE_EOI);
         ASSERT(desc->status & IRQ_GUEST);
         for ( i = 0; i < action->nr_guests; i++ )
-            clear_bit(vector_to_irq(vector), &action->guest[i]->pirq_mask[0]);
+            clear_bit(vector_to_irq(vector), action->guest[i]->pirq_mask);
         action->in_flight = 0;
         spin_unlock(&desc->lock);
     }
@@ -310,8 +310,8 @@
 
         spin_lock_irq(&desc->lock);
 
-        if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
-             test_and_clear_bit(pirq, &d->pirq_mask[0]) )
+        if ( !test_bit(d->pirq_to_evtchn[pirq], s->evtchn_mask) &&
+             test_and_clear_bit(pirq, d->pirq_mask) )
         {
             ASSERT(action->ack_type != ACKTYPE_NONE);
             if ( --action->in_flight == 0 )
@@ -493,13 +493,13 @@
     switch ( action->ack_type )
     {
     case ACKTYPE_UNMASK:
-        if ( test_and_clear_bit(irq, &d->pirq_mask[0]) &&
+        if ( test_and_clear_bit(irq, d->pirq_mask) &&
              (--action->in_flight == 0) )
             desc->handler->end(vector);
         break;
     case ACKTYPE_EOI:
         /* NB. If #guests == 0 then we clear the eoi_map later on. */
-        if ( test_and_clear_bit(irq, &d->pirq_mask[0]) &&
+        if ( test_and_clear_bit(irq, d->pirq_mask) &&
              (--action->in_flight == 0) &&
              (action->nr_guests != 0) )
         {
@@ -511,7 +511,7 @@
         break;
     }
 
-    BUG_ON(test_bit(irq, &d->pirq_mask[0]));
+    BUG_ON(test_bit(irq, d->pirq_mask));
 
     if ( action->nr_guests != 0 )
         goto out;
@@ -587,16 +587,16 @@
                 printk("%u(%c%c%c%c)",
                        d->domain_id,
                        (test_bit(d->pirq_to_evtchn[irq],
-                                 &d->shared_info->evtchn_pending[0]) ?
+                                 d->shared_info->evtchn_pending) ?
                         'P' : '-'),
                        (test_bit(d->pirq_to_evtchn[irq]/BITS_PER_LONG,
                                  &d->shared_info->vcpu_info[0].
                                  evtchn_pending_sel) ?
                         'S' : '-'),
                        (test_bit(d->pirq_to_evtchn[irq],
-                                 &d->shared_info->evtchn_mask[0]) ?
+                                 d->shared_info->evtchn_mask) ?
                         'M' : '-'),
-                       (test_bit(irq, &d->pirq_mask) ?
+                       (test_bit(irq, d->pirq_mask) ?
                         'M' : '-'));
                 if ( i != action->nr_guests )
                     printk(",");
diff -r b550a93c6459 -r 72f9c751d3ea xen/arch/x86/shadow_public.c
--- a/xen/arch/x86/shadow_public.c      Wed Apr 19 17:24:49 2006
+++ b/xen/arch/x86/shadow_public.c      Wed Apr 19 17:32:20 2006
@@ -327,7 +327,7 @@
 
     mmfn = page_to_mfn(mmfn_info);
     mpl4e = (l4_pgentry_t *) map_domain_page_global(mmfn);
-    memcpy(mpl4e, &idle_pg_table[0], PAGE_SIZE);
+    memcpy(mpl4e, idle_pg_table, PAGE_SIZE);
     mpl4e[l4_table_offset(PERDOMAIN_VIRT_START)] =
         l4e_from_paddr(__pa(d->arch.mm_perdomain_l3), __PAGE_HYPERVISOR);
 
diff -r b550a93c6459 -r 72f9c751d3ea xen/common/event_channel.c
--- a/xen/common/event_channel.c        Wed Apr 19 17:24:49 2006
+++ b/xen/common/event_channel.c        Wed Apr 19 17:32:20 2006
@@ -477,10 +477,10 @@
      * others may require explicit memory barriers.
      */
 
-    if ( test_and_set_bit(port, &s->evtchn_pending[0]) )
+    if ( test_and_set_bit(port, s->evtchn_pending) )
         return;
 
-    if ( !test_bit        (port, &s->evtchn_mask[0])    &&
+    if ( !test_bit        (port, s->evtchn_mask) &&
          !test_and_set_bit(port / BITS_PER_LONG,
                            &v->vcpu_info->evtchn_pending_sel) &&
          !test_and_set_bit(0, &v->vcpu_info->evtchn_upcall_pending) )
@@ -668,8 +668,8 @@
      * These operations must happen in strict order. Based on
      * include/xen/event.h:evtchn_set_pending(). 
      */
-    if ( test_and_clear_bit(port, &s->evtchn_mask[0]) &&
-         test_bit          (port, &s->evtchn_pending[0]) &&
+    if ( test_and_clear_bit(port, s->evtchn_mask) &&
+         test_bit          (port, s->evtchn_pending) &&
          !test_and_set_bit (port / BITS_PER_LONG,
                             &v->vcpu_info->evtchn_pending_sel) &&
          !test_and_set_bit (0, &v->vcpu_info->evtchn_upcall_pending) )
diff -r b550a93c6459 -r 72f9c751d3ea xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Wed Apr 19 17:24:49 2006
+++ b/xen/common/keyhandler.c   Wed Apr 19 17:32:20 2006
@@ -157,9 +157,9 @@
             printk("    Notifying guest (virq %d, port %d, stat %d/%d/%d)\n",
                    VIRQ_DEBUG, v->virq_to_evtchn[VIRQ_DEBUG],
                    test_bit(v->virq_to_evtchn[VIRQ_DEBUG], 
-                            &d->shared_info->evtchn_pending[0]),
+                            d->shared_info->evtchn_pending),
                    test_bit(v->virq_to_evtchn[VIRQ_DEBUG], 
-                            &d->shared_info->evtchn_mask[0]),
+                            d->shared_info->evtchn_mask),
                    test_bit(v->virq_to_evtchn[VIRQ_DEBUG]/BITS_PER_LONG, 
                             &v->vcpu_info->evtchn_pending_sel));
             send_guest_vcpu_virq(v, VIRQ_DEBUG);

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.