#pragma once #include #include enum mapping_type { MT_MMAP, MT_OWNED, }; struct filebuf { char *buf; size_t sz; enum mapping_type mapping_type; }; struct filebuf *stream_to_filebuf(FILE *restrict stream); struct filebuf *file_to_filebuf(char *fname); void free_filebuf(struct filebuf *filebuf);