Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6279876rwr; Mon, 1 May 2023 20:28:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vBssQu9OPVvTLkKIv7vP8q02DDs3QtH0mBGoLe5rmXx+qOa6NUT8IPuZiO8QSlSGJs0K+ X-Received: by 2002:a05:6a00:2d9b:b0:633:8cc7:bbd5 with SMTP id fb27-20020a056a002d9b00b006338cc7bbd5mr19384339pfb.11.1682998111321; Mon, 01 May 2023 20:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682998111; cv=none; d=google.com; s=arc-20160816; b=ZNfpEr2OJufh/YfEaP+8HjLyhUMC0vUtsoqKc+lQ/STcOWkjDJvNduibj7ClT7DPc3 GoxGUZZZym8WHvqbkjKxQQ08d5nvmIRFI4WSzx7ctqR/cUqwhzw5SCcfNEV17jd3+Swp TPTGXhm7RKzclexnjAh5mveBCqlW+mhFaXH/sL4thOZ2KBASAqAr6xZbPJhB4L2xBZaF XbRjzNi1JunsO1WdbKGt0MX8xl6i4ikpUB5SaM4AEWCGJQWVVhBt616qBuDdBfnyWvw2 gs0lxtHXnBPfphmK5vpHeMbqlv8yxYPdb/2Nyw71q8/qQePOsPnil78dUCsw6c/Am09X OhZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=NNVXUMOZeoGpfLU/g3IFEb1hzaUHRqGWiLOTQQBIzYs=; b=GeC2tU+ccVwH3aDy6cJFDocZsWgmtEu3JE51PGmXZOAKF2nbp0Q0j7e9rLfLw4pq0J F0TgKmp1I5ICdLCor/uYTW72L9EJoWtq1RVytYuERbkF67hS/l5HqMNjMMcWlJDbAzDr JTTkMHf0ZrQ3ouKUcT0aMwU0EdC88WLn8wXfH7q1Uxtf03Ao2z/atDl/xUepVooTxAgc N9Ss9YbzICaFdkHzFvxSWg+eqPyIECQxy4n6gDzubo6LCTBvqfkCHpWdSH5BYQ9fEYEq ehG8Td4821EfmOYmut6G+vXz9X4F7e0JJ1Brri8TTfZHLc4ROgRfwk/GL1Ov1dgUtjg+ aLQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=L9Ejkbdl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n22-20020a63f816000000b0050bd27672e8si28279384pgh.421.2023.05.01.20.28.17; Mon, 01 May 2023 20:28:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=L9Ejkbdl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233167AbjEBDSL (ORCPT + 99 others); Mon, 1 May 2023 23:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233196AbjEBDSH (ORCPT ); Mon, 1 May 2023 23:18:07 -0400 Received: from out-37.mta1.migadu.com (out-37.mta1.migadu.com [95.215.58.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 898D130FB for ; Mon, 1 May 2023 20:18:04 -0700 (PDT) Date: Mon, 1 May 2023 23:17:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1682997481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NNVXUMOZeoGpfLU/g3IFEb1hzaUHRqGWiLOTQQBIzYs=; b=L9EjkbdltRch9MgagDXpSmI/SQ+kmTNwjzD2kEN8waOF/RCt31vTo+jIgPhW0KLguu62G7 jZKDOwsdNq/VcE+v4jYF6hx3mSb878eUweleN/RRxaVLz4V86Oi14XqlhSq7SRWchtaboC hzokkApB+A0wqzQja9W/cxeTQjw0qp4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: James Bottomley Cc: Suren Baghdasaryan , akpm@linux-foundation.org, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, ldufour@linux.ibm.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org, Andy Shevchenko , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , "Michael S. Tsirkin" , Jason Wang , Noralf =?utf-8?B?VHLDr8K/wr1ubmVz?= Subject: Re: [PATCH 01/40] lib/string_helpers: Drop space in string_get_size's output Message-ID: References: <20230501165450.15352-1-surenb@google.com> <20230501165450.15352-2-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 01, 2023 at 10:22:18PM -0400, James Bottomley wrote: > It is not used just for debug. It's used all over the kernel for > printing out device sizes. The output mostly goes to the kernel print > buffer, so it's anyone's guess as to what, if any, tools are parsing > it, but the concern about breaking log parsers seems to be a valid one. Ok, there is sd_print_capacity() - but who in their right mind would be trying to scrape device sizes, in human readable units, from log messages when it's available in sysfs/procfs (actually, is it in sysfs? if not, that's an oversight) in more reasonable units? Correct me if I'm wrong, but I've yet to hear about kernel log messages being consider a stable interface, and this seems a bit out there. But, you did write the code :) > > If someone raises a specific objection we'll do something different, > > otherwise I think standardizing on what userspace tooling already > > parses is a good idea. > > If you want to omit the space, why not simply add your own variant? A > string_get_size_nospace() which would use most of the body of this one > as a helper function but give its own snprintf format string at the > end. It's only a couple of lines longer as a patch and has the bonus > that it definitely wouldn't break anything by altering an existing > output. I'm happy to do that - I just wanted to post this version first to see if we can avoid the fragmentation and do a bit of standardizing with how everything else seems to do that.