]> git.ozlabs.org Git - petitboot/commitdiff
discover: Deprecate 'conf' user event
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 5 Sep 2016 04:18:18 +0000 (14:18 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Thu, 8 Sep 2016 05:05:14 +0000 (15:05 +1000)
The 'conf' user event is functionally very similar to the 'url' event,
in that both events result in downloading a specified configuration file
and passing it to iterate_parsers().
The 'url' event additionally allows downloading files from a directory
path and is also accessed by the UI via pb-protocol, so remove the
'conf' event and associated functions in favour of 'url' and
device_handler_process_url().

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
(cherry picked from commit e2c92865481a5fb043c03c0cde625a96ca608699)

discover/device-handler.c
discover/device-handler.h
discover/event.c
discover/event.h
discover/user-event.c

index 364b41203f4148a60eacfead3a634c3cf9dd121b..8063ad4e3d237e43881939ce274b1b35e105beac 100644 (file)
@@ -915,36 +915,6 @@ int device_handler_dhcp(struct device_handler *handler,
        return 0;
 }
 
        return 0;
 }
 
-/* incoming conf event */
-int device_handler_conf(struct device_handler *handler,
-               struct discover_device *dev, struct pb_url *url)
-{
-       struct discover_context *ctx;
-       struct boot_status *status;
-
-       status = talloc_zero(handler, struct boot_status);
-       status->type = BOOT_STATUS_INFO;
-       status->message = talloc_asprintf(status, _("Processing user config"));
-       device_handler_boot_status(handler, status);
-
-       /* create our context */
-       ctx = device_handler_discover_context_create(handler, dev);
-       ctx->conf_url = url;
-
-       iterate_parsers(ctx);
-
-       device_handler_discover_context_commit(handler, ctx);
-
-       status->message = talloc_asprintf(status,
-                               _("Processing user config complete"));
-       device_handler_boot_status(handler, status);
-
-       talloc_free(status);
-       talloc_unlink(handler, ctx);
-
-       return 0;
-}
-
 static struct discover_boot_option *find_boot_option_by_id(
                struct device_handler *handler, const char *id)
 {
 static struct discover_boot_option *find_boot_option_by_id(
                struct device_handler *handler, const char *id)
 {
@@ -1121,7 +1091,7 @@ void device_handler_process_url(struct device_handler *handler,
 
        event = talloc(handler, struct event);
        event->type = EVENT_TYPE_USER;
 
        event = talloc(handler, struct event);
        event->type = EVENT_TYPE_USER;
-       event->action = EVENT_ACTION_CONF;
+       event->action = EVENT_ACTION_URL;
 
        if (url[strlen(url) - 1] == '/') {
                event->params = talloc_array(event, struct param, 3);
 
        if (url[strlen(url) - 1] == '/') {
                event->params = talloc_array(event, struct param, 3);
index b6f9fd51a27a7d77cd5f2ca9eef172b12d0bd016..a456181f688745fa515a6b0d22d348a94c8045e0 100644 (file)
@@ -92,8 +92,6 @@ int device_handler_discover(struct device_handler *handler,
                struct discover_device *dev);
 int device_handler_dhcp(struct device_handler *handler,
                struct discover_device *dev, struct event *event);
                struct discover_device *dev);
 int device_handler_dhcp(struct device_handler *handler,
                struct discover_device *dev, struct event *event);
-int device_handler_conf(struct device_handler *handler,
-               struct discover_device *dev, struct pb_url *url);
 void device_handler_remove(struct device_handler *handler,
                struct discover_device *device);
 
 void device_handler_remove(struct device_handler *handler,
                struct discover_device *device);
 
index 242ae81bf1a756306c97db74ee0e69d62ae4d487..1be19eb2a052bd79333c379cfa2d9d3fa5a0248e 100644 (file)
@@ -49,8 +49,6 @@ static int event_parse_ad_header(char *buf, int len, enum event_action *action,
                *action = EVENT_ACTION_REMOVE;
        else if (streq(buf, "url"))
                *action = EVENT_ACTION_URL;
                *action = EVENT_ACTION_REMOVE;
        else if (streq(buf, "url"))
                *action = EVENT_ACTION_URL;
-       else if (streq(buf, "conf"))
-               *action = EVENT_ACTION_CONF;
        else if (streq(buf, "dhcp"))
                *action = EVENT_ACTION_DHCP;
        else if (streq(buf, "boot"))
        else if (streq(buf, "dhcp"))
                *action = EVENT_ACTION_DHCP;
        else if (streq(buf, "boot"))
index a6036159d75da1bb113c61539b06afa623feeb86..a639d9cfa85b03dc87d749770a757f143aef2f48 100644 (file)
@@ -11,7 +11,6 @@ enum event_action {
        EVENT_ACTION_ADD = 20,
        EVENT_ACTION_REMOVE,
        EVENT_ACTION_URL,
        EVENT_ACTION_ADD = 20,
        EVENT_ACTION_REMOVE,
        EVENT_ACTION_URL,
-       EVENT_ACTION_CONF,
        EVENT_ACTION_DHCP,
        EVENT_ACTION_BOOT,
        EVENT_ACTION_SYNC,
        EVENT_ACTION_DHCP,
        EVENT_ACTION_BOOT,
        EVENT_ACTION_SYNC,
index d9f5bd4b9f2ab5fcd8934efe02fa1f704ce0de4b..b201de8c669e84230efd6e13cc9254ecc68fbd96 100644 (file)
@@ -382,28 +382,6 @@ static int user_event_dhcp(struct user_event *uev, struct event *event)
        return 0;
 }
 
        return 0;
 }
 
-static int user_event_conf(struct user_event *uev, struct event *event)
-{
-       struct device_handler *handler = uev->handler;
-       struct discover_device *dev;
-       struct pb_url *url;
-       const char *val;
-
-       val = event_get_param(event, "url");
-       if (!val)
-               return 0;
-
-       url = pb_url_parse(event, val);
-       if (!url)
-               return 0;
-
-       dev = discover_device_create(handler, event->device);
-
-       device_handler_conf(handler, dev, url);
-
-       return 0;
-}
-
 static int user_event_add(struct user_event *uev, struct event *event)
 {
        struct device_handler *handler = uev->handler;
 static int user_event_add(struct user_event *uev, struct event *event)
 {
        struct device_handler *handler = uev->handler;
@@ -504,9 +482,6 @@ static void user_event_handle_message(struct user_event *uev, char *buf,
        case EVENT_ACTION_URL:
                result = user_event_url(uev, event);
                goto out;
        case EVENT_ACTION_URL:
                result = user_event_url(uev, event);
                goto out;
-       case EVENT_ACTION_CONF:
-               result = user_event_conf(uev, event);
-               break;
        case EVENT_ACTION_DHCP:
                result = user_event_dhcp(uev, event);
                goto out;
        case EVENT_ACTION_DHCP:
                result = user_event_dhcp(uev, event);
                goto out;