• Home
  • Raw
  • Download

Lines Matching refs:bb

36 	ext2_u32_list	bb;  in make_u32_list()  local
39 retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_list), &bb); in make_u32_list()
42 memset(bb, 0, sizeof(struct ext2_struct_u32_list)); in make_u32_list()
43 bb->magic = EXT2_ET_MAGIC_BADBLOCKS_LIST; in make_u32_list()
44 bb->size = size ? size : 10; in make_u32_list()
45 bb->num = num; in make_u32_list()
46 retval = ext2fs_get_array(bb->size, sizeof(blk_t), &bb->list); in make_u32_list()
48 ext2fs_free_mem(&bb); in make_u32_list()
52 memcpy(bb->list, list, bb->size * sizeof(blk_t)); in make_u32_list()
54 memset(bb->list, 0, bb->size * sizeof(blk_t)); in make_u32_list()
55 *ret = bb; in make_u32_list()
108 errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk) in ext2fs_u32_list_add() argument
114 EXT2_CHECK_MAGIC(bb, EXT2_ET_MAGIC_BADBLOCKS_LIST); in ext2fs_u32_list_add()
116 if (bb->num >= bb->size) { in ext2fs_u32_list_add()
117 old_size = bb->size * sizeof(__u32); in ext2fs_u32_list_add()
118 bb->size += 100; in ext2fs_u32_list_add()
119 retval = ext2fs_resize_mem(old_size, bb->size * sizeof(__u32), in ext2fs_u32_list_add()
120 &bb->list); in ext2fs_u32_list_add()
122 bb->size -= 100; in ext2fs_u32_list_add()
130 i = bb->num-1; in ext2fs_u32_list_add()
131 if ((bb->num != 0) && (bb->list[i] == blk)) in ext2fs_u32_list_add()
133 if ((bb->num == 0) || (bb->list[i] < blk)) { in ext2fs_u32_list_add()
134 bb->list[bb->num++] = blk; in ext2fs_u32_list_add()
138 j = bb->num; in ext2fs_u32_list_add()
139 for (i=0; i < bb->num; i++) { in ext2fs_u32_list_add()
140 if (bb->list[i] == blk) in ext2fs_u32_list_add()
142 if (bb->list[i] > blk) { in ext2fs_u32_list_add()
147 for (i=bb->num; i > j; i--) in ext2fs_u32_list_add()
148 bb->list[i] = bb->list[i-1]; in ext2fs_u32_list_add()
149 bb->list[j] = blk; in ext2fs_u32_list_add()
150 bb->num++; in ext2fs_u32_list_add()
154 errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb, blk_t blk) in ext2fs_badblocks_list_add() argument
156 return ext2fs_u32_list_add((ext2_u32_list) bb, (__u32) blk); in ext2fs_badblocks_list_add()
163 int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk) in ext2fs_u32_list_find() argument
167 if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) in ext2fs_u32_list_find()
170 if (bb->num == 0) in ext2fs_u32_list_find()
174 high = bb->num-1; in ext2fs_u32_list_find()
175 if (blk == bb->list[low]) in ext2fs_u32_list_find()
177 if (blk == bb->list[high]) in ext2fs_u32_list_find()
184 if (blk == bb->list[mid]) in ext2fs_u32_list_find()
186 if (blk < bb->list[mid]) in ext2fs_u32_list_find()
198 int ext2fs_u32_list_test(ext2_u32_list bb, __u32 blk) in ext2fs_u32_list_test() argument
200 if (ext2fs_u32_list_find(bb, blk) < 0) in ext2fs_u32_list_test()
206 int ext2fs_badblocks_list_test(ext2_badblocks_list bb, blk_t blk) in ext2fs_badblocks_list_test() argument
208 return ext2fs_u32_list_test((ext2_u32_list) bb, (__u32) blk); in ext2fs_badblocks_list_test()
215 int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk) in ext2fs_u32_list_del() argument
219 if (bb->num == 0) in ext2fs_u32_list_del()
222 remloc = ext2fs_u32_list_find(bb, blk); in ext2fs_u32_list_del()
226 for (i = remloc ; i < bb->num-1; i++) in ext2fs_u32_list_del()
227 bb->list[i] = bb->list[i+1]; in ext2fs_u32_list_del()
228 bb->num--; in ext2fs_u32_list_del()
232 void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk) in ext2fs_badblocks_list_del() argument
234 ext2fs_u32_list_del(bb, blk); in ext2fs_badblocks_list_del()
237 errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb, in ext2fs_u32_list_iterate_begin() argument
243 EXT2_CHECK_MAGIC(bb, EXT2_ET_MAGIC_BADBLOCKS_LIST); in ext2fs_u32_list_iterate_begin()
250 iter->bb = bb; in ext2fs_u32_list_iterate_begin()
256 errcode_t ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb, in ext2fs_badblocks_list_iterate_begin() argument
259 return ext2fs_u32_list_iterate_begin((ext2_u32_list) bb, in ext2fs_badblocks_list_iterate_begin()
266 ext2_u32_list bb; in ext2fs_u32_list_iterate() local
271 bb = iter->bb; in ext2fs_u32_list_iterate()
273 if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) in ext2fs_u32_list_iterate()
276 if (iter->ptr < bb->num) { in ext2fs_u32_list_iterate()
277 *blk = bb->list[iter->ptr++]; in ext2fs_u32_list_iterate()
296 iter->bb = 0; in ext2fs_u32_list_iterate_end()
325 int ext2fs_u32_list_count(ext2_u32_list bb) in ext2fs_u32_list_count() argument
327 return bb->num; in ext2fs_u32_list_count()