// Checksum @@ ext2_filsys fs; expression group, flag; @@ -fs->group_desc[group].bg_checksum +ext2fs_bg_checksum(fs, group) // Get/set block/inode counts @@ ext2_filsys fs; expression group; identifier blk; expression E; @@ ( // Free blocks -blk = fs->group_desc[group].bg_free_blocks_count +blk = ext2fs_bg_free_blocks_count(fs, group) | -fs->group_desc[group].bg_free_blocks_count = E +ext2fs_bg_free_blocks_count_set(fs, group, E) | // Free inodes -blk = fs->group_desc[group].bg_free_inodes_count +blk = ext2fs_bg_free_inodes_count(fs, group) | -fs->group_desc[group].bg_free_inodes_count = E +ext2fs_bg_free_inodes_count_set(fs, group, E) | // Used dirs -blk = fs->group_desc[group].bg_used_dirs_count +blk = ext2fs_bg_used_dirs_count(fs, group) | -fs->group_desc[group].bg_used_dirs_count = E +ext2fs_bg_used_dirs_count_set(fs, group, E) | // Unused inode table blocks -blk = fs->group_desc[group].bg_itable_unused +blk = ext2fs_bg_itable_unused(fs, group) | -fs->group_desc[group].bg_itable_unused = E +ext2fs_bg_itable_unused_set(fs, group, E) ) // Increment/decrement block/inode counts // I tried to create an isomorphism for this, but I failed. @@ ext2_filsys fs; expression group, i; @@ ( // Free blocks -fs->group_desc[group].bg_free_blocks_count++ +ext2fs_bg_free_blocks_count_set(fs, group, ext2fs_bg_free_blocks_count(fs, group)+1) | -fs->group_desc[group].bg_free_blocks_count-- +ext2fs_bg_free_blocks_count_set(fs, group, ext2fs_bg_free_blocks_count(fs, group)-1) | -fs->group_desc[group].bg_free_blocks_count += i +ext2fs_bg_free_blocks_count_set(fs, group, ext2fs_bg_free_blocks_count(fs, group)+i) | -fs->group_desc[group].bg_free_blocks_count -= i +ext2fs_bg_free_blocks_count_set(fs, group, ext2fs_bg_free_blocks_count(fs, group)-i) | // Free inodes -fs->group_desc[group].bg_free_inodes_count++ +ext2fs_bg_free_inodes_count_set(fs, group, ext2fs_bg_free_inodes_count(fs, group)+1) | -fs->group_desc[group].bg_free_inodes_count-- +ext2fs_bg_free_inodes_count_set(fs, group, ext2fs_bg_free_inodes_count(fs, group)-1) | -fs->group_desc[group].bg_free_inodes_count += i +ext2fs_bg_free_inodes_count_set(fs, group, ext2fs_bg_free_inodes_count(fs, group)+i) | -fs->group_desc[group].bg_free_inodes_count -= i +ext2fs_bg_free_inodes_count_set(fs, group, ext2fs_bg_free_inodes_count(fs, group)-i) | // Used dirs -fs->group_desc[group].bg_used_dirs_count++ +ext2fs_bg_used_dirs_count_set(fs, group, ext2fs_bg_used_dirs_count(fs, group)+1) | -fs->group_desc[group].bg_used_dirs_count-- +ext2fs_bg_used_dirs_count_set(fs, group, ext2fs_bg_used_dirs_count(fs, group)-1) | -fs->group_desc[group].bg_used_dirs_count += i +ext2fs_bg_used_dirs_count_set(fs, group, ext2fs_bg_used_dirs_count(fs, group)+i) | -fs->group_desc[group].bg_used_dirs_count -= i +ext2fs_bg_used_dirs_count_set(fs, group, ext2fs_bg_used_dirs_count(fs, group)-i) | // Unused inode table blocks -fs->group_desc[group].bg_itable_unused++ +ext2fs_bg_itable_unused_set(fs, group, ext2fs_bg_itable_unused(fs, group)+1) | -fs->group_desc[group].bg_itable_unused-- +ext2fs_bg_itable_unused_set(fs, group, ext2fs_bg_itable_unused(fs, group)-1) | -fs->group_desc[group].bg_itable_unused += i +ext2fs_bg_itable_unused_set(fs, group, ext2fs_bg_itable_unused(fs, group)+i) | -fs->group_desc[group].bg_itable_unused -= i +ext2fs_bg_itable_unused_set(fs, group, ext2fs_bg_itable_unused(fs, group)-i) ) // Get a pointer to a whole dang descriptor @@ ext2_filsys fs; expression group; @@ -&fs->group_desc[group] +ext2fs_group_desc(fs, fs->group_desc, group) // Block group flags @@ ext2_filsys fs; expression group, flag; @@ ( -fs->group_desc[group].bg_flags & flag +ext2fs_bg_flag_test(fs, group, flag) | -fs->group_desc[group].bg_flags &= ~flag +ext2fs_bg_flag_clear(fs, group, flag) | -fs->group_desc[group].bg_flags |= flag +ext2fs_bg_flag_set(fs, group, flag) | -fs->group_desc[group].bg_flags = 0 +ext2fs_bg_flags_clear(fs, group, 0) ) // Block group bitmap/table locations @@ ext2_filsys fs; expression group, E; @@ ( -fs->group_desc[group].bg_block_bitmap = E +ext2fs_block_bitmap_loc_set(fs, group, E) | -fs->group_desc[group].bg_block_bitmap +ext2fs_block_bitmap_loc(fs, group) | -fs->group_desc[group].bg_inode_bitmap = E +ext2fs_inode_bitmap_loc_set(fs, group, E) | -fs->group_desc[group].bg_inode_bitmap +ext2fs_inode_bitmap_loc(fs, group) | -fs->group_desc[group].bg_inode_table = E +ext2fs_inode_table_loc_set(fs, group, E) | -fs->group_desc[group].bg_inode_table +ext2fs_inode_table_loc(fs, group) | -fs->group_desc[group].bg_free_blocks = E +ext2fs_bg_free_blocks_count_set(fs, group, E) | -fs->group_desc[group].bg_free_blocks_count +ext2fs_bg_free_blocks_count(fs, group) | -fs->group_desc[group].bg_free_inodes_count = E +ext2fs_bg_free_inodes_count_set(fs, group, E) | -fs->group_desc[group].bg_free_inodes_count +ext2fs_bg_free_inodes_count(fs, group) | -fs->group_desc[group].bg_used_dirs_count = E +ext2fs_bg_used_dirs_count_set(fs, group, E) | -fs->group_desc[group].bg_used_dirs_count +ext2fs_bg_used_dirs_count(fs, group) | -fs->group_desc[group].bg_itable_unused = E +ext2fs_bg_itable_unused_set(fs, group, E) | -fs->group_desc[group].bg_itable_unused +ext2fs_bg_itable_unused(fs, group) )