Changeset 8be96a0 in mainline for uspace/srv/fs/ext4fs/ext4fs_ops.c
- Timestamp:
- 2011-11-22T12:15:37Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bf66ef4
- Parents:
- f49638e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/ext4fs/ext4fs_ops.c
rf49638e r8be96a0 205 205 ext4_directory_iterator_t it; 206 206 int rc; 207 size_t name_size;208 size_t component_size;209 bool found = false;210 uint32_t inode;211 207 212 208 fs = eparent->instance->filesystem; … … 217 213 } 218 214 219 component_size = strlen(component);220 221 if (ext4_superblock_has_feature_compatible(fs->superblock, EXT4_FEATURE_COMPAT_DIR_INDEX) &&222 ext4_inode_has_flag(eparent->inode_ref->inode, EXT4_INODE_FLAG_INDEX)) {223 224 rc = ext4_directory_dx_find_entry(&it, fs, eparent->inode_ref, component_size, component);225 226 // Index isn't corrupted227 if (rc != EXT4_ERR_BAD_DX_DIR) {228 229 if (rc != EOK) {230 return rc;231 }232 233 inode = ext4_directory_entry_ll_get_inode(it.current);234 235 rc = ext4fs_node_get_core(rfn, eparent->instance, inode);236 ext4_directory_iterator_fini(&it);237 return rc;238 }239 240 }241 242 215 rc = ext4_directory_iterator_init(&it, fs, eparent->inode_ref, 0); 243 216 if (rc != EOK) { … … 245 218 } 246 219 247 while (it.current != NULL) { 248 inode = ext4_directory_entry_ll_get_inode(it.current); 249 250 /* ignore empty directory entries */ 251 if (inode != 0) { 252 name_size = ext4_directory_entry_ll_get_name_length(fs->superblock, 253 it.current); 254 255 if (name_size == component_size && bcmp(component, &it.current->name, 256 name_size) == 0) { 257 rc = ext4fs_node_get_core(rfn, eparent->instance, 258 inode); 259 if (rc != EOK) { 260 ext4_directory_iterator_fini(&it); 261 return rc; 262 } 263 found = true; 264 break; 265 } 266 } 267 268 rc = ext4_directory_iterator_next(&it); 269 if (rc != EOK) { 270 ext4_directory_iterator_fini(&it); 271 return rc; 272 } 220 rc = ext4_directory_find_entry(&it, eparent->inode_ref, component); 221 if (rc != EOK) { 222 ext4_directory_iterator_fini(&it); 223 return rc; 224 } 225 226 uint32_t inode = ext4_directory_entry_ll_get_inode(it.current); 227 228 rc = ext4fs_node_get_core(rfn, eparent->instance, inode); 229 if (rc != EOK) { 230 ext4_directory_iterator_fini(&it); 231 return rc; 273 232 } 274 233 275 234 ext4_directory_iterator_fini(&it); 276 277 if (!found) {278 return ENOENT;279 }280 281 235 return EOK; 282 236 } … … 791 745 ext4fs_instance_t *inst, ext4_inode_ref_t *inode_ref, size_t *rbytes) 792 746 { 793 794 747 ext4_directory_iterator_t it; 795 748 aoff64_t next; … … 1151 1104 static int ext4fs_destroy(service_id_t service_id, fs_index_t index) 1152 1105 { 1153 EXT4FS_DBG("not supported"); 1154 1155 //TODO 1156 return ENOTSUP; 1106 int rc; 1107 fs_node_t *fn; 1108 1109 rc = ext4fs_node_get(&fn, service_id, index); 1110 if (rc != EOK) { 1111 return rc; 1112 } 1113 1114 /* Destroy the inode */ 1115 return ext4fs_destroy_node(fn); 1157 1116 } 1158 1117
Note:
See TracChangeset
for help on using the changeset viewer.