aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/inode.c')
-rw-r--r--fs/udf/inode.c79
1 files changed, 23 insertions, 56 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index fb92476fcdd9..3c0a60dad478 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1136,12 +1136,24 @@ static void __udf_read_inode(struct inode *inode)
1136 brelse(bh); 1136 brelse(bh);
1137} 1137}
1138 1138
1139static void udf_fill_inode_time(struct timespec *tspec,
1140 const timestamp *tstamp,
1141 struct udf_sb_info *sbi)
1142{
1143 time_t convtime;
1144 long convtime_usec;
1145 if (udf_stamp_to_time(&convtime, &convtime_usec,
1146 lets_to_cpu(*tstamp))) {
1147 tspec->tv_sec = convtime;
1148 tspec->tv_nsec = convtime_usec * 1000;
1149 } else
1150 *tspec = sbi->s_record_time;
1151}
1152
1139static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) 1153static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1140{ 1154{
1141 struct fileEntry *fe; 1155 struct fileEntry *fe;
1142 struct extendedFileEntry *efe; 1156 struct extendedFileEntry *efe;
1143 time_t convtime;
1144 long convtime_usec;
1145 int offset; 1157 int offset;
1146 struct udf_sb_info *sbi = UDF_SB(inode->i_sb); 1158 struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
1147 struct udf_inode_info *iinfo = UDF_I(inode); 1159 struct udf_inode_info *iinfo = UDF_I(inode);
@@ -1229,29 +1241,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1229 inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << 1241 inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) <<
1230 (inode->i_sb->s_blocksize_bits - 9); 1242 (inode->i_sb->s_blocksize_bits - 9);
1231 1243
1232 if (udf_stamp_to_time(&convtime, &convtime_usec, 1244 udf_fill_inode_time(&inode->i_atime, &fe->accessTime, sbi);
1233 lets_to_cpu(fe->accessTime))) { 1245 udf_fill_inode_time(&inode->i_mtime, &fe->modificationTime,
1234 inode->i_atime.tv_sec = convtime; 1246 sbi);
1235 inode->i_atime.tv_nsec = convtime_usec * 1000; 1247 udf_fill_inode_time(&inode->i_ctime, &fe->attrTime, sbi);
1236 } else {
1237 inode->i_atime = sbi->s_record_time;
1238 }
1239
1240 if (udf_stamp_to_time(&convtime, &convtime_usec,
1241 lets_to_cpu(fe->modificationTime))) {
1242 inode->i_mtime.tv_sec = convtime;
1243 inode->i_mtime.tv_nsec = convtime_usec * 1000;
1244 } else {
1245 inode->i_mtime = sbi->s_record_time;
1246 }
1247
1248 if (udf_stamp_to_time(&convtime, &convtime_usec,
1249 lets_to_cpu(fe->attrTime))) {
1250 inode->i_ctime.tv_sec = convtime;
1251 inode->i_ctime.tv_nsec = convtime_usec * 1000;
1252 } else {
1253 inode->i_ctime = sbi->s_record_time;
1254 }
1255 1248
1256 iinfo->i_unique = le64_to_cpu(fe->uniqueID); 1249 iinfo->i_unique = le64_to_cpu(fe->uniqueID);
1257 iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); 1250 iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr);
@@ -1261,37 +1254,11 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1261 inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << 1254 inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) <<
1262 (inode->i_sb->s_blocksize_bits - 9); 1255 (inode->i_sb->s_blocksize_bits - 9);
1263 1256
1264 if (udf_stamp_to_time(&convtime, &convtime_usec, 1257 udf_fill_inode_time(&inode->i_atime, &efe->accessTime, sbi);
1265 lets_to_cpu(efe->accessTime))) { 1258 udf_fill_inode_time(&inode->i_mtime, &efe->modificationTime,
1266 inode->i_atime.tv_sec = convtime; 1259 sbi);
1267 inode->i_atime.tv_nsec = convtime_usec * 1000; 1260 udf_fill_inode_time(&iinfo->i_crtime, &efe->createTime, sbi);
1268 } else { 1261 udf_fill_inode_time(&inode->i_ctime, &efe->attrTime, sbi);
1269 inode->i_atime = sbi->s_record_time;
1270 }
1271
1272 if (udf_stamp_to_time(&convtime, &convtime_usec,
1273 lets_to_cpu(efe->modificationTime))) {
1274 inode->i_mtime.tv_sec = convtime;
1275 inode->i_mtime.tv_nsec = convtime_usec * 1000;
1276 } else {
1277 inode->i_mtime = sbi->s_record_time;
1278 }
1279
1280 if (udf_stamp_to_time(&convtime, &convtime_usec,
1281 lets_to_cpu(efe->createTime))) {
1282 iinfo->i_crtime.tv_sec = convtime;
1283 iinfo->i_crtime.tv_nsec = convtime_usec * 1000;
1284 } else {
1285 iinfo->i_crtime = sbi->s_record_time;
1286 }
1287
1288 if (udf_stamp_to_time(&convtime, &convtime_usec,
1289 lets_to_cpu(efe->attrTime))) {
1290 inode->i_ctime.tv_sec = convtime;
1291 inode->i_ctime.tv_nsec = convtime_usec * 1000;
1292 } else {
1293 inode->i_ctime = sbi->s_record_time;
1294 }
1295 1262
1296 iinfo->i_unique = le64_to_cpu(efe->uniqueID); 1263 iinfo->i_unique = le64_to_cpu(efe->uniqueID);
1297 iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); 1264 iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr);