struct list_head ifs;
struct uci_network {
+ struct ucimap_section_data map;
struct list_head list;
struct list_head alias;
};
struct uci_alias {
+ struct ucimap_section_data map;
struct list_head list;
const char *name;
network_parse_ip(void *section, struct uci_optmap *om, union ucimap_data *data, const char *str)
{
struct uci_network *net = section;
- unsigned char *target = data->s;
+ unsigned char *target = (unsigned char *) data->s;
unsigned int tmp[4];
int i;
return 0;
}
+static struct ucimap_section_data *
+network_allocate(struct uci_map *map, struct uci_sectionmap *sm, struct uci_section *s)
+{
+ struct uci_network *p = malloc(sizeof(struct uci_network));
+ memset(p, 0, sizeof(struct uci_network));
+ return &p->map;
+}
+
struct my_optmap {
struct uci_optmap map;
int test;
};
static struct uci_sectionmap network_interface = {
+ UCIMAP_SECTION(struct uci_network, map),
.type = "interface",
- .alloc_len = sizeof(struct uci_network),
+ .alloc = network_allocate,
.init = network_init_interface,
.add = network_add_interface,
.options = &network_interface_options[0].map,
};
static struct uci_sectionmap network_alias = {
+ UCIMAP_SECTION(struct uci_alias, map),
.type = "alias",
.options = network_alias_options,
- .alloc_len = sizeof(struct uci_network),
.init = network_init_alias,
.add = network_add_alias,
.n_options = ARRAY_SIZE(network_alias_options),