• Home
  • Raw
  • Download

Lines Matching refs:dir_info

22 	struct dir_info *array;
23 struct dir_info *last_lookup;
43 static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir);
48 struct dir_info_db *db = ctx->dir_info; in setup_tdb()
101 ctx->dir_info = db; in setup_db()
119 db->array = (struct dir_info *) in setup_db()
121 * sizeof (struct dir_info), in setup_db()
132 struct dir_info *dir, *old_array; in e2fsck_add_dir_info()
140 if (!ctx->dir_info) in e2fsck_add_dir_info()
143 if (ctx->dir_info->count >= ctx->dir_info->size) { in e2fsck_add_dir_info()
144 old_size = ctx->dir_info->size * sizeof(struct dir_info); in e2fsck_add_dir_info()
145 ctx->dir_info->size += 10; in e2fsck_add_dir_info()
146 old_array = ctx->dir_info->array; in e2fsck_add_dir_info()
147 retval = ext2fs_resize_mem(old_size, ctx->dir_info->size * in e2fsck_add_dir_info()
148 sizeof(struct dir_info), in e2fsck_add_dir_info()
149 &ctx->dir_info->array); in e2fsck_add_dir_info()
153 ctx->dir_info->size); in e2fsck_add_dir_info()
155 ctx->dir_info->size -= 10; in e2fsck_add_dir_info()
158 if (old_array != ctx->dir_info->array) in e2fsck_add_dir_info()
159 ctx->dir_info->last_lookup = NULL; in e2fsck_add_dir_info()
163 if (ctx->dir_info->tdb) { in e2fsck_add_dir_info()
164 struct dir_info ent; in e2fsck_add_dir_info()
183 if (ctx->dir_info->count && in e2fsck_add_dir_info()
184 ctx->dir_info->array[ctx->dir_info->count-1].ino >= ino) { in e2fsck_add_dir_info()
185 for (i = ctx->dir_info->count-1; i > 0; i--) in e2fsck_add_dir_info()
186 if (ctx->dir_info->array[i-1].ino < ino) in e2fsck_add_dir_info()
188 dir = &ctx->dir_info->array[i]; in e2fsck_add_dir_info()
190 for (j = ctx->dir_info->count++; j > i; j--) in e2fsck_add_dir_info()
191 ctx->dir_info->array[j] = ctx->dir_info->array[j-1]; in e2fsck_add_dir_info()
193 dir = &ctx->dir_info->array[ctx->dir_info->count++]; in e2fsck_add_dir_info()
204 static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino) in e2fsck_get_dir_info()
206 struct dir_info_db *db = ctx->dir_info; in e2fsck_get_dir_info()
218 static struct dir_info ret_dir_info; in e2fsck_get_dir_info()
249 high = ctx->dir_info->count - 1; in e2fsck_get_dir_info()
250 if (ino == ctx->dir_info->array[low].ino) { in e2fsck_get_dir_info()
253 ctx->dir_info->array[low].dotdot, in e2fsck_get_dir_info()
254 ctx->dir_info->array[low].parent); in e2fsck_get_dir_info()
256 return &ctx->dir_info->array[low]; in e2fsck_get_dir_info()
258 if (ino == ctx->dir_info->array[high].ino) { in e2fsck_get_dir_info()
261 ctx->dir_info->array[high].dotdot, in e2fsck_get_dir_info()
262 ctx->dir_info->array[high].parent); in e2fsck_get_dir_info()
264 return &ctx->dir_info->array[high]; in e2fsck_get_dir_info()
272 if (ino == ctx->dir_info->array[mid].ino) { in e2fsck_get_dir_info()
275 ctx->dir_info->array[mid].dotdot, in e2fsck_get_dir_info()
276 ctx->dir_info->array[mid].parent); in e2fsck_get_dir_info()
278 return &ctx->dir_info->array[mid]; in e2fsck_get_dir_info()
280 if (ino < ctx->dir_info->array[mid].ino) in e2fsck_get_dir_info()
289 struct dir_info *dir EXT2FS_NO_TDB_UNUSED) in e2fsck_put_dir_info()
292 struct dir_info_db *db = ctx->dir_info; in e2fsck_put_dir_info()
325 if (ctx->dir_info) { in e2fsck_free_dir_info()
327 if (ctx->dir_info->tdb) in e2fsck_free_dir_info()
328 tdb_close(ctx->dir_info->tdb); in e2fsck_free_dir_info()
329 if (ctx->dir_info->tdb_fn) { in e2fsck_free_dir_info()
330 if (unlink(ctx->dir_info->tdb_fn) < 0) in e2fsck_free_dir_info()
333 ext2fs_free_mem(&ctx->dir_info->tdb_fn); in e2fsck_free_dir_info()
336 if (ctx->dir_info->array) in e2fsck_free_dir_info()
337 ext2fs_free_mem(&ctx->dir_info->array); in e2fsck_free_dir_info()
338 ctx->dir_info->array = 0; in e2fsck_free_dir_info()
339 ctx->dir_info->size = 0; in e2fsck_free_dir_info()
340 ctx->dir_info->count = 0; in e2fsck_free_dir_info()
341 ext2fs_free_mem(&ctx->dir_info); in e2fsck_free_dir_info()
342 ctx->dir_info = 0; in e2fsck_free_dir_info()
351 return ctx->dir_info ? ctx->dir_info->count : 0; in e2fsck_get_num_dirinfo()
362 if (ctx->dir_info->tdb) in e2fsck_dir_info_iter_begin()
363 iter->tdb_iter = tdb_firstkey(ctx->dir_info->tdb); in e2fsck_dir_info_iter_begin()
381 struct dir_info *e2fsck_dir_info_iter(e2fsck_t ctx, struct dir_info_iter *iter) in e2fsck_dir_info_iter()
383 if (!ctx->dir_info || !iter) in e2fsck_dir_info_iter()
387 if (ctx->dir_info->tdb) { in e2fsck_dir_info_iter()
388 static struct dir_info ret_dir_info; in e2fsck_dir_info_iter()
395 data = tdb_fetch(ctx->dir_info->tdb, key); in e2fsck_dir_info_iter()
398 tdb_errorstr(ctx->dir_info->tdb)); in e2fsck_dir_info_iter()
405 iter->tdb_iter = tdb_nextkey(ctx->dir_info->tdb, key); in e2fsck_dir_info_iter()
412 if (iter->i >= ctx->dir_info->count) in e2fsck_dir_info_iter()
416 printf("iter(%u, %u, %u)...", ctx->dir_info->array[iter->i].ino, in e2fsck_dir_info_iter()
417 ctx->dir_info->array[iter->i].dotdot, in e2fsck_dir_info_iter()
418 ctx->dir_info->array[iter->i].parent); in e2fsck_dir_info_iter()
420 ctx->dir_info->last_lookup = ctx->dir_info->array + iter->i++; in e2fsck_dir_info_iter()
421 return(ctx->dir_info->last_lookup); in e2fsck_dir_info_iter()
431 struct dir_info *p; in e2fsck_dir_info_set_parent()
448 struct dir_info *p; in e2fsck_dir_info_set_dotdot()
465 struct dir_info *p; in e2fsck_dir_info_get_parent()
481 struct dir_info *p; in e2fsck_dir_info_get_dotdot()