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
20 #if EXT2_FLAT_INCLUDES
23 #include <linux/ext2_fs.h>
28 static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
32 ext2fs_dblist_dir_iterate(ext2_dblist dblist,
35 int (*func)(ino_t dir,
37 struct ext2_dir_entry *dirent,
45 struct dir_context ctx;
47 EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
54 retval = ext2fs_get_mem(dblist->fs->blocksize,
61 ctx.priv_data = priv_data;
64 retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx);
67 ext2fs_free_mem((void **) &ctx.buf);
73 static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
76 struct dir_context *ctx;
78 ctx = (struct dir_context *) priv_data;
79 ctx->dir = db_info->ino;
81 return ext2fs_process_dir_block(fs, &db_info->blk,
82 db_info->blockcnt, 0, 0, priv_data);