Final batch of conversions to option and verb macros (#42127)

This commit is contained in:
Yu Watanabe
2026-05-17 03:50:48 +09:00
committed by GitHub
70 changed files with 208 additions and 895 deletions
+8 -13
View File
@@ -83,22 +83,17 @@ static int bus_error_name_to_errno(const char *name) {
}
}
const sd_bus_error_map *elf_map = ALIGN_PTR(__start_SYSTEMD_BUS_ERROR_MAP);
while (elf_map < __stop_SYSTEMD_BUS_ERROR_MAP) {
assert_cc(sizeof(sd_bus_error_map) % sizeof(void*) == 0);
for (const sd_bus_error_map *m = __start_SYSTEMD_BUS_ERROR_MAP; m < __stop_SYSTEMD_BUS_ERROR_MAP; m++) {
/* For magic ELF error maps, the end marker might appear in the middle of things, since
* multiple maps might appear in the same section. Hence, let's skip over it, but realign
* the pointer to the next 8 byte boundary, which is the selected alignment for the arrays. */
if (elf_map->code == BUS_ERROR_MAP_END_MARKER) {
elf_map = ALIGN_PTR(elf_map + 1);
continue;
}
* multiple maps might appear in the same section. Skip over it. */
if (streq(elf_map->name, name)) {
assert(elf_map->code > 0);
return elf_map->code;
if (m->code != BUS_ERROR_MAP_END_MARKER &&
streq(m->name, name)) {
assert(m->code > 0);
return m->code;
}
elf_map++;
}
return EIO;
+4 -11
View File
@@ -128,19 +128,12 @@ extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[];
extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[];
static int dump_mapping_table(void) {
const sd_bus_error_map *m;
printf("----- errno mappings ------\n");
m = ALIGN_PTR(__start_SYSTEMD_BUS_ERROR_MAP);
while (m < __stop_SYSTEMD_BUS_ERROR_MAP) {
for (const sd_bus_error_map *m = __start_SYSTEMD_BUS_ERROR_MAP; m < __stop_SYSTEMD_BUS_ERROR_MAP; m++) {
assert((uintptr_t) m % sizeof(void*) == 0);
if (m->code == BUS_ERROR_MAP_END_MARKER) {
m = ALIGN_PTR(m + 1);
continue;
}
printf("%s -> %i/%s\n", strna(m->name), m->code, ERRNO_NAME(m->code));
m++;
if (m->code != BUS_ERROR_MAP_END_MARKER)
printf("%s -> %i/%s\n", strna(m->name), m->code, ERRNO_NAME(m->code));
}
printf("---------------------------\n");