X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fuser-event.c;h=7350b6c3c4ef558927097c53066e81759d0a0a1f;hp=15d9c87bebc2213a1cb265b532999921f0e92925;hb=5496eee36f70631ae45403f90ed7b4dc143f27c0;hpb=81f28af2bd94cc552aef1a7b959e4c6b84457ce7 diff --git a/discover/user-event.c b/discover/user-event.c index 15d9c87..7350b6c 100644 --- a/discover/user-event.c +++ b/discover/user-event.c @@ -60,6 +60,8 @@ static const char *event_action_name(enum event_action action) return "dhcp"; case EVENT_ACTION_BOOT: return "boot"; + case EVENT_ACTION_SYNC: + return "sync"; default: break; } @@ -464,6 +466,18 @@ static int user_event_boot(struct user_event *uev, struct event *event) return 0; } +static int user_event_sync(struct user_event *uev, struct event *event) +{ + struct device_handler *handler = uev->handler; + + if (strncasecmp(event->device, "all", strlen("all")) != 0) + device_sync_snapshots(handler, event->device); + else + device_sync_snapshots(handler, NULL); + + return 0; +} + static void user_event_handle_message(struct user_event *uev, char *buf, int len) { @@ -499,6 +513,9 @@ static void user_event_handle_message(struct user_event *uev, char *buf, case EVENT_ACTION_BOOT: result = user_event_boot(uev, event); break; + case EVENT_ACTION_SYNC: + result = user_event_sync(uev, event); + break; default: break; }