Changeset eef306c in mainline
- Timestamp:
- 2011-03-09T16:16:27Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 868ef40
- Parents:
- e2abab03
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext2/libext2_filesystem.c
re2abab03 reef306c 109 109 110 110 /** 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 */ 117 int 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 /** 111 148 * Get a reference to block descriptor 112 149 * -
uspace/lib/ext2/libext2_filesystem.h
re2abab03 reef306c 52 52 #define EXT2_REV0_INODE_SIZE 128 53 53 54 #define EXT2_FEATURE_RO_SPARSE_SUPERBLOCK 1 55 #define EXT2_FEATURE_RO_LARGE_FILE 2 56 #define EXT2_FEATURE_I_TYPE_IN_DIR 2 57 58 #define EXT2_SUPPORTED_INCOMPATIBLE_FEATURES EXT2_FEATURE_I_TYPE_IN_DIR 59 #define EXT2_SUPPORTED_READ_ONLY_FEATURES 0 60 54 61 extern int ext2_filesystem_init(ext2_filesystem_t *, devmap_handle_t); 55 62 extern int ext2_filesystem_check_sanity(ext2_filesystem_t *); 63 extern int ext2_filesystem_check_flags(ext2_filesystem_t *, bool *); 56 64 extern int ext2_filesystem_get_block_group_ref(ext2_filesystem_t *, uint32_t, 57 65 ext2_block_group_ref_t **); -
uspace/lib/ext2/libext2_superblock.c
re2abab03 reef306c 258 258 259 259 /** 260 * Get compatible features flags 261 * 262 * @param sb pointer to superblock 263 */ 264 inline uint32_t ext2_superblock_get_features_compatible(ext2_superblock_t *sb) 265 { 266 return uint32_t_le2host(sb->features_compatible); 267 } 268 269 /** 270 * Get incompatible features flags 271 * 272 * @param sb pointer to superblock 273 */ 274 inline uint32_t ext2_superblock_get_features_incompatible(ext2_superblock_t *sb) 275 { 276 return uint32_t_le2host(sb->features_incompatible); 277 } 278 279 /** 280 * Get read-only compatible features flags 281 * 282 * @param sb pointer to superblock 283 */ 284 inline uint32_t ext2_superblock_get_features_read_only(ext2_superblock_t *sb) 285 { 286 return uint32_t_le2host(sb->features_read_only); 287 } 288 289 /** 260 290 * Compute count of block groups present in the filesystem 261 291 * -
uspace/lib/ext2/libext2_superblock.h
re2abab03 reef306c 64 64 uint32_t first_inode; 65 65 uint16_t inode_size; 66 uint8_t unused5[14]; 66 uint16_t unused5; 67 uint32_t features_compatible; 68 uint32_t features_incompatible; 69 uint32_t features_read_only; 67 70 uint8_t uuid[16]; // UUID TODO: Create a library for UUIDs 68 71 uint8_t volume_name[16]; … … 103 106 inline uint32_t ext2_superblock_get_block_group_count(ext2_superblock_t *); 104 107 inline uint32_t ext2_superblock_get_inodes_per_group(ext2_superblock_t *); 108 inline uint32_t ext2_superblock_get_features_compatible(ext2_superblock_t *); 109 inline uint32_t ext2_superblock_get_features_incompatible(ext2_superblock_t *); 110 inline uint32_t ext2_superblock_get_features_read_only(ext2_superblock_t *); 105 111 106 112 extern int ext2_superblock_read_direct(devmap_handle_t, ext2_superblock_t **); -
uspace/srv/fs/ext2fs/ext2fs_ops.c
re2abab03 reef306c 484 484 ext2_filesystem_t *fs; 485 485 ext2fs_instance_t *inst; 486 bool read_only; 486 487 487 488 /* Accept the mount options */ … … 522 523 /* Do some sanity checking */ 523 524 rc = ext2_filesystem_check_sanity(fs); 525 if (rc != EOK) { 526 ext2_filesystem_fini(fs); 527 free(fs); 528 free(inst); 529 async_answer_0(rid, rc); 530 return; 531 } 532 533 /* Check flags */ 534 rc = ext2_filesystem_check_flags(fs, &read_only); 524 535 if (rc != EOK) { 525 536 ext2_filesystem_fini(fs);
Note:
See TracChangeset
for help on using the changeset viewer.