Use the canonical idiom for sockaddr_storage.
This works out a bit silly/ugly because the bits/ header file has the
wrong name, so I've also changed the map from kernel struct to boolean
to be a map from kernel struct to filename. That not only fixes this,
it's a bit more readable too. (Just yesterday, when I had no real reason
to change it, I was asking myself "why is this a boolean?"!)
Bug: http://b/236042740
Test: treehugger
Change-Id: I3eee25b493ea97d46cc5dc5fde07f7c5e77d2a46
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 9b357f1..1d7b427 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -28,23 +28,23 @@
}
# This is the set of known kernel data structures we want to remove from
-# the final headers. If the map value is False, that means that in
-# addition to removing the structure, add an #include <bits/STRUCT.h>
-# to the file.
+# the final headers. If the map value is non-empty, that means that in
+# addition to removing the structure, add a #include to the file.
kernel_structs_to_remove = {
- # Remove the structures since they are still the same as
+ # Remove these structures since they are still the same as
# timeval, itimerval.
- "__kernel_old_timeval": True,
- "__kernel_old_itimerval": True,
+ "__kernel_old_timeval": None,
+ "__kernel_old_itimerval": None,
# Replace all of the below structures with #include <bits/STRUCT.h>
- "epoll_event": False,
- "flock": False,
- "flock64": False,
- "in_addr": False,
- "ip_mreq_source": False,
- "ip_msfilter": False,
- "tcphdr": False,
- "timespec": False,
+ "__kernel_sockaddr_storage": "bits/sockaddr_storage.h",
+ "epoll_event": "bits/epoll_event.h",
+ "flock": "bits/flock.h",
+ "flock64": "bits/flock64.h",
+ "in_addr": "bits/in_addr.h",
+ "ip_mreq_source": "bits/ip_mreq_source.h",
+ "ip_msfilter": "bits/ip_msfilter.h",
+ "tcphdr": "bits/tcphdr.h",
+ "timespec": "bits/timespec.h",
}
# define to true if you want to remove all defined(CONFIG_FOO) tests
@@ -92,6 +92,8 @@
"__kernel_old_timeval": "timeval",
# Do the same for __kernel_old_itimerval as for timeval.
"__kernel_old_itimerval": "itimerval",
+ # Do the same for __kernel_sockaddr_storage.
+ "__kernel_sockaddr_storage": "sockaddr_storage",
# Replace __packed with __attribute__((__packed__)) to avoid depending
# on sys/cdefs.h
"__packed": "__attribute__((__packed__))",