Use in_addr in ip_mreq_source and ip_msfilter.
This adds a new mechanism to say "replace struct S with #include <bits/S.h>".
Also switch epoll_event over to the new mechanism.
Also use the kernel's struct sockaddr_storage directly rather than behind
an unnecessary #define.
This patch also removes some dead code in the header scrubber. This code
still needs rewriting completely. I learned that a "block" isn't necessarily
a single struct definition, say; it might be a run of them. It seems like
a block is a run of preprocessor directives or a run of regular code.
Bug: https://issuetracker.google.com/36987220
Test: new test
Change-Id: Ic6a5c09559766a4babe3cd4c3ea538b885e07308
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 1afdc77..967d0c7 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -78,34 +78,27 @@
"SIGRTMAX": "__SIGRTMAX",
# We want to support both BSD and Linux member names in struct udphdr.
"udphdr": "__kernel_udphdr",
- # The kernel's struct epoll_event just has __u64 for the data.
- "epoll_event": "__kernel_uapi_epoll_event",
# This causes problems when trying to export the headers for the ndk.
"__attribute_const__": "__attribute__((__const__))",
+ # In this case the kernel tries to keep out of our way, but we're happy to use its definition.
+ "__kernel_sockaddr_storage": "sockaddr_storage",
}
+
+# This is the set of struct definitions that we want to replace with
+# a #include of <bits/struct.h> instead.
+kernel_struct_replacements = set(
+ [
+ "epoll_event",
+ "in_addr",
+ "ip_mreq_source",
+ "ip_msfilter",
+ ]
+ )
+
+
# This is the set of known static inline functions that we want to keep
# in the final kernel headers.
-kernel_known_arm_statics = set(
- [
- ]
- )
-
-kernel_known_arm64_statics = set(
- [
- ]
- )
-
-kernel_known_mips_statics = set(
- [
- ]
- )
-
-kernel_known_x86_statics = set(
- [
- ]
- )
-
kernel_known_generic_statics = set(
[
"ipt_get_target", # uapi/linux/netfilter_ipv4/ip_tables.h
@@ -133,25 +126,6 @@
]
)
-# this maps an architecture to the set of static inline functions that
-# we want to keep in the final headers
-#
-kernel_known_statics = {
- "arm" : kernel_known_arm_statics,
- "arm64" : kernel_known_arm64_statics,
- "mips" : kernel_known_mips_statics,
- "x86" : kernel_known_x86_statics,
- }
-
-# this is a list of macros which we want to specifically exclude from
-# the generated files.
-#
-kernel_ignored_macros = set(
- [
-
- ]
- )
-
# this is the standard disclaimer
#
kernel_disclaimer = """\