summaryrefslogtreecommitdiffstats
path: root/ui/test/discover-test.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-03-11 14:07:36 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-04-16 11:41:46 +0800
commit12a5c9153ce95ddde7fb14eaba9d779933a3637c (patch)
tree0919a8d387e617c01b4a462d7cd9fe0cedbc709c /ui/test/discover-test.c
parentbd06734362bb727b09b943688d9b69aa0a84590d (diff)
downloadtalos-petitboot-12a5c9153ce95ddde7fb14eaba9d779933a3637c.tar.gz
talos-petitboot-12a5c9153ce95ddde7fb14eaba9d779933a3637c.zip
discover: Consolidate user events by device ID
Currently, we assume all user events are for a new device. This means that we can never add boot options to an existing device. This change tries to find an existing (matching by ID) device before creating a new one in the user event add path. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/test/discover-test.c')
-rw-r--r--ui/test/discover-test.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ui/test/discover-test.c b/ui/test/discover-test.c
index ae43b1e..8f7c2c2 100644
--- a/ui/test/discover-test.c
+++ b/ui/test/discover-test.c
@@ -28,6 +28,23 @@ static int print_device_add(struct device *device,
return 0;
}
+static int print_boot_option_add(struct device *dev,
+ struct boot_option *opt,
+ void __attribute__((unused)) *arg)
+{
+ printf("new boot option (dev: %s):\n", dev->id);
+ printf("\tdev id: %s\n", opt->device_id);
+ printf("\tid: %s\n", opt->id);
+ printf("\tname: %s\n", opt->name);
+ printf("\tdesc: %s\n", opt->description);
+ printf("\ticon: %s\n", opt->icon_file);
+ printf("\tboot: %s\n", opt->boot_image_file);
+ printf("\tinit: %s\n", opt->initrd_file);
+ printf("\targs: %s\n", opt->boot_args);
+
+ return 0;
+}
+
static void print_device_remove(struct device *device,
void __attribute__((unused)) *arg)
{
@@ -38,6 +55,7 @@ static void print_device_remove(struct device *device,
static struct discover_client_ops client_ops = {
.device_add = print_device_add,
+ .boot_option_add = print_boot_option_add,
.device_remove = print_device_remove,
};
OpenPOWER on IntegriCloud