diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-07 20:16:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-07 20:16:27 -0500 |
commit | 0c21e3aaf6ae85bee804a325aa29c325209180fd (patch) | |
tree | 81c5d698e1c40cc8f473b21c5587a34598754a64 /fs/hfsplus/dir.c | |
parent | 021db8e2bde53024a163fb4417a185de46fe77aa (diff) | |
parent | b2837fcf4994e699a4def002e26f274d95b387c1 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/hfsplus
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/hfsplus:
hfsplus: %L-to-%ll, macro correction, and remove unneeded braces
hfsplus: spaces/indentation clean-up
hfsplus: C99 comments clean-up
hfsplus: over 80 character lines clean-up
hfsplus: fix an artifact in ioctl flag checking
hfsplus: flush disk caches in sync and fsync
hfsplus: optimize fsync
hfsplus: split up inode flags
hfsplus: write up fsync for directories
hfsplus: simplify fsync
hfsplus: avoid useless work in hfsplus_sync_fs
hfsplus: make sure sync writes out all metadata
hfsplus: use raw bio access for partition tables
hfsplus: use raw bio access for the volume headers
hfsplus: always use hfsplus_sync_fs to write the volume header
hfsplus: silence a few debug printks
hfsplus: fix option parsing during remount
Fix up conflicts due to VFS changes in fs/hfsplus/{hfsplus_fs.h,unicode.c}
Diffstat (limited to 'fs/hfsplus/dir.c')
-rw-r--r-- | fs/hfsplus/dir.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index ccab87145f7a..f896dc843026 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
@@ -66,11 +66,17 @@ again: | |||
66 | goto fail; | 66 | goto fail; |
67 | } | 67 | } |
68 | cnid = be32_to_cpu(entry.file.id); | 68 | cnid = be32_to_cpu(entry.file.id); |
69 | if (entry.file.user_info.fdType == cpu_to_be32(HFSP_HARDLINK_TYPE) && | 69 | if (entry.file.user_info.fdType == |
70 | entry.file.user_info.fdCreator == cpu_to_be32(HFSP_HFSPLUS_CREATOR) && | 70 | cpu_to_be32(HFSP_HARDLINK_TYPE) && |
71 | (entry.file.create_date == HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)->create_date || | 71 | entry.file.user_info.fdCreator == |
72 | entry.file.create_date == HFSPLUS_I(sb->s_root->d_inode)->create_date) && | 72 | cpu_to_be32(HFSP_HFSPLUS_CREATOR) && |
73 | HFSPLUS_SB(sb)->hidden_dir) { | 73 | (entry.file.create_date == |
74 | HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)-> | ||
75 | create_date || | ||
76 | entry.file.create_date == | ||
77 | HFSPLUS_I(sb->s_root->d_inode)-> | ||
78 | create_date) && | ||
79 | HFSPLUS_SB(sb)->hidden_dir) { | ||
74 | struct qstr str; | 80 | struct qstr str; |
75 | char name[32]; | 81 | char name[32]; |
76 | 82 | ||
@@ -83,11 +89,13 @@ again: | |||
83 | linkid = 0; | 89 | linkid = 0; |
84 | } else { | 90 | } else { |
85 | dentry->d_fsdata = (void *)(unsigned long)cnid; | 91 | dentry->d_fsdata = (void *)(unsigned long)cnid; |
86 | linkid = be32_to_cpu(entry.file.permissions.dev); | 92 | linkid = |
93 | be32_to_cpu(entry.file.permissions.dev); | ||
87 | str.len = sprintf(name, "iNode%d", linkid); | 94 | str.len = sprintf(name, "iNode%d", linkid); |
88 | str.name = name; | 95 | str.name = name; |
89 | hfsplus_cat_build_key(sb, fd.search_key, | 96 | hfsplus_cat_build_key(sb, fd.search_key, |
90 | HFSPLUS_SB(sb)->hidden_dir->i_ino, &str); | 97 | HFSPLUS_SB(sb)->hidden_dir->i_ino, |
98 | &str); | ||
91 | goto again; | 99 | goto again; |
92 | } | 100 | } |
93 | } else if (!dentry->d_fsdata) | 101 | } else if (!dentry->d_fsdata) |
@@ -139,7 +147,8 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
139 | filp->f_pos++; | 147 | filp->f_pos++; |
140 | /* fall through */ | 148 | /* fall through */ |
141 | case 1: | 149 | case 1: |
142 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); | 150 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, |
151 | fd.entrylength); | ||
143 | if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { | 152 | if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { |
144 | printk(KERN_ERR "hfs: bad catalog folder thread\n"); | 153 | printk(KERN_ERR "hfs: bad catalog folder thread\n"); |
145 | err = -EIO; | 154 | err = -EIO; |
@@ -169,14 +178,16 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
169 | err = -EIO; | 178 | err = -EIO; |
170 | goto out; | 179 | goto out; |
171 | } | 180 | } |
172 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); | 181 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, |
182 | fd.entrylength); | ||
173 | type = be16_to_cpu(entry.type); | 183 | type = be16_to_cpu(entry.type); |
174 | len = HFSPLUS_MAX_STRLEN; | 184 | len = HFSPLUS_MAX_STRLEN; |
175 | err = hfsplus_uni2asc(sb, &fd.key->cat.name, strbuf, &len); | 185 | err = hfsplus_uni2asc(sb, &fd.key->cat.name, strbuf, &len); |
176 | if (err) | 186 | if (err) |
177 | goto out; | 187 | goto out; |
178 | if (type == HFSPLUS_FOLDER) { | 188 | if (type == HFSPLUS_FOLDER) { |
179 | if (fd.entrylength < sizeof(struct hfsplus_cat_folder)) { | 189 | if (fd.entrylength < |
190 | sizeof(struct hfsplus_cat_folder)) { | ||
180 | printk(KERN_ERR "hfs: small dir entry\n"); | 191 | printk(KERN_ERR "hfs: small dir entry\n"); |
181 | err = -EIO; | 192 | err = -EIO; |
182 | goto out; | 193 | goto out; |
@@ -202,7 +213,7 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
202 | err = -EIO; | 213 | err = -EIO; |
203 | goto out; | 214 | goto out; |
204 | } | 215 | } |
205 | next: | 216 | next: |
206 | filp->f_pos++; | 217 | filp->f_pos++; |
207 | if (filp->f_pos >= inode->i_size) | 218 | if (filp->f_pos >= inode->i_size) |
208 | goto out; | 219 | goto out; |
@@ -273,7 +284,8 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, | |||
273 | HFSPLUS_I(inode)->linkid = id; | 284 | HFSPLUS_I(inode)->linkid = id; |
274 | cnid = sbi->next_cnid++; | 285 | cnid = sbi->next_cnid++; |
275 | src_dentry->d_fsdata = (void *)(unsigned long)cnid; | 286 | src_dentry->d_fsdata = (void *)(unsigned long)cnid; |
276 | res = hfsplus_create_cat(cnid, src_dir, &src_dentry->d_name, inode); | 287 | res = hfsplus_create_cat(cnid, src_dir, |
288 | &src_dentry->d_name, inode); | ||
277 | if (res) | 289 | if (res) |
278 | /* panic? */ | 290 | /* panic? */ |
279 | goto out; | 291 | goto out; |
@@ -485,6 +497,7 @@ const struct inode_operations hfsplus_dir_inode_operations = { | |||
485 | }; | 497 | }; |
486 | 498 | ||
487 | const struct file_operations hfsplus_dir_operations = { | 499 | const struct file_operations hfsplus_dir_operations = { |
500 | .fsync = hfsplus_file_fsync, | ||
488 | .read = generic_read_dir, | 501 | .read = generic_read_dir, |
489 | .readdir = hfsplus_readdir, | 502 | .readdir = hfsplus_readdir, |
490 | .unlocked_ioctl = hfsplus_ioctl, | 503 | .unlocked_ioctl = hfsplus_ioctl, |