Changeset 9c0c0e1 in mainline for uspace/lib/ext4/libext4_filesystem.c


Ignore:
Timestamp:
2011-10-04T12:18:44Z (14 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a23297c
Parents:
01ab41b
Message:

part of code needed for successful mount (porting from ext2)

File:
1 edited

Legend:

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

    r01ab41b r9c0c0e1  
    5252        fs->device = service_id;
    5353
    54         // TODO block size !!!
     54        // TODO what does constant 2048 mean?
    5555        rc = block_init(EXCHANGE_SERIALIZE, fs->device, 2048);
    5656        if (rc != EOK) {
     
    5858        }
    5959
     60        /* Read superblock from device */
    6061        rc = ext4_superblock_read_direct(fs->device, &temp_superblock);
    6162        if (rc != EOK) {
     
    6465        }
    6566
     67        /* Read block size from superblock and check */
    6668        block_size = ext4_superblock_get_block_size(temp_superblock);
    67 
    6869        if (block_size > EXT4_MAX_BLOCK_SIZE) {
    6970                block_fini(fs->device);
     
    7172        }
    7273
     74        /* Initialize block caching */
    7375        rc = block_cache_init(service_id, block_size, 0, CACHE_MODE_WT);
    7476        if (rc != EOK) {
     
    7779        }
    7880
     81        /* Return loaded superblock */
    7982        fs->superblock = temp_superblock;
    8083
    81 
    82         // TODO
    8384        return EOK;
    8485}
     
    102103 * TODO doxy
    103104 */
    104 int ext4_filesystem_check_flags(ext4_filesystem_t *fs, bool *o_read_only)
     105int ext4_filesystem_check_features(ext4_filesystem_t *fs, bool *o_read_only)
    105106{
    106         // TODO
     107        /* Feature flags are present in rev 1 and later */
     108        if (ext4_superblock_get_rev_level(fs->superblock) == 0) {
     109                *o_read_only = false;
     110                return EOK;
     111        }
     112
     113        uint32_t incompatible_features;
     114        incompatible_features = ext4_superblock_get_features_incompatible(fs->superblock);
     115        incompatible_features &= ~EXT4_FEATURE_INCOMPAT_SUPP;
     116        if (incompatible_features > 0) {
     117                *o_read_only = true;
     118                return ENOTSUP;
     119        }
     120
     121        uint32_t compatible_read_only;
     122        compatible_read_only = ext4_superblock_get_features_read_only(fs->superblock);
     123        compatible_read_only &= ~EXT4_FEATURE_RO_COMPAT_SUPP;
     124        if (compatible_read_only > 0) {
     125                *o_read_only = true;
     126        }
     127
    107128        return EOK;
    108129}
Note: See TracChangeset for help on using the changeset viewer.