[{"id":1764204,"web_url":"http://patchwork.ozlabs.org/comment/1764204/","msgid":"<6ac4f80c-3e80-297b-a4d6-2f4ae0b70d66@redhat.com>","list_archive_url":null,"date":"2017-09-06T15:37:48","subject":"Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition\n\tof actions enum","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/06/2017 06:24 AM, Michal Privoznik wrote:\n> We already have enum that enumerates all the action that a\n\ns/action/actions/\n\n> watchdog can take when hitting its timeout: WatchdogAction.\n> Use that instead of inventing our own.\n> \n> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>\n> ---\n\n> @@ -77,27 +77,16 @@ int select_watchdog(const char *p)\n>  \n>  int select_watchdog_action(const char *p)\n>  {\n> -    if (strcasecmp(p, \"reset\") == 0)\n> -        watchdog_action = WDT_RESET;\n\nThe old code was case-insensitive,\n\n> +    action = qapi_enum_parse(&WatchdogAction_lookup, p, -1, NULL);\n\nthe new code is not.  Do we care?  (I don't, but we could be breaking\nsomeone's control flow).  Should qapi_enum_parse be taught to be\ncase-insensitive?  Or perhaps we answer related questions first: Do we\nhave any QAPI enums that have values differing only in case? Do we\nprevent such QAPI definitions, to give us the potential of making the\nparsing insensitive?","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnSRY2bTrz9t43\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 01:38:49 +1000 (AEST)","from localhost ([::1]:36754 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpcPf-0005n8-6F\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 11:38:47 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59823)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dpcOz-0005eG-EZ\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 11:38:15 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dpcOo-0007RT-KL\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 11:38:05 -0400","from mx1.redhat.com ([209.132.183.28]:45330)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>) id 1dpcOo-0007NB-2M\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 11:37:54 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2A23E81E08\n\tfor <qemu-devel@nongnu.org>; Wed,  6 Sep 2017 15:37:51 +0000 (UTC)","from [10.10.120.228] (ovpn-120-228.rdu2.redhat.com [10.10.120.228])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id DDF295C544;\n\tWed,  6 Sep 2017 15:37:49 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 2A23E81E08","To":"Michal Privoznik <mprivozn@redhat.com>, qemu-devel@nongnu.org","References":"<cover.1504696921.git.mprivozn@redhat.com>\n\t<9fe40ce91ada6dfdade83f32940f420e8b373db2.1504696921.git.mprivozn@redhat.com>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<6ac4f80c-3e80-297b-a4d6-2f4ae0b70d66@redhat.com>","Date":"Wed, 6 Sep 2017 10:37:48 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<9fe40ce91ada6dfdade83f32940f420e8b373db2.1504696921.git.mprivozn@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"FWlh09l7Uc6KC1NnHsWWaNDq0chApmMOW\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tWed, 06 Sep 2017 15:37:51 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition\n\tof actions enum","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"armbru@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1764273,"web_url":"http://patchwork.ozlabs.org/comment/1764273/","msgid":"<87zia7rb6h.fsf@dusky.pond.sub.org>","list_archive_url":null,"date":"2017-09-06T17:25:58","subject":"Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition\n\tof actions enum","submitter":{"id":2645,"url":"http://patchwork.ozlabs.org/api/people/2645/","name":"Markus Armbruster","email":"armbru@redhat.com"},"content":"Eric Blake <eblake@redhat.com> writes:\n\n> On 09/06/2017 06:24 AM, Michal Privoznik wrote:\n>> We already have enum that enumerates all the action that a\n>\n> s/action/actions/\n>\n>> watchdog can take when hitting its timeout: WatchdogAction.\n>> Use that instead of inventing our own.\n>> \n>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>\n>> ---\n>\n>> @@ -77,27 +77,16 @@ int select_watchdog(const char *p)\n>>  \n>>  int select_watchdog_action(const char *p)\n>>  {\n>> -    if (strcasecmp(p, \"reset\") == 0)\n>> -        watchdog_action = WDT_RESET;\n>\n> The old code was case-insensitive,\n>\n>> +    action = qapi_enum_parse(&WatchdogAction_lookup, p, -1, NULL);\n>\n> the new code is not.  Do we care?  (I don't, but we could be breaking\n> someone's control flow).  Should qapi_enum_parse be taught to be\n> case-insensitive?  Or perhaps we answer related questions first: Do we\n> have any QAPI enums that have values differing only in case? Do we\n> prevent such QAPI definitions, to give us the potential of making the\n> parsing insensitive?\n\nCase-sensitive everywhere is fine.  Case-insensitive everywhere also\nfine, just not my personal preference.  What's not fine is \"guess\nwhether this part of the interface is case-sensitive or not\".\n\nQMP is case-sensitive.  Let's keep it that way.\n\nThe -watchdog-action option has a case-insensitive argument.  The\nobvious way to remain misfeature-^Wbackwards compatible is converting\nthe argument to lower case before handing it off to qapi_enum_parse.  I\ndoubt it matters, but just doing it is less work than debating how far\nexactly we want to bend over backwards.\n\ng_ascii_strdown() should do.  It only converts ASCII characters, but\nanything else is going to fail in qapi_enum_parse() anyway.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=armbru@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnVqq5P0jz9t2d\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 03:26:31 +1000 (AEST)","from localhost ([::1]:37256 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpe5t-0008Pj-3V\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 13:26:29 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:36433)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1dpe5U-0008Nh-V4\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 13:26:10 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1dpe5R-00025w-0s\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 13:26:04 -0400","from mx1.redhat.com ([209.132.183.28]:51248)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <armbru@redhat.com>) id 1dpe5Q-00025F-Qt\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 13:26:00 -0400","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id C85107F414\n\tfor <qemu-devel@nongnu.org>; Wed,  6 Sep 2017 17:25:59 +0000 (UTC)","from blackfin.pond.sub.org (ovpn-116-75.ams2.redhat.com\n\t[10.36.116.75])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 827E317C2A;\n\tWed,  6 Sep 2017 17:25:59 +0000 (UTC)","by blackfin.pond.sub.org (Postfix, from userid 1000)\n\tid 0AE181138645; Wed,  6 Sep 2017 19:25:58 +0200 (CEST)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com C85107F414","From":"Markus Armbruster <armbru@redhat.com>","To":"Eric Blake <eblake@redhat.com>","References":"<cover.1504696921.git.mprivozn@redhat.com>\n\t<9fe40ce91ada6dfdade83f32940f420e8b373db2.1504696921.git.mprivozn@redhat.com>\n\t<6ac4f80c-3e80-297b-a4d6-2f4ae0b70d66@redhat.com>","Date":"Wed, 06 Sep 2017 19:25:58 +0200","In-Reply-To":"<6ac4f80c-3e80-297b-a4d6-2f4ae0b70d66@redhat.com> (Eric Blake's\n\tmessage of \"Wed, 6 Sep 2017 10:37:48 -0500\")","Message-ID":"<87zia7rb6h.fsf@dusky.pond.sub.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tWed, 06 Sep 2017 17:25:59 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition\n\tof actions enum","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Michal Privoznik <mprivozn@redhat.com>, qemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1764566,"web_url":"http://patchwork.ozlabs.org/comment/1764566/","msgid":"<cd13f335-e1ae-b340-61e5-06a7bc78881f@redhat.com>","list_archive_url":null,"date":"2017-09-07T07:56:24","subject":"Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition\n\tof actions enum","submitter":{"id":11888,"url":"http://patchwork.ozlabs.org/api/people/11888/","name":"Michal Prívozník","email":"mprivozn@redhat.com"},"content":"On 09/06/2017 07:25 PM, Markus Armbruster wrote:\n> Eric Blake <eblake@redhat.com> writes:\n> \n>> On 09/06/2017 06:24 AM, Michal Privoznik wrote:\n>>> We already have enum that enumerates all the action that a\n>>\n>> s/action/actions/\n>>\n>>> watchdog can take when hitting its timeout: WatchdogAction.\n>>> Use that instead of inventing our own.\n>>>\n>>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>\n>>> ---\n>>\n>>> @@ -77,27 +77,16 @@ int select_watchdog(const char *p)\n>>>  \n>>>  int select_watchdog_action(const char *p)\n>>>  {\n>>> -    if (strcasecmp(p, \"reset\") == 0)\n>>> -        watchdog_action = WDT_RESET;\n>>\n>> The old code was case-insensitive,\n>>\n>>> +    action = qapi_enum_parse(&WatchdogAction_lookup, p, -1, NULL);\n>>\n>> the new code is not.  Do we care?  (I don't, but we could be breaking\n>> someone's control flow).  Should qapi_enum_parse be taught to be\n>> case-insensitive?  Or perhaps we answer related questions first: Do we\n>> have any QAPI enums that have values differing only in case? Do we\n>> prevent such QAPI definitions, to give us the potential of making the\n>> parsing insensitive?\n> \n> Case-sensitive everywhere is fine.  Case-insensitive everywhere also\n> fine, just not my personal preference.  What's not fine is \"guess\n> whether this part of the interface is case-sensitive or not\".\n> \n> QMP is case-sensitive.  Let's keep it that way.\n> \n> The -watchdog-action option has a case-insensitive argument.  The\n> obvious way to remain misfeature-^Wbackwards compatible is converting\n> the argument to lower case before handing it off to qapi_enum_parse.  I\n> doubt it matters, but just doing it is less work than debating how far\n> exactly we want to bend over backwards.\n> \n> g_ascii_strdown() should do.  It only converts ASCII characters, but\n> anything else is going to fail in qapi_enum_parse() anyway.\n> \n\nOn the other hand, the documentation enumerates the accepted values in\nlowercase. So one can argue that upper- or mixed-case is just a misuse\nof a bug in the code. But getting the code in is more important to me so\nI'll do the strdown() conversion and sent yet another version.\n\nMichal","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=mprivozn@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnt8F1MJ9z9sRY\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 17:57:01 +1000 (AEST)","from localhost ([::1]:39185 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dprgJ-0001AY-BU\n\tfor incoming@patchwork.ozlabs.org; Thu, 07 Sep 2017 03:56:59 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50577)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <mprivozn@redhat.com>) id 1dprfs-00016J-Ku\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 03:56:37 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <mprivozn@redhat.com>) id 1dprfn-0003KE-M2\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 03:56:32 -0400","from mx1.redhat.com ([209.132.183.28]:11152)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <mprivozn@redhat.com>) id 1dprfn-0003IB-GW\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 03:56:27 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 38D2452778\n\tfor <qemu-devel@nongnu.org>; Thu,  7 Sep 2017 07:56:26 +0000 (UTC)","from [10.43.2.192] (unknown [10.43.2.192])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 84F4518A6C;\n\tThu,  7 Sep 2017 07:56:25 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 38D2452778","To":"Markus Armbruster <armbru@redhat.com>, Eric Blake <eblake@redhat.com>","References":"<cover.1504696921.git.mprivozn@redhat.com>\n\t<9fe40ce91ada6dfdade83f32940f420e8b373db2.1504696921.git.mprivozn@redhat.com>\n\t<6ac4f80c-3e80-297b-a4d6-2f4ae0b70d66@redhat.com>\n\t<87zia7rb6h.fsf@dusky.pond.sub.org>","From":"Michal Privoznik <mprivozn@redhat.com>","Message-ID":"<cd13f335-e1ae-b340-61e5-06a7bc78881f@redhat.com>","Date":"Thu, 7 Sep 2017 09:56:24 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<87zia7rb6h.fsf@dusky.pond.sub.org>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]);\n\tThu, 07 Sep 2017 07:56:26 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition\n\tof actions enum","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1764599,"web_url":"http://patchwork.ozlabs.org/comment/1764599/","msgid":"<87k21aj2yw.fsf@dusky.pond.sub.org>","list_archive_url":null,"date":"2017-09-07T09:02:47","subject":"Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition\n\tof actions enum","submitter":{"id":2645,"url":"http://patchwork.ozlabs.org/api/people/2645/","name":"Markus Armbruster","email":"armbru@redhat.com"},"content":"Michal Privoznik <mprivozn@redhat.com> writes:\n\n> On 09/06/2017 07:25 PM, Markus Armbruster wrote:\n>> Eric Blake <eblake@redhat.com> writes:\n>> \n>>> On 09/06/2017 06:24 AM, Michal Privoznik wrote:\n>>>> We already have enum that enumerates all the action that a\n>>>\n>>> s/action/actions/\n>>>\n>>>> watchdog can take when hitting its timeout: WatchdogAction.\n>>>> Use that instead of inventing our own.\n>>>>\n>>>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>\n>>>> ---\n>>>\n>>>> @@ -77,27 +77,16 @@ int select_watchdog(const char *p)\n>>>>  \n>>>>  int select_watchdog_action(const char *p)\n>>>>  {\n>>>> -    if (strcasecmp(p, \"reset\") == 0)\n>>>> -        watchdog_action = WDT_RESET;\n>>>\n>>> The old code was case-insensitive,\n>>>\n>>>> +    action = qapi_enum_parse(&WatchdogAction_lookup, p, -1, NULL);\n>>>\n>>> the new code is not.  Do we care?  (I don't, but we could be breaking\n>>> someone's control flow).  Should qapi_enum_parse be taught to be\n>>> case-insensitive?  Or perhaps we answer related questions first: Do we\n>>> have any QAPI enums that have values differing only in case? Do we\n>>> prevent such QAPI definitions, to give us the potential of making the\n>>> parsing insensitive?\n>> \n>> Case-sensitive everywhere is fine.  Case-insensitive everywhere also\n>> fine, just not my personal preference.  What's not fine is \"guess\n>> whether this part of the interface is case-sensitive or not\".\n>> \n>> QMP is case-sensitive.  Let's keep it that way.\n>> \n>> The -watchdog-action option has a case-insensitive argument.  The\n>> obvious way to remain misfeature-^Wbackwards compatible is converting\n>> the argument to lower case before handing it off to qapi_enum_parse.  I\n>> doubt it matters, but just doing it is less work than debating how far\n>> exactly we want to bend over backwards.\n>> \n>> g_ascii_strdown() should do.  It only converts ASCII characters, but\n>> anything else is going to fail in qapi_enum_parse() anyway.\n>> \n>\n> On the other hand, the documentation enumerates the accepted values in\n> lowercase. So one can argue that upper- or mixed-case is just a misuse\n> of a bug in the code.\n\nI quite agree, but...\n\n>                       But getting the code in is more important to me so\n> I'll do the strdown() conversion and sent yet another version.\n\n... like you, I have to pick my battles.  A respin adding the stupid\ncase conversion seems safer for both of us than risking a debate on how\nfar we need to go for backward compatibility.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=armbru@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnvcp53dHz9sNV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 19:03:22 +1000 (AEST)","from localhost ([::1]:39442 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpsiW-0003DO-Ru\n\tfor incoming@patchwork.ozlabs.org; Thu, 07 Sep 2017 05:03:20 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:51593)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1dpsiA-0003Ba-Dm\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 05:03:03 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1dpsi6-0007xO-GU\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 05:02:58 -0400","from mx1.redhat.com ([209.132.183.28]:46066)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <armbru@redhat.com>) id 1dpsi6-0007wn-8f\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 05:02:54 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 23C4280099\n\tfor <qemu-devel@nongnu.org>; Thu,  7 Sep 2017 09:02:49 +0000 (UTC)","from blackfin.pond.sub.org (ovpn-116-75.ams2.redhat.com\n\t[10.36.116.75])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id E2C1518B0D;\n\tThu,  7 Sep 2017 09:02:48 +0000 (UTC)","by blackfin.pond.sub.org (Postfix, from userid 1000)\n\tid 6A9521138645; Thu,  7 Sep 2017 11:02:47 +0200 (CEST)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 23C4280099","From":"Markus Armbruster <armbru@redhat.com>","To":"Michal Privoznik <mprivozn@redhat.com>","References":"<cover.1504696921.git.mprivozn@redhat.com>\n\t<9fe40ce91ada6dfdade83f32940f420e8b373db2.1504696921.git.mprivozn@redhat.com>\n\t<6ac4f80c-3e80-297b-a4d6-2f4ae0b70d66@redhat.com>\n\t<87zia7rb6h.fsf@dusky.pond.sub.org>\n\t<cd13f335-e1ae-b340-61e5-06a7bc78881f@redhat.com>","Date":"Thu, 07 Sep 2017 11:02:47 +0200","In-Reply-To":"<cd13f335-e1ae-b340-61e5-06a7bc78881f@redhat.com> (Michal\n\tPrivoznik's message of \"Thu, 7 Sep 2017 09:56:24 +0200\")","Message-ID":"<87k21aj2yw.fsf@dusky.pond.sub.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]);\n\tThu, 07 Sep 2017 09:02:49 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition\n\tof actions enum","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]