2010-12-25 13:08:02 +01:00
|
|
|
#ifndef _FILEDATA_H_
|
|
|
|
#define _FILEDATA_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
struct databuf {
|
2012-02-11 12:44:02 +01:00
|
|
|
uint32_t size; // allocation size
|
|
|
|
uint32_t length; // used size
|
|
|
|
uint8_t data[0];
|
2010-12-25 13:08:02 +01:00
|
|
|
};
|
|
|
|
|
2012-02-11 12:44:02 +01:00
|
|
|
struct databuf * dbuf_alloc(uint32_t size);
|
2010-12-25 13:08:02 +01:00
|
|
|
void dbuf_free(struct databuf *dbuf);
|
|
|
|
|
|
|
|
int file_getsize(const char *filename, uint32_t *size);
|
|
|
|
int file_read(const char *filename, struct databuf *dbuf);
|
|
|
|
int file_write(const char *filename, struct databuf *dbuf);
|
|
|
|
|
|
|
|
#endif /* _FILEDATA_H_ */
|