aboutsummaryrefslogtreecommitdiff
path: root/include/util/dir_iterator.h
blob: 77849e7f48ab80eccc890f8d096645a1bdc845b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
 * dir_iterator.h
 *
 * Copyright (C) 2023 David Oberhollenzer <goliath@infraroot.at>
 */
#ifndef UTIL_DIR_ITERATOR_H
#define UTIL_DIR_ITERATOR_H

#include "sqfs/predef.h"

typedef struct {
	sqfs_s64 mtime;
	sqfs_u64 dev;
	sqfs_u64 rdev;
	sqfs_u32 uid;
	sqfs_u32 gid;
	sqfs_u16 mode;

	char name[];
} dir_entry_t;

typedef struct dir_iterator_t {
	sqfs_object_t obj;

	sqfs_u64 dev;

	int (*next)(struct dir_iterator_t *it,
		    dir_entry_t **out);

	int (*read_link)(struct dir_iterator_t *it, char **out);
} dir_iterator_t;

dir_iterator_t *dir_iterator_create(const char *path);

#endif /* UTIL_DIR_ITERATOR_H */