All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Valentin Vidic <vvidic@valentin-vidic.from.hr>
Cc: devel@driverdev.osuosl.org,
	Valdis Kletnieks <valdis.kletnieks@vt.edu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] staging: exfat: add millisecond support
Date: Sun, 8 Sep 2019 17:40:40 +0100	[thread overview]
Message-ID: <20190908164040.GA8362@kroah.com> (raw)
In-Reply-To: <20190908161015.26000-3-vvidic@valentin-vidic.from.hr>

On Sun, Sep 08, 2019 at 04:10:15PM +0000, Valentin Vidic wrote:
> Use create_time_ms modify_time_ms fields to store the millisecond
> part of the file timestamp with the precision of 10 ms.
> 
> Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>
> ---
>  drivers/staging/exfat/exfat_core.c | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
> index 8476eeedba83..e87119fa8c0a 100644
> --- a/drivers/staging/exfat/exfat_core.c
> +++ b/drivers/staging/exfat/exfat_core.c
> @@ -1139,6 +1139,7 @@ void exfat_set_entry_size(struct dentry_t *p_entry, u64 size)
>  void fat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp,
>  			u8 mode)
>  {
> +	u8 ms = 0;
>  	u16 t = 0x00, d = 0x21;
>  	struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
>  
> @@ -1146,6 +1147,7 @@ void fat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp,
>  	case TM_CREATE:
>  		t = GET16_A(ep->create_time);
>  		d = GET16_A(ep->create_date);
> +		ms = ep->create_time_ms * 10;
>  		break;
>  	case TM_MODIFY:
>  		t = GET16_A(ep->modify_time);
> @@ -1159,11 +1161,17 @@ void fat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp,
>  	tp->day  = (d & 0x001F);
>  	tp->mon  = (d >> 5) & 0x000F;
>  	tp->year = (d >> 9);
> +
> +	if (ms >= 1000) {
> +		ms -= 1000;
> +		tp->sec++;
> +	}
>  }
>  
>  void exfat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp,
>  			  u8 mode)
>  {
> +	u8 ms = 0;
>  	u16 t = 0x00, d = 0x21;
>  	struct file_dentry_t *ep = (struct file_dentry_t *)p_entry;
>  
> @@ -1171,10 +1179,12 @@ void exfat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp,
>  	case TM_CREATE:
>  		t = GET16_A(ep->create_time);
>  		d = GET16_A(ep->create_date);
> +		ms = ep->create_time_ms * 10;
>  		break;
>  	case TM_MODIFY:
>  		t = GET16_A(ep->modify_time);
>  		d = GET16_A(ep->modify_date);
> +		ms = ep->modify_time_ms * 10;
>  		break;
>  	case TM_ACCESS:
>  		t = GET16_A(ep->access_time);
> @@ -1188,21 +1198,33 @@ void exfat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp,
>  	tp->day  = (d & 0x001F);
>  	tp->mon  = (d >> 5) & 0x000F;
>  	tp->year = (d >> 9);
> +
> +	if (ms >= 1000) {
> +		ms -= 1000;
> +		tp->sec++;
> +	}
>  }
>  
>  void fat_set_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp,
>  			u8 mode)
>  {
> +	u8 ms;
>  	u16 t, d;
>  	struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
>  
>  	t = (tp->hour << 11) | (tp->min << 5) | (tp->sec >> 1);
>  	d = (tp->year <<  9) | (tp->mon << 5) |  tp->day;
>  
> +	ms = tp->millisec;
> +	if (tp->sec & 1) {
> +		ms += 1000;
> +	}

checkpatch didn't complain about this { } not being needed?

Same in other parts of this patch, please fix up.

thanks,

greg k-h

  reply	other threads:[~2019-09-08 16:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-08 16:10 [PATCH v2 1/3] staging: exfat: drop duplicate date_time_t struct Valentin Vidic
2019-09-08 16:10 ` [PATCH v2 2/3] staging: exfat: drop unused field access_time_ms Valentin Vidic
2019-09-08 16:41   ` Greg Kroah-Hartman
2019-09-09  0:19   ` Valdis Klētnieks
2019-09-09  6:14     ` Valentin Vidić
2019-09-08 16:10 ` [PATCH v2 3/3] staging: exfat: add millisecond support Valentin Vidic
2019-09-08 16:40   ` Greg Kroah-Hartman [this message]
2019-09-08 16:51     ` Valentin Vidić
2019-09-08 16:45 ` [PATCH v2 1/3] staging: exfat: drop duplicate date_time_t struct Greg Kroah-Hartman

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=20190908164040.GA8362@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=valdis.kletnieks@vt.edu \
    --cc=vvidic@valentin-vidic.from.hr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.