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 X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BB4CC12002 for ; Wed, 21 Jul 2021 13:55:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFB7B60FED for ; Wed, 21 Jul 2021 13:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238667AbhGUNPK (ORCPT ); Wed, 21 Jul 2021 09:15:10 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:50426 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232706AbhGUNPJ (ORCPT ); Wed, 21 Jul 2021 09:15:09 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A4A9620341; Wed, 21 Jul 2021 13:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1626875744; h=from:from:reply-to: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=d2zL4DSMxxgusCwerQYFit51RZdm7XIpv5GcoSHdjTc=; b=k41ZNBw3GYqRYI9O1VKZjSxUOz2zBx+Bp+E+Nz9zW7n8bXxAVTwiYAaGH73jrLMynem9Ji nNQvCmYsb7AdauDaq7kR9oSaQ4aVPKIgUynRW1ea8F7jdq7NzNBYwUVyF2pECfarNjpDhj tZeaGuigE2yUMqO09pxLu/N6JsmB0yo= Received: from suse.cz (pathway.suse.cz [10.100.12.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 47F1EA3B83; Wed, 21 Jul 2021 13:55:44 +0000 (UTC) Date: Wed, 21 Jul 2021 15:55:44 +0200 From: Petr Mladek To: Jia He Cc: Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Alexander Viro , Linus Torvalds , "Peter Zijlstra (Intel)" , Eric Biggers , "Ahmed S. Darwish" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Matthew Wilcox , Christoph Hellwig , nd@arm.com Subject: Re: [PATCH v7 3/5] lib/vsprintf.c: make '%pD' print the full path of file Message-ID: <20210721135544.w4blqsvcyr42sxcb@pathway.suse.cz> References: <20210715011407.7449-1-justin.he@arm.com> <20210715011407.7449-4-justin.he@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715011407.7449-4-justin.he@arm.com> User-Agent: NeoMutt/20170912 (1.9.0) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2021-07-15 09:14:05, Jia He wrote: > Previously, the specifier '%pD' was for printing dentry name of struct > file. It may not be perfect since by default it only prints one component. > > As suggested by Linus [1]: > A dentry has a parent, but at the same time, a dentry really does > inherently have "one name" (and given just the dentry pointers, you > can't show mount-related parenthood, so in many ways the "show just > one name" makes sense for "%pd" in ways it doesn't necessarily for > "%pD"). But while a dentry arguably has that "one primary component", > a _file_ is certainly not exclusively about that last component. > > Hence change the behavior of '%pD' to print the full path of that file. > It is worthy of noting that %pD uses the entire given buffer as a scratch > space. It might write something behind the trailing '\0' but never write > beyond the scratch space. > > Precision specifier is never going to be used with %p (or any of its > kernel extensions) if -Wformat is turned on. > > Link: https://lore.kernel.org/lkml/CAHk-=wimsMqGdzik187YWLb-ru+iktb4MYbMQG1rnZ81dXYFVg@mail.gmail.com/ [1] > Suggested-by: Linus Torvalds > Signed-off-by: Jia He Reviewed-by: Petr Mladek Best Regards, Petr