From: Roman Zippel <zippel@linux-m68k.org>
To: Andrew Morton <akpm@osdl.org>, linux-fsdevel@vger.kernel.org
Subject: [PATCH 4/6] hfs: set correct ctime
Date: Mon, 16 Jan 2006 17:41:21 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.61.0601161741010.6384@scrub.home> (raw)
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>
---
fs/hfsplus/catalog.c | 14 ++++++++++----
fs/hfsplus/hfsplus_fs.h | 1 +
fs/hfsplus/inode.c | 6 ++++--
3 files changed, 15 insertions(+), 6 deletions(-)
Index: linux-2.6-git/fs/hfsplus/catalog.c
===================================================================
--- linux-2.6-git.orig/fs/hfsplus/catalog.c 2006-01-16 17:34:14.000000000 +0100
+++ linux-2.6-git/fs/hfsplus/catalog.c 2006-01-16 17:36:31.000000000 +0100
@@ -94,8 +94,11 @@ static int hfsplus_cat_build_record(hfsp
memset(folder, 0, sizeof(*folder));
folder->type = cpu_to_be16(HFSPLUS_FOLDER);
folder->id = cpu_to_be32(inode->i_ino);
- folder->create_date = folder->content_mod_date =
- folder->attribute_mod_date = folder->access_date = hfsp_now2mt();
+ HFSPLUS_I(inode).create_date =
+ folder->create_date =
+ folder->content_mod_date =
+ folder->attribute_mod_date =
+ folder->access_date = hfsp_now2mt();
hfsplus_set_perms(inode, &folder->permissions);
if (inode == HFSPLUS_SB(inode->i_sb).hidden_dir)
/* invisible and namelocked */
@@ -109,8 +112,11 @@ static int hfsplus_cat_build_record(hfsp
file->type = cpu_to_be16(HFSPLUS_FILE);
file->flags = cpu_to_be16(HFSPLUS_FILE_THREAD_EXISTS);
file->id = cpu_to_be32(cnid);
- file->create_date = file->content_mod_date =
- file->attribute_mod_date = file->access_date = hfsp_now2mt();
+ HFSPLUS_I(inode).create_date =
+ file->create_date =
+ file->content_mod_date =
+ file->attribute_mod_date =
+ file->access_date = hfsp_now2mt();
if (cnid == inode->i_ino) {
hfsplus_set_perms(inode, &file->permissions);
file->user_info.fdType = cpu_to_be32(HFSPLUS_SB(inode->i_sb).type);
Index: linux-2.6-git/fs/hfsplus/hfsplus_fs.h
===================================================================
--- linux-2.6-git.orig/fs/hfsplus/hfsplus_fs.h 2006-01-16 17:34:14.000000000 +0100
+++ linux-2.6-git/fs/hfsplus/hfsplus_fs.h 2006-01-16 17:34:16.000000000 +0100
@@ -166,6 +166,7 @@ struct hfsplus_inode_info {
struct inode *rsrc_inode;
unsigned long flags;
+ __be32 create_date;
/* Device number in hfsplus_permissions in catalog */
u32 dev;
/* BSD system and user file flags */
Index: linux-2.6-git/fs/hfsplus/inode.c
===================================================================
--- linux-2.6-git.orig/fs/hfsplus/inode.c 2006-01-16 17:33:52.000000000 +0100
+++ linux-2.6-git/fs/hfsplus/inode.c 2006-01-16 17:34:16.000000000 +0100
@@ -431,7 +431,8 @@ int hfsplus_cat_read_inode(struct inode
inode->i_size = 2 + be32_to_cpu(folder->valence);
inode->i_atime = hfsp_mt2ut(folder->access_date);
inode->i_mtime = hfsp_mt2ut(folder->content_mod_date);
- inode->i_ctime = inode->i_mtime;
+ inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date);
+ HFSPLUS_I(inode).create_date = folder->create_date;
HFSPLUS_I(inode).fs_blocks = 0;
inode->i_op = &hfsplus_dir_inode_operations;
inode->i_fop = &hfsplus_dir_operations;
@@ -462,7 +463,8 @@ int hfsplus_cat_read_inode(struct inode
}
inode->i_atime = hfsp_mt2ut(file->access_date);
inode->i_mtime = hfsp_mt2ut(file->content_mod_date);
- inode->i_ctime = inode->i_mtime;
+ inode->i_ctime = hfsp_mt2ut(file->attribute_mod_date);
+ HFSPLUS_I(inode).create_date = file->create_date;
} else {
printk(KERN_ERR "hfs: bad catalog entry used to create inode\n");
res = -EIO;
reply other threads:[~2006-01-16 16:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.61.0601161741010.6384@scrub.home \
--to=zippel@linux-m68k.org \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).