diff options
author | Vic Yang | 2018-12-06 00:04:23 -0600 |
---|---|---|
committer | Gerrit Code Review | 2018-12-06 00:04:23 -0600 |
commit | 4379a289219acc67b2121c854d75506ec097aa94 (patch) | |
tree | 7fa2d51e46669a7182baa6e61ea4465d269cca48 /tools | |
parent | 696dd3bd9399b93eebefbe74cadcbdda7665cc9b (diff) | |
parent | 5b3a7c006935947be792c6bea397a8278f5d29c6 (diff) | |
download | platform-build-4379a289219acc67b2121c854d75506ec097aa94.tar.gz platform-build-4379a289219acc67b2121c854d75506ec097aa94.tar.xz platform-build-4379a289219acc67b2121c854d75506ec097aa94.zip |
Merge "Move android_ids from .data.rel.ro to .rodata"
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/fs_config/fs_config_generator.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py index cd534ec24..f7e3eb2c1 100755 --- a/tools/fs_config/fs_config_generator.py +++ b/tools/fs_config/fs_config_generator.py | |||
@@ -1108,9 +1108,14 @@ class AIDArrayGen(BaseGenerator): | |||
1108 | 1108 | ||
1109 | _INCLUDE = '#include <private/android_filesystem_config.h>' | 1109 | _INCLUDE = '#include <private/android_filesystem_config.h>' |
1110 | 1110 | ||
1111 | # Note that the android_id name field is of type 'const char[]' instead of | ||
1112 | # 'const char*'. While this seems less straightforward as we need to | ||
1113 | # calculate the max length of all names, this allows the entire android_ids | ||
1114 | # table to be placed in .rodata section instead of .data.rel.ro section, | ||
1115 | # resulting in less memory pressure. | ||
1111 | _STRUCT_FS_CONFIG = textwrap.dedent(""" | 1116 | _STRUCT_FS_CONFIG = textwrap.dedent(""" |
1112 | struct android_id_info { | 1117 | struct android_id_info { |
1113 | const char *name; | 1118 | const char name[%d]; |
1114 | unsigned aid; | 1119 | unsigned aid; |
1115 | };""") | 1120 | };""") |
1116 | 1121 | ||
@@ -1132,12 +1137,13 @@ class AIDArrayGen(BaseGenerator): | |||
1132 | def __call__(self, args): | 1137 | def __call__(self, args): |
1133 | 1138 | ||
1134 | hdr = AIDHeaderParser(args['hdrfile']) | 1139 | hdr = AIDHeaderParser(args['hdrfile']) |
1140 | max_name_length = max(len(aid.friendly) + 1 for aid in hdr.aids) | ||
1135 | 1141 | ||
1136 | print AIDArrayGen._GENERATED | 1142 | print AIDArrayGen._GENERATED |
1137 | 1143 | ||
1138 | print AIDArrayGen._INCLUDE | 1144 | print AIDArrayGen._INCLUDE |
1139 | 1145 | ||
1140 | print AIDArrayGen._STRUCT_FS_CONFIG | 1146 | print AIDArrayGen._STRUCT_FS_CONFIG % max_name_length |
1141 | 1147 | ||
1142 | print AIDArrayGen._OPEN_ID_ARRAY | 1148 | print AIDArrayGen._OPEN_ID_ARRAY |
1143 | 1149 | ||