• Home
  • Raw
  • Download

Lines Matching refs:dir_info

20 	struct dir_info *array;
21 struct dir_info *last_lookup;
37 static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir);
41 struct dir_info_db *db = ctx->dir_info; in setup_tdb()
82 ctx->dir_info = db; in setup_db()
98 db->array = (struct dir_info *) in setup_db()
100 * sizeof (struct dir_info), in setup_db()
112 struct dir_info *dir, ent; in e2fsck_add_dir_info()
120 if (!ctx->dir_info) in e2fsck_add_dir_info()
122 db = ctx->dir_info; in e2fsck_add_dir_info()
124 if (ctx->dir_info->count >= ctx->dir_info->size) { in e2fsck_add_dir_info()
125 old_size = ctx->dir_info->size * sizeof(struct dir_info); in e2fsck_add_dir_info()
126 ctx->dir_info->size += 10; in e2fsck_add_dir_info()
127 retval = ext2fs_resize_mem(old_size, ctx->dir_info->size * in e2fsck_add_dir_info()
128 sizeof(struct dir_info), in e2fsck_add_dir_info()
129 &ctx->dir_info->array); in e2fsck_add_dir_info()
131 ctx->dir_info->size -= 10; in e2fsck_add_dir_info()
154 if (ctx->dir_info->count && in e2fsck_add_dir_info()
155 ctx->dir_info->array[ctx->dir_info->count-1].ino >= ino) { in e2fsck_add_dir_info()
156 for (i = ctx->dir_info->count-1; i > 0; i--) in e2fsck_add_dir_info()
157 if (ctx->dir_info->array[i-1].ino < ino) in e2fsck_add_dir_info()
159 dir = &ctx->dir_info->array[i]; in e2fsck_add_dir_info()
161 for (j = ctx->dir_info->count++; j > i; j--) in e2fsck_add_dir_info()
162 ctx->dir_info->array[j] = ctx->dir_info->array[j-1]; in e2fsck_add_dir_info()
164 dir = &ctx->dir_info->array[ctx->dir_info->count++]; in e2fsck_add_dir_info()
175 static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino) in e2fsck_get_dir_info()
177 struct dir_info_db *db = ctx->dir_info; in e2fsck_get_dir_info()
180 static struct dir_info ret_dir_info; in e2fsck_get_dir_info()
218 high = ctx->dir_info->count-1; in e2fsck_get_dir_info()
219 if (ino == ctx->dir_info->array[low].ino) { in e2fsck_get_dir_info()
222 ctx->dir_info->array[low].dotdot, in e2fsck_get_dir_info()
223 ctx->dir_info->array[low].parent); in e2fsck_get_dir_info()
225 return &ctx->dir_info->array[low]; in e2fsck_get_dir_info()
227 if (ino == ctx->dir_info->array[high].ino) { in e2fsck_get_dir_info()
230 ctx->dir_info->array[high].dotdot, in e2fsck_get_dir_info()
231 ctx->dir_info->array[high].parent); in e2fsck_get_dir_info()
233 return &ctx->dir_info->array[high]; in e2fsck_get_dir_info()
240 if (ino == ctx->dir_info->array[mid].ino) { in e2fsck_get_dir_info()
243 ctx->dir_info->array[mid].dotdot, in e2fsck_get_dir_info()
244 ctx->dir_info->array[mid].parent); in e2fsck_get_dir_info()
246 return &ctx->dir_info->array[mid]; in e2fsck_get_dir_info()
248 if (ino < ctx->dir_info->array[mid].ino) in e2fsck_get_dir_info()
256 static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir) in e2fsck_put_dir_info()
258 struct dir_info_db *db = ctx->dir_info; in e2fsck_put_dir_info()
289 if (ctx->dir_info) { in e2fsck_free_dir_info()
290 if (ctx->dir_info->tdb) in e2fsck_free_dir_info()
291 tdb_close(ctx->dir_info->tdb); in e2fsck_free_dir_info()
292 if (ctx->dir_info->tdb_fn) { in e2fsck_free_dir_info()
293 unlink(ctx->dir_info->tdb_fn); in e2fsck_free_dir_info()
294 free(ctx->dir_info->tdb_fn); in e2fsck_free_dir_info()
296 ctx->dir_info->size = 0; in e2fsck_free_dir_info()
297 ctx->dir_info->count = 0; in e2fsck_free_dir_info()
298 ext2fs_free_mem(&ctx->dir_info); in e2fsck_free_dir_info()
299 ctx->dir_info = 0; in e2fsck_free_dir_info()
308 return ctx->dir_info ? ctx->dir_info->count : 0; in e2fsck_get_num_dirinfo()
314 struct dir_info_db *db = ctx->dir_info; in e2fsck_dir_info_iter_begin()
337 struct dir_info *e2fsck_dir_info_iter(e2fsck_t ctx, struct dir_info_iter *iter) in e2fsck_dir_info_iter()
340 struct dir_info_db *db = ctx->dir_info; in e2fsck_dir_info_iter()
342 static struct dir_info ret_dir_info; in e2fsck_dir_info_iter()
344 if (!ctx->dir_info || !iter) in e2fsck_dir_info_iter()
367 if (iter->i >= ctx->dir_info->count) in e2fsck_dir_info_iter()
371 printf("iter(%d, %d, %d)...", ctx->dir_info->array[iter->i].ino, in e2fsck_dir_info_iter()
372 ctx->dir_info->array[iter->i].dotdot, in e2fsck_dir_info_iter()
373 ctx->dir_info->array[iter->i].parent); in e2fsck_dir_info_iter()
375 ctx->dir_info->last_lookup = ctx->dir_info->array + iter->i++; in e2fsck_dir_info_iter()
376 return(ctx->dir_info->last_lookup); in e2fsck_dir_info_iter()
386 struct dir_info *p; in e2fsck_dir_info_set_parent()
403 struct dir_info *p; in e2fsck_dir_info_set_dotdot()
420 struct dir_info *p; in e2fsck_dir_info_get_parent()
436 struct dir_info *p; in e2fsck_dir_info_get_dotdot()