From patchwork Tue Jun 21 03:21:37 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: 638394 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 3rYY1N3qzJz9sxS for ; Tue, 21 Jun 2016 13:22:00 +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=MkEIl8kW; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3rYY1N2lJhzDqGh for ; Tue, 21 Jun 2016 13:22:00 +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=MkEIl8kW; 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 3rYY18198czDq62 for ; Tue, 21 Jun 2016 13:21:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b=MkEIl8kW; 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 DD88014005A for ; Tue, 21 Jun 2016 11:21:44 +0800 (SGT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mendozajonas.com; s=mail; t=1466479305; bh=YVHeTpV1XqTeTEgOhN5ODzd3m9hS70ZYfB2OSmZIulU=; h=From:To:Subject:Date:From; b=MkEIl8kWJCwNdqRXDJ62kemzIUInMRf7P6S3xqYKEhO7mtLSawiSKse5WevDet7+y RgBARQO2DReSqCSM8bkeI5r0lWOLzgDHCg7BU3lUaDpTjcdGU9whTizHyqnJfR1O0+ sxLekulDRZGmYQMc5Pi3Yc4iVxqJYoSi4Sd3AJKI= From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH V2 1/3] discover/device-handler: Make boot_status() public Date: Tue, 21 Jun 2016 13:21:37 +1000 Message-Id: <20160621032139.9390-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.9.0 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: , MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Rename boot_status() to device_handler_boot_status() and make it accessible by files that include device-handler.h. This enables the boot status to be updated from additional callers, in particular within parser functions. Signed-off-by: Samuel Mendoza-Jonas --- discover/device-handler.c | 21 +++++++++++---------- discover/device-handler.h | 3 +++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/discover/device-handler.c b/discover/device-handler.c index cc48747..1c69de0 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -396,7 +396,7 @@ void device_handler_remove(struct device_handler *handler, talloc_free(device); } -static void boot_status(void *arg, struct boot_status *status) +void device_handler_boot_status(void *arg, struct boot_status *status) { struct device_handler *handler = arg; @@ -448,7 +448,8 @@ static int default_timeout(void *arg) platform_pre_boot(); handler->pending_boot = boot(handler, handler->default_boot_option, - NULL, handler->dry_run, boot_status, handler); + NULL, handler->dry_run, device_handler_boot_status, + handler); handler->pending_boot_is_default = true; return 0; } @@ -873,7 +874,7 @@ int device_handler_discover(struct device_handler *handler, status->message = talloc_asprintf(status, _("Processing %s device %s"), device_type_display_name(dev->device->type), dev->device->id); - boot_status(handler, status); + device_handler_boot_status(handler, status); process_boot_option_queue(handler); @@ -901,7 +902,7 @@ out: */ status->message = talloc_asprintf(status,_("Processing %s complete"), dev->device->id); - boot_status(handler, status); + device_handler_boot_status(handler, status); talloc_free(status); talloc_free(ctx); @@ -924,7 +925,7 @@ int device_handler_dhcp(struct device_handler *handler, */ status->message = talloc_asprintf(status, _("Processing dhcp event on %s"), dev->device->id); - boot_status(handler, status); + device_handler_boot_status(handler, status); /* create our context */ ctx = device_handler_discover_context_create(handler, dev); @@ -940,7 +941,7 @@ int device_handler_dhcp(struct device_handler *handler, */ status->message = talloc_asprintf(status,_("Processing %s complete"), dev->device->id); - boot_status(handler, status); + device_handler_boot_status(handler, status); talloc_free(status); talloc_free(ctx); @@ -958,7 +959,7 @@ int device_handler_conf(struct device_handler *handler, status = talloc_zero(handler, struct boot_status); status->type = BOOT_STATUS_INFO; status->message = talloc_asprintf(status, _("Processing user config")); - boot_status(handler, status); + device_handler_boot_status(handler, status); /* create our context */ ctx = device_handler_discover_context_create(handler, dev); @@ -970,7 +971,7 @@ int device_handler_conf(struct device_handler *handler, status->message = talloc_asprintf(status, _("Processing user config complete")); - boot_status(handler, status); + device_handler_boot_status(handler, status); talloc_free(status); talloc_free(ctx); @@ -1009,7 +1010,7 @@ void device_handler_boot(struct device_handler *handler, platform_pre_boot(); handler->pending_boot = boot(handler, opt, cmd, handler->dry_run, - boot_status, handler); + device_handler_boot_status, handler); handler->pending_boot_is_default = false; } @@ -1211,7 +1212,7 @@ void device_handler_process_url(struct device_handler *handler, status->message = talloc_asprintf(status, _("Config file %s parsed"), pb_url->file); msg: - boot_status(handler, status); + device_handler_boot_status(handler, status); talloc_free(status); } diff --git a/discover/device-handler.h b/discover/device-handler.h index 12f5ce0..6b1a757 100644 --- a/discover/device-handler.h +++ b/discover/device-handler.h @@ -4,6 +4,7 @@ #include #include +#include struct device_handler; struct discover_device; @@ -96,6 +97,8 @@ int device_handler_conf(struct device_handler *handler, void device_handler_remove(struct device_handler *handler, struct discover_device *device); +void device_handler_boot_status(void *arg, struct boot_status *status); + struct discover_context *device_handler_discover_context_create( struct device_handler *handler, struct discover_device *device);