From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEB16CD37BE for ; Wed, 4 Sep 2024 02:27:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 682F98D0215; Tue, 3 Sep 2024 22:27:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 633028D018A; Tue, 3 Sep 2024 22:27:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5485C8D0215; Tue, 3 Sep 2024 22:27:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3580F8D018A for ; Tue, 3 Sep 2024 22:27:27 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D66B480BAC for ; Wed, 4 Sep 2024 02:27:26 +0000 (UTC) X-FDA: 82525469292.14.F95B06E Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf03.hostedemail.com (Postfix) with ESMTP id C310E20006 for ; Wed, 4 Sep 2024 02:27:23 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725416738; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mH0eQEO0Iae1cwKPxrlFEdHKfEjxmrG2LN1ok9g48Xg=; b=N5joNu9v2i/rHMyJi1JqRfp0iVxoX7cGqSJeBoROn1HbL36eKx6b9HGCTnJvk6EMF7w+eJ zIsNkKRlwIgVIElkKv7UfOE/z/CikQexyI/NwHo9Gg98ODQKFD7dbXITG3rzXGTy+o7xif 9EwqqGqYMvIjOGqhUk0B5GbVxftHzT4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725416738; a=rsa-sha256; cv=none; b=UJEPY+4xAqcfvWdqY5/bd0OS9tITn4S47c1IDE8qqkDuyJi5gR0jtaRxwneC7O2y3KM0rp rkh5kVKjoeS9opEJaeN16O9IpNA6xij/2isyU2VvDilH67P86tp6EOni2v8yHRFwxGNumS lCezQCpPL5fzRgt9oIDl+1nPmdc9M8Y= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Wz5wg2TTNz2CpPc; Wed, 4 Sep 2024 10:26:59 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 3FD621A0188; Wed, 4 Sep 2024 10:27:19 +0800 (CST) Received: from [10.67.111.104] (10.67.111.104) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 4 Sep 2024 10:27:18 +0800 Message-ID: <56a4c8ec-2cc1-4078-b5d9-fb128be3efeb@huawei.com> Date: Wed, 4 Sep 2024 10:27:18 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper Content-Language: en-US To: Andy Shevchenko , Jakub Kicinski , Willem de Bruijn CC: , , , , , , , , References: <20240831095840.4173362-1-lihongbo22@huawei.com> <20240831095840.4173362-3-lihongbo22@huawei.com> <20240831130741.768da6da@kernel.org> <66d5cc19d34c6_613882942a@willemb.c.googlers.com.notmuch> <9d844c72-bda6-4e28-b48c-63c4f8855ae7@huawei.com> From: Hongbo Li In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.111.104] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500022.china.huawei.com (7.185.36.66) X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C310E20006 X-Stat-Signature: y7a5nb1gt8zqt7q4axzxwismqi36aabm X-Rspam-User: X-HE-Tag: 1725416843-370624 X-HE-Meta: U2FsdGVkX18sZkqqTW4lKDLEAFbxjhh8wCdRQIf19ggEMAe8QY3kGtBAih2DVdFsuTMGF56yrmIp7zAULHVWSarkiCMVUDMo5n42tBw9HjZQjZDfcam5aV0h+6K1JEtzt9YGW3PUhs3GoA80R1lV/NSqSziTCJsfE57oBKmOQYyVf7p7qarbhvKAjXlznmvdHO+gX3hGrLJI4yR6tkzSsxX5K6JPC2/ozKFfsrpbxyU+vnKz63cvlTZE0zJleTKMogl9vbry2IplOEwrE56gduNBv/BuqsTr1ZBXVKBN1Mh9DRW2GY1d3u1xu5RBPnQMrTuGzir4y21ylhe18JM3IUXtp/uZE9ad7FOi/g7l86pi5rcNstU2AZ+ywdcuFKy8QGNtPPIZ25l6fai5Ngw2tyn9TCQtCf7O7hpjijvwFWQKOinWJGHM0ZOgI6eAcTFRzGfKnQjzXakv8vW2e1MM13SbeTYtI+sZdvto4A25NnGkF/yX6yhgOgmZppl2HOkEWWtGjpEhKdsnxKPTYok9SSRqQw1ZCoK4FaB1P2+dP+geawWnx1bY9dQqCh1BWzuBJIQyC+f5t2ZeHjKL4epSMiZ9OjjjUOLh3citrbJ09uM8BWlJSsJGuf3FBQYpK67AXygZwjNXMNEkh/NLLlhNLGfD4A/Ya9T9xu7QuNNbkMyL5yyHoElaSY+zPESkeekbM21qMblFg+bUFd471N2KyXgbiMGfqGvCaEuE+XSfgKbWWH/5EgxnTIQ5VZ5FpPTg0OFMR+h43fxike2IvCZjLdMQZtyqQmmYK6klgS/PzEpbsIR4s3Cih6NAptljnTV2o83J8KGj1x5XslcXXQGMvtFediZcSx3SB9a/48SZTlkXqRxwafwLOdw9F5gTyAqdIY++zYm1Bop+Aub6l57KoZtHDyEwpiTahW43lW0i/RQCWVgcwwbBwt4KDyUcG3iaYX1YUYSO7mhEOc0tjAF jdkME9Kh f+Nv8z1wCTkJx0chTayzqazRiGYcG8be/4bzwxtdpVcnmHy+MD7xBeR+bglRUKKX2oy6B2YcBZqrf3No3j0cQl1cRxumZzW9Riiau6qBVXRSW9j1DYGQJVzVs5Fn/N7loR5gMbYyNY9e9tieeZAJDxaPuMHtomRAxlj5mz09cSbRqZzZqoy7HP4ez3ELOZauHx/iHlCPwS9GF0Gwo80sKqxcnNkj3C/j/1iQFkX/Pp4eiL4JX2sL1JJiSYYr3IXNxOJwlqp2TQesSjJ2UNyv1eGbruyuuf4VGCBYh4F0kZ9QWDyE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2024/9/3 23:09, Andy Shevchenko wrote: > On Tue, Sep 03, 2024 at 02:25:53PM +0800, Hongbo Li wrote: >> On 2024/9/2 22:30, Willem de Bruijn wrote: >>> Andy Shevchenko wrote: >>>> On Sat, Aug 31, 2024 at 01:07:41PM -0700, Jakub Kicinski wrote: >>>>> On Sat, 31 Aug 2024 17:58:38 +0800 Hongbo Li wrote: > > ... > >>>>>> netif_info(tun, drv, tun->dev, "ignored: set checksum %s\n", >>>>>> - arg ? "disabled" : "enabled"); >>>>>> + str_disabled_enabled(arg)); >>>>> >>>>> You don't explain the 'why'. How is this an improvement? >>>>> nack on this and 2 similar networking changes you sent >>>> >>>> Side opinion: This makes the messages more unified and not prone to typos >>>> and/or grammatical mistakes. Unification allows to shrink binary due to >>>> linker efforts on string literals deduplication. >>> >>> This adds a layer of indirection. >>> >>> The original code is immediately obvious. When I see the new code I >>> have to take a detour through cscope to figure out what it does. >> If they have used it once, there is no need for more jumps, because it's >> relatively simple. >> >> Using a dedicated function seems very elegant and unified, especially for >> some string printing situations, such as disable/enable. Even in today's >> kernel tree, there are several different formats that appear: >> 'enable/disable', 'enabled/disabled', 'en/dis'. > > Not to mention that the longer word is the more error prone the spelling. > >>> To me, in this case, the benefit is too marginal to justify that. > > Hongbo, perhaps you need to add a top comment to the string_choices.h to > explain the following: > 1) the convention to use is str_$TRUE_$FALSE(), where $TRUE and $FALSE the > respective words printed; > 2) the pros of having unified output, > 3) including but not limited to the linker deduplication facilities, making > the binary smaller. > > With that you may always point people to the ad-hoc documentation. > ok, thank you, and I can try it. However, with these modifications, I'm not sure whether Willem and Jakub agree with the changes. If they don't agree, then I'll have to remove this example in the next version. In the future, we can guide other developers to use these helpers directly instead of rewriting it themselves. Thanks, Hongbo