libropkg: implement compressed file streams and tar-writer functionality

This commit is contained in:
2025-07-17 18:12:16 +01:00
parent c377871d2b
commit add651a3ed
13 changed files with 1136 additions and 0 deletions

39
libropkg/stream.h Normal file
View File

@@ -0,0 +1,39 @@
#ifndef _ROPKG_STREAM_H_
#define _ROPKG_STREAM_H_
#include <ropkg/stream.h>
#include <stdio.h>
struct ropkg_compression_function;
struct ropkg_compression_stream;
enum ropkg_stream_flags {
ROPKG_STREAM_F_CURSOR_MOVED = 0x01u,
};
struct ropkg_stream_compressor {
const struct ropkg_compression_function *c_func;
struct ropkg_compression_stream *c_stream;
size_t c_in_max, c_out_max;
void *c_in_buf, *c_out_buf;
size_t c_in_count;
size_t c_nr_written_compressed, c_nr_written_uncompressed;
};
struct ropkg_stream {
FILE *s_fp;
enum ropkg_stream_flags s_flags;
enum ropkg_stream_mode s_mode;
unsigned int s_compression_depth;
struct ropkg_stream_compressor s_compressor;
size_t s_saved_cursor;
size_t s_nr_written;
size_t s_nr_written_compressed;
size_t s_nr_written_uncompressed;
};
#endif