From 4aca87515a5083ae0e31ce3177189fd43b6d05ac Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 3 Jan 2015 13:58:15 +0100 Subject: patch to Vanilla Tomato 1.28 --- .../e2fsprogs/old_e2fsprogs/ext2fs/dblist_dir.c | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 release/src/router/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dblist_dir.c (limited to 'release/src/router/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dblist_dir.c') diff --git a/release/src/router/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dblist_dir.c b/release/src/router/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dblist_dir.c new file mode 100644 index 00000000..b2392046 --- /dev/null +++ b/release/src/router/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dblist_dir.c @@ -0,0 +1,76 @@ +/* vi: set sw=4 ts=4: */ +/* + * dblist_dir.c --- iterate by directory entry + * + * Copyright 1997 by Theodore Ts'o + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Public + * License. + * %End-Header% + * + */ + +#include +#if HAVE_UNISTD_H +#include +#endif +#include +#include + +#include "ext2_fs.h" +#include "ext2fsP.h" + +static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info, + void *priv_data); + +errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist, + int flags, + char *block_buf, + int (*func)(ext2_ino_t dir, + int entry, + struct ext2_dir_entry *dirent, + int offset, + int blocksize, + char *buf, + void *priv_data), + void *priv_data) +{ + errcode_t retval; + struct dir_context ctx; + + EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); + + ctx.dir = 0; + ctx.flags = flags; + if (block_buf) + ctx.buf = block_buf; + else { + retval = ext2fs_get_mem(dblist->fs->blocksize, &ctx.buf); + if (retval) + return retval; + } + ctx.func = func; + ctx.priv_data = priv_data; + ctx.errcode = 0; + + retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx); + + if (!block_buf) + ext2fs_free_mem(&ctx.buf); + if (retval) + return retval; + return ctx.errcode; +} + +static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info, + void *priv_data) +{ + struct dir_context *ctx; + + ctx = (struct dir_context *) priv_data; + ctx->dir = db_info->ino; + + return ext2fs_process_dir_block(fs, &db_info->blk, + db_info->blockcnt, 0, 0, priv_data); +} -- cgit v1.2.3-54-g00ecf