Changeset eef306c in mainline for uspace/lib/ext2/libext2_filesystem.c


Ignore:
Timestamp:
2011-03-09T16:16:27Z (14 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
868ef40
Parents:
e2abab03
Message:

Check filesystem feature flags when mounting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext2/libext2_filesystem.c

    re2abab03 reef306c  
    109109
    110110/**
     111 * Check feature flags
     112 *
     113 * @param fs Pointer to ext2_filesystem_t to check
     114 * @param read_only bool to set to true if the fs needs to be read-only
     115 * @return EOK on success or negative error code on failure
     116 */
     117int ext2_filesystem_check_flags(ext2_filesystem_t *fs, bool *o_read_only)
     118{
     119        // feature flags are present in rev 1 and later
     120        if (ext2_superblock_get_rev_major(fs->superblock) == 0) {
     121                *o_read_only = false;
     122                return 0;
     123        }
     124       
     125        uint32_t incompatible;
     126        uint32_t read_only;
     127       
     128        incompatible = ext2_superblock_get_features_incompatible(fs->superblock);
     129        read_only = ext2_superblock_get_features_read_only(fs->superblock);
     130       
     131        // unset any supported features
     132        incompatible &= ~EXT2_SUPPORTED_INCOMPATIBLE_FEATURES;
     133        read_only &= ~EXT2_SUPPORTED_READ_ONLY_FEATURES;
     134       
     135        if (incompatible > 0) {
     136                *o_read_only = true;
     137                return ENOTSUP;
     138        }
     139       
     140        if (read_only > 0) {
     141                *o_read_only = true;
     142        }
     143       
     144        return EOK;
     145}
     146
     147/**
    111148 * Get a reference to block descriptor
    112149 *
Note: See TracChangeset for help on using the changeset viewer.