Skip to contentSkip to conversation

xen/bsearch: Split out of lib.h into it's own header

PATCH In review Andrew Cooper 2 participants 3 messages Feb 25, 2025 – Feb 26, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/bsearch: Split out of lib.h into it's own header

There are currently two users, and lib.h is included everywhere.

No functional change.

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>

This will marginally improve compile times, but mostly it's about splitting up lib.h

---
 xen/arch/arm/io.c             |  1 +
 xen/arch/arm/vgic/vgic-mmio.c |  1 +
 xen/include/xen/bsearch.h     | 50 +++++++++++++++++++++++++++++++++++
 xen/include/xen/lib.h         | 43 ------------------------------
 4 files changed, 52 insertions(+), 43 deletions(-)
 create mode 100644 xen/include/xen/bsearch.h
xen/arch/arm/io.c +1 -0
index 96c740d5636c..653428e16c1f 100644
@@ -7,6 +7,7 @@
  * Copyright (c) 2011 Citrix Systems.
  */
 
+#include <xen/bsearch.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
 #include <xen/spinlock.h>
xen/arch/arm/vgic/vgic-mmio.c +1 -0
index bd4caf7fc326..4ad350c21c8b 100644
@@ -13,6 +13,7 @@
  */
 
 #include <xen/bitops.h>
+#include <xen/bsearch.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <asm/new_vgic.h>
xen/include/xen/bsearch.h new file +50 -0

50 lines not on this page · raw message

xen/include/xen/lib.h +0 -43

49 lines not on this page · raw message

Signature · 1 line
2.39.5
#2 lore raw
Quoted 10 lines · Julien Grall

Hi Andrew,

Quoted 5 lines · Andrew Cooper

There are currently two users, and lib.h is included everywhere.

No functional change.

Thanks.

Funnily enough, there's a hunk missing.

xen/lib/bsearch.c +0 -0
index 149f7feafd1f..9973117d1d8e 100644
@@ -10,4 +10,4 @@

  */

 #define BSEARCH_IMPLEMENTATION
-#include <xen/lib.h>
+#include <xen/bsearch.h>

Nothing anywhere in CI notices, because not even ARM emits a library call, so the fact that bsearch.o is empty when it's discarded by the linker for not being used, is incidental.

I cannot think of any good way to fix this pattern.  Not even adding a self-test, because we intentionally write those in a way so they get dropped if the library function as a whole isn't referenced.

Given that we've got this pattern exactly twice (this, and SORT), I think we just need to stay vigilant.

~Andrew