1 /* vi: set sw=4 ts=4: */
3 * dblist_dir.c --- iterate by directory entry
5 * Copyright 1997 by Theodore Ts'o
8 * This file may be redistributed under the terms of the GNU Public
24 static int db_dir_proc(ext2_filsys fs
, struct ext2_db_entry
*db_info
,
27 errcode_t
ext2fs_dblist_dir_iterate(ext2_dblist dblist
,
30 int (*func
)(ext2_ino_t dir
,
32 struct ext2_dir_entry
*dirent
,
40 struct dir_context ctx
;
42 EXT2_CHECK_MAGIC(dblist
, EXT2_ET_MAGIC_DBLIST
);
49 retval
= ext2fs_get_mem(dblist
->fs
->blocksize
, &ctx
.buf
);
54 ctx
.priv_data
= priv_data
;
57 retval
= ext2fs_dblist_iterate(dblist
, db_dir_proc
, &ctx
);
60 ext2fs_free_mem(&ctx
.buf
);
66 static int db_dir_proc(ext2_filsys fs
, struct ext2_db_entry
*db_info
,
69 struct dir_context
*ctx
;
71 ctx
= (struct dir_context
*) priv_data
;
72 ctx
->dir
= db_info
->ino
;
74 return ext2fs_process_dir_block(fs
, &db_info
->blk
,
75 db_info
->blockcnt
, 0, 0, priv_data
);