From patchwork Mon Oct 11 11:21:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1539243 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=lnrzOM1K; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::43b; helo=mail-wr1-x43b.google.com; envelope-from=swupdate+bncbcxploxj6ikrb6f4scfqmgqe6f52c7y@googlegroups.com; receiver=) Received: from mail-wr1-x43b.google.com (mail-wr1-x43b.google.com [IPv6:2a00:1450:4864:20::43b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HSbxR4yh5z9sPB for ; Mon, 11 Oct 2021 22:22:35 +1100 (AEDT) Received: by mail-wr1-x43b.google.com with SMTP id 75-20020adf82d1000000b00160cbb0f800sf12299978wrc.22 for ; Mon, 11 Oct 2021 04:22:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1633951352; cv=pass; d=google.com; s=arc-20160816; b=QAY1BRhz6TRTpfj/lrhtMTT4IEDvszmRr8+TjYVAGXiiniZElYK0yUA9IsNHSNsmf2 XtlE2rjAla7fFNCwTYDe+cJBcE8Z7EmMgdh+mXTKOFNdJj4p3K8Rb2p6xapRfSwFLL2N x/a34GzpoNFbNpzmeN08CQxcyuKmQmq02hsCOEhNJ7uUOHKYBxb+iwxGg10SfWSjdytm bqi+nK2xWCtygorBkbIpco8+8lV+HUa+R8tJEQIva428mEIE7TBekXJcoAXTsyOztWLH 7/S/2BPPba7Z0cz0ZSeo0oI4X+8edm3ZFA6XDQY882mEVekEBdd6Q4OBBz4OJL74AoLD S+1w== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=YmkOo6RloxxUVcja/FCgfWUjNHAXeyarXzOsOefej+U=; b=vaE+zEvOWmPg+up/RLydPEzLJweu6hc5TDzbgVPlypZRdxz4tyDU1Bg2IPNZMPZEdc sdJbwTsQtEYHahlRSvIwwRHORwBN7NBTLIjWTe9cNUBa7V17h7UIhX+ApdzBj/e1c6U0 warqOjNJi1wXxIHRL+vJUHm64e6kLJrJb9FSJWqQAhdj3wcX3BaecgpGXLV3X6WNSeGe KQ/tdgwDCDESCtNxtbrDsnvj4RSywu4bVtj/peD4g8T7fiNlpHFCPqzckjUkoqG1Bx/V W9Rn8KkxXqgjw4Pwv+0Ij/kfNHq8W00QXKKqjIDIw3t0qBUa3nrsl31YU4xemahlvsez KMjw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=YmkOo6RloxxUVcja/FCgfWUjNHAXeyarXzOsOefej+U=; b=lnrzOM1K0dzn73wjdRUUrl61Ex++1uRSfG6ReK5+mWnqQ3UZPRC63vRh+qcXCkm4xz QljOmbOlddTdHSTl0gcLKOKo+nm+914+t86dqU0G9rRFwR+kjvzk0R4BZqr/gRUpH3mL eTT5RrKKIH/wEA3q5oXDYUQ0MDC10QXFQnsIvfUDTfDAuNLInlh1OQ0HguNr6Lqkqtln V5itzho4/XOPWnA5n89zYMRcSkt+ONRjBzDwiP5/NIzPBs93w5lpxA8iY3RD6EFvH7SL WrUOlL3a1EJcNZGW3ysV2ioPgalz4MseceaVMCMAYB7dcnD55F9OQziwWSJImUBolEaW Qeaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version: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=YmkOo6RloxxUVcja/FCgfWUjNHAXeyarXzOsOefej+U=; b=61/FRyYZhTftng9ww36zb92qZKH9hliGUiTgVg5ou5vTF6gogV75hiVnbm1JESPaUu gj55lSBHEo6A0eZk/ENvvQNkf7TuPsW6F9q8cF+KqfZGuC7tfyg6hsI9LlSE0QBbnVYT SKLwcaiQCbeQ0+wYgVU+hrEGV3b1qi3XURJhLVMyJG57Lgptcd9ceJj/bVWYA6U9JVHm JrcYyTqX3y+ZAKtI7Q4OVFufPY8CnLKH8IHKigJheP2jfp8Jl5XkpBhoWosJxaCbBuQe oWDLk464G5S4NDONLehpMwQlv+AevDkG7pDC5KfwoMowCigLoflYvn0T+Y0PMyMGI2Mn IKuA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM530xELJX6nKDxwE4MsGLcr06bzd6v5X6BDSZtYbvHGq6FEIlAE1E n0svcP//kpG88UJqJ+jNjao= X-Google-Smtp-Source: ABdhPJxa3kngD6VeVT4EKiYIcfZoQv/h1LPVC1vM1BfnfVX85QZDo8D9WW+S6Nu5tmRkGtOI7PhR/Q== X-Received: by 2002:a1c:cc09:: with SMTP id h9mr20619579wmb.191.1633951352463; Mon, 11 Oct 2021 04:22:32 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:adf:a285:: with SMTP id s5ls579363wra.1.gmail; Mon, 11 Oct 2021 04:22:31 -0700 (PDT) X-Received: by 2002:a5d:64e2:: with SMTP id g2mr24072249wri.20.1633951351642; Mon, 11 Oct 2021 04:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633951351; cv=none; d=google.com; s=arc-20160816; b=dcPPzZaP4+pc4+gRKkGNYOVOG4yU4j/L7NG/5oGjNTdGjJ1ANS6Z6KA3BxtQ8s2+YD hY9CmZWDZlbO+5qPAqfzxW9OLdrYE0s9bVhafb7hjCvlEqwM1ZauG54b+6vG0rA4cFeP S3kKfJV04RkXBmZXz3bL5Gggh5w4RlKU3qTDPToq+YFPu32gLeokqBFqkHdtKdEvNx8Y OfS+nnbd6UFWf95b9Kb4xOH1IpD6lOcIwdTgABqXe0ngTmcBtJDgSd4BEEevGlbFO6Ko TPQw3itIm4TZqlS6uCaEGZS8fhkF2WeuSWNSv29VA2F+6aUHsd2TjI41QDN1aag1bjx2 itCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=u7YJGNPCr4W/VvIWSbSh5XpppASUvk/acHSY8vvv80w=; b=RaZi+gw3/fq1hA7Us/5+EEgEt8S8YsBMO2QQqi9dMwoU8cXbW7DqyG93sfc9qxdExH KVhx68tykdrOz+wt9MGABbYVSlcwT2RxvJtiQqenxzbFUQIWmnIfb7E1oMzkD26/bV8M wOVb12+qFbBkl37U/YOKZorWrb/AaRqeJCbl5bVa0Tl2MwkyIKfhsWxqRF+s9xQ9052R 9jbL1+5xrkPyAf0YL5ySz6oCxukLhCRNfrg2aG9WcGG3LkGOgwglRG3VVmu/VYnNljEa lB84AHYM+Busj3WJRVspyPXbmc4+BDBNoN5rInRJs/W8ie7ufpV3ryxN93Nf0uX59c/y 6DPQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by 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.9]) by gmr-mx.google.com with ESMTPS id p3si368028wrg.2.2021.10.11.04.22.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Oct 2021 04:22:31 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4HSbxM3W9Nz1qwGm; Mon, 11 Oct 2021 13:22:31 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4HSbxM3PGDz1qqkB; Mon, 11 Oct 2021 13:22:31 +0200 (CEST) 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 hAmRzL_9MhTd; Mon, 11 Oct 2021 13:22:30 +0200 (CEST) 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; Mon, 11 Oct 2021 13:22:30 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 48A4E4541344; Mon, 11 Oct 2021 13:22:30 +0200 (CEST) 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 z6gMP1grXpfb; Mon, 11 Oct 2021 13:22:27 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.48]) by babic.homelinux.org (Postfix) with ESMTP id AC3384542707; Mon, 11 Oct 2021 13:22:05 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 17/29] channel_curl: pass channel pointer to internal callbacks Date: Mon, 11 Oct 2021 13:21:44 +0200 Message-Id: <20211011112156.44192-18-sbabic@denx.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211011112156.44192-1-sbabic@denx.de> References: <20211011112156.44192-1-sbabic@denx.de> MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by 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: , Channel can be used by the callbacks to call curl functions that can be evaluated later. Signed-off-by: Stefano Babic --- corelib/channel_curl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c index 9af9c39..abe252c 100644 --- a/corelib/channel_curl.c +++ b/corelib/channel_curl.c @@ -53,6 +53,7 @@ typedef struct { channel_data_t *channel_data; int output; output_data_t *outdata; + channel_t *this; } write_callback_t; typedef struct { @@ -940,7 +941,7 @@ static channel_op_res_t channel_post_method(channel_t *this, void *data, int met channel_op_res_t result = CHANNEL_OK; channel_data_t *channel_data = (channel_data_t *)data; output_data_t outdata = {}; - write_callback_t wrdata = { .channel_data = channel_data, .outdata = &outdata }; + write_callback_t wrdata = { .this = this, .channel_data = channel_data, .outdata = &outdata }; if ((result = channel_set_content_type(this, channel_data)) != CHANNEL_OK) { @@ -1153,7 +1154,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data) goto cleanup_header; } - write_callback_t wrdata; + write_callback_t wrdata = { .this = this }; wrdata.channel_data = channel_data; if (!channel_data->noipc) { swupdate_prepare_req(&req); @@ -1343,7 +1344,7 @@ channel_op_res_t channel_get(channel_t *this, void *data) channel_data_t *channel_data = (channel_data_t *)data; channel_data->http_response_code = 0; output_data_t outdata = {}; - write_callback_t wrdata = { .channel_data = channel_data, .outdata = &outdata }; + write_callback_t wrdata = { .this = this, .channel_data = channel_data, .outdata = &outdata }; if ((result = channel_set_content_type(this, channel_data)) != CHANNEL_OK) {