Remove unused code

This commit is contained in:
topjohnwu
2021-08-13 03:30:58 -07:00
parent 27f7fa7153
commit 844bc2d808
3 changed files with 9 additions and 104 deletions

View File

@@ -243,31 +243,3 @@ void cpio_rw::load_cpio(const char *buf, size_t sz) {
pos_align(pos);
}
}
cpio_mmap::cpio_mmap(const char *file) {
mmap_ro(file, buf, sz);
fprintf(stderr, "Loading cpio: [%s]\n", file);
size_t pos = 0;
cpio_newc_header *header;
unique_ptr<cpio_entry_base> entry;
while (pos < sz) {
header = (cpio_newc_header *)(buf + pos);
entry = make_unique<cpio_entry_base>(header);
pos += sizeof(*header);
string_view name_view(buf + pos);
pos += x8u(header->namesize);
pos_align(pos);
if (name_view == "." || name_view == "..")
continue;
if (name_view == "TRAILER!!!")
break;
entry->data = buf + pos;
pos += entry->filesize;
entries[name_view] = std::move(entry);
pos_align(pos);
}
}
cpio_mmap::~cpio_mmap() {
munmap(buf, sz);
}

View File

@@ -66,12 +66,3 @@ protected:
void mv(entry_map::iterator &it, const char *to);
void load_cpio(const char *buf, size_t sz);
};
class cpio_mmap : public cpio {
public:
explicit cpio_mmap(const char *file);
~cpio_mmap();
private:
char *buf;
size_t sz;
};