aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/inode.c
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-02-10 05:25:31 -0500
committerJan Kara <jack@suse.cz>2008-04-17 08:22:29 -0400
commit56774805d5eeecd3f1fb700603e593a35dc523c8 (patch)
tree525665c2a2b4fe93cf4a74b8c50332e70acf357f /fs/udf/inode.c
parentcbf5676a0e0463f05e5073589f3194846dfb02e7 (diff)
udf: convert udf_stamp_to_time and udf_time_to_stamp to use timestamps
* kernel_timestamp type was almost unused - only callers of udf_stamp_to_time and udf_time_to_stamp used it, so let these functions handle endianness internally and don't clutter code with conversions * rename udf_stamp_to_time to udf_disk_stamp_to_time and udf_time_to_stamp to udf_time_to_disk_stamp Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/inode.c')
-rw-r--r--fs/udf/inode.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index a7646e9bdbde..2362bf0c6900 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1227,16 +1227,14 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1227 inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << 1227 inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) <<
1228 (inode->i_sb->s_blocksize_bits - 9); 1228 (inode->i_sb->s_blocksize_bits - 9);
1229 1229
1230 if (!udf_stamp_to_time(&inode->i_atime, 1230 if (!udf_disk_stamp_to_time(&inode->i_atime, fe->accessTime))
1231 lets_to_cpu(fe->accessTime)))
1232 inode->i_atime = sbi->s_record_time; 1231 inode->i_atime = sbi->s_record_time;
1233 1232
1234 if (!udf_stamp_to_time(&inode->i_mtime, 1233 if (!udf_disk_stamp_to_time(&inode->i_mtime,
1235 lets_to_cpu(fe->modificationTime))) 1234 fe->modificationTime))
1236 inode->i_mtime = sbi->s_record_time; 1235 inode->i_mtime = sbi->s_record_time;
1237 1236
1238 if (!udf_stamp_to_time(&inode->i_ctime, 1237 if (!udf_disk_stamp_to_time(&inode->i_ctime, fe->attrTime))
1239 lets_to_cpu(fe->attrTime)))
1240 inode->i_ctime = sbi->s_record_time; 1238 inode->i_ctime = sbi->s_record_time;
1241 1239
1242 iinfo->i_unique = le64_to_cpu(fe->uniqueID); 1240 iinfo->i_unique = le64_to_cpu(fe->uniqueID);
@@ -1247,20 +1245,17 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1247 inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << 1245 inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) <<
1248 (inode->i_sb->s_blocksize_bits - 9); 1246 (inode->i_sb->s_blocksize_bits - 9);
1249 1247
1250 if (!udf_stamp_to_time(&inode->i_atime, 1248 if (!udf_disk_stamp_to_time(&inode->i_atime, efe->accessTime))
1251 lets_to_cpu(efe->accessTime)))
1252 inode->i_atime = sbi->s_record_time; 1249 inode->i_atime = sbi->s_record_time;
1253 1250
1254 if (!udf_stamp_to_time(&inode->i_mtime, 1251 if (!udf_disk_stamp_to_time(&inode->i_mtime,
1255 lets_to_cpu(efe->modificationTime))) 1252 efe->modificationTime))
1256 inode->i_mtime = sbi->s_record_time; 1253 inode->i_mtime = sbi->s_record_time;
1257 1254
1258 if (!udf_stamp_to_time(&iinfo->i_crtime, 1255 if (!udf_disk_stamp_to_time(&iinfo->i_crtime, efe->createTime))
1259 lets_to_cpu(efe->createTime)))
1260 iinfo->i_crtime = sbi->s_record_time; 1256 iinfo->i_crtime = sbi->s_record_time;
1261 1257
1262 if (!udf_stamp_to_time(&inode->i_ctime, 1258 if (!udf_disk_stamp_to_time(&inode->i_ctime, efe->attrTime))
1263 lets_to_cpu(efe->attrTime)))
1264 inode->i_ctime = sbi->s_record_time; 1259 inode->i_ctime = sbi->s_record_time;
1265 1260
1266 iinfo->i_unique = le64_to_cpu(efe->uniqueID); 1261 iinfo->i_unique = le64_to_cpu(efe->uniqueID);
@@ -1382,7 +1377,6 @@ static int udf_update_inode(struct inode *inode, int do_sync)
1382 uint32_t udfperms; 1377 uint32_t udfperms;
1383 uint16_t icbflags; 1378 uint16_t icbflags;
1384 uint16_t crclen; 1379 uint16_t crclen;
1385 kernel_timestamp cpu_time;
1386 int err = 0; 1380 int err = 0;
1387 struct udf_sb_info *sbi = UDF_SB(inode->i_sb); 1381 struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
1388 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; 1382 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
@@ -1485,12 +1479,9 @@ static int udf_update_inode(struct inode *inode, int do_sync)
1485 (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> 1479 (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >>
1486 (blocksize_bits - 9)); 1480 (blocksize_bits - 9));
1487 1481
1488 if (udf_time_to_stamp(&cpu_time, inode->i_atime)) 1482 udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime);
1489 fe->accessTime = cpu_to_lets(cpu_time); 1483 udf_time_to_disk_stamp(&fe->modificationTime, inode->i_mtime);
1490 if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) 1484 udf_time_to_disk_stamp(&fe->attrTime, inode->i_ctime);
1491 fe->modificationTime = cpu_to_lets(cpu_time);
1492 if (udf_time_to_stamp(&cpu_time, inode->i_ctime))
1493 fe->attrTime = cpu_to_lets(cpu_time);
1494 memset(&(fe->impIdent), 0, sizeof(regid)); 1485 memset(&(fe->impIdent), 0, sizeof(regid));
1495 strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); 1486 strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER);
1496 fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; 1487 fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
@@ -1525,14 +1516,10 @@ static int udf_update_inode(struct inode *inode, int do_sync)
1525 iinfo->i_crtime.tv_nsec > inode->i_ctime.tv_nsec)) 1516 iinfo->i_crtime.tv_nsec > inode->i_ctime.tv_nsec))
1526 iinfo->i_crtime = inode->i_ctime; 1517 iinfo->i_crtime = inode->i_ctime;
1527 1518
1528 if (udf_time_to_stamp(&cpu_time, inode->i_atime)) 1519 udf_time_to_disk_stamp(&efe->accessTime, inode->i_atime);
1529 efe->accessTime = cpu_to_lets(cpu_time); 1520 udf_time_to_disk_stamp(&efe->modificationTime, inode->i_mtime);
1530 if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) 1521 udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime);
1531 efe->modificationTime = cpu_to_lets(cpu_time); 1522 udf_time_to_disk_stamp(&efe->attrTime, inode->i_ctime);
1532 if (udf_time_to_stamp(&cpu_time, iinfo->i_crtime))
1533 efe->createTime = cpu_to_lets(cpu_time);
1534 if (udf_time_to_stamp(&cpu_time, inode->i_ctime))
1535 efe->attrTime = cpu_to_lets(cpu_time);
1536 1523
1537 memset(&(efe->impIdent), 0, sizeof(regid)); 1524 memset(&(efe->impIdent), 0, sizeof(regid));
1538 strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); 1525 strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER);