blob: 9853987c70061720ca098c148607c3da46babedf [file] [log] [blame]
Norman James6a58a272015-10-07 14:34:16 -05001#ifndef __LIBFFS_H
2#define __LIBFFS_H
3
4#include <libflash/libflash.h>
5#include <libflash/ffs.h>
6
7/* FFS handle, opaque */
8struct ffs_handle;
9
10/* Error codes:
11 *
12 * < 0 = flash controller errors
13 * 0 = success
14 * > 0 = libffs / libflash errors
15 */
16#define FFS_ERR_BAD_MAGIC 100
17#define FFS_ERR_BAD_VERSION 101
18#define FFS_ERR_BAD_CKSUM 102
19#define FFS_ERR_PART_NOT_FOUND 103
20
21int ffs_open_flash(struct flash_chip *chip, uint32_t offset,
22 uint32_t max_size, struct ffs_handle **ffs);
23
24/* TODO
25int ffs_open_image(void *image, uint32_t size, struct ffs_handle **ffs);
26*/
27
28void ffs_close(struct ffs_handle *ffs);
29
30int ffs_lookup_part(struct ffs_handle *ffs, const char *name,
31 uint32_t *part_idx);
32
33int ffs_part_info(struct ffs_handle *ffs, uint32_t part_idx,
34 char **name, uint32_t *start,
35 uint32_t *total_size, uint32_t *act_size);
36
37int ffs_update_act_size(struct ffs_handle *ffs, uint32_t part_idx,
38 uint32_t act_size);
39
40
41#endif /* __LIBFFS_H */