aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2006-01-18 20:43:09 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-18 22:20:23 -0500
commit9a4cad95c9338077487226e22d4e01bc9edebf21 (patch)
tree7153b1e890ab17910935494c433c23eb9cf94014
parent2179d372d9f8b5fc5c189c89bc6a565a42151b23 (diff)
[PATCH] hfs: set correct ctime
Read the correct ctime from disk (it was written but never read for some reason). Read also creation date, which is used in the next patch. (Problem found by Olivier Castan <olivier.castan@certa.ssi.gouv.fr>) Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/hfsplus/catalog.c14
-rw-r--r--fs/hfsplus/hfsplus_fs.h1
-rw-r--r--fs/hfsplus/inode.c6
3 files changed, 15 insertions, 6 deletions
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
index 662d176856d8..04255af34709 100644
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -94,8 +94,11 @@ static int hfsplus_cat_build_record(hfsplus_cat_entry *entry, u32 cnid, struct i
94 memset(folder, 0, sizeof(*folder)); 94 memset(folder, 0, sizeof(*folder));
95 folder->type = cpu_to_be16(HFSPLUS_FOLDER); 95 folder->type = cpu_to_be16(HFSPLUS_FOLDER);
96 folder->id = cpu_to_be32(inode->i_ino); 96 folder->id = cpu_to_be32(inode->i_ino);
97 folder->create_date = folder->content_mod_date = 97 HFSPLUS_I(inode).create_date =
98 folder->attribute_mod_date = folder->access_date = hfsp_now2mt(); 98 folder->create_date =
99 folder->content_mod_date =
100 folder->attribute_mod_date =
101 folder->access_date = hfsp_now2mt();
99 hfsplus_set_perms(inode, &folder->permissions); 102 hfsplus_set_perms(inode, &folder->permissions);
100 if (inode == HFSPLUS_SB(inode->i_sb).hidden_dir) 103 if (inode == HFSPLUS_SB(inode->i_sb).hidden_dir)
101 /* invisible and namelocked */ 104 /* invisible and namelocked */
@@ -109,8 +112,11 @@ static int hfsplus_cat_build_record(hfsplus_cat_entry *entry, u32 cnid, struct i
109 file->type = cpu_to_be16(HFSPLUS_FILE); 112 file->type = cpu_to_be16(HFSPLUS_FILE);
110 file->flags = cpu_to_be16(HFSPLUS_FILE_THREAD_EXISTS); 113 file->flags = cpu_to_be16(HFSPLUS_FILE_THREAD_EXISTS);
111 file->id = cpu_to_be32(cnid); 114 file->id = cpu_to_be32(cnid);
112 file->create_date = file->content_mod_date = 115 HFSPLUS_I(inode).create_date =
113 file->attribute_mod_date = file->access_date = hfsp_now2mt(); 116 file->create_date =
117 file->content_mod_date =
118 file->attribute_mod_date =
119 file->access_date = hfsp_now2mt();
114 if (cnid == inode->i_ino) { 120 if (cnid == inode->i_ino) {
115 hfsplus_set_perms(inode, &file->permissions); 121 hfsplus_set_perms(inode, &file->permissions);
116 file->user_info.fdType = cpu_to_be32(HFSPLUS_SB(inode->i_sb).type); 122 file->user_info.fdType = cpu_to_be32(HFSPLUS_SB(inode->i_sb).type);
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 4608171f45d3..7ae393637a0c 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -166,6 +166,7 @@ struct hfsplus_inode_info {
166 struct inode *rsrc_inode; 166 struct inode *rsrc_inode;
167 unsigned long flags; 167 unsigned long flags;
168 168
169 __be32 create_date;
169 /* Device number in hfsplus_permissions in catalog */ 170 /* Device number in hfsplus_permissions in catalog */
170 u32 dev; 171 u32 dev;
171 /* BSD system and user file flags */ 172 /* BSD system and user file flags */
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 182eb3177975..12ed2b7d046b 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -431,7 +431,8 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
431 inode->i_size = 2 + be32_to_cpu(folder->valence); 431 inode->i_size = 2 + be32_to_cpu(folder->valence);
432 inode->i_atime = hfsp_mt2ut(folder->access_date); 432 inode->i_atime = hfsp_mt2ut(folder->access_date);
433 inode->i_mtime = hfsp_mt2ut(folder->content_mod_date); 433 inode->i_mtime = hfsp_mt2ut(folder->content_mod_date);
434 inode->i_ctime = inode->i_mtime; 434 inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date);
435 HFSPLUS_I(inode).create_date = folder->create_date;
435 HFSPLUS_I(inode).fs_blocks = 0; 436 HFSPLUS_I(inode).fs_blocks = 0;
436 inode->i_op = &hfsplus_dir_inode_operations; 437 inode->i_op = &hfsplus_dir_inode_operations;
437 inode->i_fop = &hfsplus_dir_operations; 438 inode->i_fop = &hfsplus_dir_operations;
@@ -462,7 +463,8 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
462 } 463 }
463 inode->i_atime = hfsp_mt2ut(file->access_date); 464 inode->i_atime = hfsp_mt2ut(file->access_date);
464 inode->i_mtime = hfsp_mt2ut(file->content_mod_date); 465 inode->i_mtime = hfsp_mt2ut(file->content_mod_date);
465 inode->i_ctime = inode->i_mtime; 466 inode->i_ctime = hfsp_mt2ut(file->attribute_mod_date);
467 HFSPLUS_I(inode).create_date = file->create_date;
466 } else { 468 } else {
467 printk(KERN_ERR "hfs: bad catalog entry used to create inode\n"); 469 printk(KERN_ERR "hfs: bad catalog entry used to create inode\n");
468 res = -EIO; 470 res = -EIO;