Skip to contentSkip to conversation

tools/libxendevicemodel: Strip __XEN_TOOLS__ header guard

PATCH In review Andrew Cooper 2 participants 4 messages Mar 4, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxendevicemodel: Strip __XEN_TOOLS__ header guard

This is inappropriate for the header file of a standalone library with stable API and ABI.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>

Discovered when trying to actually remove the use of unstable libraries from a trivial userspace emulator. Current users of xendevicemodel.h inherit __XEN_TOOLS__ from libxenctrl.h (or equiv).

---
 tools/include/xendevicemodel.h | 4 ----
 1 file changed, 4 deletions(-)
tools/include/xendevicemodel.h +0 -4
index 33698d67f3..797e0c6b29 100644
@@ -17,8 +17,6 @@
 #ifndef XENDEVICEMODEL_H
 #define XENDEVICEMODEL_H
 
-#ifdef __XEN_TOOLS__
-
 #include <stdint.h>
 
 #include <xen/xen.h>
@@ -377,8 +375,6 @@ int xendevicemodel_nr_vcpus(
  */
 int xendevicemodel_restrict(xendevicemodel_handle *dmod, domid_t domid);
 
-#endif /* __XEN_TOOLS__ */
-
 #endif /* XENDEVICEMODEL_H */
 
 /*
Signature · 1 line
2.11.0
#1 lore raw

Andrew Cooper writes ("[PATCH for-4.15] tools/libxendevicemodel: Strip __XEN_TOOLS__ header guard"):

Quoted 2 lines

This is inappropriate for the header file of a standalone library with stable API and ABI.

wat

Quoted 3 lines

Discovered when trying to actually remove the use of unstable libraries from a trivial userspace emulator. Current users of xendevicemodel.h inherit __XEN_TOOLS__ from libxenctrl.h (or equiv).

#3 lore raw
In reply to Andrew Cooper
Quoted 4 lines · Andrew Cooper

This is inappropriate for the header file of a standalone library with stable API and ABI.

Quoted 8 lines

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>

Discovered when trying to actually remove the use of unstable libraries from a trivial userspace emulator. Current users of xendevicemodel.h inherit __XEN_TOOLS__ from libxenctrl.h (or equiv).
---

... and this patch is broken.

But CI doesn't pick it up because we've also broken the header check scripts as part of library refactoring.

The 4.13 header checks do work, and point out that there is yet another set of bogus __XEN_TOOLS__ ifdef in the Xen public ABI, which hides the ioserverid_t type and (rightly) breaks the build.

Which in turn proves that the header checks (for xendevicemodel.h at least) never ever checked anything originally, because they didn't pass __XEN_TOOLS__ in at the top and just saw an empty file.

~Andrew