From patchwork Thu Sep 6 11:40:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 966925 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=209.85.167.56; helo=mail-lf1-f56.google.com; envelope-from=swupdate+bncbcxploxj6ikrbqfeytoakgqetdy72ui@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="grTT2U5o"; dkim-atps=neutral Received: from mail-lf1-f56.google.com (mail-lf1-f56.google.com [209.85.167.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 425dtY14Flz9s4Z for ; Thu, 6 Sep 2018 21:40:52 +1000 (AEST) Received: by mail-lf1-f56.google.com with SMTP id m99-v6sf1985082lfi.6 for ; Thu, 06 Sep 2018 04:40:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1536234049; cv=pass; d=google.com; s=arc-20160816; b=TS80M541IWpRtioulrSx7ED67pmbHPyHA4sErzBSCQWnBUOEJ+11wN3iNglYo7m7qb E6AfOm6cHMJeQ91ibuDI8FfhC17bqnfXwHJ/6fLsO376t4Q6YpY151PopQoR3eap2Z5/ nHEIIIu7bXcNmr4aV5u1cuvk+LgD0bvuN4yo7qmH5cd5ilLYexuxv1FsvPumFK0nqdBt vqAXt4rOCvfNXF+bdd5999beM8IzznMFzxJxZ2eC+eksmPuncMAaqRrYpAHkuxspVqIx GlsXcMBdzA9z3r8M5+xw2JRN0bjKHWLD9bcfSSx6uB9tjSvmMcH8XMhlhTf8EHmg763e V+Kw== 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:message-id:date:subject:cc:to:from :mime-version:sender:dkim-signature; bh=u+riTWTriVBzd3Oz3gxWqbI3Eqk5lOH3gR0+dJKTc30=; b=oT3CJ849dyPR5etAEghMgj/NGduhe16N/021KFMDV+F3nbaVvUl7QE6F/LmH0GY8Wr 9n2L2nzbSPnIBh3Bva0XBbNDPyt7zN5l4tz/f3WDN3DhU2Q5t6PsKpurAnmaSrJi0R9K Qat03u1ow8m+ivnc1bzxK3e9HBTCltGLnBeRsqQrXIkQARf/3CRBEQKHHqSbR+j/WpEo lFVJJp2+qIIiE/fznxdvBEyZyWMI8JjdPqCKDx6MCSb9phK+2bb4pYMScGpjA0LO//fr GGIKwjKIv+DVX5U41t2kznnAKCs/JtkKiCHuPWPzDXHfjr582NsAruEIQGm9ETXHNdUM 5viw== 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 :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=u+riTWTriVBzd3Oz3gxWqbI3Eqk5lOH3gR0+dJKTc30=; b=grTT2U5oZVoGAlUcVVMpHWEI5lFgDaq08veBeRgln8BvdatFUlYN40cwU9SR4XAbcf fqix3T8HpLF3NoJWNlRhvDM3Q62VU6AaikoqoqMapvite+CbNJhRqZpyS9q+dqFVRSjp mIg7pdlYo1I17hTcwx2uyWfQSbGopWy0HJ+/oWtiGd49L/2W8T4kwJedUiceFc+ETauJ gA80Q+E8xI/j3LNwnwHdSKjKX6OVwBZoy8jIZGYeBH72p9iR8hVxYDwW4ZvJ2l4T9XNj YdG8I9nFEBkdW8kCfKUtbYCe2+Jwcjt6UnLcq6AIOZSW4FCvXtKc1ZHgRCTe1zdpv4Gl IMFA== 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: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=u+riTWTriVBzd3Oz3gxWqbI3Eqk5lOH3gR0+dJKTc30=; b=EkeLDl+L/mFgQ6WHTlmxxQw2XWm1qwiLlNda/Vvz0cu22cFui+Dea9X4kK3B2O5MTR pbPhSAggucGrSDVfVKN0sYQWQTttn+BukA1oLnuBo+XTBq97zfVDOqwWwi4OU+geAPhR pvifsWDyYtFgSHpq0MMLg59Awgbnw3wIuzfNKzMKdzf016jvqGoTs10vnbGoakAqv29g Yklt9FnVPxQpeXjB+5GMatPSeYt3TwjDz1ykpXVCrus1DsKyM5jEkxWFhH1psLeg+eJU VddW3/y/t/mu11z9xc5bNzOkqDGeOag1A5kgbAI10fOVgKpe51oOGOzuIMunU7Y6o4O3 uIgA== Sender: swupdate@googlegroups.com X-Gm-Message-State: APzg51DuUndKty2029HaVV+6jyvqJwkGr0m/CrLYRkqQNL+P5qq+IFtE ghzn3DjZ0/mL5Tm56oob+lc= X-Google-Smtp-Source: ANB0VdZPChVyNSKQDdnABsvDdLY6p3b1xgBbyeMF3oWgS4SIQddWR0kYqWJOSFKID/6cTYCNrC7ytA== X-Received: by 2002:a2e:8699:: with SMTP id l25-v6mr15508lji.0.1536234048795; Thu, 06 Sep 2018 04:40:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a2e:9d4:: with SMTP id 203-v6ls509899ljj.5.gmail; Thu, 06 Sep 2018 04:40:48 -0700 (PDT) X-Received: by 2002:a2e:42ce:: with SMTP id h75-v6mr53644ljf.22.1536234048298; Thu, 06 Sep 2018 04:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234048; cv=none; d=google.com; s=arc-20160816; b=lVtTlezwrNPJK+8BueZ/PKUspQ9NqN3CGHJfw3l1XSDT+/MFMbEjQxq0m5oD8Y6+Yt Dmjd/AlBmSIbj1yQV7/b+QwzoubKMvdY+XtNNmV2Kqe01Bpn9lQjz5EjnByLQkcrV3My SClw2elAIjuB4dS19SdOe7eHXojb6PnrFtgfbutkgVd4F2pVs0x8Lcz29i0lhLVSQuUr pPcGIMKlOfckwy6txsf/IsbawgmvWppkWP0VbWiOQnGoiT+gjcD7rmO3mvNA3cHVyod+ T+kQvtgNF6sg0L8GmkFywIvQezksr4zO74UEkwWjlj8aWComx2R+VePnb/SupKK6S8kh exYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=H65adklwk1+0DfcGZZkwPGVC7pxKr71u4+2tJ3xA+cg=; b=nlAg/Vo3sVjtsqwyO3IB0kg2zqCAIJE2Q/Qv4NPwM68ElhFzazLXy+YmG4QVj2u7nL 8mK6eDpX1WO4uccLs+yg0+PIjAQPfJzFfekIfZu6DkoprMJNtV9kfQXLdnCeipmSzzHy uXgl54WsbUkYf8H6d9HRPN+ZbCz0MmyAuhLuL3U8CnrkX4LVVPhDB7ILGqehndRqvqnN CILV5yqgyfUrYQM5HLZJD7DZr9Q15O+pGZmwG/jV0C2GgK0eJEIml0M+PjZVHLz69/3f b7BqJvCJmajrBexvmYiUd9pyFJ/pp0YdpjQ566kfGnCkLRen6laNs+pxF+QxPbzAMuR6 UYdg== 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 v16-v6si118561ljg.3.2018.09.06.04.40.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 04:40:48 -0700 (PDT) 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 425dtR4Wf3z1qvnY; Thu, 6 Sep 2018 13:40:47 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 425dtR4JQrz1qrVm; Thu, 6 Sep 2018 13:40:47 +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 DiZWOZGSzam5; Thu, 6 Sep 2018 13:40:46 +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; Thu, 6 Sep 2018 13:40:46 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id DABA04540571; Thu, 6 Sep 2018 13:40:45 +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 WdjPaJmlsYhy; Thu, 6 Sep 2018 13:40:43 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 50E23454035B; Thu, 6 Sep 2018 13:40:43 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 1/9] Use provided macro for exit() Date: Thu, 6 Sep 2018 13:40:33 +0200 Message-Id: <20180906114041.21828-1-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 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: , Use EXIT_FAILURE and EXIT_SUCCESS instead of the corresponding integer value. Signed-off-by: Stefano Babic --- core/swupdate.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/core/swupdate.c b/core/swupdate.c index 4a32e47..c456c2b 100644 --- a/core/swupdate.c +++ b/core/swupdate.c @@ -287,7 +287,7 @@ static int install_from_file(char *fname, int check) if (!strlen(fname)) { ERROR("Image not found...please reboot\n"); - exit(1); + exit(EXIT_FAILURE); } fdsw = open(fname, O_RDONLY); @@ -295,7 +295,7 @@ static int install_from_file(char *fname, int check) fdsw = searching_for_image(fname); if (fdsw < 0) { ERROR("Image Software cannot be read...exiting !\n"); - exit(1); + exit(EXIT_FAILURE); } } @@ -310,7 +310,7 @@ static int install_from_file(char *fname, int check) */ if (ret) { ERROR("Failed to extract meta information"); - exit(1); + exit(EXIT_FAILURE); } char* swdescfilename = alloca(strlen(get_tmpdir())+strlen(SW_DESCRIPTION_FILENAME)+1); @@ -318,19 +318,19 @@ static int install_from_file(char *fname, int check) ret = parse(&swcfg, swdescfilename); if (ret) { ERROR("failed to parse " SW_DESCRIPTION_FILENAME "!\n"); - exit(1); + exit(EXIT_FAILURE); } if (check_hw_compatibility(&swcfg)) { ERROR("SW not compatible with hardware\n"); - exit(1); + exit(EXIT_FAILURE); } if (cpio_scan(fdsw, &swcfg, pos) < 0) { ERROR("failed to scan for pos '%ld'!", pos); close(fdsw); - exit(1); + exit(EXIT_FAILURE); } /* @@ -340,17 +340,17 @@ static int install_from_file(char *fname, int check) ret = check_provided(&swcfg.images); if (ret) { ERROR("failed to check images!\n"); - exit(1); + exit(EXIT_FAILURE); } ret = check_provided(&swcfg.scripts); if (ret) { ERROR("failed to check scripts!\n"); - exit(1); + exit(EXIT_FAILURE); } if (check) { fprintf(stdout, "successfully checked '%s'\n", fname); - exit(0); + exit(EXIT_SUCCESS); } #ifdef CONFIG_MTD @@ -615,7 +615,7 @@ int main(int argc, char **argv) read_globals_settings, &swcfg)) { fprintf(stderr, "Error parsing configuration file, exiting..\n"); - exit(1); + exit(EXIT_FAILURE); } loglevel = swcfg.globals.loglevel; @@ -631,12 +631,12 @@ int main(int argc, char **argv) if (ret == -EINVAL) { fprintf(stderr, "Error parsing configuration file, exiting..\n"); - exit(1); + exit(EXIT_FAILURE); } break; case '0': printf("%s", BANNER); - exit(0); + exit(EXIT_SUCCESS); } } @@ -714,7 +714,7 @@ int main(int argc, char **argv) break; case 'h': usage(argv[0]); - exit(0); + exit(EXIT_SUCCESS); break; #ifdef CONFIG_DOWNLOAD case 'd': @@ -725,7 +725,7 @@ int main(int argc, char **argv) #endif case 'H': if (opt_to_hwrev(optarg, &swcfg.hw) < 0) - exit(1); + exit(EXIT_FAILURE); break; #ifdef CONFIG_SURICATTA case 'u': @@ -750,7 +750,7 @@ int main(int argc, char **argv) break; default: usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); break; } } @@ -758,7 +758,7 @@ int main(int argc, char **argv) if (optind < argc) { /* SWUpdate has no non-option arguments, fail on them */ usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); } /* @@ -769,27 +769,27 @@ int main(int argc, char **argv) fprintf(stderr, "swupdate built for signed image, provide a public key file\n"); usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); } if (opt_c && !opt_i) { fprintf(stderr, "request check for local image, it requires -i\n"); usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); } if (opt_i && strlen(swcfg.output)) { fprintf(stderr, "Output just from network - do you know cp ?\n"); usage(argv[0]); - exit(1); + exit(EXIT_FAILURE); } #ifdef CONFIG_SURICATTA if (opt_u && (opt_c || opt_i)) { fprintf(stderr, "invalid mode combination with suricatta.\n"); - exit(1); + exit(EXIT_FAILURE); } #endif @@ -799,7 +799,7 @@ int main(int argc, char **argv) if (swupdate_dgst_init(&swcfg, swcfg.globals.publickeyfname)) { fprintf(stderr, "Crypto cannot be initialized\n"); - exit(1); + exit(EXIT_FAILURE); } } @@ -876,7 +876,7 @@ int main(int argc, char **argv) if (load_decryption_key(swcfg.globals.aeskeyfname)) { fprintf(stderr, "Key file does not contain a valid AES key\n"); - exit(1); + exit(EXIT_FAILURE); } } @@ -895,7 +895,7 @@ int main(int argc, char **argv) if (opt_e) { if (parse_image_selector(software_select, &swcfg)) { fprintf(stderr, "Incorrect select option format\n"); - exit(1); + exit(EXIT_FAILURE); } fprintf(stderr, "software set: %s mode: %s\n", swcfg.software_set, swcfg.running_mode); From patchwork Thu Sep 6 11:40:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 966924 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=209.85.167.55; helo=mail-lf1-f55.google.com; envelope-from=swupdate+bncbcxploxj6ikrbqveytoakgqea2mgg6q@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="PPW0FVsT"; dkim-atps=neutral Received: from mail-lf1-f55.google.com (mail-lf1-f55.google.com [209.85.167.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 425dtY2ylzz9sBZ for ; Thu, 6 Sep 2018 21:40:53 +1000 (AEST) Received: by mail-lf1-f55.google.com with SMTP id x78-v6sf1942533lfi.18 for ; Thu, 06 Sep 2018 04:40:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1536234050; cv=pass; d=google.com; s=arc-20160816; b=bNa8u+sam6gWrsXzYe0JCIE4IIwQKly8fwGeRi84rMT+zvINpiiSwp4jGfpRwi63KE Rj5ltyrJ0ANAx2xrs9IQse1z+7Z3HKdbJZdT5X6UjokPIAFIxXTUzauOYYG1bg05V2RX M16KUljuj7fnUl2o0iMq3ghGUORGsDpv9n6Au2ckSfW6Oggp9lQSdpB8hlvSc1mi24ee To7phKJhn986HXm2cEthywf6qvMeEAtqJV3wuG8jfCOt45YD1SUYAcDPv4MqOdAMdqeJ atWmS0B2GhqBQNfG+iHlWfswGgFjkMiNuOpg9D2QRmWxZAuJt+SP4b+PAhBLnMxLI0KZ EmKQ== 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:mime-version:sender:dkim-signature; bh=2pQbby+KSb3uam8Vs1Dr8bxPRfbzWKCBnkCDT0wySU0=; b=QqXL2ySVylGTTjBCW0ToSnPAc24h9p33hakwBj5RvJVHB2szce/G7j/PkIMfxmvbvv IM/bQbpOZW+qOWRphU/i83OOseOeNWKIlhc7EVDXxW0VnjzAFcdL89/iQ+PUsLY86nbj gu5+CRVx5lBzQzxDRfFw4Q4NIHU0Axp5iuYyN/aooswKgi5yOGR0pV0cczcw5BhlHH+x TOIWLYHOd6MQNlFceRJiIwdzzArfBdKlfO8+HONcTyrRRVIQTUoWvwlDVlIE7+Jzs+k/ I2BKE5sJ3o64iXh88PZep0C2tER8JxpPAKcM/bCgZpNpSWdPoe/rINHU3GM/eYBG0y5V ZJNA== 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=2pQbby+KSb3uam8Vs1Dr8bxPRfbzWKCBnkCDT0wySU0=; b=PPW0FVsTtOKdqWu6FPS1rc1CYusMVM3JQQm1m9wwESs2qCSwZCwO+4ZzuJZw8BJAZQ GkKJsv7x4o0Boc43s+kq3XYvpxRIrNHPacp/9XKKLz+5ETBRYDjzxJTz2FPS1sYkalNs tR2wlzNsZWDabV3NRPyRu+LefDBgly6hYYGHCyuIjKvUvb/zxArSMWAiC7lPq5QUEbZ2 C4w/9sk4ND8VLVNxsRcPDerdP/Rr0cSKFy2oO11Uu27ikA7USBL+b9zSYvj3T3kAyLcC 0k7dX0gOjh9ayOkkGEA0ON1UrZ2CWmXfXMs7MW0ws/QnQ3rjtM/FQ6r7CPDJJA7WJB6r Xuxw== 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=2pQbby+KSb3uam8Vs1Dr8bxPRfbzWKCBnkCDT0wySU0=; b=bD8duNdfp+pEb6pN9FC+cQfJtU4dmrqlU1FgBA7/uulkJgIlJXuglDKJBjXHUoHGtY 9DHAlSzIXCC1RYH+Z7G6f06Zd6wCtkuCT2ZjOLd4bK9EAPHbNhaIbTcHg76R/ynq/Fff P1nL3CRwSDjaxtoZ7kiZ3o8TSgqBdq4No42J9Nm6R2LDqcvxUBv5lvYxUnRHQUCKm5hV YosRlFeMI+BLeLfhhlqzMkUCmvSAnSQvQTk54WHAbtf74xkkpF5g8NTYbZqWrqZq2Hi+ QvTHK16Zy7Yw9m75KJ2yGFCze3WbD16YPOWYrfac5eE6ZGDCoHfYCmMG3oKbEsU+StM/ Bxow== Sender: swupdate@googlegroups.com X-Gm-Message-State: APzg51AUETMwnEaoIMGgjZio6rWSLwcC2QJQrdVSanT6qVqmTsMNTH3t 7W4LN6Hewe8MY53kCLWjmGE= X-Google-Smtp-Source: ANB0VdadmLpzJ9FhGH2JQvWw3t1g+71/3G8f6oB/OlPOoWXQjAr0mslNthJfRNrAevk/+FHKQs1tag== X-Received: by 2002:a2e:63cd:: with SMTP id s74-v6mr17581lje.1.1536234050562; Thu, 06 Sep 2018 04:40:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a19:1656:: with SMTP id m83-v6ls351589lfi.25.gmail; Thu, 06 Sep 2018 04:40:50 -0700 (PDT) X-Received: by 2002:a19:e4cc:: with SMTP id x73-v6mr59929lfi.19.1536234050046; Thu, 06 Sep 2018 04:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234050; cv=none; d=google.com; s=arc-20160816; b=oaNABqsrVFQWzWb8b7g2xqDW8wRTsE93MX/Ga9fuzvUzi+d/yhXrWXehC/tssPHJ7D 4l0hrMGSUvfRcROEJb0G0kjxSYkpIX5FHw83URIlUsQ+KxpmgJ/Z/9HSTPGsBh+mLdFO ueFjZluSiVJPl6bkT1pLhjeDbaRWY8zgOA50vIF32jk/r3gu1G4y8yjgvV4JUrWlgZWR sCTWqQo+mVoegYCSy54P89tPGa2kIYR/foPp/VTwOQj556pnqT08DERhi7nWjZ+/TpT3 7c/G0aAE37BczJ2+d/+QmrgpjDsHZgTJfV32ARWpScgFLjCACeMpDPyg694j2ySkEnxV yNpw== 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; bh=Wp9HOAyAY5FA5Xilpg1tfjvSHo22ERbnxgJahAoYZnY=; b=agotDFcHw1o7YBFcFkwdCtZ3QFXen+dI4CZ7RPuECLqoeSPtUlBcppSrAvv6mhSsVc kJv6x5vkg06XWxISYSu7yQ7Opv5lbjnyE1MtaHlQLxXjoFeCe/5xsbIor8dbnNm8R/ra muXT8CWwZxbueWeaYo0+ifZnNbOAiymBgkrnpfKYbeoOcjcsv0LZXEb9Rsk1XUpsLi9K RuPS7+EjzEID2Bd1TmXvLq7SXbGRHhxoBmmUmp7yfBHYiT/Bb+qRHGDDFlS/eWy/npmg fpaFMzuF45BbJUIrOzvnSYw9t12FP1pJZqzAPQfriqmgW0RSbcyD3wqUCMW1paRw6q2X yyIA== 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 81-v6si191088lfs.0.2018.09.06.04.40.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 04:40:48 -0700 (PDT) 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 425dtS37tHz1qvnY; Thu, 6 Sep 2018 13:40:48 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 425dtS2xhsz1qrVm; Thu, 6 Sep 2018 13:40:48 +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 NArSK5x0EHCB; Thu, 6 Sep 2018 13:40:47 +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; Thu, 6 Sep 2018 13:40:47 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 63599454035B; Thu, 6 Sep 2018 13:40:47 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([IPv6:::1]) by localhost (mail.babic.homelinux.org [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id iavMO_qkDpuZ; Thu, 6 Sep 2018 13:40:43 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 9DB344540360; Thu, 6 Sep 2018 13:40:43 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 2/9] Factorize function to load a dictionary from a file Date: Thu, 6 Sep 2018 13:40:34 +0200 Message-Id: <20180906114041.21828-2-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180906114041.21828-1-sbabic@denx.de> References: <20180906114041.21828-1-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: , Signed-off-by: Stefano Babic --- corelib/swupdate_dict.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/swupdate_dict.h | 1 + 2 files changed, 42 insertions(+) diff --git a/corelib/swupdate_dict.c b/corelib/swupdate_dict.c index 11d3cd9..a5f14db 100644 --- a/corelib/swupdate_dict.c +++ b/corelib/swupdate_dict.c @@ -170,3 +170,44 @@ void dict_drop_db(struct dict *dictionary) remove_entry(entry); } } + +int dict_parse_script(struct dict *dictionary, const char *script) +{ + FILE *fp = NULL; + int ret = 0; + char *line = NULL, *key = NULL, *value = NULL; + size_t len = 0; + + /* open script generated during sw-description parsing */ + fp = fopen(script, "rb"); + if (!fp) { + ERROR("Failed to open script file: %s\n", script); + ret = -1; + goto cleanup; + } + + /* load key-value pairs from script into dictionary */ + + while ((getline(&line, &len, fp)) != -1) { + key = strtok(line, " \t\n"); + value = strtok(NULL, "\t\n"); + if (value != NULL && key != NULL) { + ret = dict_set_value(dictionary, key, value); + if (ret) { + ERROR("Adding pair [%s] = %s into dictionary" + "list failed\n", key, value); + goto cleanup; + } + } + + if (value == NULL && key != NULL) { + dict_remove(dictionary, key); + } + } + +cleanup: + if (fp) fclose(fp); + /* free(null) should not harm anything */ + free(line); + return ret; +} diff --git a/include/swupdate_dict.h b/include/swupdate_dict.h index 82988ac..1c988b1 100644 --- a/include/swupdate_dict.h +++ b/include/swupdate_dict.h @@ -34,5 +34,6 @@ int dict_set_value(struct dict *dictionary, const char *key, const char *value); int dict_insert_value(struct dict *dictionary, const char *key, const char *value); void dict_remove(struct dict *dictionary, const char *key); void dict_drop_db(struct dict *dictionary); +int dict_parse_script(struct dict *dictionary, const char *script); #endif From patchwork Thu Sep 6 11:40:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 966926 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=209.85.208.60; helo=mail-ed1-f60.google.com; envelope-from=swupdate+bncbcxploxj6ikrbq5eytoakgqed476daq@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="XdrO1V2G"; dkim-atps=neutral Received: from mail-ed1-f60.google.com (mail-ed1-f60.google.com [209.85.208.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 425dtZ1c3Jz9sBn for ; Thu, 6 Sep 2018 21:40:54 +1000 (AEST) Received: by mail-ed1-f60.google.com with SMTP id c16-v6sf3575105edc.21 for ; Thu, 06 Sep 2018 04:40:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1536234051; cv=pass; d=google.com; s=arc-20160816; b=YT1JkLsLACvvk069kpR6vbt7a2cWGbrWXcCD4OcfE7ucxpj8pLoeXBiN0pV++E9qyy 2StKkMU/ZrprmwxhRIezX+eJwcZBZiozbwpI+ar+sf0oyL9I+pUPqnQxNJ4qgjQ1aMth VZI2yoEEYQSvobrC4+Fo+kJSkb9XY8BTz0t3sGFI6KAM155d8AbrJHm0iKRVKJ/t9qEr fS/8Ki+XPNrSPlaKJDIkA8Hg00oDx8Myb80B/4szIXFLVvW6tMSIheTWsL/SnLdUao1h 0Otc4wCdmkZTwu3HXsKRjDHfxt+/ussMtwo+ZsfqQhtYyW8tF/tkZJX6SLPl6z/06jGQ sJyw== 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:mime-version:sender:dkim-signature; bh=yY7msT4RbSTjkXWjXLuroKYTnAKNSExWW9WqpXxfgXA=; b=zt3pqCS/0ZJ7XN0kOxwKVTmRqGjc0syattynTyPgEsVgm5zJUzujmA1lQJj+SfqBUY 7ZCFLtAw8QXKlGZBUbuD73yp3yYjw7ZNIl9glpxWOoNzuuYFbuUUX5gcn8mZdSJ1vrrl SoigF2eIdtYXV9eI6s9x30kD7pTMmc2E6Jc6l7yHxU1pP9nNoOGGtHkVa9FrT6FkshmE 0bSG4zkJHhFmLqjoxXl7TmJsMpi9skubujALOytXaaoC93tpbzralZ83F5vWoC3O44Lg U9lhOXeiLuQz9BrZluym76tMGEQgXw7ALSOJchxHttiql6FItW08p+JtKyCGXxrq6ptw +zQA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 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=yY7msT4RbSTjkXWjXLuroKYTnAKNSExWW9WqpXxfgXA=; b=XdrO1V2GzBZJ9FrwuYyPkZOY83mI6RM7ixe5j/cFlYFLFICgk8SXFr236lzRw6NmuM 0ktsEaU3GpLz4k/K7qXNGcnXckcOlZJ2S/i6+z0zu74n6j47w41bBjTaQiROVgo9KPPU 2EkYfgqx3nH8ErMmC4Oqv176vXHF6pcG281WwVPCKcI/1PKgFUeFKG9Xz7Jbwm/f9SJ0 znye7Omf1q3oEQlGN7cFfteRjoLoHko10NUYlsUW3uuPehEKKB7/QzQObr8WgNd5euKO +wWQJ7PHuwIncLkZLV/MJbtqNI6fUtHmbKTjRheeLAgQLhE+koHDvS/33ce4gY6PlSPU 8EzA== 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=yY7msT4RbSTjkXWjXLuroKYTnAKNSExWW9WqpXxfgXA=; b=Powj1q3LKNeWZUzTLo9XDSdrUnkFdtlZPk734bXclCHYkl29+wfOQpmVO80e2RyIYT dUn2Onb2QtqzNif1MAvdJI2DclR1rO5ovzp2a2yrZ9FAw4Nqa5//sA5ihsdOhO2L8rdV F1ezejP0suthQ4/RKbeo5c8kK4YreCrJijamtKCm5QKbvaLG6ijTg+bL8GpYi9sejKb1 NOZcFWC8ntryPFo/O7XHgvbLiIbtHNHN3QjqOeSYQaz2Eqem5cVvWbmKzOevHYZyx0gn Nf4QxZyD1f+nyH7xnC+LavmznsUIMmbSSVrl5p4/L5z0+oHWvsLQTTX8PgwFRDY08UfC 9cLg== Sender: swupdate@googlegroups.com X-Gm-Message-State: APzg51AEPrZ93T73EICJdcn/MOf+2BQtdHLBVZt+QKWmsgMIC+YrVJri x1zoX5e2RxqRzIkEYonV2tE= X-Google-Smtp-Source: ANB0VdaiRwQAV5oMGaEF1bv4ONIvcZ6ZqRjFeFMiguLgf49zfcj42uGHEzkjzG6u4w7GxluWYDQ+0A== X-Received: by 2002:a50:e807:: with SMTP id e7-v6mr17141edn.7.1536234051629; Thu, 06 Sep 2018 04:40:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a50:d716:: with SMTP id t22-v6ls2349966edi.4.gmail; Thu, 06 Sep 2018 04:40:51 -0700 (PDT) X-Received: by 2002:aa7:c415:: with SMTP id j21-v6mr651553edq.3.1536234051067; Thu, 06 Sep 2018 04:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234051; cv=none; d=google.com; s=arc-20160816; b=vqHiRdgnCBCNqDKWH6RfSSMTLwf/BDdaIWsWxi7pFCsjQBem0uOm5bmOjmZlP0ZkhZ +JRNkmkDc3jqc4IVAs5uMCJciXt1JAcNTsJTYHZ9k+4HCqIaWSYclFmpVvHg44KK5saV 5nqPCQ9Yw7AKjJU23Ma11znvgRIq95dQA25gF4TR2Ct6RGma3VgSBbzm1+QenpMUE1tz Urc74OmwQ3UYicoKfHDU3X6RrBVVv4PLGDcnJ0Y0KZ5n2nbHhJdmoUF8h7BMxP6pCDie 4CbLUxhIVmGaJgUMZJN3lGLqQF8a6bBl5yXcw4LlOdl3HiwGygNrsHxgjkSIX3kncON6 7x0Q== 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; bh=mhIaylCuMzLK4h9IpovABRYqDCRN9NnHAtJi55bxdM0=; b=UzLcz7LLf5zCoWTNnK5UlCqn4ya20DZE4QSPn8+fgCukj6/owFeYre8ja8EEeRhEgx /NUM5BlkiOGmSlG5iHpviKEDZwby3Vsq4VsuvoY0cf45G/8eeU3vsbAwym9K1Pzzd6v4 CHNHXEYyyvgAYHyGtY8HGXmoHfdcl0ZFiapA8vt3IWJPJgxE19cQ8jveGh728JqcZnee 6s8xA2j2eB5Tsuhu/gyzN4CV8S//AY3BGnod9xbIVfbX2mFBNsfWV7pJCYiHzEmtPdWo uwsDf7j7hFHsZMudQd40WiUr7cIx5wq4IaHE1dQF0pQELvkq9VGTv/BvGPZ4xsJjKav4 tKhA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 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.9]) by gmr-mx.google.com with ESMTPS id y4-v6si188420edh.4.2018.09.06.04.40.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 04:40:51 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for 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 425dtV5t92z1qvfq; Thu, 6 Sep 2018 13:40:50 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 425dtV5nMrz1qrVq; Thu, 6 Sep 2018 13:40:50 +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 0LAIpGivdIdj; Thu, 6 Sep 2018 13:40:50 +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; Thu, 6 Sep 2018 13:40:50 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id B6DC1454035B; Thu, 6 Sep 2018 13:40:49 +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 f5xR_75BR49T; Thu, 6 Sep 2018 13:40:47 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id D2C9045404FF; Thu, 6 Sep 2018 13:40:43 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 4/9] CONFIG_SURICATTA_STATE_CHOICE_BOOTLOADER not checked for state Date: Thu, 6 Sep 2018 13:40:36 +0200 Message-Id: <20180906114041.21828-4-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180906114041.21828-1-sbabic@denx.de> References: <20180906114041.21828-1-sbabic@denx.de> 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 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: , state changes are written via the bootloader interface. Because this was done more general as in the past, it is not required a special handle if U-Boot is not chosen. Dropping CONFIG_SURICATTA_STATE_CHOICE_BOOTLOADER corresponds to select CONFIG_BOOTLOADER_NONE in the bootloader menu. Signed-off-by: Stefano Babic --- suricatta/state.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/suricatta/state.c b/suricatta/state.c index 935475b..36897b8 100644 --- a/suricatta/state.c +++ b/suricatta/state.c @@ -34,36 +34,6 @@ bool is_state_valid(update_state_t state) { return true; } -#ifndef CONFIG_SURICATTA_STATE_CHOICE_BOOTLOADER -/* - * This is just if the state is not stored persistently, that is - * it does not survive after a reboot. - * Save it in a variable and use setter / getter to retrieve it - */ -static int suricatta_state = STATE_NOT_AVAILABLE; -server_op_res_t save_state(char *key, update_state_t value) -{ - (void)key; - suricatta_state = value; - return SERVER_OK; -} - -server_op_res_t read_state(char *key, update_state_t *value) -{ - (void)key; - - *value = suricatta_state; - return SERVER_OK; -} - -server_op_res_t reset_state(char *key) -{ - (void)key; - suricatta_state = STATE_NOT_AVAILABLE; - return SERVER_OK; -} -#else - server_op_res_t save_state(char *key, update_state_t value) { int ret; @@ -104,4 +74,3 @@ server_op_res_t reset_state(char *key) ret = bootloader_env_unset(key); return ret == 0 ? SERVER_OK : SERVER_EERR; } -#endif From patchwork Thu Sep 6 11:40:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 966927 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=209.85.208.56; helo=mail-ed1-f56.google.com; envelope-from=swupdate+bncbcxploxj6ikrbrfeytoakgqecson4si@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="ab2v9eHo"; dkim-atps=neutral Received: from mail-ed1-f56.google.com (mail-ed1-f56.google.com [209.85.208.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 425dtZ6Nfzz9s55 for ; Thu, 6 Sep 2018 21:40:54 +1000 (AEST) Received: by mail-ed1-f56.google.com with SMTP id z30-v6sf3578960edd.19 for ; Thu, 06 Sep 2018 04:40:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1536234052; cv=pass; d=google.com; s=arc-20160816; b=bkwWpcPTDpRfLqOyMBayDH843OanHm6efLcsfPGa4Sl7u0x3rGK3p+2lgzIOB0vTk8 qY1KiL8UiVkVsU4L7axIDov9GipE2CJ7J+fOlSXfDYSulo1izxP76F4UYg/GIWkYVI8R e084ht4lO/eny4QRzBEXc5glvgc23nijdYQfd3xvSrshg2NzPGL2OO9V028Vkptqplwn RxAfVfWgoyMFJqGypuIgGsN+xm2s5vDUPFO1xy8qXtkwkclxZY72XPH5Mn62dPIYAtNg gPq+tf+i0SolpPf6zRHXyQV60oKPnl6znuc/xvEe0LYNhZRCL5DpN7UOxdyLQX1bRArL 60xw== 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:mime-version:sender:dkim-signature; bh=E2Soyq13CFddOMaOKkKwiVNlzzp0RJVWuu9SyQE+nmM=; b=PbPUrTfxybd630K7S/SogFuROqlUG1YZab24fFo9iWIpmkjT+4Zl0deGQNoAtOah00 CvKNvfqXrwCFygMNsu47dBM66rVfYfd41oi9oUugrqDxEAl1hGA2zUn5x5uwh8kNEGw2 WHp2Gb/5ECCJocJfxMbWk3aNXVSlj9GQJQo2R5enObNwIsx51AuvDc1cpZYjb6PmPrLP U53CRtsn2vYCxzcI/Q5lU5jyIg+bDOB9cNl5jiGThOqjpqBW4zcPeOV437CWv/fp/aJh 3YbEt1CkveRUnIMubJKuZP7LxVLVYQ8RElvkuplsqhT330kg64i5GUVoT6dxYJ0FHm3F L4Og== 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=E2Soyq13CFddOMaOKkKwiVNlzzp0RJVWuu9SyQE+nmM=; b=ab2v9eHo058COqPZNyBYCNjmVbsLQPW/BCnhwgYOJ8pz9e2H7q/OI0ri3zIQvn99EE fMXUtMYVzEQOsZu7BsvImt8jaLtAlHvHhJm0rlFQnOOxmnbUnjHCbZKgkh0ne08WxWfs mHjklYJAUq9ZbGfnxeO4Olk08hLmVmpKQaICdNFG68GGF2puXOjT1q0p2dIJ4bbv6ZJU wAVbIfOSFvNj+Kaau7ZHsX6iTNEuccCni0+4MIYQ3FWPFikz1R1jvCHB5HTFAhj1tT1P b36m+oCy/GCHL/brwnFdH4gmSh5+3DKwa1ZZz+Ig/ZYxeGTLv9yiXwQUd3zzh/PAlbDJ c58A== 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=E2Soyq13CFddOMaOKkKwiVNlzzp0RJVWuu9SyQE+nmM=; b=t9AHRNC1ec3pIeDgYlargEr5ceQpG/U3DuKebGEpQ4+/bl1FPorS+n70ZwEg9+JYHV s0ePRin/IDAfE9yov7ZaLmCEb2Un75volHAzVkr34vV9+SWlULFI2i+AiyJqem+gLqtj vtCLVSUoDOqH5lB03lSriB2utX+VWzyVOtGPTm9ZSYPaBWACFLmcR9gl+fmALT6M/dUl ByCX56x0Wor2LrHwHabyuUOaiNVXcF5LXF+1gzx+fMR+ay5Ws3ZebI8G7Q+dzoAuRYZA LNmQmcoC+xij1pX9WCvA8zBGIQfE4Oh3SHaUnfkXUNrnz3vDCK/4c9vUx86tie85hsZS GdDQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: APzg51Dgc5DU0vxf9XJgaAAWBb54ztjDQDRxrjtFLnPeRxTiyLNC8lin 40JTcbziapg1Ld2ucqljxt0= X-Google-Smtp-Source: ANB0VdbqPJO8TVypeSyAi5jTw9hu+8lLwEjZD+MPtz0oATVSO6MlDSl+9o0QM5H12woM/9DYAjCIUg== X-Received: by 2002:a50:9011:: with SMTP id b17-v6mr16699eda.2.1536234052284; Thu, 06 Sep 2018 04:40:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a50:f5e3:: with SMTP id x32-v6ls2353663edm.0.gmail; Thu, 06 Sep 2018 04:40:51 -0700 (PDT) X-Received: by 2002:a50:9eee:: with SMTP id a101-v6mr650674edf.9.1536234051902; Thu, 06 Sep 2018 04:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234051; cv=none; d=google.com; s=arc-20160816; b=lFnf/KfmH5HxYNrzZp4cMAHRvZQZgqkqZIzUKzWYAlmMMIHv7sO6Cw+NNyOHj8R+wq 5I7sLx2syy8UsvmmEQqfWvx9Ey5bc+XdqvLyAMunqlY9FTtQL4ZLLYDjiI1q2NUve9BK uNVvcg47h+tOviWDwYfMNssBb/ByBELenCCyKel+G/hRsUMjALgmika5rE2Szs7ZGQQ+ AKGjjITlcGXg939BC8XSUQvNg0F6fOUjDzye8CGjOzHe+MZyG4m7PIxON/V/TWs3DcgU IwxQoIm7EHS3nMFz/RSw9+slx2Xb9aILyyVqj14+ib23s44OruyBt9ZsTWh8EeztcM0M nP3A== 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; bh=HZ8FRvmj3TOkVWVB+5iM7pjKFM50aomf1wCrEyDWCX8=; b=kKpQO3r6PhWtUYcsKgLYF2SWFX6q5vifHFvV1ATzY/6MVmaM2yPNCB46LxialjfTrL Cc0pMDxAnuXLxEsX9njDfqShf7eJx5wnGGmacxiO4k8kGrUQQnXxpY4aVA9SffIDICER qJ0Tgvcma7DzD/FLi8lI/gLzYL+DSlgLx9DT5zFWPsQQek2n40dRymjXo/7HYhIuws7Y QQOZzuvAiw1+9dS5NV3uKbFtvsmOrKzbtteeZkTAPMi9/OgPZ+FcdFZ9+XoGii47HCj3 i8D2XEhYIJoHaDkSCzmAVn0s6YWaHvZ/ccv9ZjbcoEYsuLvs1YBGlUhh2Y6iK2KcKs07 EkTQ== 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 y4-v6si188422edh.4.2018.09.06.04.40.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 04:40:51 -0700 (PDT) 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 425dtW4Xn8z1qvnY; Thu, 6 Sep 2018 13:40:51 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 425dtW4RN1z1qrVr; Thu, 6 Sep 2018 13:40:51 +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 uJ-zXojHpkOz; Thu, 6 Sep 2018 13:40:50 +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; Thu, 6 Sep 2018 13:40:50 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 6F25F4540360; Thu, 6 Sep 2018 13:40:50 +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 vrgSYgWGNj01; Thu, 6 Sep 2018 13:40:48 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 01B4C4540538; Thu, 6 Sep 2018 13:40:44 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 5/9] Factorize handling of state Date: Thu, 6 Sep 2018 13:40:37 +0200 Message-Id: <20180906114041.21828-5-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180906114041.21828-1-sbabic@denx.de> References: <20180906114041.21828-1-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: , A state is set just in case suricatta is running. However, this is a general feature and can be factorized. Signed-off-by: Stefano Babic --- bootloader/ebg.c | 2 +- core/Makefile | 1 + {suricatta => core}/state.c | 2 +- include/{suricatta => }/state.h | 1 - include/suricatta/suricatta.h | 13 ------------- include/util.h | 13 +++++++++++++ suricatta/Makefile | 2 +- suricatta/server_hawkbit.c | 2 +- suricatta/server_hawkbit.h | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) rename {suricatta => core}/state.c (98%) rename include/{suricatta => }/state.h (97%) diff --git a/bootloader/ebg.c b/bootloader/ebg.c index ab1c871..dd4387e 100644 --- a/bootloader/ebg.c +++ b/bootloader/ebg.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "bootloader.h" #ifdef CONFIG_SURICATTA_STATE_CHOICE_BOOTLOADER diff --git a/core/Makefile b/core/Makefile index 1fe0d4c..2657c31 100644 --- a/core/Makefile +++ b/core/Makefile @@ -15,4 +15,5 @@ obj-y += swupdate.o \ util.o \ parser.o \ pctl.o \ + state.o \ syslog.o \ diff --git a/suricatta/state.c b/core/state.c similarity index 98% rename from suricatta/state.c rename to core/state.c index 36897b8..fab1eda 100644 --- a/suricatta/state.c +++ b/core/state.c @@ -11,7 +11,7 @@ #include #include #include -#include "suricatta/state.h" +#include /* * This check is to avoid to corrupt the environment diff --git a/include/suricatta/state.h b/include/state.h similarity index 97% rename from include/suricatta/state.h rename to include/state.h index 47d4471..80d4f55 100644 --- a/include/suricatta/state.h +++ b/include/state.h @@ -7,7 +7,6 @@ #pragma once #include -#include "suricatta.h" /* (Persistent) Update State Management Functions. * diff --git a/include/suricatta/suricatta.h b/include/suricatta/suricatta.h index 57bf46b..0efbfba 100644 --- a/include/suricatta/suricatta.h +++ b/include/suricatta/suricatta.h @@ -18,19 +18,6 @@ * implementations are defined here. */ -typedef enum { - SERVER_OK, - SERVER_EERR, - SERVER_EBADMSG, - SERVER_EINIT, - SERVER_EACCES, - SERVER_EAGAIN, - SERVER_UPDATE_AVAILABLE, - SERVER_NO_UPDATE_AVAILABLE, - SERVER_UPDATE_CANCELED, - SERVER_ID_REQUESTED, -} server_op_res_t; - int start_suricatta(const char *cfgname, int argc, char *argv[]) __attribute__((noreturn)); void suricatta_print_help(void); int suricatta_wait(int seconds); diff --git a/include/util.h b/include/util.h index d59668b..e14861a 100644 --- a/include/util.h +++ b/include/util.h @@ -20,6 +20,19 @@ extern int loglevel; +typedef enum { + SERVER_OK, + SERVER_EERR, + SERVER_EBADMSG, + SERVER_EINIT, + SERVER_EACCES, + SERVER_EAGAIN, + SERVER_UPDATE_AVAILABLE, + SERVER_NO_UPDATE_AVAILABLE, + SERVER_UPDATE_CANCELED, + SERVER_ID_REQUESTED, +} server_op_res_t; + /* * loglevel is used into TRACE / ERROR * for values > LASTLOGLEVEL, it is an encoded field diff --git a/suricatta/Makefile b/suricatta/Makefile index 8bb15ad..3b8dfa7 100644 --- a/suricatta/Makefile +++ b/suricatta/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 2014-2018 Stefano Babic # # SPDX-License-Identifier: GPL-2.0-or-later -lib-$(CONFIG_SURICATTA) += state.o suricatta.o +lib-$(CONFIG_SURICATTA) += suricatta.o ifneq ($(CONFIG_SURICATTA_HAWKBIT),) lib-$(CONFIG_SURICATTA) += server_hawkbit.o endif diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index b4e10df..ebcf7f1 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -23,7 +23,7 @@ #include "parselib.h" #include "channel.h" #include "channel_curl.h" -#include "suricatta/state.h" +#include "state.h" #include "server_hawkbit.h" #include "parselib.h" #include "swupdate_settings.h" diff --git a/suricatta/server_hawkbit.h b/suricatta/server_hawkbit.h index e7cf3dc..cd66f0c 100644 --- a/suricatta/server_hawkbit.h +++ b/suricatta/server_hawkbit.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include From patchwork Thu Sep 6 11:40:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 966929 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=209.85.221.55; helo=mail-wr1-f55.google.com; envelope-from=swupdate+bncbcxploxj6ikrbrveytoakgqeyfmw72y@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="NGIyCu4G"; dkim-atps=neutral Received: from mail-wr1-f55.google.com (mail-wr1-f55.google.com [209.85.221.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 425dtd0ntqz9s55 for ; Thu, 6 Sep 2018 21:40:56 +1000 (AEST) Received: by mail-wr1-f55.google.com with SMTP id d17-v6sf2049812wrr.14 for ; Thu, 06 Sep 2018 04:40:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1536234054; cv=pass; d=google.com; s=arc-20160816; b=kTTwLkAlEx0r4v+zXzTavX4A71cbLHOYRXxwwUI+EIRWex8chE2YmX4UMeUGLqMqhW jKxZjUrshrTOHSe8pfKLjR7ek40fU0PS8Wxd2CFdiH7e4esuSiOlKDtpderozC+T53yh kxfBo7wjbSlHj3NHjcHZFLcglco7/iXFuuFLaXzzBVBU3a9JsGcac+X98XKnh3td8RAk mFCORfjBZaWdpuTwG8gNdIIrIgyc4WYBqFU0lYTOq6HMm2pZi2Uhk5vWCdSvzNHGLepS fsDT89+AYP83obHI00bNBeg6x9SjFEZnwNtIRjKVgS2P+yzYDBhjRXKS7XjCj/2pHbo7 5e2A== 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:mime-version:sender:dkim-signature; bh=q3TkFqoIuuZicTstqCVhtwPJvKlEBpEpbiUVv0iCtGk=; b=jlYSS3eYDIA3T6FVTen7qXq9biKSlLryXh7cnhFWEXIbg+KqOItL5LJvJBqG4wAmJh u0eVsL+bM4BDvLXQPPuV+y++Q9DeR8aNYn8Gr4ZGEkESnrE44oDPlFSklc3Ncvs0fGM0 xOY9x3Lql/dHkRQ+iTHJarQf+iICcD79CwWtLGLtho64dexHXNAn/o6aBVmbou1DhuNm eQOrrT6SEmjJ5jerWiSmzvgZstnM//UOcwxO7nYf8o3j5jGJdCOceYzi7wGjSX8/RxPt zw6Fjt02czpD84YsPyLdVqY9Ang/BCV4Rr10UDQhS8ORAYDHgkEPheFIBUgyuwc+L/EM MSLg== 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=q3TkFqoIuuZicTstqCVhtwPJvKlEBpEpbiUVv0iCtGk=; b=NGIyCu4GK+nsg7Wd0JXS4BTuiVcqjcCmOQwJIO0JBKeWMVbAXAa3RVkiUTih7/jjsQ RbDV/ofmkhNoYBZ02Vld/BeSpQbtf5shxc+ZPBspK5rH+CHCpdVTLgsmDxqWhfaK3RfK 9LP6a2D1RdP1DXwefyyD14BtUxVAGghRDMVKtHXmoJkJtc3SnnW7Z6SOTaM050ogK9Jx EBkcKj49z+ej+GhS2jwLWjjPGCZMRnNKmDK+bvr9Z/vejxu8m2mTvVR3fPDjnYEVvlcE oddc7sV7hlnYheREaTFWJFpR/ftYKSiVFooWECSXtIv4dIwo/nDk2iiVMOUgiYZGR6lK KH9w== 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=q3TkFqoIuuZicTstqCVhtwPJvKlEBpEpbiUVv0iCtGk=; b=gt+7ZeDZq/0OO3rBepyzOBzR9+FXVymZA0TKdsdJIyr0UL8WfLRBLGPazil3rovG+J rq0jSFh0ntcrpXuzFXlX3Gjvqi30WIjdCtiA8jhe/DGv5gahW/SN1flISj49UVIMTz6c dc7DAbhMpyZud6AQswcpGwz72s6Z1E0BdgWP7pFj1kgr7vD/8fsaqhBH/vMNzstM33v7 xLRP+FKqFKu8jRUEsKM920HpGVxsELaAMKsyUJRlgYLuFwpvM5PH6pVKahm3sniMouTa GJd7ZoKtcwxzmsGlJO3bn3+tLDiMf5U5ox+1p3StqGcvzJ5FkWUlGEoF4dYAQss9DGUQ Dq5g== Sender: swupdate@googlegroups.com X-Gm-Message-State: APzg51B/UIdjm2rmh96Mk+UmuwbhFSRo2lsq3u7geABm7fe0j0h6oSyU cfnYVmXR7qZNfKNOELJdii8= X-Google-Smtp-Source: ANB0VdaZb3H3+clPDhCYTW1NV0Rf81uYjYpxN3gyy9R7B9j8f8sq/H09h9zBGxm1UR6/ZYZHc1/bTQ== X-Received: by 2002:adf:eb0e:: with SMTP id s14-v6mr33276wrn.3.1536234054487; Thu, 06 Sep 2018 04:40:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:adf:8265:: with SMTP id 92-v6ls1685627wrb.2.gmail; Thu, 06 Sep 2018 04:40:54 -0700 (PDT) X-Received: by 2002:adf:ad4b:: with SMTP id p69-v6mr221788wrc.31.1536234053971; Thu, 06 Sep 2018 04:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234053; cv=none; d=google.com; s=arc-20160816; b=dUf4aPqSVLEmH0AOUXmfBBFQSjzZg29bODkCAJlqSYDr9j2BLCweeJL7nnKmcVjjR8 C2sKJ9ud6eyoqxSn7q079zWh8sKoOACvqZ2NNmIuKTmaoOwWs2bLZhAyTqBRDN4MW6zN bWPnBtamNY/uRT6rmZ/IhnV2ic/dtrYigpgOcYcJuPyC4Vk3yHpMMpc4QgegCKHJEQfL 7Vd0qjPaYibRhiWelIo1zufDHWzof88d//KmoX7n4Oqp/UPET9zsv4FeVpntLiHhNvI/ b93Rdz28CV6kpuGK9oJKu7dqjaighy3Sj1JK3ZVmhK84mpkaSwTh7kjRGYkt/MI279wp Q89Q== 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; bh=1Z15SHJS0mKjGhzO8gY4GkfVWOmt/m8JrMQ8CBhGF1A=; b=EZ2yUAhaqsf++sd9dFK/rK9tvdzy6iRxweIfnK7Yk+gNz2MR+JvyKkdVOKCq8L3Mtq RZiKOJzTH6rvf8Jl+9kT+TTxIEO9RT7bhYgVL9OAVGPh+HxY01TPreUoNJCwuj9cDheE ZRzcyihNo6CEgxLyhw6EoYhPfr0/yKyDK2+cZyhqxhx/ecYA0KyjjrKx/t1Fc/oDzHuP m0swDn/vPPIHGFoBnZJZBtc3dH13UAc1AbZewTE6ZcIgmBxTmss60T5YlJ/tRvlnWMO6 5iDToJHhJcS+g0k5VUrdtaEOwv9Q5OZnPLsL7wD4xO5uUlmVYRTBdSccjgjCq8G4dae8 AfDw== 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 t23-v6si433516wmh.4.2018.09.06.04.40.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 04:40:53 -0700 (PDT) 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 425dtY5Rmwz1qvnY; Thu, 6 Sep 2018 13:40:53 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 425dtY5KGKz1qrVm; Thu, 6 Sep 2018 13:40:53 +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 Iioey5BQljFP; Thu, 6 Sep 2018 13:40:52 +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; Thu, 6 Sep 2018 13:40:52 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 27714454035B; Thu, 6 Sep 2018 13:40:52 +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 naDQplEOtdRj; Thu, 6 Sep 2018 13:40:49 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 1F31B4540559; Thu, 6 Sep 2018 13:40:44 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 6/9] Factorize reading of identities from config file Date: Thu, 6 Sep 2018 13:40:38 +0200 Message-Id: <20180906114041.21828-6-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180906114041.21828-1-sbabic@denx.de> References: <20180906114041.21828-1-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: , identities are read up now by the Hawkbit connector. Factorize it and put in common code to make it available to other servers. Signed-off-by: Stefano Babic --- corelib/swupdate_settings.c | 36 ++++++++++++++++++++++++++++++++++++ include/swupdate_settings.h | 4 ++++ suricatta/server_hawkbit.c | 33 ++------------------------------- 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/corelib/swupdate_settings.c b/corelib/swupdate_settings.c index ec726f2..f18a0e8 100644 --- a/corelib/swupdate_settings.c +++ b/corelib/swupdate_settings.c @@ -25,6 +25,7 @@ #include "swupdate.h" #include "parselib.h" #include "swupdate_settings.h" +#include "swupdate_dict.h" #include "compat.h" struct run_as { @@ -125,3 +126,38 @@ int read_settings_user_id(const char *filename, const char *module, uid_t *useri return 0; } + + +/* + * Callback to be used to put a section of configuration + * into a dictionary + */ +int settings_into_dict(void *settings, void *data) +{ + void *elem; + int count, i; + char name[80], value[80]; + struct dict *dictionary = (struct dict *) data; + + count = get_array_length(LIBCFG_PARSER, settings); + + for(i = 0; i < count; ++i) { + elem = get_elem_from_idx(LIBCFG_PARSER, settings, i); + + if (!elem) + continue; + + if(!(exist_field_string(LIBCFG_PARSER, elem, "name"))) + continue; + if(!(exist_field_string(LIBCFG_PARSER, elem, "value"))) + continue; + + GET_FIELD_STRING(LIBCFG_PARSER, elem, "name", name); + GET_FIELD_STRING(LIBCFG_PARSER, elem, "value", value); + dict_set_value(dictionary, name, value); + TRACE("Identify for configData: %s --> %s\n", + name, value); + } + + return 0; +} diff --git a/include/swupdate_settings.h b/include/swupdate_settings.h index 1c06095..7101cc5 100644 --- a/include/swupdate_settings.h +++ b/include/swupdate_settings.h @@ -11,6 +11,7 @@ #ifdef CONFIG_LIBCONFIG int read_module_settings(const char *filename, const char *module, settings_callback fcn, void *data); int read_settings_user_id(const char *filename, const char *module, uid_t *userid, gid_t *groupid); +int settings_into_dict(void *settings, void *data); #else #include static inline int read_module_settings(const char __attribute__ ((__unused__))*filename, @@ -33,6 +34,9 @@ static inline int read_settings_user_id(const char __attribute__ ((__unused__))* return 0; } + +static inline int settings_into_dict(void __attribute__ ((__unused__)) *settings, + void __attribute__ ((__unused__))*data); #endif #endif diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index ebcf7f1..31266c0 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -1556,35 +1556,6 @@ static int suricatta_settings(void *elem, void __attribute__ ((__unused__)) *da } -static int suricatta_configdata_settings(void *settings, void __attribute__ ((__unused__)) *data) -{ - void *elem; - int count, i; - char name[80], value[80]; - - count = get_array_length(LIBCFG_PARSER, settings); - - for(i = 0; i < count; ++i) { - elem = get_elem_from_idx(LIBCFG_PARSER, settings, i); - - if (!elem) - continue; - - if(!(exist_field_string(LIBCFG_PARSER, elem, "name"))) - continue; - if(!(exist_field_string(LIBCFG_PARSER, elem, "value"))) - continue; - - GET_FIELD_STRING(LIBCFG_PARSER, elem, "name", name); - GET_FIELD_STRING(LIBCFG_PARSER, elem, "value", value); - dict_set_value(&server_hawkbit.configdata, name, value); - TRACE("Identify for configData: %s --> %s\n", - name, value); - } - - return 0; -} - server_op_res_t server_start(char *fname, int argc, char *argv[]) { update_state_t update_state = STATE_NOT_AVAILABLE; @@ -1597,8 +1568,8 @@ server_op_res_t server_start(char *fname, int argc, char *argv[]) if (fname) { read_module_settings(fname, "suricatta", suricatta_settings, NULL); - read_module_settings(fname, "identify", suricatta_configdata_settings, - NULL); + read_module_settings(fname, "identify", settings_into_dict, + &server_hawkbit.configdata); } if (loglevel >= DEBUGLEVEL) { From patchwork Thu Sep 6 11:40:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 966928 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=209.85.208.56; helo=mail-ed1-f56.google.com; envelope-from=swupdate+bncbcxploxj6ikrbrveytoakgqeyfmw72y@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="rEa6kPNC"; dkim-atps=neutral Received: from mail-ed1-f56.google.com (mail-ed1-f56.google.com [209.85.208.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 425dtc3PrJz9s4Z for ; Thu, 6 Sep 2018 21:40:56 +1000 (AEST) Received: by mail-ed1-f56.google.com with SMTP id k16-v6sf3581961ede.6 for ; Thu, 06 Sep 2018 04:40:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1536234054; cv=pass; d=google.com; s=arc-20160816; b=PCZoLuiKMHiRT0gt2UJyc/Miv7/pNF4K4AK7esvJ8EnJoI/IaLL2zcfTu1HCz0GpRN O9nLtnh9qXSWtiJOsXLjJHbC4+AjUlTS7TyppFNairf2JNfxHLVZhg4f4g6ZUQVItq/D PFrhyOePA/3PRFTrQin6zHtSylHpxXA3dRjq3126D5Yb+n5lzjCF0GBAg+i5fkX9zoz+ 2JFLwbgeScYG6G6JGRfBnkcSzO+Bk1Zh4xOlGIrOq0S1WlrcFCed3iV4alvf8OOGe2FL N/ikaRG863DNTrz0ZOvG93TC5p1Mrb5k93t1lbAtobXP6Q1XQRHRCfnmzbpN59xWYqYq nr8A== 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:mime-version:sender:dkim-signature; bh=ast3Qnm7CbmkJ0cXj1Exhl6XO6gCy9he4Dv76MBjhaE=; b=GTiWpHzWypu4NQEgsNYRxUXRJ+AEb9trchG5WXWWgiMd8tapZxZoEv42p5m+Q+8m/Q GZiwf1jcQPh0NaaYfimSfQcSS5w0SsL66yyfiJArAg2BJMDlZ22UxCZgudxkrANVdMKS SZX/WAJ62mFz80MSgJXh5nRVEndNmJd3aTdwlPV6ldGUQSn0zXwnRHpp0a/gm+wCB3py /TlHFydJqA1ngXhASabl/ESiuLc3LULB19j+roxsrFyzkoP8ZWsSYzEMXTQyj29MzZ6M jQnBINGCF0uaAMbifgJunD3G5jU8mef300dnUBRs1UjEBQIwt1zCsk0SqIqvEOZQVftS Tf5g== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 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=ast3Qnm7CbmkJ0cXj1Exhl6XO6gCy9he4Dv76MBjhaE=; b=rEa6kPNClTatAt/Mrm1CPxUD910EPoXYeatPp2zrOwBP+zNAR/etShIjd0Oqkfunpl 5aOXHFV63dSi1ubgHs0q12xTA9u7obK2XILcjMfojo87AUWuYex/OJTAuXhj12dvQvCm HhwDUHqMhVhK5JuBloP8t1+5stk4zCH9nYjpHVds0kEROQdSW8Az7OQHeXzt3ib+MOWN /qOVVl73a3PO18ZjVVPKHXh8DNWv+D2pCrVn5CIPyJijD3+alfEq8yxMoOG9zaTe+eke uil9e2U7CHd+rC5UxSgJ9TF35sodKrBYsbMkVEcw1FJJ1HC7OAdqutLr4DrbUBL3aYnJ AXkg== 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=ast3Qnm7CbmkJ0cXj1Exhl6XO6gCy9he4Dv76MBjhaE=; b=ff65vHPbpPS1w1HxlzRd4wu8+fK9F3mMaToyl+EdrFPbQrO45NhuwgWNoqxLSVRMO4 VD4/2X1gQ21FRLmmEYn3bIvZfxOSRTXb5M3PcDJs72BsRSmw/4IrXZzWhMtIc4L9qDve EHIgMpW1I3npA3mLbV36D3Lbp4oV786qVWyiR6PbNhEsrKZwBI7GOPM4zfI6CNKZCxX8 lUS/xl/RMMdfL+5B4pLOpG+JI4fDuT5HFYPPamN0CNWNdYWVmo6RYprtVg+AmIQxQPso s85CWNEvkVF63Nh989KmUZxQTCrm/loqi2DCH5mAn8lAnfjl8Idhp7bNOzIQj1O2lO/z Av+w== Sender: swupdate@googlegroups.com X-Gm-Message-State: APzg51DWTvV9MZtRfiybg4Ww0gIwQHIr95hDZgYKo6FjESw9csonI3ov Kn8gVoB6nvkfUMVkXn4O5nc= X-Google-Smtp-Source: ANB0VdalBnvKEBP/+9AhBFfzOyH0HCWCdA7o0rPlNxhXt4IdkG/4IrhgpZabPO0CMjgLgYGFAJ1oUg== X-Received: by 2002:a50:b1d1:: with SMTP id n17-v6mr16830edd.3.1536234054219; Thu, 06 Sep 2018 04:40:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a50:d716:: with SMTP id t22-v6ls2350015edi.4.gmail; Thu, 06 Sep 2018 04:40:53 -0700 (PDT) X-Received: by 2002:aa7:d5ca:: with SMTP id d10-v6mr665883eds.2.1536234053958; Thu, 06 Sep 2018 04:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234053; cv=none; d=google.com; s=arc-20160816; b=ckDM0T0Bbetdwx3SniSNpsa0pDxyC5hHNYKcURx5H9rgMEE9ZnJOP9dY6Cn/bCsSf7 7Qt7yYVnrDhFAb6zhSW3ZpwDbDs9TH30+bPXhGvzAIWeqVeNkzTUbDxAB1KzC/bfp6lk n7iucuuEVuaI9u3jsjDbcHqhRTp9jbUQAEj1YFvKJnbicCPScvmwkKDy8R7PUuyRaeDk +euxDHBVSYAPybo3RiAXfL31j2k5Ya8+7ZqlJvhqMvjJopdUjlEV8MsEMDTG6RQY3cm4 ehN7XXsVryVgL8Dlerc4q+pspy+Fv5QmnoEmgtXFUFLaSAfiTy8VEWFemIxwcM7weWYh 0jAQ== 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; bh=U27WpnMvUUfpW2MLFn9THh94S8vRoIPH2uDFxc0q18s=; b=yxh7CUGanU4T3TV0Gtb1ExOcMXuXg0R/eDdt2ofeCbKqi2tTYjsSShPEv6vUs8yS6h cMp+MqPbISNbsa9beKFoUlMAWb/D29116RYd0IYJ3i9m9qtAZYjiSLHz90e+7flAewGo wjDqH//tjZcx7XW3sijAciEe2ppNY33BdvpVHZTGqjAMeIdUWKT9Gbx70Mq+r/59lGDj XSzUYx4tOPxBlC8oYJnqn/QUwj/YRU03QxwnIkU5y/yDkt2Kryw0+gCJZH8Z/pE8469M hueQ5Rcu6c83cIdcoNl0FSu+mZH8Pje2GyYjQVLMTudVjJOXID2fONpd/gUGoS00VdwS Nqiw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 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.9]) by gmr-mx.google.com with ESMTPS id y4-v6si188424edh.4.2018.09.06.04.40.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 04:40:53 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for 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 425dtY59FLz1qvgL; Thu, 6 Sep 2018 13:40:53 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 425dtY51Kkz1qrVq; Thu, 6 Sep 2018 13:40:53 +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 LypJQFL7FokV; Thu, 6 Sep 2018 13:40:53 +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; Thu, 6 Sep 2018 13:40:53 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id B25AB4540360; Thu, 6 Sep 2018 13:40:52 +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 tBLJZtsikjSX; Thu, 6 Sep 2018 13:40:50 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 3CA07454055E; Thu, 6 Sep 2018 13:40:44 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 7/9] examples: add description in swupdate.cfg Date: Thu, 6 Sep 2018 13:40:39 +0200 Message-Id: <20180906114041.21828-7-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180906114041.21828-1-sbabic@denx.de> References: <20180906114041.21828-1-sbabic@denx.de> 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 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: , Signed-off-by: Stefano Babic --- examples/configuration/swupdate.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/configuration/swupdate.cfg b/examples/configuration/swupdate.cfg index 42ec91f..be66484 100644 --- a/examples/configuration/swupdate.cfg +++ b/examples/configuration/swupdate.cfg @@ -101,6 +101,7 @@ identify : ( # retry : integer # number of retries to connect to server # retrywait : integer +# cafile : Certificate Authority certificate # sslkey : string # path of the file containing the key for ssl connection # sslcert : string From patchwork Thu Sep 6 11:40:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 966930 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=209.85.208.55; helo=mail-ed1-f55.google.com; envelope-from=swupdate+bncbcxploxj6ikrbr5eytoakgqejkgh72i@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="PaTrnqb4"; dkim-atps=neutral Received: from mail-ed1-f55.google.com (mail-ed1-f55.google.com [209.85.208.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 425dtf4mZ8z9s4Z for ; Thu, 6 Sep 2018 21:40:58 +1000 (AEST) Received: by mail-ed1-f55.google.com with SMTP id g15-v6sf3550642edm.11 for ; Thu, 06 Sep 2018 04:40:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1536234056; cv=pass; d=google.com; s=arc-20160816; b=C5LzHCEukeFzQmbCDr9yzC0RSvsiKSl3VIC+PD9d2riM/Y8zHzI0ZsHlD5Rwn7esAh 3F8gXTtmRxSUTG6mxNQIKlZDuwwxhAljf6653mRGzd88wEDZebn6VAoffPhadNsBBxoN yb2PHeeCpxt9e9APJQrPSvdV6KjNIEMSdeRwP7ZUOOovBvTv0PyBT8seLGuBysPTt2aM G3CFm+75XbVZbHu53TRNG7MDCZKrF05942ktH7DA0+PwtLl0hsjBwLnsZoPY+6pNoJ51 uEuaHrW4P4zcEDlJWPJl/MG8WHyDy0mgr6JfoTAcC3phs/5C65+pudTHdZmdsZI5Vd0u K/8w== 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:mime-version:sender:dkim-signature; bh=40F7vrTZE4bJRsw+6bfzuaByYJODXi66QcDeskCVkgE=; b=W9mdoOP4rCepasCHEJW6SgpyL6Oja1CCp7iCL4IBB27zHSEy5yUdGGmZvSMzpgClIa v8ps8Cs1CL+5sTXxGGMVAPcVjrJoqNiZipwz1pPKyhLCrrOuJjIrUcslnOXGvV4OeOgf xgRg4N2fApaF/xIuomTTGZjFIVM1uApY83bSE23WakuhaKIzftgVoMHlrJ0tUw3tXh7J leRP6NJ566GjKNkV7lCEJWgnOD2KodComTs+GDRP3loSg5CSzqvmKb1XxkvS2rv9MrkU tDUq0AWxBcqK1L68RBQRcSkc/ENeereKUS+sZ9P8nIxkEqN5qZhVMu1NSK5m+mjWcsG5 lJhw== 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=40F7vrTZE4bJRsw+6bfzuaByYJODXi66QcDeskCVkgE=; b=PaTrnqb4HXufK2CMeJ+b5/AL8zTEUoHk/TtPiMFD+mf8Za7vnCIn+cX+Uzh0xgP8rQ +vOiln89F23LFYzZ4nJMQE6dpIuDIE9uIvWWE8CO8zE/kW2Qr46IJ2pqmSQqf15e8eph TPjOk4H3EseZuiOD6kjH07vt8mdFm7VUJsVScJiotiGsEVM5ex6aU4MOIU8xew9fYy/R JXD/vKhszpaOxBNav7KfG55iNwjiPNZSTUaK/t6v2dYiPIBliLnLtEIfA7+paMDriRa1 bKid5lJ9ZzthgcXnS7Ixo05MdXgtcF81nf+XxOvsaCKmJo2l9OvAj1nO2l4Q6KjjqDee vtQA== 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=40F7vrTZE4bJRsw+6bfzuaByYJODXi66QcDeskCVkgE=; b=XjUXcAD92IsGzIkx/t//YA5oGvwCQrPZcYf+uIa+SojoplYovCHN4ANZVEAmXJayL3 CuDzFH+fAHDfocpfFCJ0zXgsZkO0MJ/ZpkyYvIICjaO+Ye86ojddEMtiNQ2UN4KDSVcv CTTC8s79XwuN2Zj7FR59vjtj7rJpSUizI2GRF1yr67WyfwYr/kIF9Smf2/u26ee2ZBeA Ztr7+dJZFxy230r7uZDy1CqbACCBh0lcOeOx/+JCGMEgWlk6DIj10E1YyjckN8XZnWFC sJ64Jibi94Ll4vt4RNNrV7A5y2AU61CGhDhzzjO7rJNS+YgxDL3sEJAIW5Px6cDtOxDh p91g== Sender: swupdate@googlegroups.com X-Gm-Message-State: APzg51DjFNm8DwGAZHeLLFNl0IgBBakC7vwcvVoLOp7rSrv+gNxeLIn/ MSNC3wP5Fwy66seuIV9SXLo= X-Google-Smtp-Source: ANB0VdbBVIfi+jp8WGFPu2FdcyhBgu0HOdwAPmRKIw+ruhkx7BF29b4h0isSMatYGf446N2kSTUbGQ== X-Received: by 2002:aa7:d70f:: with SMTP id t15-v6mr16102edq.6.1536234056069; Thu, 06 Sep 2018 04:40:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a50:b364:: with SMTP id r33-v6ls2348268edd.3.gmail; Thu, 06 Sep 2018 04:40:55 -0700 (PDT) X-Received: by 2002:a50:b125:: with SMTP id k34-v6mr656481edd.8.1536234055658; Thu, 06 Sep 2018 04:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234055; cv=none; d=google.com; s=arc-20160816; b=b9aXFtyjeGnEftfwrxml/KpdnLCbTzhc3YIipfFPjFgeLabZgGtRwpedThf69DHN8C 0Tsp38UVPdFirzeHIn56lcgf01bt+EjIGFuHuGejk8fE5Eg75vISuFlsH91M/ZsU6e4b uUGyf52gs8yb9SBEwE9BYO8m3SHVxVOOC1ZtP0HDHO0XsnyPmFEryN/cPqNw2ez3+hEP DCn2S4V9RSmmCGsQ6q1+E8lbb/udnPfmbtvBis4TZVQ9HTtie8d07em/q8Gr4fDae0Fr mGmXN56RCBdUYsM46XEG7luhRYfVfnN3P4qYjaYNJvd6rF6OWj998mHKyC21mFpBqK/C n8cQ== 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; bh=asnrLPEwGJGP3hqPmr0YIOvPCmnhr3FfDzd2oZ6WJq4=; b=keEKc4xmuRynNCW7WN+HXV/VvV/PPmky5DJr1GTOONkqmugbG39w+sLEJAvRR5wc6/ 8KA/S+s4OHFrNOvaV5zToaRWZ5PJhsHG8IrMSul6d3cy+hHiux8HcLGFdnYb6rYqT9Fa 7ntEaPQ4HuC3IkY++ISA6UIsWWdEKDIJNuq9bcikBZSaX2KXK23RTdvRzHXgk3daSylu Gf08V6jURQFEiFxgq0dOAbLt6PjyvBZsy2KGJPaq0CQ9615VVSD7JtT8aZ7CBkcUrP7R 6QaIUPzuEAI6BIHtiufaRWYgS/UqSE6QpteuAnIzOhjpPfqKRiyRqTtBkVghmSwoj/SZ oioQ== 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 g20-v6si104964edm.0.2018.09.06.04.40.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 04:40:55 -0700 (PDT) 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 425dtb2zfXz1qvnY; Thu, 6 Sep 2018 13:40:55 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 425dtb2p5xz1qrVm; Thu, 6 Sep 2018 13:40:55 +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 FC7t3dtknSJd; Thu, 6 Sep 2018 13:40:54 +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; Thu, 6 Sep 2018 13:40:54 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 6EC0B454035B; Thu, 6 Sep 2018 13:40:54 +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 3VMoK13ryFim; Thu, 6 Sep 2018 13:40:52 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 577574540568; Thu, 6 Sep 2018 13:40:44 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 8/9] hawkbit: rename section in swupdate.cfg Date: Thu, 6 Sep 2018 13:40:40 +0200 Message-Id: <20180906114041.21828-8-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180906114041.21828-1-sbabic@denx.de> References: <20180906114041.21828-1-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: , As preparation to support more server in suricatta mode, rename the section for hawkbit from "suricatta" to "hawkbit", but still search in "suricatta" to maintain compatibility. Signed-off-by: Stefano Babic --- suricatta/server_hawkbit.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index 31266c0..106b535 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -1501,7 +1501,7 @@ void suricatta_print_help(void) DEFAULT_RESUME_DELAY); } -static int suricatta_settings(void *elem, void __attribute__ ((__unused__)) *data) +static int server_hawkbit_settings(void *elem, void __attribute__ ((__unused__)) *data) { char tmp[128]; @@ -1566,7 +1566,16 @@ server_op_res_t server_start(char *fname, int argc, char *argv[]) LIST_INIT(&server_hawkbit.configdata); if (fname) { - read_module_settings(fname, "suricatta", suricatta_settings, + /* + * Search "suricatta" section to be compatible with past + */ + read_module_settings(fname, "suricatta", server_hawkbit_settings, + NULL); + /* + * Then try "hawkbit" because each server has its own + * section + */ + read_module_settings(fname, "hawkbit", server_hawkbit_settings, NULL); read_module_settings(fname, "identify", settings_into_dict, &server_hawkbit.configdata); From patchwork Thu Sep 6 11:40:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 966931 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=209.85.208.190; helo=mail-lj1-f190.google.com; envelope-from=swupdate+bncbcxploxj6ikrbsneytoakgqenltazbq@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="EouZUGt0"; dkim-atps=neutral Received: from mail-lj1-f190.google.com (mail-lj1-f190.google.com [209.85.208.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 425dth01sPz9s55 for ; Thu, 6 Sep 2018 21:40:59 +1000 (AEST) Received: by mail-lj1-f190.google.com with SMTP id t82-v6sf2192173lje.15 for ; Thu, 06 Sep 2018 04:40:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1536234057; cv=pass; d=google.com; s=arc-20160816; b=G2vqrCeqnTaIT1N81BiDCpTD04DobcO8H+Vop3AZKFWgSNcnk+8o3Ou1n0UrLjI+0+ YNAgpP1IlezYJFtmBcAsOK4wrWExUPQlusKe42BnGGPvO3xKh6LXa/hpEI0l16isabVJ cYYhaWMNXVPCO7aCWPFUQwNJ2hfkHYoYMgB5XJtmIKlRazWUE1E8SpAJHr+fGk+wdqAi 9kz/tXYejUBHuQSkeXos3eRgpAaKkPCUqdJuTWMyvrrZYtj1qo0ijwMCW13hoCWgCwJz lZWjz+tV+nS9Jr+wbhKeoSrjBUn19keL0q3OhV8xefRTCXMY1Pt79eisWDYXyVcwfIn5 vDIw== 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:mime-version:sender:dkim-signature; bh=UXY4sm6Wj7Oe/2rMkAVb1SHTyIRBg8qQdLs4Wfwrkm8=; b=WAAqUH0BF5qQPOUlt4fxlGGdFmWjA2puTPVhdsbnmrIECVSlWtvf1Eb/ou6WtqavRO t48fpjEkjkbcY7SI0Ig+y3XOn79Oazq9Oybnu6giEFFniCGieXeIL74cV+ampM2PGGOQ 0BKpvMHSxrOtuiHK1UNymZrNdni29omuXcrZcjh1Ni1dpkMyC4SGmB2Tq1MgqlxdLggu b1HKSrRTPkd2T4axpGKF7D1MUaWHDdCg29UGGKWJRl58iGXWUVPtLEWitxzhUfMUJzqE FWLA79q4Uox6yDhH937ZuE1nGqYN+C3ifN4/FqggdBHNK69bwRdRgHHnQarnauxh4uYi 4qIQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 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=UXY4sm6Wj7Oe/2rMkAVb1SHTyIRBg8qQdLs4Wfwrkm8=; b=EouZUGt045clZwOwh2dYRG4XWPkKR54aU+egK8DBjtzEW7x1KiZR0lx9zZaggmwx8v HOOJmmQ/U10Jw6t0eN+NGqkXuL4BVhzkuFW2SNBz6MQiqd44HAHqT4m2SgQh8o5ACbNP wLqZPWAIMX65w25FMYLhGzjYrq/IHa4xcgiA3NhKCEQSFTXv/i/RIGuM9hHAP7h8rcYi V/G0EdaAwWS0JwRMkcQ9Z+dHnvJA0Ec+2zbcCRdo3JIrsrF3s1mDmv6ka1JxDm+fB+U6 1uoZRxCq4hZ9f771TxOqhN4Gx9MYoAZMiyO7qmLiu7w5OKKqyD6VRevS0pQd+z0AkFLU yfTg== 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=UXY4sm6Wj7Oe/2rMkAVb1SHTyIRBg8qQdLs4Wfwrkm8=; b=ZgsypMRVoPbfPsUF15bxv+K1KcBCIeyPNo9qbrxx2Sj4uGCM6rWQ4N9vnBzX7aF5+Q sLNpPGQDRviOlAZq/OKgzeJ3A3jIIu0G3V0LiLUpyWIE1Fah9ejmu+YocZBz6WrRqnVb K8qvkumNPEKeq0SoIaSR6KMauQEExOy5xZlrVAz6y3dVs/fJwh15tCxf011LhxYT+eDV mlrl+HMh3BZr2Z+br+7ghQl0Hxo0hujMnvGHjn8dJZr/9FX5zP4+um/vUNmowFyzxa0W cyiAC40i6nnG/FyFbTHwNDkkEVchwoyD/RvcGSaaV+IVW0HUU1hJ3CqWBQjUtBDegw9f bjVg== Sender: swupdate@googlegroups.com X-Gm-Message-State: APzg51BZTG9OQ9HlUC0VU6F7TkEun/eN0sJ1QWwJtr+F4JMKJDTZfAzq OX1QV/Zbj30A+5p562n+K2Q= X-Google-Smtp-Source: ANB0VdY2OPGmGd0fOznNk2CShDo7yCw8aW0XR3PMfjzJwygjTJiY3/ZS02BX1hbSRzSQ5ozWgvxCTQ== X-Received: by 2002:a2e:350f:: with SMTP id z15-v6mr15736ljz.6.1536234057174; Thu, 06 Sep 2018 04:40:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a19:520f:: with SMTP id m15-v6ls341099lfb.12.gmail; Thu, 06 Sep 2018 04:40:56 -0700 (PDT) X-Received: by 2002:a19:ee14:: with SMTP id g20-v6mr61684lfb.35.1536234056706; Thu, 06 Sep 2018 04:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234056; cv=none; d=google.com; s=arc-20160816; b=Hx0G21exCSDgdhbvd7FrZLlJy+ac2933paNEhRRZIU+NgzOTn9pg5cjcyc5gNWnNVB Lr7XHEbDn4Tuh8MDITtjzaoFF3NAs+3XIh9vclAVWqLLKG/j4Eij7LBiYDPr/mQJUcav 5SfHy2qP3qWLyScfBrU9XjCP7rfIcFyRx0YBBu0c5Dt77+J04ZIgzEOOiiNaMUn+LBDW tEAnaNKhUCJyQFcxgBmXmciWDWKW/5KsLDci7R1edCmPa2CwDKkvhUhYYB9zgF6SrWQQ guU/eCrnumrWHxCNFHxFTHsMoIy7+ye30zD/4tIBpdPdACycrX8hmlvji95rCRkRT9mN gYQQ== 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; bh=BnCOCHqNf43kFClLXEjs15jbk5Ei7VXo7aAgex1iIww=; b=h4BA8fP3brT1K2/0hJQe42VbziVk6Ghax6ij0zTzaJoyF/P4z+chdNcMD8v44t5caf n+Aom2i3v/OqSMaGaF6RlncarSEInhtSD9P3thWbm/9lawzRauBgBglbStoShyBNLWRL ABWsyYeeaKFH3QcBLffqS0u00hXrOD+/JmEk0Iab54EV1zp1kfax58u5AfVwY1kM+Atr /HIWt/nbRdLvbdn8QQozHQ9yqHpkBoDqn7FBy+ij0Y5UF1vRIDTcWQZ6K5qpBOM3OkZ1 JrqA8fDsBff+EN4hG+3vRH/Mii7eiIvht476G2WGy+sQ/pZe5kkMMxylTJ/BxuWsmU+0 BRIg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 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.9]) by gmr-mx.google.com with ESMTPS id v82-v6si222063lje.2.2018.09.06.04.40.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 04:40:56 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for 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 425dtc1J0Fz1qvgd; Thu, 6 Sep 2018 13:40:56 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 425dtc16jzz1qrVq; Thu, 6 Sep 2018 13:40:56 +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 HljUR_x48WkF; Thu, 6 Sep 2018 13:40:55 +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; Thu, 6 Sep 2018 13:40:55 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 131BE4540360; Thu, 6 Sep 2018 13:40:55 +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 SNFME5BUPr0Y; Thu, 6 Sep 2018 13:40:52 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 748C1454056A; Thu, 6 Sep 2018 13:40:44 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 9/9] suricatta: add help to exported server functions Date: Thu, 6 Sep 2018 13:40:41 +0200 Message-Id: <20180906114041.21828-9-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180906114041.21828-1-sbabic@denx.de> References: <20180906114041.21828-1-sbabic@denx.de> 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 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: , Each server has its own setup and comman line parameters. Set a general function to be called in suricatta daemon that references to the server specific help function. Signed-off-by: Stefano Babic --- include/suricatta/server.h | 3 +++ suricatta/server_hawkbit.c | 4 ++-- suricatta/suricatta.c | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/suricatta/server.h b/include/suricatta/server.h index 75b93f6..fc65543 100644 --- a/include/suricatta/server.h +++ b/include/suricatta/server.h @@ -21,6 +21,7 @@ extern unsigned int server_get_polling_interval(void); extern server_op_res_t server_start(const char *cfgfname, int argc, char *argv[]); extern server_op_res_t server_stop(void); extern server_op_res_t server_ipc(int fd); +extern void server_print_help(void); static struct server_t { server_op_res_t (*has_pending_action)(int *action_id); @@ -30,10 +31,12 @@ static struct server_t { server_op_res_t (*start)(const char *fname, int argc, char *argv[]); server_op_res_t (*stop)(void); server_op_res_t (*ipc)(int fd); + void (*help)(void); } server = {.has_pending_action = &server_has_pending_action, .install_update = &server_install_update, .send_target_data = &server_send_target_data, .get_polling_interval = &server_get_polling_interval, + .help = &server_print_help, .ipc = &server_ipc, .start = &server_start, .stop = &server_stop}; diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index 106b535..bc85140 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -108,7 +108,7 @@ server_op_res_t server_process_update_artifact(int action_id, const char *part, const char *version, const char *name); -void suricatta_print_help(void); +void server_print_help(void); server_op_res_t server_set_polling_interval(json_object *json_root); server_op_res_t server_set_config_data(json_object *json_root); static update_state_t get_state(void); @@ -1474,7 +1474,7 @@ cleanup: return result; } -void suricatta_print_help(void) +void server_print_help(void) { fprintf( stderr, diff --git a/suricatta/suricatta.c b/suricatta/suricatta.c index 0ca5142..e9718cd 100644 --- a/suricatta/suricatta.c +++ b/suricatta/suricatta.c @@ -17,6 +17,11 @@ #include "suricatta/suricatta.h" #include "suricatta/server.h" +void suricatta_print_help(void) +{ + server.help(); +} + int suricatta_wait(int seconds) { fd_set readfds;