aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/udf_sb.h
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-02-08 07:20:30 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:34 -0500
commit6c79e987d629cb0f8f7e2983725f4434a2dec66b (patch)
treeea2e17a12a0bdc5d68d2fe49941bfdf249e0f647 /fs/udf/udf_sb.h
parent3a71fc5de56338076fe99f24f50bccfebabefe18 (diff)
udf: remove some ugly macros
remove macros: - UDF_SB_PARTMAPS - UDF_SB_PARTTYPE - UDF_SB_PARTROOT - UDF_SB_PARTLEN - UDF_SB_PARTVSN - UDF_SB_PARTNUM - UDF_SB_TYPESPAR - UDF_SB_TYPEVIRT - UDF_SB_PARTFUNC - UDF_SB_PARTFLAGS - UDF_SB_VOLIDENT - UDF_SB_NUMPARTS - UDF_SB_PARTITION - UDF_SB_SESSION - UDF_SB_ANCHOR - UDF_SB_LASTBLOCK - UDF_SB_LVIDBH - UDF_SB_LVID - UDF_SB_UMASK - UDF_SB_GID - UDF_SB_UID - UDF_SB_RECORDTIME - UDF_SB_SERIALNUM - UDF_SB_UDFREV - UDF_SB_FLAGS - UDF_SB_VAT - UDF_UPDATE_UDFREV - UDF_SB_FREE and open code them convert UDF_SB_LVIDIU macro to udf_sb_lvidiu function rename some struct udf_sb_info fields: - s_volident to s_volume_ident - s_lastblock to s_last_block - s_lvidbh to s_lvid_bh - s_recordtime to s_record_time - s_serialnum to s_serial_number; - s_vat to s_vat_inode; Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Ben Fennema <bfennema@falcon.csc.calpoly.edu> Cc: Jan Kara <jack@suse.cz> Acked-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/udf_sb.h')
-rw-r--r--fs/udf/udf_sb.h75
1 files changed, 20 insertions, 55 deletions
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index 3c2982017c6d..92e6d75b0163 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -41,40 +41,36 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
41 return sb->s_fs_info; 41 return sb->s_fs_info;
42} 42}
43 43
44#define UDF_SB_FREE(X)\ 44struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi);
45{\
46 if (UDF_SB(X)) {\
47 kfree(UDF_SB_PARTMAPS(X));\
48 UDF_SB_PARTMAPS(X) = NULL;\
49 }\
50}
51 45
52#define UDF_SB_ALLOC_PARTMAPS(X,Y)\ 46#define UDF_SB_ALLOC_PARTMAPS(X,Y)\
53{\ 47{\
54 UDF_SB_PARTMAPS(X) = kmalloc(sizeof(struct udf_part_map) * Y, GFP_KERNEL);\ 48 struct udf_sb_info *sbi = UDF_SB(X);\
55 if (UDF_SB_PARTMAPS(X) != NULL) {\ 49 sbi->s_partmaps = kmalloc(sizeof(struct udf_part_map) * Y, GFP_KERNEL);\
56 UDF_SB_NUMPARTS(X) = Y;\ 50 if (sbi->s_partmaps != NULL) {\
57 memset(UDF_SB_PARTMAPS(X), 0x00, sizeof(struct udf_part_map) * Y);\ 51 sbi->s_partitions = Y;\
52 memset(sbi->s_partmaps, 0x00, sizeof(struct udf_part_map) * Y);\
58 } else {\ 53 } else {\
59 UDF_SB_NUMPARTS(X) = 0;\ 54 sbi->s_partitions = 0;\
60 udf_error(X, __FUNCTION__, "Unable to allocate space for %d partition maps", Y);\ 55 udf_error(X, __FUNCTION__, "Unable to allocate space for %d partition maps", Y);\
61 }\ 56 }\
62} 57}
63 58
64#define UDF_SB_ALLOC_BITMAP(X,Y,Z)\ 59#define UDF_SB_ALLOC_BITMAP(X,Y,Z)\
65{\ 60{\
66 int nr_groups = ((UDF_SB_PARTLEN((X),(Y)) + (sizeof(struct spaceBitmapDesc) << 3) +\ 61 struct udf_sb_info *sbi = UDF_SB(X);\
62 int nr_groups = ((sbi->s_partmaps[(Y)].s_partition_len + (sizeof(struct spaceBitmapDesc) << 3) +\
67 ((X)->s_blocksize * 8) - 1) / ((X)->s_blocksize * 8));\ 63 ((X)->s_blocksize * 8) - 1) / ((X)->s_blocksize * 8));\
68 int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\ 64 int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\
69 if (size <= PAGE_SIZE)\ 65 if (size <= PAGE_SIZE)\
70 UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap = kmalloc(size, GFP_KERNEL);\ 66 sbi->s_partmaps[(Y)].Z.s_bitmap = kmalloc(size, GFP_KERNEL);\
71 else\ 67 else\
72 UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap = vmalloc(size);\ 68 sbi->s_partmaps[(Y)].Z.s_bitmap = vmalloc(size);\
73 if (UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap != NULL) {\ 69 if (sbi->s_partmaps[(Y)].Z.s_bitmap != NULL) {\
74 memset(UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap, 0x00, size);\ 70 memset(sbi->s_partmaps[(Y)].Z.s_bitmap, 0x00, size);\
75 UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_block_bitmap =\ 71 sbi->s_partmaps[(Y)].Z.s_bitmap->s_block_bitmap =\
76 (struct buffer_head **)(UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap + 1);\ 72 (struct buffer_head **)(sbi->s_partmaps[(Y)].Z.s_bitmap + 1);\
77 UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_nr_groups = nr_groups;\ 73 sbi->s_partmaps[(Y)].Z.s_bitmap->s_nr_groups = nr_groups;\
78 } else {\ 74 } else {\
79 udf_error(X, __FUNCTION__, "Unable to allocate space for bitmap and %d buffer_head pointers", nr_groups);\ 75 udf_error(X, __FUNCTION__, "Unable to allocate space for bitmap and %d buffer_head pointers", nr_groups);\
80 }\ 76 }\
@@ -90,47 +86,16 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
90 brelse(UDF_SB_BITMAP(X,Y,Z,i));\ 86 brelse(UDF_SB_BITMAP(X,Y,Z,i));\
91 }\ 87 }\
92 if (size <= PAGE_SIZE)\ 88 if (size <= PAGE_SIZE)\
93 kfree(UDF_SB_PARTMAPS(X)[Y].Z.s_bitmap);\ 89 kfree(UDF_SB(X)->s_partmaps[Y].Z.s_bitmap);\
94 else\ 90 else\
95 vfree(UDF_SB_PARTMAPS(X)[Y].Z.s_bitmap);\ 91 vfree(UDF_SB(X)->s_partmaps[Y].Z.s_bitmap);\
96} 92}
97 93
98#define UDF_QUERY_FLAG(X,Y) ( UDF_SB(X)->s_flags & ( 1 << (Y) ) ) 94#define UDF_QUERY_FLAG(X,Y) ( UDF_SB(X)->s_flags & ( 1 << (Y) ) )
99#define UDF_SET_FLAG(X,Y) ( UDF_SB(X)->s_flags |= ( 1 << (Y) ) ) 95#define UDF_SET_FLAG(X,Y) ( UDF_SB(X)->s_flags |= ( 1 << (Y) ) )
100#define UDF_CLEAR_FLAG(X,Y) ( UDF_SB(X)->s_flags &= ~( 1 << (Y) ) ) 96#define UDF_CLEAR_FLAG(X,Y) ( UDF_SB(X)->s_flags &= ~( 1 << (Y) ) )
101 97
102#define UDF_UPDATE_UDFREV(X,Y) ( ((Y) > UDF_SB_UDFREV(X)) ? UDF_SB_UDFREV(X) = (Y) : UDF_SB_UDFREV(X) ) 98#define UDF_SB_BITMAP(X,Y,Z,I) ( UDF_SB(X)->s_partmaps[(Y)].Z.s_bitmap->s_block_bitmap[I] )
103 99#define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( UDF_SB(X)->s_partmaps[(Y)].Z.s_bitmap->s_nr_groups )
104#define UDF_SB_PARTMAPS(X) ( UDF_SB(X)->s_partmaps )
105#define UDF_SB_PARTTYPE(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_type )
106#define UDF_SB_PARTROOT(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_root )
107#define UDF_SB_PARTLEN(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_len )
108#define UDF_SB_PARTVSN(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_volumeseqnum )
109#define UDF_SB_PARTNUM(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_num )
110#define UDF_SB_TYPESPAR(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_type_specific.s_sparing )
111#define UDF_SB_TYPEVIRT(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_type_specific.s_virtual )
112#define UDF_SB_PARTFUNC(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_func )
113#define UDF_SB_PARTFLAGS(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_flags )
114#define UDF_SB_BITMAP(X,Y,Z,I) ( UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_block_bitmap[I] )
115#define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_nr_groups )
116
117#define UDF_SB_VOLIDENT(X) ( UDF_SB(X)->s_volident )
118#define UDF_SB_NUMPARTS(X) ( UDF_SB(X)->s_partitions )
119#define UDF_SB_PARTITION(X) ( UDF_SB(X)->s_partition )
120#define UDF_SB_SESSION(X) ( UDF_SB(X)->s_session )
121#define UDF_SB_ANCHOR(X) ( UDF_SB(X)->s_anchor )
122#define UDF_SB_LASTBLOCK(X) ( UDF_SB(X)->s_lastblock )
123#define UDF_SB_LVIDBH(X) ( UDF_SB(X)->s_lvidbh )
124#define UDF_SB_LVID(X) ( (struct logicalVolIntegrityDesc *)UDF_SB_LVIDBH(X)->b_data )
125#define UDF_SB_LVIDIU(X) ( (struct logicalVolIntegrityDescImpUse *)&(UDF_SB_LVID(X)->impUse[le32_to_cpu(UDF_SB_LVID(X)->numOfPartitions) * 2 * sizeof(uint32_t)/sizeof(uint8_t)]) )
126
127#define UDF_SB_UMASK(X) ( UDF_SB(X)->s_umask )
128#define UDF_SB_GID(X) ( UDF_SB(X)->s_gid )
129#define UDF_SB_UID(X) ( UDF_SB(X)->s_uid )
130#define UDF_SB_RECORDTIME(X) ( UDF_SB(X)->s_recordtime )
131#define UDF_SB_SERIALNUM(X) ( UDF_SB(X)->s_serialnum )
132#define UDF_SB_UDFREV(X) ( UDF_SB(X)->s_udfrev )
133#define UDF_SB_FLAGS(X) ( UDF_SB(X)->s_flags )
134#define UDF_SB_VAT(X) ( UDF_SB(X)->s_vat )
135 100
136#endif /* __LINUX_UDF_SB_H */ 101#endif /* __LINUX_UDF_SB_H */