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 Library
8 * General Public License, version 2.
23 static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry2 *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_iterate2(dblist, db_dir_proc, &ctx);
59 ext2fs_free_mem(&ctx.buf);
65 static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry2 *db_info,
68 struct ext2_inode inode;
69 struct dir_context *ctx;
72 ctx = (struct dir_context *) priv_data;
73 ctx->dir = db_info->ino;
76 ctx->errcode = ext2fs_read_inode(fs, ctx->dir, &inode);
79 if (inode.i_flags & EXT4_INLINE_DATA_FL)
80 ret = ext2fs_inline_data_dir_iterate(fs, ctx->dir, ctx);
82 ret = ext2fs_process_dir_block(fs, &db_info->blk,
83 db_info->blockcnt, 0, 0,
85 if ((ret & BLOCK_ABORT) && !ctx->errcode)