dir.c (3d5271f9883cba7b54762bc4fe027d4172f06db7) | dir.c (634725a92938b0f282b17cec0b007dca77adebd2) |
---|---|
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 --- 70 unchanged lines hidden (view full) --- 79 linkid = be32_to_cpu(entry.file.permissions.dev); 80 str.len = sprintf(name, "iNode%d", linkid); 81 str.name = name; 82 hfsplus_cat_build_key(sb, fd.search_key, HFSPLUS_SB(sb).hidden_dir->i_ino, &str); 83 goto again; 84 } else if (!dentry->d_fsdata) 85 dentry->d_fsdata = (void *)(unsigned long)cnid; 86 } 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 --- 70 unchanged lines hidden (view full) --- 79 linkid = be32_to_cpu(entry.file.permissions.dev); 80 str.len = sprintf(name, "iNode%d", linkid); 81 str.name = name; 82 hfsplus_cat_build_key(sb, fd.search_key, HFSPLUS_SB(sb).hidden_dir->i_ino, &str); 83 goto again; 84 } else if (!dentry->d_fsdata) 85 dentry->d_fsdata = (void *)(unsigned long)cnid; 86 } else { |
87 printk("HFS+-fs: Illegal catalog entry type in lookup\n"); | 87 printk(KERN_ERR "hfs: invalid catalog entry type in lookup\n"); |
88 err = -EIO; 89 goto fail; 90 } 91 hfs_find_exit(&fd); 92 inode = iget(dir->i_sb, cnid); 93 if (!inode) 94 return ERR_PTR(-EACCES); 95 if (S_ISREG(inode->i_mode)) --- 31 unchanged lines hidden (view full) --- 127 /* This is completely artificial... */ 128 if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR)) 129 goto out; 130 filp->f_pos++; 131 /* fall through */ 132 case 1: 133 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); 134 if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { | 88 err = -EIO; 89 goto fail; 90 } 91 hfs_find_exit(&fd); 92 inode = iget(dir->i_sb, cnid); 93 if (!inode) 94 return ERR_PTR(-EACCES); 95 if (S_ISREG(inode->i_mode)) --- 31 unchanged lines hidden (view full) --- 127 /* This is completely artificial... */ 128 if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR)) 129 goto out; 130 filp->f_pos++; 131 /* fall through */ 132 case 1: 133 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); 134 if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { |
135 printk("HFS+-fs: bad catalog folder thread\n"); | 135 printk(KERN_ERR "hfs: bad catalog folder thread\n"); |
136 err = -EIO; 137 goto out; 138 } 139 if (fd.entrylength < HFSPLUS_MIN_THREAD_SZ) { | 136 err = -EIO; 137 goto out; 138 } 139 if (fd.entrylength < HFSPLUS_MIN_THREAD_SZ) { |
140 printk("HFS+-fs: truncated catalog thread\n"); | 140 printk(KERN_ERR "hfs: truncated catalog thread\n"); |
141 err = -EIO; 142 goto out; 143 } 144 if (filldir(dirent, "..", 2, 1, 145 be32_to_cpu(entry.thread.parentID), DT_DIR)) 146 goto out; 147 filp->f_pos++; 148 /* fall through */ 149 default: 150 if (filp->f_pos >= inode->i_size) 151 goto out; 152 err = hfs_brec_goto(&fd, filp->f_pos - 1); 153 if (err) 154 goto out; 155 } 156 157 for (;;) { 158 if (be32_to_cpu(fd.key->cat.parent) != inode->i_ino) { | 141 err = -EIO; 142 goto out; 143 } 144 if (filldir(dirent, "..", 2, 1, 145 be32_to_cpu(entry.thread.parentID), DT_DIR)) 146 goto out; 147 filp->f_pos++; 148 /* fall through */ 149 default: 150 if (filp->f_pos >= inode->i_size) 151 goto out; 152 err = hfs_brec_goto(&fd, filp->f_pos - 1); 153 if (err) 154 goto out; 155 } 156 157 for (;;) { 158 if (be32_to_cpu(fd.key->cat.parent) != inode->i_ino) { |
159 printk("HFS+-fs: walked past end of dir\n"); | 159 printk(KERN_ERR "hfs: walked past end of dir\n"); |
160 err = -EIO; 161 goto out; 162 } 163 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); 164 type = be16_to_cpu(entry.type); 165 len = HFSPLUS_MAX_STRLEN; 166 err = hfsplus_uni2asc(sb, &fd.key->cat.name, strbuf, &len); 167 if (err) 168 goto out; 169 if (type == HFSPLUS_FOLDER) { 170 if (fd.entrylength < sizeof(struct hfsplus_cat_folder)) { | 160 err = -EIO; 161 goto out; 162 } 163 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); 164 type = be16_to_cpu(entry.type); 165 len = HFSPLUS_MAX_STRLEN; 166 err = hfsplus_uni2asc(sb, &fd.key->cat.name, strbuf, &len); 167 if (err) 168 goto out; 169 if (type == HFSPLUS_FOLDER) { 170 if (fd.entrylength < sizeof(struct hfsplus_cat_folder)) { |
171 printk("HFS+-fs: small dir entry\n"); | 171 printk(KERN_ERR "hfs: small dir entry\n"); |
172 err = -EIO; 173 goto out; 174 } 175 if (HFSPLUS_SB(sb).hidden_dir && 176 HFSPLUS_SB(sb).hidden_dir->i_ino == be32_to_cpu(entry.folder.id)) 177 goto next; 178 if (filldir(dirent, strbuf, len, filp->f_pos, 179 be32_to_cpu(entry.folder.id), DT_DIR)) 180 break; 181 } else if (type == HFSPLUS_FILE) { 182 if (fd.entrylength < sizeof(struct hfsplus_cat_file)) { | 172 err = -EIO; 173 goto out; 174 } 175 if (HFSPLUS_SB(sb).hidden_dir && 176 HFSPLUS_SB(sb).hidden_dir->i_ino == be32_to_cpu(entry.folder.id)) 177 goto next; 178 if (filldir(dirent, strbuf, len, filp->f_pos, 179 be32_to_cpu(entry.folder.id), DT_DIR)) 180 break; 181 } else if (type == HFSPLUS_FILE) { 182 if (fd.entrylength < sizeof(struct hfsplus_cat_file)) { |
183 printk("HFS+-fs: small file entry\n"); | 183 printk(KERN_ERR "hfs: small file entry\n"); |
184 err = -EIO; 185 goto out; 186 } 187 if (filldir(dirent, strbuf, len, filp->f_pos, 188 be32_to_cpu(entry.file.id), DT_REG)) 189 break; 190 } else { | 184 err = -EIO; 185 goto out; 186 } 187 if (filldir(dirent, strbuf, len, filp->f_pos, 188 be32_to_cpu(entry.file.id), DT_REG)) 189 break; 190 } else { |
191 printk("HFS+-fs: bad catalog entry type\n"); | 191 printk(KERN_ERR "hfs: bad catalog entry type\n"); |
192 err = -EIO; 193 goto out; 194 } 195 next: 196 filp->f_pos++; 197 if (filp->f_pos >= inode->i_size) 198 goto out; 199 err = hfs_brec_goto(&fd, 1); --- 284 unchanged lines hidden --- | 192 err = -EIO; 193 goto out; 194 } 195 next: 196 filp->f_pos++; 197 if (filp->f_pos >= inode->i_size) 198 goto out; 199 err = hfs_brec_goto(&fd, 1); --- 284 unchanged lines hidden --- |