Skip to contentSkip to conversation

libxl: provide libxl_bitmap_{or,and}

PATCH Superseded Linda Jacobson 3 participants 14 messages Apr 15, 2015

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 libxl: provide libxl_bitmap_{or,and}

There are new functions to provide logical and and or of two bitmaps.

---

v.1 The new functions were added.
v.2 The comments and format were corrected.
v.3 The bitmap functions were rewritten to manipulate bytes not bits. v.4 Several non-modified parameters, and local variables were changed to const
Also the code formatting was fixed.
v.5 The commit subject line now has versions and is simpler.
v.6 All descriptions in the commit history are now complete sentences.
Extraneous blank lines are gone.

---
 tools/libxl/libxl_utils.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_utils.h |  7 +++++
 2 files changed, 77 insertions(+)
tools/libxl/libxl_utils.c +70 -0
index 9053b27..f552700 100644
@@ -691,6 +691,76 @@ void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit)
     bitmap->map[bit / 8] &= ~(1 << (bit & 7));
 }
 
+int libxl_bitmap_or(libxl_ctx *ctx, libxl_bitmap *or_map,
+                    const libxl_bitmap *map1, const libxl_bitmap *map2)
+{
+    GC_INIT(ctx);
+    int rc;
+    uint32_t i;
+    const libxl_bitmap *large_map;
+    const libxl_bitmap *small_map;
+
+    if (map1->size > map2->size) {
+        large_map = map1;
+        small_map = map2;
+    } else {
+        large_map = map2;
+        small_map = map1;
+    }
+
+    rc = libxl_bitmap_alloc(ctx, or_map, large_map->size * 8);
+    if (rc)
+        goto out;
+
+    /*
+     *  If bitmaps aren't the same size, their union (logical or) will
+     *  be size of larger bit map.  Any bit past the end of the
+     *  smaller bit map, will match the larger one.
+     */
+    for (i = 0; i < small_map->size; i++)
+        or_map->map[i] = (small_map->map[i] | large_map->map[i]);
+
+    for (i = small_map->size; i < large_map->size; i++)
+        or_map->map[i] = large_map->map[i];
+
+out:
+    GC_FREE;
+    return rc;
+}
+
+int libxl_bitmap_and(libxl_ctx *ctx, libxl_bitmap *and_map,
+                     const libxl_bitmap *map1, const libxl_bitmap *map2)
+{
+    GC_INIT(ctx);    
+    int rc;
+    uint32_t i;
+    const libxl_bitmap *large_map;
+    const libxl_bitmap *small_map;
+
+    if (map1->size > map2->size) {
+        large_map = map1;
+        small_map = map2;
+    } else {
+        large_map = map2;
+        small_map = map1;
+    }
+
+    rc = libxl_bitmap_alloc(ctx, and_map, small_map->size * 8);
+    if (rc)
+        goto out;
+
+    /* 
+     *  If bitmaps aren't same size, their 'and' will be size of
+     *  smaller bit map
+     */
+    for (i = 0; i < and_map->size; i++)
+        and_map->map[i] = (large_map->map[i] & small_map->map[i]);
+
+out: 
+    GC_FREE;
+    return rc;
+}
+
 int libxl_bitmap_count_set(const libxl_bitmap *bitmap)
 {
     int i, nr_set_bits = 0;
tools/libxl/libxl_utils.h +7 -0
index acacdd9..a128a7c 100644
@@ -90,6 +90,13 @@ int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_set(libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit);
 int libxl_bitmap_count_set(const libxl_bitmap *cpumap);
+/* Or and and functions for two bitmaps */
+int libxl_bitmap_or(libxl_ctx *ctx, libxl_bitmap *or_map,
+                    const libxl_bitmap *map1, 
+                    const libxl_bitmap *map2); 
+int libxl_bitmap_and(libxl_ctx *ctx, libxl_bitmap *and_map,
+                     const libxl_bitmap *map1, 
+                     const libxl_bitmap *map2);
 char *libxl_bitmap_to_hex_string(libxl_ctx *ctx, const libxl_bitmap *cpumap);
 static inline void libxl_bitmap_set_any(libxl_bitmap *bitmap)
 {
Signature · 1 line
1.9.1
#1 lore raw
Quoted 1 line · Linda Jacobson

There are new functions to provide logical and and or of two bitmaps.

Please could you add a sentence or two on the intended use of these functions, since there are no callers being added here.

In particular without that I can't tell if these need to be part of the public API or if they are going to be used by something internal.

If the former then I think a LIBXL_HAVE_... #define is needed in libxl.h (as described by the comments in there, and there are many examples).

If the latter then the prototype should differ. (I'll explain that if/when this turns out to be the case).

tools/libxl/libxl_utils.h int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit); · line 93

Quoted 9 lines
tools/libxl/libxl_utils.h +1 -0
index acacdd9..a128a7c 100644
@@ -90,6 +90,13 @@ int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_set(libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit);
 int libxl_bitmap_count_set(const libxl_bitmap *cpumap);
+/* Or and and functions for two bitmaps */

This comment doesn't say anything which isn't already apparent from the names and prototypes of the functions in question. Just leave it out.

Quoted 9 lines
tools/libxl/libxl_utils.h +6 -0
+int libxl_bitmap_or(libxl_ctx *ctx, libxl_bitmap *or_map,
+                    const libxl_bitmap *map1, 
+                    const libxl_bitmap *map2); 
+int libxl_bitmap_and(libxl_ctx *ctx, libxl_bitmap *and_map,
+                     const libxl_bitmap *map1, 
+                     const libxl_bitmap *map2);
 char *libxl_bitmap_to_hex_string(libxl_ctx *ctx, const libxl_bitmap *cpumap);
 static inline void libxl_bitmap_set_any(libxl_bitmap *bitmap)
 {
#2 lore raw
Quoted 6 lines · Ian Campbell
Quoted 1 line · Linda Jacobson

There are new functions to provide logical and and or of two bitmaps.

Please could you add a sentence or two on the intended use of these functions, since there are no callers being added here.

Linda is our Outreachy applicant. This is a small task that Julien and I assigned to her.

One user I can think of is in some of the vNUMA validation functions that operate on bitmaps. But to keep this task small and simple I didn't ask her to actually use the functions she introduce.

Quoted 3 lines

In particular without that I can't tell if these need to be part of the public API or if they are going to be used by something internal.

I think these functions should be public functions.

Quoted 3 lines

If the former then I think a LIBXL_HAVE_... #define is needed in libxl.h (as described by the comments in there, and there are many examples).

We're a bit lax on these functions (there is no LIBXL_HAVE_BITMAP...) so I didn't ask her to add one. We can add LIBXL_HAVE_BITMAP_AND_OR in libxl.h if you think it is necessary.

Wei.

Quoted 27 lines

If the latter then the prototype should differ. (I'll explain that if/when this turns out to be the case).

tools/libxl/libxl_utils.h int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit); · line 93

Quoted 9 lines
tools/libxl/libxl_utils.h +1 -0
index acacdd9..a128a7c 100644
@@ -90,6 +90,13 @@ int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_set(libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit);
 int libxl_bitmap_count_set(const libxl_bitmap *cpumap);
+/* Or and and functions for two bitmaps */

This comment doesn't say anything which isn't already apparent from the names and prototypes of the functions in question. Just leave it out.

Quoted 9 lines
tools/libxl/libxl_utils.h +6 -0
+int libxl_bitmap_or(libxl_ctx *ctx, libxl_bitmap *or_map,
+                    const libxl_bitmap *map1, 
+                    const libxl_bitmap *map2); 
+int libxl_bitmap_and(libxl_ctx *ctx, libxl_bitmap *and_map,
+                     const libxl_bitmap *map1, 
+                     const libxl_bitmap *map2);
 char *libxl_bitmap_to_hex_string(libxl_ctx *ctx, const libxl_bitmap *cpumap);
 static inline void libxl_bitmap_set_any(libxl_bitmap *bitmap)
 {
#3 lore raw
Quoted 10 lines · Wei Liu
Quoted 6 lines · Ian Campbell
Quoted 1 line · Linda Jacobson

There are new functions to provide logical and and or of two bitmaps.

Please could you add a sentence or two on the intended use of these functions, since there are no callers being added here.

Linda is our Outreachy applicant. This is a small task that Julien and I assigned to her.

Sure, but that doesn't remove the need for the commit log to be a standalone justification for the patch in its own right.

Quoted 9 lines

One user I can think of is in some of the vNUMA validation functions that operate on bitmaps. But to keep this task small and simple I didn't ask her to actually use the functions she introduce.

Quoted 3 lines

In particular without that I can't tell if these need to be part of the public API or if they are going to be used by something internal.

I think these functions should be public functions.

Sure, but the reasoning for why you^WLinda thinks that needs to be in the commit log. In particular because there are no users being added.

I could probably guess why you think these should be public, but I shouldn't have to guess and in any case that doesn't help in 6 months when someone asks "why do we have these functions".

Quoted 5 lines
Quoted 3 lines

If the former then I think a LIBXL_HAVE_... #define is needed in libxl.h (as described by the comments in there, and there are many examples).

We're a bit lax on these functions (there is no LIBXL_HAVE_BITMAP...)

Weren't they always there and hence don't need it?

Ian.

Quoted 33 lines

so
I didn't ask her to add one. We can add LIBXL_HAVE_BITMAP_AND_OR in libxl.h if you think it is necessary.

Wei.

Quoted 27 lines

If the latter then the prototype should differ. (I'll explain that if/when this turns out to be the case).

tools/libxl/libxl_utils.h int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit); · line 93

Quoted 9 lines
tools/libxl/libxl_utils.h +1 -0
index acacdd9..a128a7c 100644
@@ -90,6 +90,13 @@ int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_set(libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit);
 int libxl_bitmap_count_set(const libxl_bitmap *cpumap);
+/* Or and and functions for two bitmaps */

This comment doesn't say anything which isn't already apparent from the names and prototypes of the functions in question. Just leave it out.

Quoted 9 lines
tools/libxl/libxl_utils.h +6 -0
+int libxl_bitmap_or(libxl_ctx *ctx, libxl_bitmap *or_map,
+                    const libxl_bitmap *map1, 
+                    const libxl_bitmap *map2); 
+int libxl_bitmap_and(libxl_ctx *ctx, libxl_bitmap *and_map,
+                     const libxl_bitmap *map1, 
+                     const libxl_bitmap *map2);
 char *libxl_bitmap_to_hex_string(libxl_ctx *ctx, const libxl_bitmap *cpumap);
 static inline void libxl_bitmap_set_any(libxl_bitmap *bitmap)
 {
#4 lore raw
Quoted 23 lines · Ian Campbell
Quoted 10 lines · Wei Liu
Quoted 6 lines · Ian Campbell
Quoted 1 line · Linda Jacobson

There are new functions to provide logical and and or of two bitmaps.

Please could you add a sentence or two on the intended use of these functions, since there are no callers being added here.

Linda is our Outreachy applicant. This is a small task that Julien and I assigned to her.

Sure, but that doesn't remove the need for the commit log to be a standalone justification for the patch in its own right.

Quoted 8 lines

One user I can think of is in some of the vNUMA validation functions that operate on bitmaps. But to keep this task small and simple I didn't ask her to actually use the functions she introduce.

Quoted 3 lines

In particular without that I can't tell if these need to be part of the public API or if they are going to be used by something internal.

Quoted 9 lines
Quoted 1 line

I think these functions should be public functions.

Sure, but the reasoning for why you^WLinda thinks that needs to be in the commit log. In particular because there are no users being added.

I could probably guess why you think these should be public, but I shouldn't have to guess and in any case that doesn't help in 6 months when someone asks "why do we have these functions".

Linda, can you use something like this in your commit log:

Provide libxl_bitmap_{and,or} functions. These functions can be used in vNUMA configuration check function. They are also generally useful so they are made as public API.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

If the former then I think a LIBXL_HAVE_... #define is needed in libxl.h (as described by the comments in there, and there are many examples).

We're a bit lax on these functions (there is no LIBXL_HAVE_BITMAP...)

Weren't they always there and hence don't need it?

OK, maybe I'm mistaken.

Linda, you need to add one more hunk to libxl.h.

#define LIBXL_HAVE_BITMAP_AND_OR 1

Search for other LIBXL_HAVE_ macro to get an idea how it is handled.

If you have any questions, just ask.

Wei.

Quoted 36 lines

Ian.

Quoted 33 lines

so
I didn't ask her to add one. We can add LIBXL_HAVE_BITMAP_AND_OR in libxl.h if you think it is necessary.

Wei.

Quoted 27 lines

If the latter then the prototype should differ. (I'll explain that if/when this turns out to be the case).

tools/libxl/libxl_utils.h int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit); · line 93

Quoted 9 lines
tools/libxl/libxl_utils.h +1 -0
index acacdd9..a128a7c 100644
@@ -90,6 +90,13 @@ int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_set(libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit);
 int libxl_bitmap_count_set(const libxl_bitmap *cpumap);
+/* Or and and functions for two bitmaps */

This comment doesn't say anything which isn't already apparent from the names and prototypes of the functions in question. Just leave it out.

Quoted 9 lines
tools/libxl/libxl_utils.h +6 -0
+int libxl_bitmap_or(libxl_ctx *ctx, libxl_bitmap *or_map,
+                    const libxl_bitmap *map1, 
+                    const libxl_bitmap *map2); 
+int libxl_bitmap_and(libxl_ctx *ctx, libxl_bitmap *and_map,
+                     const libxl_bitmap *map1, 
+                     const libxl_bitmap *map2);
 char *libxl_bitmap_to_hex_string(libxl_ctx *ctx, const libxl_bitmap *cpumap);
 static inline void libxl_bitmap_set_any(libxl_bitmap *bitmap)
 {
#5 lore raw

Sent from my iPhone

Quoted 33 lines · Wei Liu
Quoted 23 lines · Ian Campbell
Quoted 10 lines · Wei Liu
Quoted 6 lines · Ian Campbell
Quoted 2 lines · Linda Jacobson

There are new functions to provide logical and and or of two bitmaps.

Please could you add a sentence or two on the intended use of these functions, since there are no callers being added here.

Linda is our Outreachy applicant. This is a small task that Julien and I assigned to her.

Sure, but that doesn't remove the need for the commit log to be a standalone justification for the patch in its own right.

Quoted 7 lines

One user I can think of is in some of the vNUMA validation functions that operate on bitmaps. But to keep this task small and simple I didn't ask her to actually use the functions she introduce.

Quoted 2 lines

In particular without that I can't tell if these need to be part of the public API or if they are going to be used by something internal.

Quoted 8 lines
Quoted 1 line

I think these functions should be public functions.

Sure, but the reasoning for why you^WLinda thinks that needs to be in the commit log. In particular because there are no users being added.

I could probably guess why you think these should be public, but I shouldn't have to guess and in any case that doesn't help in 6 months when someone asks "why do we have these functions".

Quoted 5 lines

Linda, can you use something like this in your commit log:

Provide libxl_bitmap_{and,or} functions. These functions can be used in vNUMA configuration check function. They are also generally useful so they are made as public API.

Of course

L

Quoted 55 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

If the former then I think a LIBXL_HAVE_... #define is needed in libxl.h (as described by the comments in there, and there are many examples).

We're a bit lax on these functions (there is no LIBXL_HAVE_BITMAP...)

Weren't they always there and hence don't need it?

OK, maybe I'm mistaken.

Linda, you need to add one more hunk to libxl.h.

#define LIBXL_HAVE_BITMAP_AND_OR 1

Search for other LIBXL_HAVE_ macro to get an idea how it is handled.

If you have any questions, just ask.

Wei.

Quoted 35 lines

Ian.

Quoted 32 lines

so
I didn't ask her to add one. We can add LIBXL_HAVE_BITMAP_AND_OR in libxl.h if you think it is necessary.

Wei.

Quoted 26 lines

If the latter then the prototype should differ. (I'll explain that if/when this turns out to be the case).

tools/libxl/libxl_utils.h int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit); · line 93

Quoted 9 lines
tools/libxl/libxl_utils.h +1 -0
index acacdd9..a128a7c 100644
@@ -90,6 +90,13 @@ int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_set(libxl_bitmap *bitmap, int bit);
 void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit);
 int libxl_bitmap_count_set(const libxl_bitmap *cpumap);
+/* Or and and functions for two bitmaps */

This comment doesn't say anything which isn't already apparent from the names and prototypes of the functions in question. Just leave it out.

Quoted 9 lines
tools/libxl/libxl_utils.h +6 -0
+int libxl_bitmap_or(libxl_ctx *ctx, libxl_bitmap *or_map,
+                    const libxl_bitmap *map1, 
+                    const libxl_bitmap *map2); 
+int libxl_bitmap_and(libxl_ctx *ctx, libxl_bitmap *and_map,
+                     const libxl_bitmap *map1, 
+                     const libxl_bitmap *map2);
 char *libxl_bitmap_to_hex_string(libxl_ctx *ctx, const libxl_bitmap *cpumap);
 static inline void libxl_bitmap_set_any(libxl_bitmap *bitmap)
 {
author
#6 lore raw
In reply to Wei Liu

When adding the HAVE macro, is there a protocol on where in libxl.h, this one should be placed? They appear to be fairly spread out through the file.

Thanks.

Linda

Quoted 85 lines · Wei Liu
Quoted 19 lines · Ian Campbell
Quoted 8 lines · Wei Liu
Quoted 5 lines · Ian Campbell
Quoted 1 line · Linda Jacobson

There are new functions to provide logical and and or of two bitmaps.

Please could you add a sentence or two on the intended use of these functions, since there are no callers being added here.

Linda is our Outreachy applicant. This is a small task that Julien and I assigned to her.

Sure, but that doesn't remove the need for the commit log to be a standalone justification for the patch in its own right.

Quoted 7 lines

One user I can think of is in some of the vNUMA validation functions that operate on bitmaps. But to keep this task small and simple I didn't ask her to actually use the functions she introduce.

Quoted 3 lines

In particular without that I can't tell if these need to be part of the public API or if they are going to be used by something internal.

Quoted 8 lines
Quoted 1 line

I think these functions should be public functions.

Sure, but the reasoning for why you^WLinda thinks that needs to be in the commit log. In particular because there are no users being added.

I could probably guess why you think these should be public, but I shouldn't have to guess and in any case that doesn't help in 6 months when someone asks "why do we have these functions".

Linda, can you use something like this in your commit log:

Provide libxl_bitmap_{and,or} functions. These functions can be used in vNUMA configuration check function. They are also generally useful so they are made as public API.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

If the former then I think a LIBXL_HAVE_... #define is needed in libxl.h (as described by the comments in there, and there are many examples).

We're a bit lax on these functions (there is no LIBXL_HAVE_BITMAP...)

Weren't they always there and hence don't need it?

OK, maybe I'm mistaken.

Linda, you need to add one more hunk to libxl.h.

#define LIBXL_HAVE_BITMAP_AND_OR 1

Search for other LIBXL_HAVE_ macro to get an idea how it is handled.

If you have any questions, just ask.

Wei.

Quoted 33 lines

Ian.

Quoted 31 lines

so
I didn't ask her to add one. We can add LIBXL_HAVE_BITMAP_AND_OR in libxl.h if you think it is necessary.

Wei.

Quoted 25 lines

If the latter then the prototype should differ. (I'll explain that if/when this turns out to be the case).

tools/libxl/libxl_utils.h int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit); · line 93

Quoted 9 lines
tools/libxl/libxl_utils.h +1 -0
index acacdd9..a128a7c 100644
@@ -90,6 +90,13 @@ int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit);
  void libxl_bitmap_set(libxl_bitmap *bitmap, int bit);
  void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit);
  int libxl_bitmap_count_set(const libxl_bitmap *cpumap);
+/* Or and and functions for two bitmaps */

This comment doesn't say anything which isn't already apparent from the names and prototypes of the functions in question. Just leave it out.

Quoted 9 lines
tools/libxl/libxl_utils.h +6 -0
+int libxl_bitmap_or(libxl_ctx *ctx, libxl_bitmap *or_map,
+                    const libxl_bitmap *map1,
+                    const libxl_bitmap *map2);
+int libxl_bitmap_and(libxl_ctx *ctx, libxl_bitmap *and_map,
+                     const libxl_bitmap *map1,
+                     const libxl_bitmap *map2);
  char *libxl_bitmap_to_hex_string(libxl_ctx *ctx, const libxl_bitmap *cpumap);
  static inline void libxl_bitmap_set_any(libxl_bitmap *bitmap)
  {
#7 lore raw
Quoted 3 lines · Linda

When adding the HAVE macro, is there a protocol on where in libxl.h, this one should be placed? They appear to be fairly spread out through the file.

You can place it near the top.

Wei.

#8 lore raw
Quoted 6 lines · Wei Liu
Quoted 3 lines · Linda

When adding the HAVE macro, is there a protocol on where in libxl.h, this one should be placed? They appear to be fairly spread out through the file.

You can place it near the top.

But not right at the top! Just stick it next to an arbitrary existing one.

author
#9 lore raw
Quoted 8 lines · Ian Campbell
Quoted 5 lines · Wei Liu
Quoted 3 lines · Linda

When adding the HAVE macro, is there a protocol on where in libxl.h, this one should be placed? They appear to be fairly spread out through the file.

You can place it near the top.

But not right at the top! Just stick it next to an arbitrary existing one.

Will do.

Linda Jacobson

Quoted 2 lines
author
#10 lore raw
In reply to Wei Liu

BTW who changes the configure file to test for the HAVE_ macros?

Thanks.

Linda

Quoted 85 lines · Wei Liu
Quoted 19 lines · Ian Campbell
Quoted 8 lines · Wei Liu
Quoted 5 lines · Ian Campbell
Quoted 1 line · Linda Jacobson

There are new functions to provide logical and and or of two bitmaps.

Please could you add a sentence or two on the intended use of these functions, since there are no callers being added here.

Linda is our Outreachy applicant. This is a small task that Julien and I assigned to her.

Sure, but that doesn't remove the need for the commit log to be a standalone justification for the patch in its own right.

Quoted 7 lines

One user I can think of is in some of the vNUMA validation functions that operate on bitmaps. But to keep this task small and simple I didn't ask her to actually use the functions she introduce.

Quoted 3 lines

In particular without that I can't tell if these need to be part of the public API or if they are going to be used by something internal.

Quoted 8 lines
Quoted 1 line

I think these functions should be public functions.

Sure, but the reasoning for why you^WLinda thinks that needs to be in the commit log. In particular because there are no users being added.

I could probably guess why you think these should be public, but I shouldn't have to guess and in any case that doesn't help in 6 months when someone asks "why do we have these functions".

Linda, can you use something like this in your commit log:

Provide libxl_bitmap_{and,or} functions. These functions can be used in vNUMA configuration check function. They are also generally useful so they are made as public API.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

If the former then I think a LIBXL_HAVE_... #define is needed in libxl.h (as described by the comments in there, and there are many examples).

We're a bit lax on these functions (there is no LIBXL_HAVE_BITMAP...)

Weren't they always there and hence don't need it?

OK, maybe I'm mistaken.

Linda, you need to add one more hunk to libxl.h.

#define LIBXL_HAVE_BITMAP_AND_OR 1

Search for other LIBXL_HAVE_ macro to get an idea how it is handled.

If you have any questions, just ask.

Wei.

Quoted 33 lines

Ian.

Quoted 31 lines

so
I didn't ask her to add one. We can add LIBXL_HAVE_BITMAP_AND_OR in libxl.h if you think it is necessary.

Wei.

Quoted 25 lines

If the latter then the prototype should differ. (I'll explain that if/when this turns out to be the case).

tools/libxl/libxl_utils.h int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit); · line 93

Quoted 9 lines
tools/libxl/libxl_utils.h +1 -0
index acacdd9..a128a7c 100644
@@ -90,6 +90,13 @@ int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit);
  void libxl_bitmap_set(libxl_bitmap *bitmap, int bit);
  void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit);
  int libxl_bitmap_count_set(const libxl_bitmap *cpumap);
+/* Or and and functions for two bitmaps */

This comment doesn't say anything which isn't already apparent from the names and prototypes of the functions in question. Just leave it out.

Quoted 9 lines
tools/libxl/libxl_utils.h +6 -0
+int libxl_bitmap_or(libxl_ctx *ctx, libxl_bitmap *or_map,
+                    const libxl_bitmap *map1,
+                    const libxl_bitmap *map2);
+int libxl_bitmap_and(libxl_ctx *ctx, libxl_bitmap *and_map,
+                     const libxl_bitmap *map1,
+                     const libxl_bitmap *map2);
  char *libxl_bitmap_to_hex_string(libxl_ctx *ctx, const libxl_bitmap *cpumap);
  static inline void libxl_bitmap_set_any(libxl_bitmap *bitmap)
  {
#11 lore raw
Quoted 2 lines · Linda

BTW who changes the configure file to test for the HAVE_ macros?

The user (application) of libxl should test that. We don't need to worry about the test.

Wei.

#13 lore raw
In reply to Linda

On Wed, 2015-04-15 at 10:38 -0600, Linda wrote:

Please stop top posting.

Quoted 1 line

BTW who changes the configure file to test for the HAVE_ macros?

Nobody, this is purely for the benefit of external callers of the library.

No code in xen.git should ever check this #define (with a few exceptions which do not apply here).

Ian.

author
#12 lore raw
In reply to Wei Liu
Quoted 5 lines · Wei Liu
Quoted 2 lines · Linda

BTW who changes the configure file to test for the HAVE_ macros?

The user (application) of libxl should test that. We don't need to worry about the test.

Thanks.

Linda

Quoted 3 lines

Wei.