Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760055AbYBETM4 (ORCPT ); Tue, 5 Feb 2008 14:12:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752427AbYBETMr (ORCPT ); Tue, 5 Feb 2008 14:12:47 -0500 Received: from fg-out-1718.google.com ([72.14.220.152]:34756 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753221AbYBETMp (ORCPT ); Tue, 5 Feb 2008 14:12:45 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=g3Vf73BrO5gFXtdRinbY+B/2jkCDVGlIgRdyp4AptjDx/jhkePn3xtE6u0LeUQGr43FMXpaIz25z7uTVpaqNg4VX0bC0hAJgHBre/Mms58Y44Ql2tUy+83L0H0OBfiaUSsstWjlEuQcI8l4+0pQcrJ1an4vwyytF85FRjMjp3nM= Date: Tue, 5 Feb 2008 20:12:05 +0100 From: Marcin Slusarz To: Jan Kara Cc: LKML Subject: Re: [PATCH 3/6] udf: convert udf_stamp_to_time to return struct timespec Message-ID: <20080205191136.GA6234@joi> References: <1202063771-18172-1-git-send-email-marcin.slusarz@gmail.com> <1202063771-18172-4-git-send-email-marcin.slusarz@gmail.com> <20080205154831.GH25464@duck.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080205154831.GH25464@duck.suse.cz> User-Agent: Mutt/1.5.16 (2007-06-09) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7744 Lines: 195 On Tue, Feb 05, 2008 at 04:48:31PM +0100, Jan Kara wrote: > > Uh, oh. I guess you somehow mangled the ordering of patches. In this > patch you revert what you've done in the previous patch. Otherwise I agree > with the idea of the change... No, the ordering is ok. Creation of udf_fill_inode_time was an intermediate state in this cleanup. Every step is obvious and easy. When I tried to create just one patch it didn't look so obvious, so I decided to send it in 4 parts. > > On Sun 03-02-08 19:36:08, marcin.slusarz@gmail.com wrote: > > Signed-off-by: Marcin Slusarz > > Cc: Jan Kara > > --- > > fs/udf/inode.c | 49 ++++++++++++++++++++++++++----------------------- > > fs/udf/super.c | 9 ++------- > > fs/udf/udfdecl.h | 4 ++-- > > fs/udf/udftime.c | 17 +++++++---------- > > 4 files changed, 37 insertions(+), 42 deletions(-) > > > > diff --git a/fs/udf/inode.c b/fs/udf/inode.c > > index 2578677..252efe0 100644 > > --- a/fs/udf/inode.c > > +++ b/fs/udf/inode.c > > @@ -1151,20 +1151,6 @@ 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; > > @@ -1256,10 +1242,17 @@ 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); > > > > - 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); > > + if (!udf_stamp_to_time(&inode->i_atime, > > + lets_to_cpu(fe->accessTime))) > > + inode->i_atime = sbi->s_record_time; > > + > > + if (!udf_stamp_to_time(&inode->i_mtime, > > + lets_to_cpu(fe->modificationTime))) > > + inode->i_mtime = sbi->s_record_time; > > + > > + if (!udf_stamp_to_time(&inode->i_ctime, > > + lets_to_cpu(fe->attrTime))) > > + inode->i_ctime = sbi->s_record_time; > > > > iinfo->i_unique = le64_to_cpu(fe->uniqueID); > > iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); > > @@ -1269,11 +1262,21 @@ 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); > > > > - 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); > > + if (!udf_stamp_to_time(&inode->i_atime, > > + lets_to_cpu(efe->accessTime))) > > + inode->i_atime = sbi->s_record_time; > > + > > + if (!udf_stamp_to_time(&inode->i_mtime, > > + lets_to_cpu(efe->modificationTime))) > > + inode->i_mtime = sbi->s_record_time; > > + > > + if (!udf_stamp_to_time(&iinfo->i_crtime, > > + lets_to_cpu(efe->createTime))) > > + iinfo->i_crtime = sbi->s_record_time; > > + > > + if (!udf_stamp_to_time(&inode->i_ctime, > > + lets_to_cpu(efe->attrTime))) > > + inode->i_ctime = sbi->s_record_time; > > > > iinfo->i_unique = le64_to_cpu(efe->uniqueID); > > iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); > > diff --git a/fs/udf/super.c b/fs/udf/super.c > > index 0dcee12..9f565a9 100644 > > --- a/fs/udf/super.c > > +++ b/fs/udf/super.c > > @@ -909,24 +909,19 @@ static int udf_find_fileset(struct super_block *sb, > > static void udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh) > > { > > struct primaryVolDesc *pvoldesc; > > - time_t recording; > > - long recording_usec; > > struct ustr instr; > > struct ustr outstr; > > > > pvoldesc = (struct primaryVolDesc *)bh->b_data; > > > > - if (udf_stamp_to_time(&recording, &recording_usec, > > + if (udf_stamp_to_time(&UDF_SB(sb)->s_record_time, > > lets_to_cpu(pvoldesc->recordingDateAndTime))) { > > kernel_timestamp ts; > > ts = lets_to_cpu(pvoldesc->recordingDateAndTime); > > - udf_debug("recording time %ld/%ld, %04u/%02u/%02u" > > + udf_debug("recording time %04u/%02u/%02u" > > " %02u:%02u (%x)\n", > > - recording, recording_usec, > > ts.year, ts.month, ts.day, ts.hour, > > ts.minute, ts.typeAndTimezone); > > - UDF_SB(sb)->s_record_time.tv_sec = recording; > > - UDF_SB(sb)->s_record_time.tv_nsec = recording_usec * 1000; > > } > > > > if (!udf_build_ustr(&instr, pvoldesc->volIdent, 32)) > > diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h > > index 375be1b..508be85 100644 > > --- a/fs/udf/udfdecl.h > > +++ b/fs/udf/udfdecl.h > > @@ -204,7 +204,7 @@ extern short_ad *udf_get_fileshortad(uint8_t *, int, uint32_t *, int); > > extern uint16_t udf_crc(const uint8_t *, uint32_t, uint16_t); > > > > /* udftime.c */ > > -extern time_t *udf_stamp_to_time(time_t *, long *, kernel_timestamp); > > -extern kernel_timestamp *udf_time_to_stamp(kernel_timestamp *, struct timespec); > > +extern struct timespec *udf_stamp_to_time(struct timespec *dest, kernel_timestamp src); > > +extern kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec src); > > > > #endif /* __UDF_DECL_H */ > > diff --git a/fs/udf/udftime.c b/fs/udf/udftime.c > > index ce59573..12fae6c 100644 > > --- a/fs/udf/udftime.c > > +++ b/fs/udf/udftime.c > > @@ -85,7 +85,7 @@ extern struct timezone sys_tz; > > #define SECS_PER_HOUR (60 * 60) > > #define SECS_PER_DAY (SECS_PER_HOUR * 24) > > > > -time_t *udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src) > > +struct timespec *udf_stamp_to_time(struct timespec *dest, kernel_timestamp src) > > { > > int yday; > > uint8_t type = src.typeAndTimezone >> 12; > > @@ -97,23 +97,20 @@ time_t *udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src) > > offset = (offset >> 4); > > if (offset == -2047) /* unspecified offset */ > > offset = 0; > > - } else { > > + } else > > offset = 0; > > - } > > > > if ((src.year < EPOCH_YEAR) || > > (src.year >= EPOCH_YEAR + MAX_YEAR_SECONDS)) { > > - *dest = -1; > > - *dest_usec = -1; > > return NULL; > > } > > - *dest = year_seconds[src.year - EPOCH_YEAR]; > > - *dest -= offset * 60; > > + dest->tv_sec = year_seconds[src.year - EPOCH_YEAR]; > > + dest->tv_sec -= offset * 60; > > > > yday = ((__mon_yday[__isleap(src.year)][src.month - 1]) + src.day - 1); > > - *dest += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second; > > - *dest_usec = src.centiseconds * 10000 + > > - src.hundredsOfMicroseconds * 100 + src.microseconds; > > + dest->tv_sec += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second; > > + dest->tv_nsec = 1000 * (src.centiseconds * 10000 + > > + src.hundredsOfMicroseconds * 100 + src.microseconds); > > return dest; > > } > > > > -- > > 1.5.3.7 > > Honza > -- > Jan Kara > SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/