Create libioutil, implement a filewriter
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m21s

This commit is contained in:
2026-03-02 22:47:10 +01:00
parent 27afd57427
commit 58c515e90a
28 changed files with 231 additions and 29 deletions

36
libioutil/filewriter.h Normal file
View File

@@ -0,0 +1,36 @@
#ifndef _LIBIOUTIL_FILEWRITER_H
#define _LIBIOUTIL_FILEWRITER_H
#include <path_defs.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#define FW_OK 0
#define FW_VOLUME_OPEN_ERROR 1
#define FW_DESC_ERROR 2
#define FW_NOT_FILE 3
#define FW_VOLUME_NOT_OPENED 4
#define FW_WRITE_ERROR 5
#define FW_CURSOR_OOB 6
#define FW_CREATE_FILE_ERROR 7
#define FW_CREATE_FILE (1 << 0)
#define FW_APPEND (1 << 1)
#define FW_OPEN (1 << 31)
struct filewriter {
char volume[VOLUME_MAX];
char path[PATH_MAX];
size_t write_cursor;
size_t file_size;
uint32_t flags;
};
int filewriter_init (struct filewriter* fw, const char* volume, const char* path, uint32_t flags);
int filewriter_fini (struct filewriter* fw);
int filewriter_write (struct filewriter* fw, uint8_t* buffer, size_t buffer_size);
#endif // _LIBIOUTIL_FILEWRITER_H