Hi, which api would you prefer? Option 1 ======== typedef enum {TYPE1, TYPE2} bitmap_type; struct ext2fs_abstract_bitmap { bitmap_type type; }; struct ext2fs_type1_bitmap { bitmap_type type; type1_data data; }; struct ext2fs_type2_bitmap { bitmap_type type; type2_data data; }; int ext2fs_fast_test_block_type1_bitmap(ext2fs_type1_bitmap *map, blk64_t i); int ext2fs_fast_test_block_type2_bitmap(ext2fs_type2_bitmap *map, blk64_t i); int ext2fs_fast_test_block_abstract_bitmap(ext2fs_abstract_bitmap *map, blk64_t i) { switch(map->type) { case TYPE1: return ext2fs_fast_test_block_type1_bitmap((ext2fs_type1_bitmap*)map, i); case TYPE2: return ext2fs_fast_test_block_type2_bitmap((ext2fs_type2_bitmap*)map, i); }; return 0; } Option 2 ======== struct ext2fs_abstract_bitmap { int (*fast_test_block)(void *map, blk64_t i); void *map; }; int ext2fs_fast_test_block_abstract_bitmap(ext2fs_abstract_bitmap *map, blk64_t i) { return map->fast_test_block(map->map, i); } Option 3 ======== struct ext2fs_bitmap_ops { int (*fast_test_block)(ext2fs_abstract_bitmap *map, blk64_t i); }; struct ext2fs_abstract_bitmap { ext2fs_bitmap_ops *ops; }; struct ext2fs_type1_bitmap { ext2fs_bitmap_ops *ops; type1_data data; }; struct ext2fs_type2_bitmap { ext2fs_bitmap_ops *ops; type2_data data; }; int ext2fs_fast_test_block_abstract_bitmap(ext2fs_abstract_bitmap *map, blk64_t i) { return map->ops->fast_test_block(map, i); } Or something completly different? MfG Goswin -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html