[PATCH 02/13] alist: Allow inclusion from OS headers

Simon Glass sjg at chromium.org
Wed May 27 18:10:12 CEST 2026


Sandbox needs to include system headers in some files, but also wants
to use alist. Adjust the headers to permit this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 include/alist.h | 16 +++++++++++-----
 lib/alist.c     |  1 +
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/include/alist.h b/include/alist.h
index b00d9ea97d6..69d7cdb722f 100644
--- a/include/alist.h
+++ b/include/alist.h
@@ -10,8 +10,14 @@
 #define __ALIST_H
 
 #include <stdbool.h>
-#include <linux/bitops.h>
+
+#ifdef USE_HOSTCC
+#include <sys/types.h>
+#include <stdint.h>
+#else
 #include <linux/types.h>
+#endif
+#define BIT(nr)			(1UL << (nr))
 
 /**
  * struct alist - object list that can be allocated and freed
@@ -41,10 +47,10 @@
  */
 struct alist {
 	void *data;
-	u16 obj_size;
-	u16 count;
-	u16 alloc;
-	u16 flags;
+	unsigned short obj_size;
+	unsigned short count;
+	unsigned short alloc;
+	unsigned short flags;
 };
 
 /**
diff --git a/lib/alist.c b/lib/alist.c
index 4ce651f5c45..0ae07f0f5c0 100644
--- a/lib/alist.c
+++ b/lib/alist.c
@@ -8,6 +8,7 @@
 
 #include <alist.h>
 #include <display_options.h>
+#include <log.h>
 #include <malloc.h>
 #include <stdio.h>
 #include <string.h>
-- 
2.43.0



More information about the U-Boot mailing list