From patchwork Tue Sep 6 01:45:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 666117 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sSqFN6Hksz9rxl for ; Tue, 6 Sep 2016 11:46:16 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b=jtH/CE/G; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sSqFN5Dy5zDrqF for ; Tue, 6 Sep 2016 11:46:16 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b=jtH/CE/G; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Received: from mendozajonas.com (mendozajonas.com [188.166.185.233]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sSqFD0YKwzDrpj for ; Tue, 6 Sep 2016 11:46:08 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b=jtH/CE/G; dkim-atps=neutral Received: from skellige.ozlabs.ibm.com (unknown [122.99.82.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: sam@mendozajonas.com) by mendozajonas.com (Postfix) with ESMTPSA id BBC6E143F6B; Tue, 6 Sep 2016 09:46:04 +0800 (SGT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mendozajonas.com; s=mail; t=1473126365; bh=Rjp09AcKNPg78Qyitf/UzIDPnjjO8B+O26e8CAFlwQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jtH/CE/GT7lvmnB3YhhIcRFlW8gRK/BpdGHwc1vIlJsp4UCx8OlVH+HsqbeijWZFJ kyaBm6dEktloR/ICT+Dh1SdPbhaQ8X8WUbigFNzlNfshrJACbEPVF0Xmwu7vSKDIbk YMyJspiMxEtlnNRSQvD/4RdkR1kIek1kILMm0744= From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH 1/4] discover: Deprecate 'conf' user event Date: Tue, 6 Sep 2016 11:45:51 +1000 Message-Id: <20160906014554.20634-2-sam@mendozajonas.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160906014554.20634-1-sam@mendozajonas.com> References: <20160906014554.20634-1-sam@mendozajonas.com> X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" 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 --- discover/device-handler.c | 32 +------------------------------- discover/device-handler.h | 2 -- discover/event.c | 2 -- discover/event.h | 1 - discover/user-event.c | 25 ------------------------- 5 files changed, 1 insertion(+), 61 deletions(-) diff --git a/discover/device-handler.c b/discover/device-handler.c index 346cb02..54a1986 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -921,36 +921,6 @@ int device_handler_dhcp(struct device_handler *handler, 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) { @@ -1127,7 +1097,7 @@ void device_handler_process_url(struct device_handler *handler, 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); diff --git a/discover/device-handler.h b/discover/device-handler.h index f785ccc..6ffa4e1 100644 --- a/discover/device-handler.h +++ b/discover/device-handler.h @@ -93,8 +93,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); -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); diff --git a/discover/event.c b/discover/event.c index 242ae81..1be19eb 100644 --- a/discover/event.c +++ b/discover/event.c @@ -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; - else if (streq(buf, "conf")) - *action = EVENT_ACTION_CONF; else if (streq(buf, "dhcp")) *action = EVENT_ACTION_DHCP; else if (streq(buf, "boot")) diff --git a/discover/event.h b/discover/event.h index a603615..a639d9c 100644 --- a/discover/event.h +++ b/discover/event.h @@ -11,7 +11,6 @@ enum event_action { EVENT_ACTION_ADD = 20, EVENT_ACTION_REMOVE, EVENT_ACTION_URL, - EVENT_ACTION_CONF, EVENT_ACTION_DHCP, EVENT_ACTION_BOOT, EVENT_ACTION_SYNC, diff --git a/discover/user-event.c b/discover/user-event.c index 3ccac90..7ceddb1 100644 --- a/discover/user-event.c +++ b/discover/user-event.c @@ -392,28 +392,6 @@ static int user_event_dhcp(struct user_event *uev, struct event *event) 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; @@ -514,9 +492,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_CONF: - result = user_event_conf(uev, event); - break; case EVENT_ACTION_DHCP: result = user_event_dhcp(uev, event); goto out;