Changeset 304faab in mainline for uspace/lib/ext4/libext4_filesystem.c
- Timestamp:
- 2012-01-24T09:24:14Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 786bd56
- Parents:
- 08cc26b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_filesystem.c
r08cc26b r304faab 266 266 } 267 267 268 int ext4_filesystem_alloc_inode(ext4_filesystem_t *fs, ext4_inode_ref_t **inode_ref) 269 { 270 // TODO 271 return EOK; 272 } 273 274 int ext4_filesystem_init_inode(ext4_filesystem_t *fs, ext4_inode_ref_t *inode_ref, int flags) 275 { 276 ext4_inode_t *inode = inode_ref->inode; 277 268 int ext4_filesystem_alloc_inode(ext4_filesystem_t *fs, 269 ext4_inode_ref_t **inode_ref, int flags) 270 { 271 int rc; 272 273 bool is_dir = false; 278 274 if (flags & L_DIRECTORY) { 275 is_dir = true; 276 } 277 278 // allocate inode 279 uint32_t index; 280 rc = ext4_ialloc_alloc_inode(fs, &index, is_dir); 281 if (rc != EOK) { 282 return rc; 283 } 284 285 // TODO extents, dir_index etc... 286 rc = ext4_filesystem_get_inode_ref(fs, index, inode_ref); 287 if (rc != EOK) { 288 ext4_ialloc_free_inode(fs, index, is_dir); 289 return rc; 290 } 291 292 // init inode 293 ext4_inode_t *inode = (*inode_ref)->inode; 294 295 if (is_dir) { 279 296 ext4_inode_set_mode(fs->superblock, inode, EXT4_INODE_MODE_DIRECTORY); 280 297 ext4_inode_set_links_count(inode, 1); // '.' entry … … 299 316 } 300 317 318 (*inode_ref)->dirty = true; 319 301 320 return EOK; 302 321 } … … 408 427 409 428 // Free inode 410 rc = ext4_ialloc_free_inode(fs, inode_ref); 429 if (ext4_inode_is_type(fs->superblock, inode_ref->inode, 430 EXT4_INODE_MODE_DIRECTORY)) { 431 rc = ext4_ialloc_free_inode(fs, inode_ref->index, true); 432 } else { 433 rc = ext4_ialloc_free_inode(fs, inode_ref->index, false); 434 } 411 435 if (rc != EOK) { 412 436 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.