Last change
on this file since 3735 was 821, checked in by Bruno Cornec, 18 years ago |
Addition of busybox 1.2.1 as a mindi-busybox new package
This should avoid delivering binary files in mindi not built there (Fedora and Debian are quite serious about that)
|
File size:
1.5 KB
|
Line | |
---|
1 | /*
|
---|
2 | * dblist_dir.c --- iterate by directory entry
|
---|
3 | *
|
---|
4 | * Copyright 1997 by Theodore Ts'o
|
---|
5 | *
|
---|
6 | * %Begin-Header%
|
---|
7 | * This file may be redistributed under the terms of the GNU Public
|
---|
8 | * License.
|
---|
9 | * %End-Header%
|
---|
10 | *
|
---|
11 | */
|
---|
12 |
|
---|
13 | #include <stdio.h>
|
---|
14 | #if HAVE_UNISTD_H
|
---|
15 | #include <unistd.h>
|
---|
16 | #endif
|
---|
17 | #include <string.h>
|
---|
18 | #include <time.h>
|
---|
19 |
|
---|
20 | #include "ext2_fs.h"
|
---|
21 | #include "ext2fsP.h"
|
---|
22 |
|
---|
23 | static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
|
---|
24 | void *priv_data);
|
---|
25 |
|
---|
26 | errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist,
|
---|
27 | int flags,
|
---|
28 | char *block_buf,
|
---|
29 | int (*func)(ext2_ino_t dir,
|
---|
30 | int entry,
|
---|
31 | struct ext2_dir_entry *dirent,
|
---|
32 | int offset,
|
---|
33 | int blocksize,
|
---|
34 | char *buf,
|
---|
35 | void *priv_data),
|
---|
36 | void *priv_data)
|
---|
37 | {
|
---|
38 | errcode_t retval;
|
---|
39 | struct dir_context ctx;
|
---|
40 |
|
---|
41 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
|
---|
42 |
|
---|
43 | ctx.dir = 0;
|
---|
44 | ctx.flags = flags;
|
---|
45 | if (block_buf)
|
---|
46 | ctx.buf = block_buf;
|
---|
47 | else {
|
---|
48 | retval = ext2fs_get_mem(dblist->fs->blocksize, &ctx.buf);
|
---|
49 | if (retval)
|
---|
50 | return retval;
|
---|
51 | }
|
---|
52 | ctx.func = func;
|
---|
53 | ctx.priv_data = priv_data;
|
---|
54 | ctx.errcode = 0;
|
---|
55 |
|
---|
56 | retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx);
|
---|
57 |
|
---|
58 | if (!block_buf)
|
---|
59 | ext2fs_free_mem(&ctx.buf);
|
---|
60 | if (retval)
|
---|
61 | return retval;
|
---|
62 | return ctx.errcode;
|
---|
63 | }
|
---|
64 |
|
---|
65 | static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
|
---|
66 | void *priv_data)
|
---|
67 | {
|
---|
68 | struct dir_context *ctx;
|
---|
69 |
|
---|
70 | ctx = (struct dir_context *) priv_data;
|
---|
71 | ctx->dir = db_info->ino;
|
---|
72 |
|
---|
73 | return ext2fs_process_dir_block(fs, &db_info->blk,
|
---|
74 | db_info->blockcnt, 0, 0, priv_data);
|
---|
75 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.