{"id":803089,"url":"http://patchwork.ozlabs.org/api/patches/803089/?format=json","web_url":"http://patchwork.ozlabs.org/project/swupdate/patch/20170818082704.11873-1-christian.storm@siemens.com/","project":{"id":58,"url":"http://patchwork.ozlabs.org/api/projects/58/?format=json","name":"swupdate development","link_name":"swupdate","list_id":"swupdate.googlegroups.com","list_email":"swupdate@googlegroups.com","web_url":"https://github.com/sbabic/swupdate","scm_url":"git://github.com/sbabic/swupdate","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170818082704.11873-1-christian.storm@siemens.com>","list_archive_url":null,"date":"2017-08-18T08:27:04","name":"[resent] suricatta: enable IPC to signal wait abort","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"561336650de150874a055013a4c49e1d20684cc5","submitter":{"id":72180,"url":"http://patchwork.ozlabs.org/api/people/72180/?format=json","name":"Storm, Christian","email":"christian.storm@siemens.com"},"delegate":{"id":1693,"url":"http://patchwork.ozlabs.org/api/users/1693/?format=json","username":"sbabic","first_name":"Stefano","last_name":"Babic","email":"sbabic@denx.de"},"mbox":"http://patchwork.ozlabs.org/project/swupdate/patch/20170818082704.11873-1-christian.storm@siemens.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/803089/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/803089/checks/","tags":{},"related":[],"headers":{"Return-Path":"<swupdate+bncBDD6BWV65QPBBTWK3LGAKGQEUJQQNLI@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=googlegroups.com\n\t(client-ip=2a00:1450:4010:c07::238;\n\thelo=mail-lf0-x238.google.com;\n\tenvelope-from=swupdate+bncbdd6bwv65qpbbtwk3lgakgqeujqqnli@googlegroups.com;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=googlegroups.com header.i=@googlegroups.com\n\theader.b=\"m7UNs7dG\"; dkim-atps=neutral"],"Received":["from mail-lf0-x238.google.com (mail-lf0-x238.google.com\n\t[IPv6:2a00:1450:4010:c07::238])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xYbpV4dGzz9t2c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 18 Aug 2017 18:29:05 +1000 (AEST)","by mail-lf0-x238.google.com with SMTP id 87sf1528685lfy.0\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 18 Aug 2017 01:29:05 -0700 (PDT)","by 10.46.19.17 with SMTP id 17ls164899ljt.2.gmail; Fri, 18 Aug 2017\n\t01:29:02 -0700 (PDT)","from david.siemens.de (david.siemens.de. [192.35.17.14])\n\tby gmr-mx.google.com with ESMTPS id\n\tx63si341519wmf.8.2017.08.18.01.29.02\n\tfor <swupdate@googlegroups.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 18 Aug 2017 01:29:02 -0700 (PDT)","from mail3.siemens.de (mail3.siemens.de [139.25.208.14])\n\tby david.siemens.de (8.15.2/8.15.2) with ESMTPS id v7I8T2Dt010813\n\t(version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)\n\tfor <swupdate@googlegroups.com>; Fri, 18 Aug 2017 10:29:02 +0200","from MD1KR9XC.ww002.siemens.net ([139.25.68.253])\n\tby mail3.siemens.de (8.15.2/8.15.2) with ESMTP id v7I8T1IB031894;\n\tFri, 18 Aug 2017 10:29:01 +0200"],"ARC-Seal":["i=2; a=rsa-sha256; t=1503044943; cv=pass;\n\td=google.com; s=arc-20160816;\n\tb=DS9guRSJZjGOZWR0fnRxSwoG34qecQoP1jHN3B9AKogEB50q6kUvf82ZA8+74loY77\n\tCt8SLMySYyLHW2QBAW2SqoSsqUa/JI0OYfFD4ZhNia9OfLuM67V6gR9jCpoj5iDr/xqh\n\tXJyaywk7XOwInxYV86dTwbq8wS0ngvuhfm7fMJre+Taus+5mnbVjLRXkf5T99Z2HAugb\n\t/qr7noLeaPgfqvuTYfaRqwd35o5bK0tBxQE3YPVKh3zFuHYNwl0bZraPdnmW8jbynDry\n\thG4RyD3R7pNxf4O+PhVr0U9J9XvboZIfWYMuAxMvQbdMMX17lEQVW1DcxyF7EtKlCF5K\n\tQx6Q==","i=1; a=rsa-sha256; t=1503044942; cv=none;\n\td=google.com; s=arc-20160816;\n\tb=MQNzt2928qqOzvsDt/nURS4tzcRQU7q1JPzkcidlaJdLguFTkqG596/0B7Z6EDkG89\n\tQKhDq5QpJyE0OPyb1FiXAgMzXZxTnBwTV64562cdEvT3GQHAqJZucl6sMtwGMdPDaYNa\n\tfsLYYU5wenoSobbPL9sRauAqtZNlfXgNp0dkHwghf38CruBTd1e31D4059pM6N4Kw7/B\n\ttByPHkLWkTdCC4PbgvHxk3+ljkD0dwHmY16OC7p5wHSHar8MOBJEi7oJbISYQkaotRha\n\tZZmt1zQGZDGoXdQo7RJAH9H/GzjxZ4OBaUjeqiohjQZSzcIsEueauLb8afL9z3Vo03i5\n\tsvBw=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20160816; \n\th=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n\t:list-id:mailing-list:precedence:message-id:date:subject:cc:to:from\n\t:arc-authentication-results:arc-message-signature:mime-version\n\t:sender:dkim-signature:arc-authentication-results;\n\tbh=kpvG4FiYUc07Cc8KSdQci+tClrwCUlgyi6n2W+gQqUU=;\n\tb=VgYTbTKvM0SA8cauCGImrtgOx5KSHgNUEN7dw7/zd1RGSqFzMIrF6jkvTcDWGkj4CQ\n\tBEG8ejZRiqqgIfr1uOQw54cDweY/ufpRoziIWy3P/pI7ZM3RlBIZdV/3/CBhps7PM+pL\n\t0caqY+5QRmV9T2Dr/P4R/vgU5WlAGsEDy02my3FCrdslgK+OBkkClpWdcOvLX9QDcHW0\n\t0KrU/0as3fSSavoC1a4+loCt7QS+NZLK7YrFQGcGxGYU048JrCZjplTu68INtSYOqGn8\n\tDfvFfWIIhorw+SFAvrZniIinRY5b2bwmw0powR8XyMjXjStnzyAHRXtr9+gbOlPGLMlv\n\t9dgQ==","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20160816; \n\th=message-id:date:subject:cc:to:from:arc-authentication-results;\n\tbh=9USukjxCdTRZaDO4TDuCq2pneaOPsm+40W/lK31Hf58=;\n\tb=cphR5n7uutw0UdYMDLw3hqUQ3WQL13jk9MUd/7oBF7KNQ51tcKP7osJB6xK8XlnlvT\n\t/HVFxIhJhUi0cSWbFZltDzbHsenTnl5vQzjQyanrbMGrML46WNnu1SKll4Zov38nLBcR\n\tkrJ6Tw2tIwxJuEqjNyGt7wmvFBGiwbeih7ff5OGVej4/Dqe+JotPv6Vs7sQa1Y5m/UZY\n\tiiWoLNY4RPVUBulVNnMdfwzwwt0IEQNZ8b5NdP4T6CTdt1xCcQUqZgd4Cv4DHkQtSZ/o\n\tz4O5t3PlYSxzcq9/amP+dFWLYFffbXbp8vo5jTdb6rJ2kgJCDkWZjQJH2TQ5e8cjyb8m\n\tnqTQ=="],"ARC-Authentication-Results":["i=2; gmr-mx.google.com;\n\tspf=neutral (google.com: 192.35.17.14 is neither permitted nor denied\n\tby best guess record for domain of\n\tchristian.storm@siemens.com)\n\tsmtp.mailfrom=christian.storm@siemens.com","i=1; gmr-mx.google.com;\n\tspf=neutral (google.com: 192.35.17.14 is neither permitted nor denied\n\tby best guess record for domain of\n\tchristian.storm@siemens.com)\n\tsmtp.mailfrom=christian.storm@siemens.com"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlegroups.com; s=20161025;\n\th=sender:mime-version:from:to:cc:subject:date:message-id\n\t:x-original-sender:x-original-authentication-results:precedence\n\t:mailing-list:list-id:list-post:list-help:list-archive\n\t:list-subscribe:list-unsubscribe;\n\tbh=kpvG4FiYUc07Cc8KSdQci+tClrwCUlgyi6n2W+gQqUU=;\n\tb=m7UNs7dGKzOppdnYL8qyBNRTSb5cJUyKY2VEJFQOeP/pJd1Dbr0IQudIxQKHf2Z26b\n\tlBqq4jMZNh12umvEcyMNeEDoP51kiBtt2LWPeBUZYs5S2C7ybP/zvz8+ttOdFEffrpiO\n\tyR5WFdC3pMrzz30J6apRMagv+vIvtUTpBmnqvAOmixEXCxBHQjlnxzhtQvMoHB1ZC04Y\n\tjAiZzXNMaf01qR++IJc1GSzoMbYNrs2Fr66FtJMA0sKqWotiayjVyuRSn3S3FCMVfH25\n\tB1PV3lciHxy5xSD6UrlyHlIJ0qLSmFtGSy5cfoyqPhUIJ7jcZC+bhp6awdfBmmt8tx37\n\t9kzQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=sender:x-gm-message-state:mime-version:from:to:cc:subject:date\n\t:message-id:x-original-sender:x-original-authentication-results\n\t:precedence:mailing-list:list-id:x-spam-checked-in-group:list-post\n\t:list-help:list-archive:list-subscribe:list-unsubscribe;\n\tbh=kpvG4FiYUc07Cc8KSdQci+tClrwCUlgyi6n2W+gQqUU=;\n\tb=R6XL2Qh6t6RRIWHK5VRWGzX/pvsj/NzhjI1O+dRnYO9pbiC3YhhOVGPXlLtouWxlVA\n\tkEHERXXVbU47h8qYI3Xq0RpNV7A6xT2/ps3jCCi9ULBcy6eN9qKWdUsj91540Kh4R1S3\n\t5gXgZeeTqGypk2Vd9cIx26wkTpCM39s/hhswDGSKtGpCf3WUfJfTLQMoEimASHUt496r\n\tyx0RFZX0g0iEn9c1YKabJ3wWzg2cbFqiG7G31Z8oHmJ/krj4i60VJ45prkXds3jeHMy1\n\tzDVjVpgYVqmIG9kNTxcqBJpatLzYUDoPD/hf2d54bm9MdCu5OOMbIFCOh1k1AVAbScqm\n\tdmOQ==","Sender":"swupdate@googlegroups.com","X-Gm-Message-State":"AHYfb5ivitVl/b2qBiQIOjKB5DwwE0qn0HeHJEzUwnO60GZkK9zZHo8Q\n\t/T9GaBIYqhTOPw==","X-Received":["by 10.25.67.69 with SMTP id m5mr5059lfj.23.1503044943095;\n\tFri, 18 Aug 2017 01:29:03 -0700 (PDT)","by 10.46.87.78 with SMTP id r14mr1236835ljd.29.1503044942458;\n\tFri, 18 Aug 2017 01:29:02 -0700 (PDT)"],"MIME-Version":"1.0","X-BeenThere":"swupdate@googlegroups.com","Received-SPF":"neutral (google.com: 192.35.17.14 is neither permitted nor\n\tdenied by best guess record for domain of\n\tchristian.storm@siemens.com) client-ip=192.35.17.14; ","From":"Christian Storm <christian.storm@siemens.com>","To":"swupdate@googlegroups.com","Cc":"Christian Storm <christian.storm@siemens.com>","Subject":"[swupdate] [PATCH resent] suricatta: enable IPC to signal wait abort","Date":"Fri, 18 Aug 2017 10:27:04 +0200","Message-Id":"<20170818082704.11873-1-christian.storm@siemens.com>","X-Mailer":"git-send-email 2.14.1","X-Original-Sender":"christian.storm@siemens.com","X-Original-Authentication-Results":"gmr-mx.google.com;       spf=neutral\n\t(google.com: 192.35.17.14 is neither permitted nor denied by best\n\tguess\n\trecord for domain of christian.storm@siemens.com)\n\tsmtp.mailfrom=christian.storm@siemens.com","Content-Type":"text/plain; charset=\"UTF-8\"","Precedence":"list","Mailing-list":"list swupdate@googlegroups.com;\n\tcontact swupdate+owners@googlegroups.com","List-ID":"<swupdate.googlegroups.com>","X-Spam-Checked-In-Group":"swupdate@googlegroups.com","X-Google-Group-Id":"605343134186","List-Post":"<https://groups.google.com/group/swupdate/post>,\n\t<mailto:swupdate@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n\t<mailto:swupdate+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/swupdate","List-Subscribe":"<https://groups.google.com/group/swupdate/subscribe>,\n\t<mailto:swupdate+subscribe@googlegroups.com>","List-Unsubscribe":"<mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n\t<https://groups.google.com/group/swupdate/subscribe>"},"content":"Allow aborting suricatta_wait() via IPC by server_ipc()\nreturning SERVER_OK_WAKEUP.\n\nSigned-off-by: Christian Storm <christian.storm@siemens.com>\n---\n include/network_ipc.h         |  3 ++-\n include/suricatta/suricatta.h |  1 +\n suricatta/server_hawkbit.c    | 23 ++++++++++-------------\n suricatta/suricatta.c         |  6 +++++-\n 4 files changed, 18 insertions(+), 15 deletions(-)","diff":"diff --git a/include/network_ipc.h b/include/network_ipc.h\nindex e0d6672..9cd947b 100644\n--- a/include/network_ipc.h\n+++ b/include/network_ipc.h\n@@ -37,7 +37,8 @@ typedef enum {\n \n enum {\n \tCMD_ACTIVATION,\n-\tCMD_CONFIG\n+\tCMD_CONFIG,\n+\tCMD_WAKEUP\n };\n \n typedef union {\ndiff --git a/include/suricatta/suricatta.h b/include/suricatta/suricatta.h\nindex c04aff4..2419d8c 100644\n--- a/include/suricatta/suricatta.h\n+++ b/include/suricatta/suricatta.h\n@@ -44,6 +44,7 @@ typedef enum {\n \n typedef enum {\n \tSERVER_OK,\n+\tSERVER_OK_WAKEUP,\n \tSERVER_EERR,\n \tSERVER_EBADMSG,\n \tSERVER_EINIT,\ndiff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c\nindex 605733f..6550835 100644\n--- a/suricatta/server_hawkbit.c\n+++ b/suricatta/server_hawkbit.c\n@@ -871,6 +871,7 @@ static server_op_res_t handle_feedback(int action_id, server_op_res_t result,\n \n \tswitch (result) {\n \tcase SERVER_OK:\n+\tcase SERVER_OK_WAKEUP:\n \tcase SERVER_ID_REQUESTED:\n \tcase SERVER_UPDATE_CANCELED:\n \tcase SERVER_NO_UPDATE_AVAILABLE:\n@@ -1193,6 +1194,7 @@ server_op_res_t server_install_update(void)\n \tcase SERVER_UPDATE_AVAILABLE:\n \tcase SERVER_ID_REQUESTED:\n \tcase SERVER_OK:\n+\tcase SERVER_OK_WAKEUP:\n \t\tbreak;\n \tcase SERVER_EERR:\n \tcase SERVER_EBADMSG:\n@@ -1916,12 +1918,11 @@ static server_op_res_t server_configuration_ipc(ipc_message *msg)\n server_op_res_t server_ipc(int fd)\n {\n \tipc_message msg;\n-\tserver_op_res_t result = SERVER_OK;\n-\tint ret;\n+\tserver_op_res_t result;\n \n-\tret = read(fd, &msg, sizeof(msg));\n-\tif (ret != sizeof(msg))\n+\tif (read(fd, &msg, sizeof(msg)) != sizeof(msg)) {\n \t\treturn SERVER_EERR;\n+\t}\n \n \tswitch (msg.data.instmsg.cmd) {\n \tcase CMD_ACTIVATION:\n@@ -1930,23 +1931,19 @@ server_op_res_t server_ipc(int fd)\n \tcase CMD_CONFIG:\n \t\tresult = server_configuration_ipc(&msg);\n \t\tbreak;\n+\tcase CMD_WAKEUP:\n+\t\tresult = SERVER_OK_WAKEUP;\n+\t\tbreak;\n \tdefault:\n \t\tresult = SERVER_EERR;\n \t\tbreak;\n \t}\n \n-\tif (result == SERVER_EERR) {\n-\t\tmsg.type = NACK;\n-\t} else\n-\t\tmsg.type = ACK;\n-\n+\tmsg.type = (result == SERVER_EERR) ? NACK : ACK;\n \tmsg.data.instmsg.len = 0;\n-\n \tif (write(fd, &msg, sizeof(msg)) != sizeof(msg)) {\n \t\tTRACE(\"IPC ERROR: sending back msg\");\n \t}\n \n-\t/* Send ipc back */\n-\n-\treturn SERVER_OK;\n+\treturn result;\n }\ndiff --git a/suricatta/suricatta.c b/suricatta/suricatta.c\nindex b520978..e1b161b 100644\n--- a/suricatta/suricatta.c\n+++ b/suricatta/suricatta.c\n@@ -47,7 +47,11 @@ int suricatta_wait(int seconds)\n \t}\n \tif (retval && FD_ISSET(sw_sockfd, &readfds)) {\n \t\tTRACE(\"Suricatta woke up for IPC at %ld seconds\", tv.tv_sec);\n-\t\tif (server.ipc(sw_sockfd) != SERVER_OK){\n+\t\tserver_op_res_t result = server.ipc(sw_sockfd);\n+\t\tif (result == SERVER_OK_WAKEUP) {\n+\t\t\treturn 0;\n+\t\t}\n+\t\tif (result != SERVER_OK){\n \t\t\tDEBUG(\"Handling IPC failed!\");\n \t\t}\n \t\treturn (int)tv.tv_sec;\n","prefixes":["resent"]}