Support loading CPIO from a chunk of bytes

This commit is contained in:
topjohnwu
2019-02-23 16:16:35 -05:00
parent 4a398642b8
commit 1d3ce9fef1
2 changed files with 34 additions and 31 deletions

View File

@ -30,8 +30,9 @@ struct cpio_entry : public cpio_entry_base {
explicit cpio_entry(const char *name, uint32_t mode) : filename(name) {
this->mode = mode;
}
cpio_entry(int fd, cpio_newc_header &header);
~cpio_entry() override;
explicit cpio_entry(cpio_newc_header *h) : cpio_entry_base(h) {}
~cpio_entry() override { free(data); };
};
typedef std::map<std::string_view, std::unique_ptr<cpio_entry_base>> entry_map;
@ -61,6 +62,7 @@ public:
protected:
void mv(entry_map::iterator &it, const char *to);
void load_cpio(char *buf, size_t sz);
};
class cpio_mmap : public cpio {