summaryrefslogtreecommitdiff
path: root/include/meta_reader.h
blob: 16003f618e22f3095b80732e72107e2f0e39dc38 (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
37
/* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef META_READER_H
#define META_READER_H

#include "compress.h"
#include "squashfs.h"

typedef struct meta_reader_t meta_reader_t;

/* Create a meta data reader using a given compressor to extract data.
   Internally prints error message to stderr on failure. */
meta_reader_t *meta_reader_create(int fd, compressor_t *cmp);

void meta_reader_destroy(meta_reader_t *m);

/* Returns 0 on success. Internally prints to stderr on failure */
int meta_reader_seek(meta_reader_t *m, uint64_t block_start,
		     size_t offset);

/* Returns 0 on success. Internally prints to stderr on failure */
int meta_reader_read(meta_reader_t *m, void *data, size_t size);

/* Inode can be freed with a single free() call.
   The function internally prints error message to stderr on failure. */
sqfs_inode_generic_t *meta_reader_read_inode(meta_reader_t *ir,
					     sqfs_super_t *super,
					     uint64_t block_start,
					     size_t offset);

/* Returns 0 on success. Internally prints to stderr on failure */
int meta_reader_read_dir_header(meta_reader_t *m, sqfs_dir_header_t *hdr);

/* Entry can be freed with a single free() call.
   The function internally prints to stderr on failure */
sqfs_dir_entry_t *meta_reader_read_dir_ent(meta_reader_t *m);

#endif /* META_READER_H */