[PATCH v2 1/3] xen/elfstructs: Include xen/types.h

Andrew Cooper posted 3 patches 7 months, 1 week ago
[PATCH v2 1/3] xen/elfstructs: Include xen/types.h
Posted by Andrew Cooper 7 months, 1 week ago
elfstructs.h needs the stdint.h types.  Two headers arrange this manually, but
elf.h and livepatch.h do not, which breaks source files whose headers are
properly sorted.

elfstructs.h is used by tools too, so use stdint directly outside of Xen.

Clean up trailing whitespace.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Julien Grall <julien@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
CC: Shawn Anastasio <sanastasio@raptorengineering.com>
CC: Ross Lagerwall <ross.lagerwall@citrix.com>

v2:
 * Include stdint outside of Xen.
---
 xen/include/xen/elfstructs.h    | 8 +++++++-
 xen/include/xen/livepatch_elf.h | 1 -
 xen/include/xen/version.h       | 1 -
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
index eb6b87a823a8..0ca86cd6ac4d 100644
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -26,6 +26,12 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef __XEN__
+#include <xen/stdint.h>
+#else
+#include <stdint.h>
+#endif
+
 typedef uint32_t	Elf32_Addr;	/* Unsigned program address */
 typedef uint32_t	Elf32_Off;	/* Unsigned file offset */
 typedef uint16_t	Elf32_Half;	/* Unsigned medium integer */
@@ -45,7 +51,7 @@ typedef uint64_t	Elf64_Xword;
 
 /*
  * e_ident[] identification indexes
- * See http://www.caldera.com/developers/gabi/2000-07-17/ch4.eheader.html 
+ * See http://www.caldera.com/developers/gabi/2000-07-17/ch4.eheader.html
  */
 #define EI_MAG0		0		/* file ID */
 #define EI_MAG1		1		/* file ID */
diff --git a/xen/include/xen/livepatch_elf.h b/xen/include/xen/livepatch_elf.h
index 842111e14518..a8aafecd34b1 100644
--- a/xen/include/xen/livepatch_elf.h
+++ b/xen/include/xen/livepatch_elf.h
@@ -5,7 +5,6 @@
 #ifndef __XEN_LIVEPATCH_ELF_H__
 #define __XEN_LIVEPATCH_ELF_H__
 
-#include <xen/types.h>
 #include <xen/elfstructs.h>
 
 /* The following describes an Elf file as consumed by Xen Live Patch. */
diff --git a/xen/include/xen/version.h b/xen/include/xen/version.h
index 4856ad1b446d..bc69ec9fb029 100644
--- a/xen/include/xen/version.h
+++ b/xen/include/xen/version.h
@@ -1,7 +1,6 @@
 #ifndef __XEN_VERSION_H__
 #define __XEN_VERSION_H__
 
-#include <xen/types.h>
 #include <xen/elfstructs.h>
 
 const char *xen_compile_date(void);
-- 
2.39.5


Re: [PATCH v2 1/3] xen/elfstructs: Include xen/types.h
Posted by Jan Beulich 7 months, 1 week ago
On 09.05.2025 18:32, Andrew Cooper wrote:
> elfstructs.h needs the stdint.h types.  Two headers arrange this manually, but
> elf.h and livepatch.h do not, which breaks source files whose headers are
> properly sorted.
> 
> elfstructs.h is used by tools too, so use stdint directly outside of Xen.
> 
> Clean up trailing whitespace.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
Re: [PATCH v2 1/3] xen/elfstructs: Include xen/types.h
Posted by Ross Lagerwall 7 months, 1 week ago
On Fri, May 9, 2025 at 5:32 PM Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>
> elfstructs.h needs the stdint.h types.  Two headers arrange this manually, but
> elf.h and livepatch.h do not, which breaks source files whose headers are
> properly sorted.
>
> elfstructs.h is used by tools too, so use stdint directly outside of Xen.
>
> Clean up trailing whitespace.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>