diff options
Diffstat (limited to 'fs/udf/udf_sb.h')
-rw-r--r-- | fs/udf/udf_sb.h | 90 |
1 files changed, 4 insertions, 86 deletions
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 3c2982017c6d..737d1c604eea 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h | |||
@@ -26,6 +26,8 @@ | |||
26 | #define UDF_FLAG_GID_IGNORE 14 | 26 | #define UDF_FLAG_GID_IGNORE 14 |
27 | #define UDF_FLAG_UID_SET 15 | 27 | #define UDF_FLAG_UID_SET 15 |
28 | #define UDF_FLAG_GID_SET 16 | 28 | #define UDF_FLAG_GID_SET 16 |
29 | #define UDF_FLAG_SESSION_SET 17 | ||
30 | #define UDF_FLAG_LASTBLOCK_SET 18 | ||
29 | 31 | ||
30 | #define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 | 32 | #define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 |
31 | #define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 | 33 | #define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 |
@@ -41,96 +43,12 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb) | |||
41 | return sb->s_fs_info; | 43 | return sb->s_fs_info; |
42 | } | 44 | } |
43 | 45 | ||
44 | #define UDF_SB_FREE(X)\ | 46 | struct 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 | |||
52 | #define UDF_SB_ALLOC_PARTMAPS(X,Y)\ | ||
53 | {\ | ||
54 | UDF_SB_PARTMAPS(X) = kmalloc(sizeof(struct udf_part_map) * Y, GFP_KERNEL);\ | ||
55 | if (UDF_SB_PARTMAPS(X) != NULL) {\ | ||
56 | UDF_SB_NUMPARTS(X) = Y;\ | ||
57 | memset(UDF_SB_PARTMAPS(X), 0x00, sizeof(struct udf_part_map) * Y);\ | ||
58 | } else {\ | ||
59 | UDF_SB_NUMPARTS(X) = 0;\ | ||
60 | udf_error(X, __FUNCTION__, "Unable to allocate space for %d partition maps", Y);\ | ||
61 | }\ | ||
62 | } | ||
63 | |||
64 | #define UDF_SB_ALLOC_BITMAP(X,Y,Z)\ | ||
65 | {\ | ||
66 | int nr_groups = ((UDF_SB_PARTLEN((X),(Y)) + (sizeof(struct spaceBitmapDesc) << 3) +\ | ||
67 | ((X)->s_blocksize * 8) - 1) / ((X)->s_blocksize * 8));\ | ||
68 | int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\ | ||
69 | if (size <= PAGE_SIZE)\ | ||
70 | UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap = kmalloc(size, GFP_KERNEL);\ | ||
71 | else\ | ||
72 | UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap = vmalloc(size);\ | ||
73 | if (UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap != NULL) {\ | ||
74 | memset(UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap, 0x00, size);\ | ||
75 | UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_block_bitmap =\ | ||
76 | (struct buffer_head **)(UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap + 1);\ | ||
77 | UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_nr_groups = nr_groups;\ | ||
78 | } else {\ | ||
79 | udf_error(X, __FUNCTION__, "Unable to allocate space for bitmap and %d buffer_head pointers", nr_groups);\ | ||
80 | }\ | ||
81 | } | ||
82 | 47 | ||
83 | #define UDF_SB_FREE_BITMAP(X,Y,Z)\ | 48 | int udf_compute_nr_groups(struct super_block *sb, u32 partition); |
84 | {\ | ||
85 | int i;\ | ||
86 | int nr_groups = UDF_SB_BITMAP_NR_GROUPS(X,Y,Z);\ | ||
87 | int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\ | ||
88 | for (i = 0; i < nr_groups; i++) {\ | ||
89 | if (UDF_SB_BITMAP(X,Y,Z,i))\ | ||
90 | brelse(UDF_SB_BITMAP(X,Y,Z,i));\ | ||
91 | }\ | ||
92 | if (size <= PAGE_SIZE)\ | ||
93 | kfree(UDF_SB_PARTMAPS(X)[Y].Z.s_bitmap);\ | ||
94 | else\ | ||
95 | vfree(UDF_SB_PARTMAPS(X)[Y].Z.s_bitmap);\ | ||
96 | } | ||
97 | 49 | ||
98 | #define UDF_QUERY_FLAG(X,Y) ( UDF_SB(X)->s_flags & ( 1 << (Y) ) ) | 50 | #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) ) ) | 51 | #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) ) ) | 52 | #define UDF_CLEAR_FLAG(X,Y) ( UDF_SB(X)->s_flags &= ~( 1 << (Y) ) ) |
101 | 53 | ||
102 | #define UDF_UPDATE_UDFREV(X,Y) ( ((Y) > UDF_SB_UDFREV(X)) ? UDF_SB_UDFREV(X) = (Y) : UDF_SB_UDFREV(X) ) | ||
103 | |||
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 | |||
136 | #endif /* __LINUX_UDF_SB_H */ | 54 | #endif /* __LINUX_UDF_SB_H */ |