aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfsplus/dir.c')
-rw-r--r--fs/hfsplus/dir.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index e44c78a837e8..c423942793ee 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;
@@ -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;