From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752213AbdHHNqf (ORCPT ); Tue, 8 Aug 2017 09:46:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47088 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010AbdHHNqd (ORCPT ); Tue, 8 Aug 2017 09:46:33 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2160B883DA Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=prarit@redhat.com Subject: Re: [PATCH v4] printk: Add monotonic, boottime, and realtime timestamps To: Sergey Senozhatsky References: <1502121162-27981-1-git-send-email-prarit@redhat.com> <20170808001908.GA7765@jagdpanzerIV.localdomain> Cc: linux-kernel@vger.kernel.org, Mark Salyzyn , Jonathan Corbet , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , John Stultz , Thomas Gleixner , Stephen Boyd , Andrew Morton , Greg Kroah-Hartman , "Paul E. McKenney" , Christoffer Dall , Deepa Dinamani , Ingo Molnar , Joel Fernandes , Kees Cook , Peter Zijlstra , Geert Uytterhoeven , "Luis R. Rodriguez" , Nicholas Piggin , "Jason A. Donenfeld" , Olof Johansson , Josh Poimboeuf , linux-doc@vger.kernel.org From: Prarit Bhargava Message-ID: <9cbfa88f-fdc8-0356-1e4e-dc949c085caf@redhat.com> Date: Tue, 8 Aug 2017 09:46:22 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170808001908.GA7765@jagdpanzerIV.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 08 Aug 2017 13:46:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/07/2017 08:19 PM, Sergey Senozhatsky wrote: > On (08/07/17 11:52), Prarit Bhargava wrote: > [..] >> + if (strlen(param) == 1) { >> + /* Preserve legacy boolean settings */ >> + if (!strcmp("0", param) || !strcmp("n", param) || >> + !strcmp("N", param)) >> + _printk_time = PRINTK_TIME_DISABLE; >> + if (!strcmp("1", param) || !strcmp("y", param) || >> + !strcmp("Y", param)) >> + _printk_time = PRINTK_TIME_LOCAL; >> + } >> + if (_printk_time == -1) { >> + for (stamp = 0; stamp <= 4; stamp++) { >> + if (!strncmp(printk_time_str[stamp], param, >> + strlen(param))) { >> + _printk_time = stamp; >> + break; >> + } >> + } >> + } > > you can use match_string() here. match_string doesn't match correctly. Others have made requests for, for example, printk.time=r printk.time=real, etc. Instead of butchering the code for a bunch of strings I chose to allow partial matching and simplify the code. P.