Skip to content

Commit

Permalink
add_inode: handle non-resident EAs
Browse files Browse the repository at this point in the history
  • Loading branch information
maharmstone committed Oct 6, 2021
1 parent 9b0e376 commit 4d0239a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/ntfs2btrfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2214,12 +2214,25 @@ static void add_inode(root& r, uint64_t inode, uint64_t ntfs_inode, bool& is_dir
}

case ntfs_attribute::EA: {
buffer_t eabuf;
string_view sv;

if (att.FormCode == NTFS_ATTRIBUTE_FORM::NONRESIDENT_FORM) {
add_warning("FIXME non-resident EA");
break;
}
list<mapping> ea_mappings;

read_nonresident_mappings(att, ea_mappings, cluster_size, att.Form.Nonresident.ValidDataLength);

eabuf.resize((size_t)sector_align(att.Form.Nonresident.FileSize, cluster_size));
memset(eabuf.data(), 0, eabuf.size());

auto sv = res_data;
for (const auto& m : ea_mappings) {
dev.seek(m.lcn * cluster_size);
dev.read(eabuf.data() + (m.vcn * cluster_size), (size_t)(m.length * cluster_size));
}

sv = string_view((char*)eabuf.data(), (size_t)att.Form.Nonresident.FileSize);
} else
sv = res_data;

do {
auto& ead = *(ea_data*)sv.data();
Expand Down

0 comments on commit 4d0239a

Please sign in to comment.