From patchwork Fri Mar 9 14:24:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 883663 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:400c:c09::23b; helo=mail-wm0-x23b.google.com; envelope-from=swupdate+bncbcxploxj6ikrbrnsrlkqkgqevygdd6a@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="GXL/plso"; dkim-atps=neutral Received: from mail-wm0-x23b.google.com (mail-wm0-x23b.google.com [IPv6:2a00:1450:400c:c09::23b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zyV5h3lXjz9sbb for ; Sat, 10 Mar 2018 01:25:12 +1100 (AEDT) Received: by mail-wm0-x23b.google.com with SMTP id o6sf1125815wmd.0 for ; Fri, 09 Mar 2018 06:25:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1520605509; cv=pass; d=google.com; s=arc-20160816; b=ICHGNS2YcVKAQc/clDdD2OrUxYgatJW0T497AATkCrBZcNq1y7UgUaqN38Jen+db7g nSnyLk4/ARW2+zKa6dWiWg4WRj96BwQJAYRpEPV55HtB+GBogwsduaVlHZMWyL4CkmU5 iCCmaeGU3YjuDpUqsznBwyOl6xOWvlXyeq5P7AKI1jnGB0iJxHgSTnkbFkgRgZhz/tr8 VqDh0PSJecbYWNJtKQWaPeshOrWAN5cE+QeVsl62zNUmGHeI3GwNkl8oe0pkWaVMN03b Y94EEBDzv3SrsORg9SDTHEp4vTGRCvlsjln/xVwWNS82ORIaXj1+jFK0GPEeEcljrE82 BWLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:arc-authentication-results :arc-message-signature:mime-version:sender:dkim-signature :arc-authentication-results; bh=qTn3Tylennk8Y2Mpec6eNBfMEzU7CicxK5oOA9oOtkE=; b=c38iedxN/kPxGCe6y4MCO60DonjdzXi4VsGGmalnnsKoJU5rtMhiLiFHev6jV18ion +aJ/eK2E6x2RtB0efggmRbPQWLPXzklLDXbjrFjQfqiSPgbZX3Qg5+J+xbT5YV89T73Z 1T8mva0lG8JNQWxN0IIsu5jFX72XT/h0lbWMnh2GyDPanzd3Sodw1rgluyXC8tUcuY0m G8aIrZJmUY3VPEO8whUirqj3plyrhvYgF4OYPHCW+ljy+X8DUZRN+ffN0/kHcIOyr892 rA7jq6s3+oEr4tfr2Tv66B6c7Otrj/ILK6mII5RAJ5tFcvQt4Q37nNLk6uu/P1hV2d/Q LuFQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=qTn3Tylennk8Y2Mpec6eNBfMEzU7CicxK5oOA9oOtkE=; b=GXL/plsoxtY7gb6xBQP4jZ8APBJGhs7dbiOZP4FZihA8TX/ULKJC8upWKWTB0vbssk OtM9HBGbihdtLo9DiYh9IlzPrhImiBQjhVLNsbPKE2uhPGCdz7dn0zjb/MxkzKE5gcG1 m8OodnFzvfnWWnhXbUEcpH+4ga3WB9CIivpHTUmFEriDzIK3vCQwnoKktctRJ2in4ytS Zqi8SgHjtDoIc5EyUTWHhNot7Prg0OXrzCxGHkXtpHb/V8WaK1a/t4Ydiva269MzYI2L isO9k4PRwHaVmTtFqHuhz7liw860tbvzsxpcU8y26jm6fy3mHbVoX/sUdpb5qC+18nj7 J6dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=qTn3Tylennk8Y2Mpec6eNBfMEzU7CicxK5oOA9oOtkE=; b=F9TlFb3mRks6sam/36IYFZM2ZzicElfP1O+X8M5tdFpeJVQ7Jq9XkGUZiHZCzNdV79 rMbYEc8B+Cy8H/LlpbKsWqEjdrYcgfBgikaOZwiyUqtGCzxhkaymwuYUhGuIF8rHPnQl uUE094xcabuuuu4ICe9bUXsGNF6WXHaKcvwg5Q/PrGVqdXw/3K7zh7Pu9eFZ3epMsUYj uLvoM3dOVza9NyZ3XSaj2QWQp2SHi3LMhT21UdIfNcZyCZvsG52dOzOoWI3AW2ELZikx 8YUS2bes/sf0KBCL5XF0jW9+BJcmQgcFZrtXxuSmM5Zt4PTHM2b3a7xjYRZmav9T2DMP Fung== Sender: swupdate@googlegroups.com X-Gm-Message-State: AElRT7HVIY1vdlMdfWtX79D9wtyXF4XvlyKotAIKPD8/v8i06Ke9Ortx iuqFKXsJx7oNUK3pshnvJkg= X-Google-Smtp-Source: AG47ELtYyVgLYBymeclARvo/RvW+COF5X7rJvRm2+hdZeCbMVK0MJxc7SGbgFXFmrXJU2AtT8qXFeQ== X-Received: by 10.28.15.138 with SMTP id 132mr38331wmp.4.1520605509695; Fri, 09 Mar 2018 06:25:09 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.223.208.195 with SMTP id z3ls2061451wrh.13.gmail; Fri, 09 Mar 2018 06:25:08 -0800 (PST) X-Received: by 10.223.152.182 with SMTP id w51mr2878299wrb.29.1520605508951; Fri, 09 Mar 2018 06:25:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520605508; cv=none; d=google.com; s=arc-20160816; b=J+jqlcmBRl7VPrBlJYwi//gjAwuA2KcIqI2P55XmF1YfQOYAvBp1xtoRgtBXsmslDA SNu9xx+pSaqfI4gyd9kdPHsi5eECCRfMWpfdMqeDK7zJRlSXbv5dXHgyFpDRsSZ0vGlf xqbMXk+Ij+L6a1DG80kfhmFgz0Cy2TaAtP6vJ1QxpO3zsQu9Y620GSek+SDu/H08YuLD MbNFFN6GmTeU4luh5XlpvkGDN1QKffCO4yosdapwAx/5gEnNsu9SGqTyDmeMjCrsLGoE EGGemODmYGKzIRU05OoSj4YK1FpgDV91MG5ssRmopZzsqkSotbNpLWZfaX20l/65pPnj Qu8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=vRGMpjrJTH9KKJvAuOqTHDpnnYcvD+8n3QfT8elimXQ=; b=z7IF3HTETqRwqXPbXs4LBADLs1QQfxdRDxWxcHlz6iv0SD6eRD8QeXZLT4KOKKrsAz N/1SWxnVrA9OSucQLRs/C1aogqKIDjYg72L1Pl77GnO8avRUBiZ0i0GvTQK5EQ4YnGBL MT/v5QHIxIDGMFRvN8Iha65zw55rJuXLXm8axhXybBBenTRyT5g+dle3zYBq6N2k0qZ1 ag51qbNsmU3OAhAJcdW8ez7YhtfeX2D6Od/AIvvfMSBam8iphfPOg0IPVNxcnv66vFGS UlEMHx7E3OPJAQXyEK5nogXlHTtXEoSX4/J5b4bOMDiqsTljDc3LzSSSyW3sJPcsT57H Q+hw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.10]) by gmr-mx.google.com with ESMTPS id 51si54547wrw.0.2018.03.09.06.25.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 06:25:08 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.10; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3zyV5c5Bnjz1qtPd; Fri, 9 Mar 2018 15:25:08 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3zyV5c514hz1qqkr; Fri, 9 Mar 2018 15:25:08 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id ZACWX6pfHe_V; Fri, 9 Mar 2018 15:25:03 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Fri, 9 Mar 2018 15:25:03 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 9122C454046C; Fri, 9 Mar 2018 15:25:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8Bh8fYWSoQuX; Fri, 9 Mar 2018 15:25:00 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 4E121454041A; Fri, 9 Mar 2018 15:25:00 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 2/2] Drop file output from channel_curl Date: Fri, 9 Mar 2018 15:24:56 +0100 Message-Id: <1520605496-19708-2-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520605496-19708-1-git-send-email-sbabic@denx.de> References: <1520605496-19708-1-git-send-email-sbabic@denx.de> X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , After adding a general way to save the stream, drop the hack in suricatta to do the same. Signed-off-by: Stefano Babic --- corelib/channel_curl.c | 33 +++++++++++++++------------------ corelib/downloader.c | 2 +- include/channel.h | 2 +- include/channel_curl.h | 2 -- suricatta/server_hawkbit.c | 2 +- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c index 834100d..2de5819 100644 --- a/corelib/channel_curl.c +++ b/corelib/channel_curl.c @@ -66,7 +66,7 @@ channel_op_res_t channel_curl_init(void); channel_op_res_t channel_close(channel_t *this); channel_op_res_t channel_open(channel_t *this, void *cfg); channel_op_res_t channel_get(channel_t *this, void *data); -channel_op_res_t channel_get_file(channel_t *this, void *data, int file_handle); +channel_op_res_t channel_get_file(channel_t *this, void *data); channel_op_res_t channel_put(channel_t *this, void *data); channel_t *channel_new(void); @@ -705,9 +705,10 @@ channel_op_res_t channel_put(channel_t *this, void *data) } } -channel_op_res_t channel_get_file(channel_t *this, void *data, int file_handle) +channel_op_res_t channel_get_file(channel_t *this, void *data) { channel_curl_t *channel_curl = this->priv; + int file_handle; assert(data != NULL); assert(channel_curl->handle != NULL); @@ -745,22 +746,18 @@ channel_op_res_t channel_get_file(channel_t *this, void *data, int file_handle) goto cleanup_header; } - if (file_handle == FD_USE_IPC) { - for (int retries = 3; retries >= 0; retries--) { - file_handle = ipc_inst_start_ext(channel_data->source, - channel_data->info == NULL ? 0 : strlen(channel_data->info), - channel_data->info); - if (file_handle > 0) - break; - sleep(1); - } - if (file_handle < 0) { - ERROR("Cannot open SWUpdate IPC stream: %s\n", strerror(errno)); - result = CHANNEL_EIO; - goto cleanup_header; - } - } else { - assert(file_handle > 0); + for (int retries = 3; retries >= 0; retries--) { + file_handle = ipc_inst_start_ext(channel_data->source, + channel_data->info == NULL ? 0 : strlen(channel_data->info), + channel_data->info); + if (file_handle > 0) + break; + sleep(1); + } + if (file_handle < 0) { + ERROR("Cannot open SWUpdate IPC stream: %s\n", strerror(errno)); + result = CHANNEL_EIO; + goto cleanup_header; } write_callback_t wrdata; diff --git a/corelib/downloader.c b/corelib/downloader.c index 23471f1..7cfd630 100644 --- a/corelib/downloader.c +++ b/corelib/downloader.c @@ -56,7 +56,7 @@ static RECOVERY_STATUS download_from_url(channel_data_t* channel_data) notify(DOWNLOAD, 0, INFOLEVEL, NULL); RECOVERY_STATUS result = SUCCESS; - channel_op_res_t chanresult = channel->get_file(channel, channel_data, FD_USE_IPC); + channel_op_res_t chanresult = channel->get_file(channel, channel_data); if (chanresult != CHANNEL_OK) { result = FAILURE; } diff --git a/include/channel.h b/include/channel.h index f12edc2..0b59eab 100644 --- a/include/channel.h +++ b/include/channel.h @@ -20,7 +20,7 @@ struct channel { channel_op_res_t (*open)(channel_t *this, void *cfg); channel_op_res_t (*close)(channel_t *this); channel_op_res_t (*get)(channel_t *this, void *data); - channel_op_res_t (*get_file)(channel_t *this, void *data, int file_handle); + channel_op_res_t (*get_file)(channel_t *this, void *data); channel_op_res_t (*put)(channel_t *this, void *data); void *priv; }; diff --git a/include/channel_curl.h b/include/channel_curl.h index 0e3ac89..6b5d904 100644 --- a/include/channel_curl.h +++ b/include/channel_curl.h @@ -27,8 +27,6 @@ typedef enum { CHANNEL_PUT, } channel_method_t; -#define FD_USE_IPC -2 - #define USE_PROXY_ENV (char *)0x11 typedef struct { diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index 6509793..e11777e 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -1068,7 +1068,7 @@ server_op_res_t server_process_update_artifact(int action_id, server_get_current_time(&server_time); channel_op_res_t cresult = - channel->get_file(channel, (void *)&channel_data, FD_USE_IPC); + channel->get_file(channel, (void *)&channel_data); if ((result = map_channel_retcode(cresult)) != SERVER_OK) { /* this is called to collect errors */ ipc_wait_for_complete(server_update_status_callback);