History

Fix issues with big-endian system

branzhu committed 9 years ago

Commit 02eb0501 parent 9c59c0b3 files · +9 −8Browse files

Unified · Split

3 files
  1. include/ext4_types.h +7 −6
  2. src/ext4_fs.c +1 −1
  3. src/ext4_mkfs.c +1 −1
include/ext4_types.h+7−6
@@ -698,19 +698,20 @@ struct ext4_extent_header { · 697 unmodified lines
698 ((struct ext4_extent_index *)(((char *)(__hdr__)) + \698 ((struct ext4_extent_index *)(((char *)(__hdr__)) + \
699 sizeof(struct ext4_extent_header)))699 sizeof(struct ext4_extent_header)))
700#define EXT_HAS_FREE_INDEX(__path__) \700#define EXT_HAS_FREE_INDEX(__path__) \
701 ((__path__)->header->entries_count < (__path__)->header->max_entries_count)701 (to_le16((__path__)->header->entries_count) < \
702 to_le16((__path__)->header->max_entries_count))
702#define EXT_LAST_EXTENT(__hdr__) \703#define EXT_LAST_EXTENT(__hdr__) \
703 (EXT_FIRST_EXTENT((__hdr__)) + (__hdr__)->entries_count - 1)704 (EXT_FIRST_EXTENT((__hdr__)) + to_le16((__hdr__)->entries_count) - 1)
704#define EXT_LAST_INDEX(__hdr__) \705#define EXT_LAST_INDEX(__hdr__) \
705 (EXT_FIRST_INDEX((__hdr__)) + (__hdr__)->entries_count - 1)706 (EXT_FIRST_INDEX((__hdr__)) + to_le16((__hdr__)->entries_count) - 1)
706#define EXT_MAX_EXTENT(__hdr__) \707#define EXT_MAX_EXTENT(__hdr__) \
707 (EXT_FIRST_EXTENT((__hdr__)) + (__hdr__)->max_entries_count - 1)708 (EXT_FIRST_EXTENT((__hdr__)) + to_le16((__hdr__)->max_entries_count) - 1)
708#define EXT_MAX_INDEX(__hdr__) \709#define EXT_MAX_INDEX(__hdr__) \
709 (EXT_FIRST_INDEX((__hdr__)) + (__hdr__)->max_entries_count - 1)710 (EXT_FIRST_INDEX((__hdr__)) + to_le16((__hdr__)->max_entries_count) - 1)
710 711
711#define EXT4_EXTENT_TAIL_OFFSET(hdr) \712#define EXT4_EXTENT_TAIL_OFFSET(hdr) \
712 (sizeof(struct ext4_extent_header) + \713 (sizeof(struct ext4_extent_header) + \
713 (sizeof(struct ext4_extent) * (hdr)->max_entries_count))714 (sizeof(struct ext4_extent) * to_le16((hdr)->max_entries_count)))
714 715
715/*716/*
716 * ext4_ext_next_allocated_block:717 * ext4_ext_next_allocated_block:
src/ext4_fs.c+1−1
@@ -431,7 +431,7 @@ static int ext4_fs_init_inode_table(struct ext4_block_group_ref *bg_ref) · 430 unmodified lines
431 struct ext4_sblock *sb = &bg_ref->fs->sb;431 struct ext4_sblock *sb = &bg_ref->fs->sb;
432 struct ext4_bgroup *bg = bg_ref->block_group;432 struct ext4_bgroup *bg = bg_ref->block_group;
433 433
434 uint32_t inode_size = ext4_get32(sb, inode_size);434 uint32_t inode_size = ext4_get16(sb, inode_size);
435 uint32_t block_size = ext4_sb_get_block_size(sb);435 uint32_t block_size = ext4_sb_get_block_size(sb);
436 uint32_t inodes_per_block = block_size / inode_size;436 uint32_t inodes_per_block = block_size / inode_size;
437 uint32_t inodes_in_group = ext4_inodes_in_group_cnt(sb, bg_ref->index);437 uint32_t inodes_in_group = ext4_inodes_in_group_cnt(sb, bg_ref->index);
src/ext4_mkfs.c+1−1
@@ -388,7 +388,7 @@ static int write_bgroups(struct ext4_blockdev *bd, struct fs_aux_info *aux_info, · 387 unmodified lines
388 bg_free_blk);388 bg_free_blk);
389 389
390 ext4_bg_set_free_inodes_count(bg_desc,390 ext4_bg_set_free_inodes_count(bg_desc,
391 aux_info->sb, aux_info->sb->inodes_per_group);391 aux_info->sb, to_le32(aux_info->sb->inodes_per_group));
392 392
393 ext4_bg_set_used_dirs_count(bg_desc, aux_info->sb, 0);393 ext4_bg_set_used_dirs_count(bg_desc, aux_info->sb, 0);
394 394

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t