aboutsummaryrefslogtreecommitdiff
path: root/include/mgl/system/fileutils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/mgl/system/fileutils.h')
-rw-r--r--include/mgl/system/fileutils.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/mgl/system/fileutils.h b/include/mgl/system/fileutils.h
index 7696679..5e45cb3 100644
--- a/include/mgl/system/fileutils.h
+++ b/include/mgl/system/fileutils.h
@@ -13,8 +13,23 @@ typedef struct {
bool null_terminated; /* false by default */
} mgl_file_load_options;
+typedef struct {
+ void *data;
+ size_t size;
+ int fd;
+} mgl_memory_mapped_file;
+
+typedef struct {
+ bool readable; /* true by default */
+ bool writable; /* true by default */
+} mgl_memory_mapped_file_load_options;
+
/* |load_options| can be null, in which case the default options are used */
int mgl_load_file(const char *filepath, mgl_filedata *filedata, mgl_file_load_options *load_options);
void mgl_filedata_free(mgl_filedata *self);
+/* |load_options| can be null, in which case the default options are used */
+int mgl_mapped_file_load(const char *filepath, mgl_memory_mapped_file *memory_mapped_file, mgl_memory_mapped_file_load_options *load_options);
+void mgl_mapped_file_unload(mgl_memory_mapped_file *memory_mapped_file);
+
#endif /* MGL_FILEUTILS_H */