70322ae3 |
1 | /* |
2 | * du.h: the function which actually performs the disk scan. |
3 | */ |
4 | |
5 | #include <sys/types.h> |
6 | #include <sys/stat.h> |
7 | |
8 | /* |
9 | * Function called to report a file or directory, its size and its |
10 | * last-access time. |
11 | * |
12 | * Returns non-zero if recursion should proceed into this file's |
13 | * contents (if it's a directory); zero if it should not. If the |
14 | * file isn't a directory, the return value is ignored. |
15 | */ |
16 | typedef int (*gotdata_fn_t)(void *ctx, |
17 | const char *pathname, |
b28bc23d |
18 | const STRUCT_STAT *st); |
70322ae3 |
19 | |
20 | /* |
09fd7619 |
21 | * Function called to report an error during scanning. The ctx is |
22 | * the same one passed to gotdata_fn_t. |
23 | */ |
24 | typedef void (*err_fn_t)(void *vctx, const char *fmt, ...); |
25 | |
26 | /* |
70322ae3 |
27 | * Recursively scan a directory tree and report every |
28 | * space-consuming item in it to gotdata(). |
29 | */ |
09fd7619 |
30 | void du(const char *path, gotdata_fn_t gotdata, err_fn_t err, |
31 | void *gotdata_ctx); |