#ifndef _LIBIOUTIL_FILEREADER_H
#define _LIBIOUTIL_FILEREADER_H

#include <path_defs.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#define FR_OK                0
#define FR_VOLUME_OPEN_ERROR 1
#define FR_DESC_ERROR        2
#define FR_NOT_FILE          3
#define FR_VOLUME_NOT_OPENED 4
#define FR_READ_ERROR        5
#define FR_CURSOR_OOB        6

#define FR_OPEN (1 << 31)

struct filereader {
  char volume[VOLUME_MAX];
  char path[PATH_MAX];
  size_t read_cursor;
  size_t file_size;
  uint32_t flags;
};

int filereader_init (struct filereader* fw, const char* volume, const char* path);

int filereader_fini (struct filereader* fw);

int filereader_read (struct filereader* fw, uint8_t* buffer, size_t buffer_size);

#endif // _LIBIOUTIL_FILEREADER_H
