dir.c (f53f292eeaa234615c31a1306babe703fc4263f2) | dir.c (d614267329f2bee7a082ed8781c581c0f3aaa808) |
---|---|
1/* 2 * linux/fs/hfsplus/dir.c 3 * 4 * Copyright (C) 2001 5 * Brad Boyer (flar@allandria.com) 6 * (C) 2003 Ardis Technologies <roman@ardistech.com> 7 * 8 * Handling of directories --- 89 unchanged lines hidden (view full) --- 98 hfsplus_cat_build_key(sb, fd.search_key, 99 HFSPLUS_SB(sb)->hidden_dir->i_ino, 100 &str); 101 goto again; 102 } 103 } else if (!dentry->d_fsdata) 104 dentry->d_fsdata = (void *)(unsigned long)cnid; 105 } else { | 1/* 2 * linux/fs/hfsplus/dir.c 3 * 4 * Copyright (C) 2001 5 * Brad Boyer (flar@allandria.com) 6 * (C) 2003 Ardis Technologies <roman@ardistech.com> 7 * 8 * Handling of directories --- 89 unchanged lines hidden (view full) --- 98 hfsplus_cat_build_key(sb, fd.search_key, 99 HFSPLUS_SB(sb)->hidden_dir->i_ino, 100 &str); 101 goto again; 102 } 103 } else if (!dentry->d_fsdata) 104 dentry->d_fsdata = (void *)(unsigned long)cnid; 105 } else { |
106 printk(KERN_ERR "hfs: invalid catalog entry type in lookup\n"); | 106 pr_err("invalid catalog entry type in lookup\n"); |
107 err = -EIO; 108 goto fail; 109 } 110 hfs_find_exit(&fd); 111 inode = hfsplus_iget(dir->i_sb, cnid); 112 if (IS_ERR(inode)) 113 return ERR_CAST(inode); 114 if (S_ISREG(inode->i_mode)) --- 39 unchanged lines hidden (view full) --- 154 if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { 155 err = -EIO; 156 goto out; 157 } 158 159 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, 160 fd.entrylength); 161 if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { | 107 err = -EIO; 108 goto fail; 109 } 110 hfs_find_exit(&fd); 111 inode = hfsplus_iget(dir->i_sb, cnid); 112 if (IS_ERR(inode)) 113 return ERR_CAST(inode); 114 if (S_ISREG(inode->i_mode)) --- 39 unchanged lines hidden (view full) --- 154 if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { 155 err = -EIO; 156 goto out; 157 } 158 159 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, 160 fd.entrylength); 161 if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { |
162 printk(KERN_ERR "hfs: bad catalog folder thread\n"); | 162 pr_err("bad catalog folder thread\n"); |
163 err = -EIO; 164 goto out; 165 } 166 if (fd.entrylength < HFSPLUS_MIN_THREAD_SZ) { | 163 err = -EIO; 164 goto out; 165 } 166 if (fd.entrylength < HFSPLUS_MIN_THREAD_SZ) { |
167 printk(KERN_ERR "hfs: truncated catalog thread\n"); | 167 pr_err("truncated catalog thread\n"); |
168 err = -EIO; 169 goto out; 170 } 171 if (filldir(dirent, "..", 2, 1, 172 be32_to_cpu(entry.thread.parentID), DT_DIR)) 173 goto out; 174 filp->f_pos++; 175 /* fall through */ 176 default: 177 if (filp->f_pos >= inode->i_size) 178 goto out; 179 err = hfs_brec_goto(&fd, filp->f_pos - 1); 180 if (err) 181 goto out; 182 } 183 184 for (;;) { 185 if (be32_to_cpu(fd.key->cat.parent) != inode->i_ino) { | 168 err = -EIO; 169 goto out; 170 } 171 if (filldir(dirent, "..", 2, 1, 172 be32_to_cpu(entry.thread.parentID), DT_DIR)) 173 goto out; 174 filp->f_pos++; 175 /* fall through */ 176 default: 177 if (filp->f_pos >= inode->i_size) 178 goto out; 179 err = hfs_brec_goto(&fd, filp->f_pos - 1); 180 if (err) 181 goto out; 182 } 183 184 for (;;) { 185 if (be32_to_cpu(fd.key->cat.parent) != inode->i_ino) { |
186 printk(KERN_ERR "hfs: walked past end of dir\n"); | 186 pr_err("walked past end of dir\n"); |
187 err = -EIO; 188 goto out; 189 } 190 191 if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { 192 err = -EIO; 193 goto out; 194 } 195 196 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, 197 fd.entrylength); 198 type = be16_to_cpu(entry.type); 199 len = HFSPLUS_MAX_STRLEN; 200 err = hfsplus_uni2asc(sb, &fd.key->cat.name, strbuf, &len); 201 if (err) 202 goto out; 203 if (type == HFSPLUS_FOLDER) { 204 if (fd.entrylength < 205 sizeof(struct hfsplus_cat_folder)) { | 187 err = -EIO; 188 goto out; 189 } 190 191 if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { 192 err = -EIO; 193 goto out; 194 } 195 196 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, 197 fd.entrylength); 198 type = be16_to_cpu(entry.type); 199 len = HFSPLUS_MAX_STRLEN; 200 err = hfsplus_uni2asc(sb, &fd.key->cat.name, strbuf, &len); 201 if (err) 202 goto out; 203 if (type == HFSPLUS_FOLDER) { 204 if (fd.entrylength < 205 sizeof(struct hfsplus_cat_folder)) { |
206 printk(KERN_ERR "hfs: small dir entry\n"); | 206 pr_err("small dir entry\n"); |
207 err = -EIO; 208 goto out; 209 } 210 if (HFSPLUS_SB(sb)->hidden_dir && 211 HFSPLUS_SB(sb)->hidden_dir->i_ino == 212 be32_to_cpu(entry.folder.id)) 213 goto next; 214 if (filldir(dirent, strbuf, len, filp->f_pos, 215 be32_to_cpu(entry.folder.id), DT_DIR)) 216 break; 217 } else if (type == HFSPLUS_FILE) { 218 if (fd.entrylength < sizeof(struct hfsplus_cat_file)) { | 207 err = -EIO; 208 goto out; 209 } 210 if (HFSPLUS_SB(sb)->hidden_dir && 211 HFSPLUS_SB(sb)->hidden_dir->i_ino == 212 be32_to_cpu(entry.folder.id)) 213 goto next; 214 if (filldir(dirent, strbuf, len, filp->f_pos, 215 be32_to_cpu(entry.folder.id), DT_DIR)) 216 break; 217 } else if (type == HFSPLUS_FILE) { 218 if (fd.entrylength < sizeof(struct hfsplus_cat_file)) { |
219 printk(KERN_ERR "hfs: small file entry\n"); | 219 pr_err("small file entry\n"); |
220 err = -EIO; 221 goto out; 222 } 223 if (filldir(dirent, strbuf, len, filp->f_pos, 224 be32_to_cpu(entry.file.id), DT_REG)) 225 break; 226 } else { | 220 err = -EIO; 221 goto out; 222 } 223 if (filldir(dirent, strbuf, len, filp->f_pos, 224 be32_to_cpu(entry.file.id), DT_REG)) 225 break; 226 } else { |
227 printk(KERN_ERR "hfs: bad catalog entry type\n"); | 227 pr_err("bad catalog entry type\n"); |
228 err = -EIO; 229 goto out; 230 } 231next: 232 filp->f_pos++; 233 if (filp->f_pos >= inode->i_size) 234 goto out; 235 err = hfs_brec_goto(&fd, 1); --- 310 unchanged lines hidden --- | 228 err = -EIO; 229 goto out; 230 } 231next: 232 filp->f_pos++; 233 if (filp->f_pos >= inode->i_size) 234 goto out; 235 err = hfs_brec_goto(&fd, 1); --- 310 unchanged lines hidden --- |