-#define UDF_SB_ALLOC_PARTMAPS(X,Y)\
-{\
- struct udf_sb_info *sbi = UDF_SB(X);\
- sbi->s_partmaps = kmalloc(sizeof(struct udf_part_map) * Y, GFP_KERNEL);\
- if (sbi->s_partmaps != NULL) {\
- sbi->s_partitions = Y;\
- memset(sbi->s_partmaps, 0x00, sizeof(struct udf_part_map) * Y);\
- } else {\
- sbi->s_partitions = 0;\
- udf_error(X, __FUNCTION__, "Unable to allocate space for %d partition maps", Y);\
- }\
-}
-
-#define UDF_SB_ALLOC_BITMAP(X,Y,Z)\
-{\
- struct udf_sb_info *sbi = UDF_SB(X);\
- int nr_groups = ((sbi->s_partmaps[(Y)].s_partition_len + (sizeof(struct spaceBitmapDesc) << 3) +\
- ((X)->s_blocksize * 8) - 1) / ((X)->s_blocksize * 8));\
- int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\
- if (size <= PAGE_SIZE)\
- sbi->s_partmaps[(Y)].Z.s_bitmap = kmalloc(size, GFP_KERNEL);\
- else\
- sbi->s_partmaps[(Y)].Z.s_bitmap = vmalloc(size);\
- if (sbi->s_partmaps[(Y)].Z.s_bitmap != NULL) {\
- memset(sbi->s_partmaps[(Y)].Z.s_bitmap, 0x00, size);\
- sbi->s_partmaps[(Y)].Z.s_bitmap->s_block_bitmap =\
- (struct buffer_head **)(sbi->s_partmaps[(Y)].Z.s_bitmap + 1);\
- sbi->s_partmaps[(Y)].Z.s_bitmap->s_nr_groups = nr_groups;\
- } else {\
- udf_error(X, __FUNCTION__, "Unable to allocate space for bitmap and %d buffer_head pointers", nr_groups);\
- }\
-}
-
-#define UDF_SB_FREE_BITMAP(X,Y,Z)\
-{\
- int i;\
- int nr_groups = UDF_SB_BITMAP_NR_GROUPS(X,Y,Z);\
- int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\
- for (i = 0; i < nr_groups; i++) {\
- if (UDF_SB_BITMAP(X,Y,Z,i))\
- brelse(UDF_SB_BITMAP(X,Y,Z,i));\
- }\
- if (size <= PAGE_SIZE)\
- kfree(UDF_SB(X)->s_partmaps[Y].Z.s_bitmap);\
- else\
- vfree(UDF_SB(X)->s_partmaps[Y].Z.s_bitmap);\
-}