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 8EFF9C433EF for ; Sun, 24 Apr 2022 23:46:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04FC16B007D; Sun, 24 Apr 2022 19:46:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F40646B007E; Sun, 24 Apr 2022 19:46:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2E916B0080; Sun, 24 Apr 2022 19:46:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id CF6BC6B007D for ; Sun, 24 Apr 2022 19:46:07 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B93772721B for ; Sun, 24 Apr 2022 23:46:07 +0000 (UTC) X-FDA: 79393408374.14.F64E192 Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by imf21.hostedemail.com (Postfix) with ESMTP id B7FFF1C0040 for ; Sun, 24 Apr 2022 23:46:04 +0000 (UTC) Received: from omf10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 1A0DA121943; Sun, 24 Apr 2022 23:46:06 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf10.hostedemail.com (Postfix) with ESMTPA id 5DB292F; Sun, 24 Apr 2022 23:46:04 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 1/8] lib/printbuf: New data structure for heap-allocated strings From: Joe Perches To: Kent Overstreet , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: hch@lst.de, hannes@cmpxchg.org, akpm@linux-foundation.org, linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-input@vger.kernel.org, roman.gushchin@linux.dev Date: Sun, 24 Apr 2022 16:46:03 -0700 In-Reply-To: <20220421234837.3629927-7-kent.overstreet@gmail.com> References: <20220421234837.3629927-1-kent.overstreet@gmail.com> <20220421234837.3629927-7-kent.overstreet@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+UuhWGGV8DOnuXU/zVKG4cn1mdOYheV60= X-HE-Tag-Orig: 1650843964-516463 Authentication-Results: imf21.hostedemail.com; dkim=none; spf=none (imf21.hostedemail.com: domain of joe@perches.com has no SPF policy when checking 64.99.140.25) smtp.mailfrom=joe@perches.com; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B7FFF1C0040 X-Stat-Signature: g6wq68ciu557iearabnzotny6herxi3i X-HE-Tag: 1650843964-21865 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: On Thu, 2022-04-21 at 19:48 -0400, Kent Overstreet wrote: > This adds printbufs: simple heap-allocated strings meant for building up > structured messages, for logging/procfs/sysfs and elsewhere. They've > been heavily used in bcachefs for writing .to_text() functions/methods - > pretty printers, which has in turn greatly improved the overall quality > of error messages. > > Basic usage is documented in include/linux/printbuf.h. Given the maximum printk output is less than 1024 bytes, why should this be allowed to be larger than that or larger than PAGE_SIZE? > + * pr_human_readable_u64, pr_human_readable_s64: Print an integer with human > + * readable units. Why not extend vsprintf for this using something like %pH[8|16|32|64] or %pH[c|s|l|ll|uc|us|ul|ull] ?