+static void *
+ucimap_find_section(struct uci_map *map, struct uci_fixup *f)
+{
+ struct ucimap_section_data *sd;
+ struct list_head *p;
+
+ list_for_each(p, &map->sdata) {
+ sd = list_entry(p, struct ucimap_section_data, list);
+ if (sd->sm != f->sm)
+ continue;
+ if (strcmp(f->name, sd->section_name) != 0)
+ continue;
+ return ucimap_section_ptr(sd);
+ }
+ return NULL;
+}
+
+static bool
+ucimap_handle_fixup(struct uci_map *map, struct uci_fixup *f)
+{
+ void *ptr = ucimap_find_section(map, f);
+ struct ucimap_list *list;
+
+ if (!ptr)
+ return false;
+
+ switch(f->type & UCIMAP_TYPE) {
+ case UCIMAP_SIMPLE:
+ f->data->section = ptr;
+ break;
+ case UCIMAP_LIST:
+ list = f->data->list;
+ list->item[list->n_items++].section = ptr;
+ break;
+ }
+ return true;
+}
+