void ext2fs_swap_mmp(struct mmp_struct *mmp) { mmp->mmp_magic = ext2fs_swab32(mmp->mmp_magic); mmp->mmp_seq = ext2fs_swab32(mmp->mmp_seq); mmp->mmp_time = ext2fs_swab64(mmp->mmp_time); mmp->mmp_check_interval = ext2fs_swab16(mmp->mmp_check_interval); }
void ext2fs_swap_super(struct ext2_super_block * sb) { int i; sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count); sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count); sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count); sb->s_free_blocks_count = ext2fs_swab32(sb->s_free_blocks_count); sb->s_free_inodes_count = ext2fs_swab32(sb->s_free_inodes_count); sb->s_first_data_block = ext2fs_swab32(sb->s_first_data_block); sb->s_log_block_size = ext2fs_swab32(sb->s_log_block_size); sb->s_log_frag_size = ext2fs_swab32(sb->s_log_frag_size); sb->s_blocks_per_group = ext2fs_swab32(sb->s_blocks_per_group); sb->s_frags_per_group = ext2fs_swab32(sb->s_frags_per_group); sb->s_inodes_per_group = ext2fs_swab32(sb->s_inodes_per_group); sb->s_mtime = ext2fs_swab32(sb->s_mtime); sb->s_wtime = ext2fs_swab32(sb->s_wtime); sb->s_mnt_count = ext2fs_swab16(sb->s_mnt_count); sb->s_max_mnt_count = ext2fs_swab16(sb->s_max_mnt_count); sb->s_magic = ext2fs_swab16(sb->s_magic); sb->s_state = ext2fs_swab16(sb->s_state); sb->s_errors = ext2fs_swab16(sb->s_errors); sb->s_minor_rev_level = ext2fs_swab16(sb->s_minor_rev_level); sb->s_lastcheck = ext2fs_swab32(sb->s_lastcheck); sb->s_checkinterval = ext2fs_swab32(sb->s_checkinterval); sb->s_creator_os = ext2fs_swab32(sb->s_creator_os); sb->s_rev_level = ext2fs_swab32(sb->s_rev_level); sb->s_def_resuid = ext2fs_swab16(sb->s_def_resuid); sb->s_def_resgid = ext2fs_swab16(sb->s_def_resgid); sb->s_first_ino = ext2fs_swab32(sb->s_first_ino); sb->s_inode_size = ext2fs_swab16(sb->s_inode_size); sb->s_block_group_nr = ext2fs_swab16(sb->s_block_group_nr); sb->s_feature_compat = ext2fs_swab32(sb->s_feature_compat); sb->s_feature_incompat = ext2fs_swab32(sb->s_feature_incompat); sb->s_feature_ro_compat = ext2fs_swab32(sb->s_feature_ro_compat); sb->s_algorithm_usage_bitmap = ext2fs_swab32(sb->s_algorithm_usage_bitmap); sb->s_reserved_gdt_blocks = ext2fs_swab16(sb->s_reserved_gdt_blocks); sb->s_journal_inum = ext2fs_swab32(sb->s_journal_inum); sb->s_journal_dev = ext2fs_swab32(sb->s_journal_dev); sb->s_last_orphan = ext2fs_swab32(sb->s_last_orphan); sb->s_desc_size = ext2fs_swab16(sb->s_desc_size); sb->s_default_mount_opts = ext2fs_swab32(sb->s_default_mount_opts); sb->s_first_meta_bg = ext2fs_swab32(sb->s_first_meta_bg); sb->s_mkfs_time = ext2fs_swab32(sb->s_mkfs_time); sb->s_blocks_count_hi = ext2fs_swab32(sb->s_blocks_count_hi); sb->s_r_blocks_count_hi = ext2fs_swab32(sb->s_r_blocks_count_hi); sb->s_free_blocks_hi = ext2fs_swab32(sb->s_free_blocks_hi); sb->s_min_extra_isize = ext2fs_swab16(sb->s_min_extra_isize); sb->s_want_extra_isize = ext2fs_swab16(sb->s_want_extra_isize); sb->s_flags = ext2fs_swab32(sb->s_flags); sb->s_kbytes_written = ext2fs_swab64(sb->s_kbytes_written); for (i=0; i < 4; i++) sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]); for (i=0; i < 17; i++) sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]); }
void ext2fs_swap_super(struct ext2_super_block * sb) { int i; sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count); sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count); sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count); sb->s_free_blocks_count = ext2fs_swab32(sb->s_free_blocks_count); sb->s_free_inodes_count = ext2fs_swab32(sb->s_free_inodes_count); sb->s_first_data_block = ext2fs_swab32(sb->s_first_data_block); sb->s_log_block_size = ext2fs_swab32(sb->s_log_block_size); sb->s_log_frag_size = ext2fs_swab32(sb->s_log_frag_size); sb->s_blocks_per_group = ext2fs_swab32(sb->s_blocks_per_group); sb->s_frags_per_group = ext2fs_swab32(sb->s_frags_per_group); sb->s_inodes_per_group = ext2fs_swab32(sb->s_inodes_per_group); sb->s_mtime = ext2fs_swab32(sb->s_mtime); sb->s_wtime = ext2fs_swab32(sb->s_wtime); sb->s_mnt_count = ext2fs_swab16(sb->s_mnt_count); sb->s_max_mnt_count = ext2fs_swab16(sb->s_max_mnt_count); sb->s_magic = ext2fs_swab16(sb->s_magic); sb->s_state = ext2fs_swab16(sb->s_state); sb->s_errors = ext2fs_swab16(sb->s_errors); sb->s_minor_rev_level = ext2fs_swab16(sb->s_minor_rev_level); sb->s_lastcheck = ext2fs_swab32(sb->s_lastcheck); sb->s_checkinterval = ext2fs_swab32(sb->s_checkinterval); sb->s_creator_os = ext2fs_swab32(sb->s_creator_os); sb->s_rev_level = ext2fs_swab32(sb->s_rev_level); sb->s_def_resuid = ext2fs_swab16(sb->s_def_resuid); sb->s_def_resgid = ext2fs_swab16(sb->s_def_resgid); sb->s_first_ino = ext2fs_swab32(sb->s_first_ino); sb->s_inode_size = ext2fs_swab16(sb->s_inode_size); sb->s_block_group_nr = ext2fs_swab16(sb->s_block_group_nr); sb->s_feature_compat = ext2fs_swab32(sb->s_feature_compat); sb->s_feature_incompat = ext2fs_swab32(sb->s_feature_incompat); sb->s_feature_ro_compat = ext2fs_swab32(sb->s_feature_ro_compat); sb->s_algorithm_usage_bitmap = ext2fs_swab32(sb->s_algorithm_usage_bitmap); sb->s_reserved_gdt_blocks = ext2fs_swab16(sb->s_reserved_gdt_blocks); sb->s_journal_inum = ext2fs_swab32(sb->s_journal_inum); sb->s_journal_dev = ext2fs_swab32(sb->s_journal_dev); sb->s_last_orphan = ext2fs_swab32(sb->s_last_orphan); sb->s_desc_size = ext2fs_swab16(sb->s_desc_size); sb->s_default_mount_opts = ext2fs_swab32(sb->s_default_mount_opts); sb->s_first_meta_bg = ext2fs_swab32(sb->s_first_meta_bg); sb->s_mkfs_time = ext2fs_swab32(sb->s_mkfs_time); sb->s_blocks_count_hi = ext2fs_swab32(sb->s_blocks_count_hi); sb->s_r_blocks_count_hi = ext2fs_swab32(sb->s_r_blocks_count_hi); sb->s_free_blocks_hi = ext2fs_swab32(sb->s_free_blocks_hi); sb->s_min_extra_isize = ext2fs_swab16(sb->s_min_extra_isize); sb->s_want_extra_isize = ext2fs_swab16(sb->s_want_extra_isize); sb->s_flags = ext2fs_swab32(sb->s_flags); sb->s_kbytes_written = ext2fs_swab64(sb->s_kbytes_written); for (i=0; i < 4; i++) sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]); /* if journal backup is for a valid extent-based journal... */ if (!ext2fs_extent_header_verify(sb->s_jnl_blocks, sizeof(sb->s_jnl_blocks))) { /* ... swap only the journal i_size */ sb->s_jnl_blocks[16] = ext2fs_swab32(sb->s_jnl_blocks[16]); /* and the extent data is not swapped on read */ return; } /* direct/indirect journal: swap it all */ for (i=0; i < 17; i++) sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]); }