udf: create function for conversion from timestamp to timespec
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
f18f17b033
commit
c87e8e90d0
|
@ -1136,12 +1136,24 @@ static void __udf_read_inode(struct inode *inode)
|
||||||
brelse(bh);
|
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)
|
static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
|
||||||
{
|
{
|
||||||
struct fileEntry *fe;
|
struct fileEntry *fe;
|
||||||
struct extendedFileEntry *efe;
|
struct extendedFileEntry *efe;
|
||||||
time_t convtime;
|
|
||||||
long convtime_usec;
|
|
||||||
int offset;
|
int offset;
|
||||||
struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
|
struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
|
||||||
struct udf_inode_info *iinfo = UDF_I(inode);
|
struct udf_inode_info *iinfo = UDF_I(inode);
|
||||||
|
@ -1229,29 +1241,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
|
||||||
inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) <<
|
inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) <<
|
||||||
(inode->i_sb->s_blocksize_bits - 9);
|
(inode->i_sb->s_blocksize_bits - 9);
|
||||||
|
|
||||||
if (udf_stamp_to_time(&convtime, &convtime_usec,
|
udf_fill_inode_time(&inode->i_atime, &fe->accessTime, sbi);
|
||||||
lets_to_cpu(fe->accessTime))) {
|
udf_fill_inode_time(&inode->i_mtime, &fe->modificationTime,
|
||||||
inode->i_atime.tv_sec = convtime;
|
sbi);
|
||||||
inode->i_atime.tv_nsec = convtime_usec * 1000;
|
udf_fill_inode_time(&inode->i_ctime, &fe->attrTime, sbi);
|
||||||
} 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
iinfo->i_unique = le64_to_cpu(fe->uniqueID);
|
iinfo->i_unique = le64_to_cpu(fe->uniqueID);
|
||||||
iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr);
|
iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr);
|
||||||
|
@ -1261,37 +1254,11 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
|
||||||
inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) <<
|
inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) <<
|
||||||
(inode->i_sb->s_blocksize_bits - 9);
|
(inode->i_sb->s_blocksize_bits - 9);
|
||||||
|
|
||||||
if (udf_stamp_to_time(&convtime, &convtime_usec,
|
udf_fill_inode_time(&inode->i_atime, &efe->accessTime, sbi);
|
||||||
lets_to_cpu(efe->accessTime))) {
|
udf_fill_inode_time(&inode->i_mtime, &efe->modificationTime,
|
||||||
inode->i_atime.tv_sec = convtime;
|
sbi);
|
||||||
inode->i_atime.tv_nsec = convtime_usec * 1000;
|
udf_fill_inode_time(&iinfo->i_crtime, &efe->createTime, sbi);
|
||||||
} else {
|
udf_fill_inode_time(&inode->i_ctime, &efe->attrTime, sbi);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
iinfo->i_unique = le64_to_cpu(efe->uniqueID);
|
iinfo->i_unique = le64_to_cpu(efe->uniqueID);
|
||||||
iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr);
|
iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr);
|
||||||
|
|
Loading…
Reference in a new issue