From: Felix Fietkau Date: Sat, 29 Aug 2009 20:28:26 +0000 (+0200) Subject: ucimap: rename uci_sectmap* to uci_sectionmap* X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=062323b4f663d3c0a33c49d2c0ded624e4fb4693;p=uci.git ucimap: rename uci_sectmap* to uci_sectionmap* --- diff --git a/ucimap-example.c b/ucimap-example.c index 0ad31d6..d401624 100644 --- a/ucimap-example.c +++ b/ucimap-example.c @@ -104,8 +104,8 @@ struct my_optmap { int test; }; -static struct uci_sectmap network_interface; -static struct uci_sectmap network_alias; +static struct uci_sectionmap network_interface; +static struct uci_sectionmap network_alias; static struct my_optmap network_interface_options[] = { { @@ -154,7 +154,7 @@ static struct my_optmap network_interface_options[] = { } }; -static struct uci_sectmap network_interface = { +static struct uci_sectionmap network_interface = { .type = "interface", .alloc_len = sizeof(struct uci_network), .init = network_init_interface, @@ -172,7 +172,7 @@ static struct uci_optmap network_alias_options[] = { } }; -static struct uci_sectmap network_alias = { +static struct uci_sectionmap network_alias = { .type = "alias", .options = network_alias_options, .alloc_len = sizeof(struct uci_network), @@ -181,7 +181,7 @@ static struct uci_sectmap network_alias = { .n_options = ARRAY_SIZE(network_alias_options), }; -static struct uci_sectmap *network_smap[] = { +static struct uci_sectionmap *network_smap[] = { &network_interface, &network_alias, }; diff --git a/ucimap.c b/ucimap.c index 8fdeed2..cbe9320 100644 --- a/ucimap.c +++ b/ucimap.c @@ -27,16 +27,16 @@ struct uci_alloc { struct uci_fixup { struct list_head list; - struct uci_sectmap *sm; + struct uci_sectionmap *sm; const char *name; enum ucimap_type type; union ucimap_data *data; }; -struct uci_sectmap_data { +struct uci_sectionmap_data { struct list_head list; struct uci_map *map; - struct uci_sectmap *sm; + struct uci_sectionmap *sm; const char *section_name; /* list of allocations done by ucimap */ @@ -100,14 +100,14 @@ ucimap_is_custom(enum ucimap_type type) } static inline void * -ucimap_section_ptr(struct uci_sectmap_data *sd) +ucimap_section_ptr(struct uci_sectionmap_data *sd) { void *data = sd + 1; return data; } static inline union ucimap_data * -ucimap_get_data(struct uci_sectmap_data *sd, struct uci_optmap *om) +ucimap_get_data(struct uci_sectionmap_data *sd, struct uci_optmap *om) { void *data; @@ -135,7 +135,7 @@ ucimap_free_item(struct uci_alloc *a) } static void -ucimap_add_alloc(struct uci_sectmap_data *sd, void *ptr) +ucimap_add_alloc(struct uci_sectionmap_data *sd, void *ptr) { struct uci_alloc *a = &sd->allocmap[sd->allocmap_len++]; a->type = UCIMAP_SIMPLE; @@ -143,7 +143,7 @@ ucimap_add_alloc(struct uci_sectmap_data *sd, void *ptr) } static void -ucimap_free_section(struct uci_map *map, struct uci_sectmap_data *sd) +ucimap_free_section(struct uci_map *map, struct uci_sectionmap_data *sd) { void *section; int i; @@ -169,7 +169,7 @@ ucimap_cleanup(struct uci_map *map) struct list_head *ptr, *tmp; list_for_each_safe(ptr, tmp, &map->sdata) { - struct uci_sectmap_data *sd = list_entry(ptr, struct uci_sectmap_data, list); + struct uci_sectionmap_data *sd = list_entry(ptr, struct uci_sectionmap_data, list); ucimap_free_section(map, sd); } } @@ -192,7 +192,7 @@ ucimap_add_fixup(struct uci_map *map, union ucimap_data *data, struct uci_optmap } static void -ucimap_add_value(union ucimap_data *data, struct uci_optmap *om, struct uci_sectmap_data *sd, const char *str) +ucimap_add_value(union ucimap_data *data, struct uci_optmap *om, struct uci_sectionmap_data *sd, const char *str) { union ucimap_data tdata = *data; char *eptr = NULL; @@ -256,7 +256,7 @@ ucimap_add_value(union ucimap_data *data, struct uci_optmap *om, struct uci_sect static int -ucimap_parse_options(struct uci_map *map, struct uci_sectmap *sm, struct uci_sectmap_data *sd, struct uci_section *s) +ucimap_parse_options(struct uci_map *map, struct uci_sectionmap *sm, struct uci_sectionmap_data *sd, struct uci_section *s) { struct uci_element *e, *l; struct uci_option *o; @@ -290,20 +290,20 @@ ucimap_parse_options(struct uci_map *map, struct uci_sectmap *sm, struct uci_sec static int -ucimap_parse_section(struct uci_map *map, struct uci_sectmap *sm, struct uci_section *s) +ucimap_parse_section(struct uci_map *map, struct uci_sectionmap *sm, struct uci_section *s) { - struct uci_sectmap_data *sd = NULL; + struct uci_sectionmap_data *sd = NULL; struct uci_optmap *om; char *section_name; void *section; int n_alloc = 2; int err; - sd = malloc(sm->alloc_len + sizeof(struct uci_sectmap_data)); + sd = malloc(sm->alloc_len + sizeof(struct uci_sectionmap_data)); if (!sd) return UCI_ERR_MEM; - memset(sd, 0, sm->alloc_len + sizeof(struct uci_sectmap_data)); + memset(sd, 0, sm->alloc_len + sizeof(struct uci_sectionmap_data)); INIT_LIST_HEAD(&sd->list); ucimap_foreach_option(sm, om) { @@ -406,9 +406,9 @@ ucimap_fill_ptr(struct uci_ptr *ptr, struct uci_section *s, const char *option) void ucimap_set_changed(void *section, void *field) { - char *sptr = (char *)section - sizeof(struct uci_sectmap_data); - struct uci_sectmap_data *sd = (struct uci_sectmap_data *) sptr; - struct uci_sectmap *sm = sd->sm; + char *sptr = (char *)section - sizeof(struct uci_sectionmap_data); + struct uci_sectionmap_data *sd = (struct uci_sectionmap_data *) sptr; + struct uci_sectionmap *sm = sd->sm; struct uci_optmap *om; int ofs = (char *)field - (char *)section; int i = 0; @@ -425,9 +425,9 @@ ucimap_set_changed(void *section, void *field) int ucimap_store_section(struct uci_map *map, struct uci_package *p, void *section) { - char *sptr = (char *)section - sizeof(struct uci_sectmap_data); - struct uci_sectmap_data *sd = (struct uci_sectmap_data *) sptr; - struct uci_sectmap *sm = sd->sm; + char *sptr = (char *)section - sizeof(struct uci_sectionmap_data); + struct uci_sectionmap_data *sd = (struct uci_sectionmap_data *) sptr; + struct uci_sectionmap *sm = sd->sm; struct uci_section *s = NULL; struct uci_optmap *om; struct uci_element *e; @@ -488,17 +488,17 @@ ucimap_store_section(struct uci_map *map, struct uci_package *p, void *section) void * ucimap_find_section(struct uci_map *map, struct uci_fixup *f) { - struct uci_sectmap_data *sd; + struct uci_sectionmap_data *sd; struct list_head *p; void *ret; list_for_each(p, &map->sdata) { - sd = list_entry(p, struct uci_sectmap_data, list); + sd = list_entry(p, struct uci_sectionmap_data, list); if (sd->sm != f->sm) continue; if (strcmp(f->name, sd->section_name) != 0) continue; - ret = (char *)sd + sizeof(struct uci_sectmap_data); + ret = (char *)sd + sizeof(struct uci_sectionmap_data); return ret; } return NULL; @@ -541,13 +541,13 @@ ucimap_parse(struct uci_map *map, struct uci_package *pkg) free(f); } list_for_each_safe(p, tmp, &map->sdata) { - struct uci_sectmap_data *sd = list_entry(p, struct uci_sectmap_data, list); + struct uci_sectionmap_data *sd = list_entry(p, struct uci_sectionmap_data, list); void *section; if (sd->done) continue; - section = (char *) sd + sizeof(struct uci_sectmap_data); + section = (char *) sd + sizeof(struct uci_sectionmap_data); if (sd->sm->add(map, section) != 0) ucimap_free_section(map, sd); } diff --git a/ucimap.h b/ucimap.h index 2aedc78..961d34e 100644 --- a/ucimap.h +++ b/ucimap.h @@ -37,12 +37,12 @@ .name = #_field, \ .offset = offsetof(_type, _field) -struct uci_sectmap; +struct uci_sectionmap; struct uci_optmap; struct ucimap_list; struct uci_map { - struct uci_sectmap **sections; + struct uci_sectionmap **sections; unsigned int n_sections; struct list_head sdata; struct list_head fixup; @@ -78,7 +78,7 @@ struct uci_listmap { union ucimap_data data; }; -struct uci_sectmap { +struct uci_sectionmap { /* type string for the uci section */ const char *type; @@ -114,7 +114,7 @@ struct uci_optmap { struct { int maxlen; } s; - struct uci_sectmap *sm; + struct uci_sectionmap *sm; } data; };