]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
xen/nodemask: Introduce a NODEMASK_PR() wrapper for printing
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 25 Jun 2019 09:48:22 +0000 (10:48 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 31 Jul 2019 13:19:07 +0000 (14:19 +0100)
Rework nodes_addr() into nodemask_bits() and change the indirection to match
its cpumask_bits() counterpart, and update the caller.

Use NODEMASK_PR() to fix up one opencoded access into nodemask.bits in
dump_domains().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/domctl.c
xen/common/keyhandler.c
xen/include/xen/nodemask.h

index 3d937434af0271a3175af6b4b9eae66389f8f67e..b48e4085830ea86adbc7b98a04d1077d8d938cca 100644 (file)
@@ -123,14 +123,14 @@ int xenctl_bitmap_to_cpumask(cpumask_var_t *cpumask,
 static int nodemask_to_xenctl_bitmap(struct xenctl_bitmap *xenctl_nodemap,
                                      const nodemask_t *nodemask)
 {
-    return bitmap_to_xenctl_bitmap(xenctl_nodemap, nodes_addr(*nodemask),
+    return bitmap_to_xenctl_bitmap(xenctl_nodemap, nodemask_bits(nodemask),
                                    MAX_NUMNODES);
 }
 
 static int xenctl_bitmap_to_nodemask(nodemask_t *nodemask,
                                      const struct xenctl_bitmap *xenctl_nodemap)
 {
-    return xenctl_bitmap_to_bitmap(nodes_addr(*nodemask), xenctl_nodemap,
+    return xenctl_bitmap_to_bitmap(nodemask_bits(nodemask), xenctl_nodemap,
                                    MAX_NUMNODES);
 }
 
index a5e95e2fe90037d86396d1efe96ad1cec6b3946c..57b360ee4b88c8750cf205991116686cc5dc0677 100644 (file)
@@ -293,7 +293,7 @@ static void dump_domains(unsigned char key)
         dump_pageframe_info(d);
 
         printk("NODE affinity for domain %d: [%*pbl]\n",
-               d->domain_id, MAX_NUMNODES, d->node_affinity.bits);
+               d->domain_id, NODEMASK_PR(&d->node_affinity));
 
         printk("VCPU information and callbacks for domain %u:\n",
                d->domain_id);
index 7ab8b794c6018c8b9124ee0199d0ba5ec5df7766..1dd6c7458e77e3aa796761db14aceed55dfa1091 100644 (file)
@@ -39,7 +39,7 @@
  * nodemask_t nodemask_of_node(node)   Return nodemask with bit 'node' set
  * NODE_MASK_ALL                       Initializer - all bits set
  * NODE_MASK_NONE                      Initializer - no bits set
- * unsigned long *nodes_addr(mask)     Array of unsigned long's in mask
+ * unsigned long *nodemask_bits(mask)  Array of unsigned long's in mask
  *
  * for_each_node_mask(node, mask)      for-loop node over mask
  *
 #include <xen/numa.h>
 
 typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
+
+/*
+ * printf arguments for a nodemask.  Shorthand for using '%*pb[l]' when
+ * printing a nodemask.
+ */
+#define NODEMASK_PR(src) MAX_NUMNODES, nodemask_bits(src)
+
+#define nodemask_bits(src) ((src)->bits)
+
 extern nodemask_t _unused_nodemask_arg_;
 
 #define node_set(node, dst) __node_set((node), &(dst))
@@ -250,8 +259,6 @@ static inline int __cycle_node(int n, const nodemask_t *maskp, int nbits)
        [0 ... BITS_TO_LONGS(MAX_NUMNODES)-1] =  0UL                    \
 } })
 
-#define nodes_addr(src) ((src).bits)
-
 #if MAX_NUMNODES > 1
 #define for_each_node_mask(node, mask)                 \
        for ((node) = first_node(mask);                 \