Support compressing during cpio backup

This commit is contained in:
LoveSy
2023-12-08 23:30:55 +08:00
committed by topjohnwu
parent d73c2daf6d
commit 8b7fae278b
9 changed files with 145 additions and 11 deletions

View File

@@ -78,6 +78,21 @@ private:
void resize(size_t new_sz, bool zero = false);
};
class rust_vec_channel : public channel {
public:
rust_vec_channel(rust::Vec<uint8_t> &data) : _data(data) {}
ssize_t read(void *buf, size_t len) override;
bool write(const void *buf, size_t len) override;
off_t seek(off_t off, int whence) override;
private:
rust::Vec<uint8_t> &_data;
size_t _pos = 0;
void ensure_size(size_t sz);
};
class file_channel : public channel {
public:
bool write(const void *buf, size_t len) final;