public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lukáš Czerner" <lczerner@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH -v2 2/3] mke2fs: print extra information about existing ext2/3/4 file systemsGjj
Date: Wed, 7 May 2014 15:43:09 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1405071534070.2128@localhost.localdomain> (raw)
In-Reply-To: <20140507123913.GA28814@thunk.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3301 bytes --]

On Wed, 7 May 2014, Theodore Ts'o wrote:

> Date: Wed, 7 May 2014 08:39:13 -0400
> From: Theodore Ts'o <tytso@mit.edu>
> To: Lukáš Czerner <lczerner@redhat.com>
> Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
> Subject: Re: [PATCH -v2 2/3] mke2fs: print extra information about existing
>     ext2/3/4 file systemsG
> 
> On Wed, May 07, 2014 at 10:15:56AM +0200, Lukáš Czerner wrote:
> > > Yes, that's a cut and paste typo, thanks for spotting it.  It should
> > > have been:
> > > 
> > > 	} else if (sb->s_mkfs_time) {
> > > 		tm = sb->s_mkfs_time;
> > > 		printf(_("\tcreated on %s"), ctime(&tm));
> > > 	} else if (sb->s_mtime) {  <========
> > 
> > But you're already checking for sb->s_mtime in the first condition,
> > am I missing something ?
> 
> The basic idea is to give one bit of context, and whatever would be
> the most useful.  In order of preference, it's:
> 
> 1)  Last mount directory (if available) and last mount time
> 2)  Time file system was created
> 3)  Time file system was written
> 
> #2 or #3 is only needed if the file system was never mounted.
> 
> #3 is only needed for those file systems that (a) were never mounted,
> (b) was modified/filled via e2tools or debugfs.  (Or Windows FS SDK
> based hacks, etc.)
> 
> 					- Ted
> 

I understand that, but here is what is in your patch:


 +      if (sb->s_mtime) {
 +              tm = sb->s_mtime;
 +              if (sb->s_last_mounted[0]) {
 +                      memset(buf, 0, sizeof(buf));
 +                      strncpy(buf, sb->s_last_mounted,
 +                              sizeof(sb->s_last_mounted));
 +                      printf(_("\tlast mounted on %s on %s"), buf,
 +                             ctime(&tm));
 +              } else
 +                      printf(_("\tlast mounted on %s"), ctime(&tm));
 +      } else if (sb->s_mkfs_time) {
 +              tm = sb->s_mkfs_time;
 +              printf(_("\tcreated on %s"), ctime(&tm));
 +      } else if (sb->s_mkfs_time) {
 +              tm = sb->s_mtime;
 +              printf(_("\tlast modified on %s"), ctime(&tm));
 +      }

Now you're saying that the last condition should really be

	} else if (sb->s_mtime) {  <========

But that does not make sense because it's the same as the first
condition, so it would either never get there, or never be true.

So it really should be

	} else if (sb->s_wtime) {


so the whole thing should look like:

 +      if (sb->s_mtime) {
 +              tm = sb->s_mtime;
 +              if (sb->s_last_mounted[0]) {
 +                      memset(buf, 0, sizeof(buf));
 +                      strncpy(buf, sb->s_last_mounted,
 +                              sizeof(sb->s_last_mounted));
 +                      printf(_("\tlast mounted on %s on %s"), buf,
 +                             ctime(&tm));
 +              } else
 +                      printf(_("\tlast mounted on %s"), ctime(&tm));
 +      } else if (sb->s_mkfs_time) {
 +              tm = sb->s_mkfs_time;
 +              printf(_("\tcreated on %s"), ctime(&tm));
 +      } else if (sb->s_wtime) {
 +              tm = sb->s_wtime;
 +              printf(_("\tlast modified on %s"), ctime(&tm));
 +      }

Also I wonder whether we need to use 'tm' variable, can't we use the
sb->s_*time directly ? But that's nitpicking.

Thanks!
-Lukas

  reply	other threads:[~2014-05-07 13:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06  1:02 [PATCH -v2 1/3] mke2fs: print a message when creating a regular file Theodore Ts'o
2014-05-06  1:02 ` [PATCH -v2 2/3] mke2fs: print extra information about existing ext2/3/4 file systems Theodore Ts'o
2014-05-06 13:42   ` Lukáš Czerner
2014-05-07  2:46     ` Theodore Ts'o
2014-05-07  8:15       ` Lukáš Czerner
2014-05-07 12:39         ` [PATCH -v2 2/3] mke2fs: print extra information about existing ext2/3/4 file systemsG Theodore Ts'o
2014-05-07 13:43           ` Lukáš Czerner [this message]
2014-05-07 14:54             ` [PATCH -v2 2/3] mke2fs: print extra information about existing ext2/3/4 file systemsGjj Theodore Ts'o
2014-05-06  1:02 ` [PATCH -v2 3/3] mke2fs: check for a partition table and warn if present Theodore Ts'o
2014-05-06 13:47   ` Lukáš Czerner
2014-05-06 13:23 ` [PATCH -v2 1/3] mke2fs: print a message when creating a regular file Lukáš Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.1405071534070.2128@localhost.localdomain \
    --to=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox