2 * dblist_dir.c --- iterate by directory entry
4 * Copyright 1997 by Theodore Ts'o
7 * This file may be redistributed under the terms of the GNU Public
23 static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
26 errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist,
29 int (*func)(ext2_ino_t dir,
31 struct ext2_dir_entry *dirent,
39 struct dir_context ctx;
41 EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
48 retval = ext2fs_get_mem(dblist->fs->blocksize, &ctx.buf);
53 ctx.priv_data = priv_data;
56 retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx);
59 ext2fs_free_mem(&ctx.buf);
65 static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
68 struct dir_context *ctx;
70 ctx = (struct dir_context *) priv_data;
71 ctx->dir = db_info->ino;
73 return ext2fs_process_dir_block(fs, &db_info->blk,
74 db_info->blockcnt, 0, 0, priv_data);