Loading cmds/lshal/Lshal.cpp +42 −7 Original line number Original line Diff line number Diff line Loading @@ -160,14 +160,14 @@ bool Lshal::getReferencedPids( } } void Lshal::forEachTable(const std::function<void(Table &)> &f) { void Lshal::forEachTable(const std::function<void(Table &)> &f) { for (const Table &table : {mServicesTable, mPassthroughRefTable, mImplementationsTable}) { f(mServicesTable); f(const_cast<Table &>(table)); f(mPassthroughRefTable); } f(mImplementationsTable); } } void Lshal::forEachTable(const std::function<void(const Table &)> &f) const { void Lshal::forEachTable(const std::function<void(const Table &)> &f) const { for (const Table &table : {mServicesTable, mPassthroughRefTable, mImplementationsTable}) { f(mServicesTable); f(table); f(mPassthroughRefTable); } f(mImplementationsTable); } } void Lshal::postprocess() { void Lshal::postprocess() { Loading @@ -183,6 +183,26 @@ void Lshal::postprocess() { } } } } }); }); // use a double for loop here because lshal doesn't care about efficiency. for (TableEntry &packageEntry : mImplementationsTable) { std::string packageName = packageEntry.interfaceName; FQName fqPackageName{packageName.substr(0, packageName.find("::"))}; if (!fqPackageName.isValid()) { continue; } for (TableEntry &interfaceEntry : mPassthroughRefTable) { if (interfaceEntry.arch != ARCH_UNKNOWN) { continue; } FQName interfaceName{splitFirst(interfaceEntry.interfaceName, '/').first}; if (!interfaceName.isValid()) { continue; } if (interfaceName.getPackageAndVersion() == fqPackageName) { interfaceEntry.arch = packageEntry.arch; } } } } } void Lshal::printLine( void Lshal::printLine( Loading Loading @@ -247,10 +267,25 @@ void Lshal::dumpVintf() const { &table == &mImplementationsTable ? "" : splittedFqInstanceName.second; &table == &mImplementationsTable ? "" : splittedFqInstanceName.second; vintf::Transport transport; vintf::Transport transport; vintf::Arch arch; if (entry.transport == "hwbinder") { if (entry.transport == "hwbinder") { transport = vintf::Transport::HWBINDER; transport = vintf::Transport::HWBINDER; arch = vintf::Arch::ARCH_EMPTY; } else if (entry.transport == "passthrough") { } else if (entry.transport == "passthrough") { transport = vintf::Transport::PASSTHROUGH; transport = vintf::Transport::PASSTHROUGH; switch (entry.arch) { case lshal::ARCH32: arch = vintf::Arch::ARCH_32; break; case lshal::ARCH64: arch = vintf::Arch::ARCH_64; break; case lshal::ARCH_BOTH: arch = vintf::Arch::ARCH_32_64; break; case lshal::ARCH_UNKNOWN: // fallthrough default: mErr << "Warning: '" << fqName.package() << "' doesn't have bitness info, assuming 32+64." << std::endl; arch = vintf::Arch::ARCH_32_64; } } else { } else { mErr << "Warning: '" << entry.transport << "' is not a valid transport." << std::endl; mErr << "Warning: '" << entry.transport << "' is not a valid transport." << std::endl; continue; continue; Loading @@ -262,7 +297,7 @@ void Lshal::dumpVintf() const { .format = vintf::HalFormat::HIDL, .format = vintf::HalFormat::HIDL, .name = fqName.package(), .name = fqName.package(), .impl = {.implLevel = vintf::ImplLevel::GENERIC, .impl = ""}, .impl = {.implLevel = vintf::ImplLevel::GENERIC, .impl = ""}, .transport = transport .transportArch = {transport, arch} })) { })) { mErr << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl; mErr << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl; continue; continue; Loading cmds/lshal/TableEntry.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -37,8 +37,8 @@ using TableEntrySource = unsigned int; enum : unsigned int { enum : unsigned int { ARCH_UNKNOWN = 0, ARCH_UNKNOWN = 0, ARCH64 = 1 << 0, ARCH32 = 1 << 0, ARCH32 = 1 << 1, ARCH64 = 1 << 1, ARCH_BOTH = ARCH32 | ARCH64 ARCH_BOTH = ARCH32 | ARCH64 }; }; using Architecture = unsigned int; using Architecture = unsigned int; Loading Loading
cmds/lshal/Lshal.cpp +42 −7 Original line number Original line Diff line number Diff line Loading @@ -160,14 +160,14 @@ bool Lshal::getReferencedPids( } } void Lshal::forEachTable(const std::function<void(Table &)> &f) { void Lshal::forEachTable(const std::function<void(Table &)> &f) { for (const Table &table : {mServicesTable, mPassthroughRefTable, mImplementationsTable}) { f(mServicesTable); f(const_cast<Table &>(table)); f(mPassthroughRefTable); } f(mImplementationsTable); } } void Lshal::forEachTable(const std::function<void(const Table &)> &f) const { void Lshal::forEachTable(const std::function<void(const Table &)> &f) const { for (const Table &table : {mServicesTable, mPassthroughRefTable, mImplementationsTable}) { f(mServicesTable); f(table); f(mPassthroughRefTable); } f(mImplementationsTable); } } void Lshal::postprocess() { void Lshal::postprocess() { Loading @@ -183,6 +183,26 @@ void Lshal::postprocess() { } } } } }); }); // use a double for loop here because lshal doesn't care about efficiency. for (TableEntry &packageEntry : mImplementationsTable) { std::string packageName = packageEntry.interfaceName; FQName fqPackageName{packageName.substr(0, packageName.find("::"))}; if (!fqPackageName.isValid()) { continue; } for (TableEntry &interfaceEntry : mPassthroughRefTable) { if (interfaceEntry.arch != ARCH_UNKNOWN) { continue; } FQName interfaceName{splitFirst(interfaceEntry.interfaceName, '/').first}; if (!interfaceName.isValid()) { continue; } if (interfaceName.getPackageAndVersion() == fqPackageName) { interfaceEntry.arch = packageEntry.arch; } } } } } void Lshal::printLine( void Lshal::printLine( Loading Loading @@ -247,10 +267,25 @@ void Lshal::dumpVintf() const { &table == &mImplementationsTable ? "" : splittedFqInstanceName.second; &table == &mImplementationsTable ? "" : splittedFqInstanceName.second; vintf::Transport transport; vintf::Transport transport; vintf::Arch arch; if (entry.transport == "hwbinder") { if (entry.transport == "hwbinder") { transport = vintf::Transport::HWBINDER; transport = vintf::Transport::HWBINDER; arch = vintf::Arch::ARCH_EMPTY; } else if (entry.transport == "passthrough") { } else if (entry.transport == "passthrough") { transport = vintf::Transport::PASSTHROUGH; transport = vintf::Transport::PASSTHROUGH; switch (entry.arch) { case lshal::ARCH32: arch = vintf::Arch::ARCH_32; break; case lshal::ARCH64: arch = vintf::Arch::ARCH_64; break; case lshal::ARCH_BOTH: arch = vintf::Arch::ARCH_32_64; break; case lshal::ARCH_UNKNOWN: // fallthrough default: mErr << "Warning: '" << fqName.package() << "' doesn't have bitness info, assuming 32+64." << std::endl; arch = vintf::Arch::ARCH_32_64; } } else { } else { mErr << "Warning: '" << entry.transport << "' is not a valid transport." << std::endl; mErr << "Warning: '" << entry.transport << "' is not a valid transport." << std::endl; continue; continue; Loading @@ -262,7 +297,7 @@ void Lshal::dumpVintf() const { .format = vintf::HalFormat::HIDL, .format = vintf::HalFormat::HIDL, .name = fqName.package(), .name = fqName.package(), .impl = {.implLevel = vintf::ImplLevel::GENERIC, .impl = ""}, .impl = {.implLevel = vintf::ImplLevel::GENERIC, .impl = ""}, .transport = transport .transportArch = {transport, arch} })) { })) { mErr << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl; mErr << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl; continue; continue; Loading
cmds/lshal/TableEntry.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -37,8 +37,8 @@ using TableEntrySource = unsigned int; enum : unsigned int { enum : unsigned int { ARCH_UNKNOWN = 0, ARCH_UNKNOWN = 0, ARCH64 = 1 << 0, ARCH32 = 1 << 0, ARCH32 = 1 << 1, ARCH64 = 1 << 1, ARCH_BOTH = ARCH32 | ARCH64 ARCH_BOTH = ARCH32 | ARCH64 }; }; using Architecture = unsigned int; using Architecture = unsigned int; Loading