Changeset fe61181 in mainline for uspace/lib/ext4/libext4_filesystem.c


Ignore:
Timestamp:
2012-07-21T08:19:33Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0b293a6
Parents:
34bc2fe
Message:

Debug messages removed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_filesystem.c

    r34bc2fe rfe61181  
    5656        rc = block_init(EXCHANGE_SERIALIZE, fs->device, 4096);
    5757        if (rc != EOK) {
    58                 EXT4FS_DBG("block init error: \%d", rc);
    5958                return rc;
    6059        }
     
    6564        if (rc != EOK) {
    6665                block_fini(fs->device);
    67                 EXT4FS_DBG("superblock read error: \%d", rc);
    6866                return rc;
    6967        }
     
    7371        if (block_size > EXT4_MAX_BLOCK_SIZE) {
    7472                block_fini(fs->device);
    75                 EXT4FS_DBG("get blocksize error: \%d", rc);
    7673                return ENOTSUP;
    7774        }
     
    8178        if (rc != EOK) {
    8279                block_fini(fs->device);
    83                 EXT4FS_DBG("block cache init error: \%d", rc);
    8480                return rc;
    8581        }
     
    104100                block_cache_fini(fs->device);
    105101                block_fini(fs->device);
    106                 EXT4FS_DBG("Unable to mount: Invalid state error");
    107102                return ENOTSUP;
    108103        }
     
    114109                block_cache_fini(fs->device);
    115110                block_fini(fs->device);
    116                 EXT4FS_DBG("state write error: \%d", rc);
    117111                return rc;
    118112        }
     
    192186        incompatible_features &= ~EXT4_FEATURE_INCOMPAT_SUPP;
    193187        if (incompatible_features > 0) {
    194                 EXT4FS_DBG("Not supported incompatible features");
    195188                return ENOTSUP;
    196189        }
     
    203196        compatible_read_only &= ~EXT4_FEATURE_RO_COMPAT_SUPP;
    204197        if (compatible_read_only > 0) {
    205                 EXT4FS_DBG("Not supported readonly features - mounting READ-ONLY");
    206198                *read_only = true;
    207199                return EOK;
     
    357349 * @param bg_ref        reference to block group
    358350 * @return                      error code
    359  */static int ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
     351 */
     352static int ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
    360353{
    361354        int rc;
     
    14051398}
    14061399
    1407 /** Add orphaned i-node to the orphans linked list.
    1408  *
    1409  * @param inode_ref             i-node to be added to orphans list
    1410  * @return                              error code
    1411  */
    1412 int ext4_filesystem_add_orphan(ext4_inode_ref_t *inode_ref)
    1413 {
    1414         uint32_t next_orphan = ext4_superblock_get_last_orphan(
    1415                         inode_ref->fs->superblock);
    1416 
    1417         /* Deletion time is used for holding next item of the list */
    1418         ext4_inode_set_deletion_time(inode_ref->inode, next_orphan);
    1419 
    1420         /* Head of the list is in the superblock */
    1421         ext4_superblock_set_last_orphan(
    1422                         inode_ref->fs->superblock, inode_ref->index);
    1423         inode_ref->dirty = true;
    1424 
    1425         return EOK;
    1426 }
    1427 
    1428 /** Delete orphaned i-node from the orphans linked list.
    1429  *
    1430  * @param inode_ref             i-node to be deleted from the orphans list
    1431  * @return                              error code
    1432  */
    1433 int ext4_filesystem_delete_orphan(ext4_inode_ref_t *inode_ref)
    1434 {
    1435         int rc;
    1436 
    1437         /* Get head of the linked list */
    1438         uint32_t last_orphan = ext4_superblock_get_last_orphan(
    1439                         inode_ref->fs->superblock);
    1440 
    1441         assert (last_orphan != 0);
    1442 
    1443         ext4_inode_ref_t *current;
    1444         rc = ext4_filesystem_get_inode_ref(inode_ref->fs, last_orphan, &current);
    1445         if (rc != EOK) {
    1446                 return rc;
    1447         }
    1448 
    1449         uint32_t next_orphan = ext4_inode_get_deletion_time(current->inode);
    1450 
    1451         /* Check if the head is the target */
    1452         if (last_orphan == inode_ref->index) {
    1453                 ext4_superblock_set_last_orphan(inode_ref->fs->superblock, next_orphan);
    1454                 return EOK;
    1455         }
    1456 
    1457         bool found = false;
    1458 
    1459         /* Walk thourgh the linked list */
    1460         while (next_orphan != 0) {
    1461 
    1462                 /* Found? */
    1463                 if (next_orphan == inode_ref->index) {
    1464                         next_orphan = ext4_inode_get_deletion_time(inode_ref->inode);
    1465                         ext4_inode_set_deletion_time(current->inode, next_orphan);
    1466                         current->dirty = true;
    1467                         found = true;
    1468                         break;
    1469                 }
    1470 
    1471                 ext4_filesystem_put_inode_ref(current);
    1472 
    1473                 rc = ext4_filesystem_get_inode_ref(inode_ref->fs, next_orphan, &current);
    1474                 if (rc != EOK) {
    1475                         return rc;
    1476                 }
    1477                 next_orphan = ext4_inode_get_deletion_time(current->inode);
    1478 
    1479         }
    1480 
    1481         rc = ext4_filesystem_put_inode_ref(current);
    1482         if (rc != EOK) {
    1483                 return rc;
    1484         }
    1485 
    1486         if (!found) {
    1487                 return ENOENT;
    1488         } else {
    1489                 return EOK;
    1490         }
    1491 }
    1492 
    14931400/**
    14941401 * @}
Note: See TracChangeset for help on using the changeset viewer.