Add client ops instance arg
[petitboot] / ui / test / pb-test.c
index a36e991507563f2d59e9dd51a885b19b95adf85b..b6ff627566b9ce59fa6ebf8d45071ba5fa10e5b2 100644 (file)
@@ -2,11 +2,11 @@
 #include <stdio.h>
 
 #include "ui/common/discover-client.h"
 #include <stdio.h>
 
 #include "ui/common/discover-client.h"
-#include "ui/common/device.h"
 
 
-static int print_device_add(struct device *device)
+static int print_device_add(struct device *device,
+       void __attribute__((unused)) *arg)
 {
 {
-       int i;
+       struct boot_option *opt;
 
        printf("new device:\n");
        printf("\tid:   %s\n", device->id);
 
        printf("new device:\n");
        printf("\tid:   %s\n", device->id);
@@ -14,9 +14,8 @@ static int print_device_add(struct device *device)
        printf("\tdesc: %s\n", device->description);
        printf("\ticon: %s\n", device->icon_file);
 
        printf("\tdesc: %s\n", device->description);
        printf("\ticon: %s\n", device->icon_file);
 
-       printf("\t%d boot options:\n", device->n_options);
-       for (i = 0; i < device->n_options; i++) {
-               struct boot_option *opt = &device->options[i];
+       printf("\tboot options:\n");
+       list_for_each_entry(&device->boot_options, opt, list) {
                printf("\t\tid:   %s\n", opt->id);
                printf("\t\tname: %s\n", opt->name);
                printf("\t\tdesc: %s\n", opt->description);
                printf("\t\tid:   %s\n", opt->id);
                printf("\t\tname: %s\n", opt->name);
                printf("\t\tdesc: %s\n", opt->description);
@@ -29,13 +28,13 @@ static int print_device_add(struct device *device)
        return 0;
 }
 
        return 0;
 }
 
-static void print_device_remove(const char *dev_id)
+static void print_device_remove(char *dev_id, void __attribute__((unused)) *arg)
 {
        printf("removed device:\n");
        printf("\tid:   %s\n", dev_id);
 }
 
 {
        printf("removed device:\n");
        printf("\tid:   %s\n", dev_id);
 }
 
-struct discover_client_ops client_ops = {
+static struct discover_client_ops client_ops = {
        .add_device = print_device_add,
        .remove_device = print_device_remove,
 };
        .add_device = print_device_add,
        .remove_device = print_device_remove,
 };
@@ -44,8 +43,6 @@ int main(void)
 {
        struct discover_client *client;
 
 {
        struct discover_client *client;
 
-       printf("pid: %d\n", getpid());
-
        client = discover_client_init(&client_ops);
        if (!client)
                return -1;
        client = discover_client_init(&client_ops);
        if (!client)
                return -1;