lib: Add array-size header
[petitboot] / lib / pb-config / storage-test.c
index ba4e952d94ac0f64b4b26091feb646d6540544c4..3ce58ef0a03c30b39ea44ac9b0abbfa79a58eea1 100644 (file)
@@ -4,15 +4,17 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
+#include <array-size/array-size.h>
+
 #include "pb-config.h"
 #include "storage.h"
 
-struct network_config net1 = {
+struct interface_config net1 = {
        .hwaddr = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 },
        .method = CONFIG_METHOD_DHCP,
 };
 
-struct network_config net2 = {
+struct interface_config net2 = {
        .hwaddr = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x56 },
        .method = CONFIG_METHOD_STATIC,
        .static_config = {
@@ -21,14 +23,17 @@ struct network_config net2 = {
        },
 };
 
-struct network_config *network_configs[] = { &net1, &net2 };
-
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+struct interface_config *interface_configs[] = { &net1, &net2 };
+const char *dns_servers[] = { "192.168.1.1", "192.168.1.2" };
 
 struct config test_config = {
        .autoboot_enabled = true,
-       .network_configs = network_configs,
-       .n_network_configs = ARRAY_SIZE(network_configs),
+       .network = {
+               .interfaces = interface_configs,
+               .n_interfaces = ARRAY_SIZE(interface_configs),
+               .dns_servers = dns_servers,
+               .n_dns_servers = ARRAY_SIZE(dns_servers),
+       }
 };
 
 struct test_storage {