lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y742110t.fsf@frosties.localdomain>
Date:	Wed, 16 Jul 2008 14:12:02 +0200
From:	Goswin von Brederlow <goswin-v-b@....de>
To:	linux-ext4@...r.kernel.org
Subject: Suggestions for a 64bit bitmap api

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ