linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] fs/namespace: fnic: Switch to use %ptTd
@ 2023-03-14 15:09 Andy Shevchenko
  2023-03-15  8:05 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2023-03-14 15:09 UTC (permalink / raw)
  To: Christian Brauner, linux-fsdevel, linux-kernel
  Cc: Alexander Viro, Andy Shevchenko

Use %ptTd instead of open-coded variant to print contents
of time64_t type in human readable form.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 fs/namespace.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index d26ea0d9041f..0e7c69a2009b 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2617,15 +2617,12 @@ static void mnt_warn_timestamp_expiry(struct path *mountpoint, struct vfsmount *
 	   (ktime_get_real_seconds() + TIME_UPTIME_SEC_MAX > sb->s_time_max)) {
 		char *buf = (char *)__get_free_page(GFP_KERNEL);
 		char *mntpath = buf ? d_path(mountpoint, buf, PAGE_SIZE) : ERR_PTR(-ENOMEM);
-		struct tm tm;
 
-		time64_to_tm(sb->s_time_max, 0, &tm);
-
-		pr_warn("%s filesystem being %s at %s supports timestamps until %04ld (0x%llx)\n",
+		pr_warn("%s filesystem being %s at %s supports timestamps until %ptTd (0x%llx)\n",
 			sb->s_type->name,
 			is_mounted(mnt) ? "remounted" : "mounted",
-			mntpath,
-			tm.tm_year+1900, (unsigned long long)sb->s_time_max);
+			mntpath, &sb->s_time_max,
+			(unsigned long long)sb->s_time_max);
 
 		free_page((unsigned long)buf);
 		sb->s_iflags |= SB_I_TS_EXPIRY_WARNED;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] fs/namespace: fnic: Switch to use %ptTd
  2023-03-14 15:09 [PATCH v1 1/1] fs/namespace: fnic: Switch to use %ptTd Andy Shevchenko
@ 2023-03-15  8:05 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2023-03-15  8:05 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel, Andy Shevchenko
  Cc: Christian Brauner, Alexander Viro

From: Christian Brauner (Microsoft) <brauner@kernel.org>


On Tue, 14 Mar 2023 17:09:06 +0200, Andy Shevchenko wrote:
> Use %ptTd instead of open-coded variant to print contents
> of time64_t type in human readable form.
> 
> 

Ok, looking at lib/vsprintf.c

pointer(t)
-> time_and_date(T)
   -> time64_str()
      -> time64_to_tm()
      -> rtc_str(d)
	 -> date_str()

ends up with the same helper and four digits for the year so this seems
like a good cleanup. Thanks!

tree: git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping.git
branch: fs.misc
[1/1] fs/namespace: fnic: Switch to use %ptTd
      commit: 74e60b8b2f0fe3702710e648a31725ee8224dbdf

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-15  8:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-14 15:09 [PATCH v1 1/1] fs/namespace: fnic: Switch to use %ptTd Andy Shevchenko
2023-03-15  8:05 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).