LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: marcin.slusarz@gmail.com
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] udf: create function for conversion from timestamp to timespec
Date: Tue, 5 Feb 2008 16:32:12 +0100	[thread overview]
Message-ID: <20080205153212.GG25464@duck.suse.cz> (raw)
In-Reply-To: <1202063771-18172-3-git-send-email-marcin.slusarz@gmail.com>

On Sun 03-02-08 19:36:07, marcin.slusarz@gmail.com wrote:
> Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> Cc: Jan Kara <jack@suse.cz>
  Acked-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/udf/inode.c |   79 ++++++++++++++++---------------------------------------
>  1 files changed, 23 insertions(+), 56 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index 531443d..2578677 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -1151,12 +1151,24 @@ static void __udf_read_inode(struct inode *inode)
>  	brelse(bh);
>  }
>  
> +static void udf_fill_inode_time(struct timespec *tspec,
> +				const timestamp *tstamp,
> +				struct udf_sb_info *sbi)
> +{
> +	time_t convtime;
> +	long convtime_usec;
> +	if (udf_stamp_to_time(&convtime, &convtime_usec,
> +				lets_to_cpu(*tstamp))) {
> +		tspec->tv_sec = convtime;
> +		tspec->tv_nsec = convtime_usec * 1000;
> +	} else
> +		*tspec = sbi->s_record_time;
> +}
> +
>  static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
>  {
>  	struct fileEntry *fe;
>  	struct extendedFileEntry *efe;
> -	time_t convtime;
> -	long convtime_usec;
>  	int offset;
>  	struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
>  	struct udf_inode_info *iinfo = UDF_I(inode);
> @@ -1244,29 +1256,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
>  		inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) <<
>  			(inode->i_sb->s_blocksize_bits - 9);
>  
> -		if (udf_stamp_to_time(&convtime, &convtime_usec,
> -				      lets_to_cpu(fe->accessTime))) {
> -			inode->i_atime.tv_sec = convtime;
> -			inode->i_atime.tv_nsec = convtime_usec * 1000;
> -		} else {
> -			inode->i_atime = sbi->s_record_time;
> -		}
> -
> -		if (udf_stamp_to_time(&convtime, &convtime_usec,
> -				      lets_to_cpu(fe->modificationTime))) {
> -			inode->i_mtime.tv_sec = convtime;
> -			inode->i_mtime.tv_nsec = convtime_usec * 1000;
> -		} else {
> -			inode->i_mtime = sbi->s_record_time;
> -		}
> -
> -		if (udf_stamp_to_time(&convtime, &convtime_usec,
> -				      lets_to_cpu(fe->attrTime))) {
> -			inode->i_ctime.tv_sec = convtime;
> -			inode->i_ctime.tv_nsec = convtime_usec * 1000;
> -		} else {
> -			inode->i_ctime = sbi->s_record_time;
> -		}
> +		udf_fill_inode_time(&inode->i_atime, &fe->accessTime, sbi);
> +		udf_fill_inode_time(&inode->i_mtime, &fe->modificationTime,
> +				    sbi);
> +		udf_fill_inode_time(&inode->i_ctime, &fe->attrTime, sbi);
>  
>  		iinfo->i_unique = le64_to_cpu(fe->uniqueID);
>  		iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr);
> @@ -1276,37 +1269,11 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
>  		inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) <<
>  		    (inode->i_sb->s_blocksize_bits - 9);
>  
> -		if (udf_stamp_to_time(&convtime, &convtime_usec,
> -				      lets_to_cpu(efe->accessTime))) {
> -			inode->i_atime.tv_sec = convtime;
> -			inode->i_atime.tv_nsec = convtime_usec * 1000;
> -		} else {
> -			inode->i_atime = sbi->s_record_time;
> -		}
> -
> -		if (udf_stamp_to_time(&convtime, &convtime_usec,
> -				      lets_to_cpu(efe->modificationTime))) {
> -			inode->i_mtime.tv_sec = convtime;
> -			inode->i_mtime.tv_nsec = convtime_usec * 1000;
> -		} else {
> -			inode->i_mtime = sbi->s_record_time;
> -		}
> -
> -		if (udf_stamp_to_time(&convtime, &convtime_usec,
> -				      lets_to_cpu(efe->createTime))) {
> -			iinfo->i_crtime.tv_sec = convtime;
> -			iinfo->i_crtime.tv_nsec = convtime_usec * 1000;
> -		} else {
> -			iinfo->i_crtime = sbi->s_record_time;
> -		}
> -
> -		if (udf_stamp_to_time(&convtime, &convtime_usec,
> -				      lets_to_cpu(efe->attrTime))) {
> -			inode->i_ctime.tv_sec = convtime;
> -			inode->i_ctime.tv_nsec = convtime_usec * 1000;
> -		} else {
> -			inode->i_ctime = sbi->s_record_time;
> -		}
> +		udf_fill_inode_time(&inode->i_atime, &efe->accessTime, sbi);
> +		udf_fill_inode_time(&inode->i_mtime, &efe->modificationTime,
> +				    sbi);
> +		udf_fill_inode_time(&iinfo->i_crtime, &efe->createTime, sbi);
> +		udf_fill_inode_time(&inode->i_ctime, &efe->attrTime, sbi);
>  
>  		iinfo->i_unique = le64_to_cpu(efe->uniqueID);
>  		iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr);
> -- 
> 1.5.3.7
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2008-02-05 15:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-03 18:36 [PATCH 0/6] udf: next round of cleanups marcin.slusarz
2008-02-03 18:36 ` [PATCH 1/6] udf: udf_get_block, inode_bmap - remove unneeded checks marcin.slusarz
2008-02-05 15:30   ` Jan Kara
2008-02-03 18:36 ` [PATCH 2/6] udf: create function for conversion from timestamp to timespec marcin.slusarz
2008-02-05 15:32   ` Jan Kara [this message]
2008-02-03 18:36 ` [PATCH 3/6] udf: convert udf_stamp_to_time to return struct timespec marcin.slusarz
2008-02-05 15:48   ` Jan Kara
2008-02-05 19:12     ` Marcin Slusarz
2008-02-06 13:25       ` Jan Kara
2008-02-03 18:36 ` [PATCH 4/6] udf: convert udf_stamp_to_time and udf_time_to_stamp to use timestamps marcin.slusarz
2008-02-05 15:59   ` Jan Kara
2008-02-05 19:21     ` Marcin Slusarz
2008-02-06 11:10       ` Jan Kara
2008-02-10 10:25         ` Marcin Slusarz
2008-02-03 18:36 ` [PATCH 5/6] udf: remove unneeded kernel_timestamp type marcin.slusarz
2008-02-05 16:01   ` Jan Kara
2008-02-10 10:29     ` Marcin Slusarz
2008-02-03 18:42 ` [PATCH 6/6] udf: super.c reorganization Marcin Slusarz
2008-02-05 16:22   ` Jan Kara
2008-02-05 19:34     ` Marcin Slusarz
2008-02-06 11:09       ` Jan Kara
2008-02-10 10:33         ` Marcin Slusarz

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=20080205153212.GG25464@duck.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.slusarz@gmail.com \
    --subject='Re: [PATCH 2/6] udf: create function for conversion from timestamp to timespec' \
    /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

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).