Lines Matching refs:ctx
16 void e2fsck_add_dx_dir(e2fsck_t ctx, ext2_ino_t ino, int num_blocks)
26 if (!ctx->dx_dir_info) {
27 ctx->dx_dir_info_count = 0;
28 ctx->dx_dir_info_size = 100; /* Guess */
29 ctx->dx_dir_info = (struct dx_dir_info *)
30 e2fsck_allocate_memory(ctx, ctx->dx_dir_info_size
35 if (ctx->dx_dir_info_count >= ctx->dx_dir_info_size) {
36 old_size = ctx->dx_dir_info_size * sizeof(struct dx_dir_info);
37 ctx->dx_dir_info_size += 10;
38 retval = ext2fs_resize_mem(old_size, ctx->dx_dir_info_size *
40 &ctx->dx_dir_info);
42 ctx->dx_dir_info_size -= 10;
56 if (ctx->dx_dir_info_count &&
57 ctx->dx_dir_info[ctx->dx_dir_info_count-1].ino >= ino) {
58 for (i = ctx->dx_dir_info_count-1; i > 0; i--)
59 if (ctx->dx_dir_info[i-1].ino < ino)
61 dir = &ctx->dx_dir_info[i];
63 for (j = ctx->dx_dir_info_count++; j > i; j--)
64 ctx->dx_dir_info[j] = ctx->dx_dir_info[j-1];
66 dir = &ctx->dx_dir_info[ctx->dx_dir_info_count++];
71 dir->dx_block = e2fsck_allocate_memory(ctx, num_blocks
81 struct dx_dir_info *e2fsck_get_dx_dir_info(e2fsck_t ctx, ext2_ino_t ino)
86 high = ctx->dx_dir_info_count-1;
87 if (!ctx->dx_dir_info)
89 if (ino == ctx->dx_dir_info[low].ino)
90 return &ctx->dx_dir_info[low];
91 if (ino == ctx->dx_dir_info[high].ino)
92 return &ctx->dx_dir_info[high];
98 if (ino == ctx->dx_dir_info[mid].ino)
99 return &ctx->dx_dir_info[mid];
100 if (ino < ctx->dx_dir_info[mid].ino)
111 void e2fsck_free_dx_dir_info(e2fsck_t ctx)
116 if (ctx->dx_dir_info) {
117 dir = ctx->dx_dir_info;
118 for (i=0; i < ctx->dx_dir_info_count; i++,dir++) {
124 ext2fs_free_mem(&ctx->dx_dir_info);
125 ctx->dx_dir_info = 0;
127 ctx->dx_dir_info_size = 0;
128 ctx->dx_dir_info_count = 0;
134 int e2fsck_get_num_dx_dirinfo(e2fsck_t ctx)
136 return ctx->dx_dir_info_count;
142 struct dx_dir_info *e2fsck_dx_dir_info_iter(e2fsck_t ctx, int *control)
144 if (*control >= ctx->dx_dir_info_count)
147 return(ctx->dx_dir_info + (*control)++);