/* bitmap super size is 256, but we round up to a sector for alignment */
#define BM_SUPER_SIZE 512
#define MAX_DEVS ((int)(MAX_SB_SIZE - sizeof(struct mdp_superblock_1)) / 2)
+#define SUPER1_SIZE (MAX_SB_SIZE + BM_SUPER_SIZE \
+ + sizeof(struct misc_dev_info))
struct misc_dev_info {
__u64 device_size;
char defname[10];
int sbsize;
- if (posix_memalign((void**)&sb, 512, (MAX_SB_SIZE + BM_SUPER_SIZE +
- sizeof(struct misc_dev_info))) != 0) {
+ if (posix_memalign((void**)&sb, 512, SUPER1_SIZE) != 0) {
fprintf(stderr, Name
": %s could not allocate superblock\n", __func__);
return 0;
return 1;
if (!first) {
- if (posix_memalign((void**)&first, 512,
- MAX_SB_SIZE + BM_SUPER_SIZE +
- sizeof(struct misc_dev_info)) != 0) {
+ if (posix_memalign((void**)&first, 512, SUPER1_SIZE) != 0) {
fprintf(stderr, Name
": %s could not allocate superblock\n", __func__);
return 1;
}
- memcpy(first, second, MAX_SB_SIZE + BM_SUPER_SIZE +
- sizeof(struct misc_dev_info));
+ memcpy(first, second, SUPER1_SIZE);
st->sb = first;
return 0;
}
return 1;
}
- if (posix_memalign((void**)&super, 512,
- MAX_SB_SIZE + BM_SUPER_SIZE +
- sizeof(struct misc_dev_info)) != 0) {
+ if (posix_memalign((void**)&super, 512, SUPER1_SIZE) != 0) {
fprintf(stderr, Name ": %s could not allocate superblock\n",
__func__);
return 1;