Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20f4ee8c authored by Yifan Hong's avatar Yifan Hong
Browse files

lshal: Remove obsolete TableEntrySource type.

HalType is a better type.
Test: lshal_test

Change-Id: I2de08a6cce8413d93d3b7fb2367d0c1ad09d032a
parent c443091c
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -552,17 +552,17 @@ Status ListCommand::dump() {
    return OK;
}

void ListCommand::putEntry(TableEntrySource source, TableEntry &&entry) {
void ListCommand::putEntry(HalType type, TableEntry &&entry) {
    Table *table = nullptr;
    switch (source) {
        case HWSERVICEMANAGER_LIST :
    switch (type) {
        case HalType::BINDERIZED_SERVICES :
            table = &mServicesTable; break;
        case PTSERVICEMANAGER_REG_CLIENT :
        case HalType::PASSTHROUGH_CLIENTS :
            table = &mPassthroughRefTable; break;
        case LIST_DLLIB :
        case HalType::PASSTHROUGH_LIBRARIES :
            table = &mImplementationsTable; break;
        default:
            err() << "Error: Unknown source of entry " << source << std::endl;
            err() << "Error: Unknown type of entry " << static_cast<int64_t>(type) << std::endl;
    }
    if (table) {
        table->add(std::forward<TableEntry>(entry));
@@ -588,7 +588,7 @@ Status ListCommand::fetchAllLibraries(const sp<IServiceManager> &manager) {
            }).first->second.arch |= fromBaseArchitecture(info.arch);
        }
        for (auto &&pair : entries) {
            putEntry(LIST_DLLIB, std::move(pair.second));
            putEntry(HalType::PASSTHROUGH_LIBRARIES, std::move(pair.second));
        }
    });
    if (!ret.isOk()) {
@@ -611,7 +611,7 @@ Status ListCommand::fetchPassthrough(const sp<IServiceManager> &manager) {
            if (info.clientPids.size() <= 0) {
                continue;
            }
            putEntry(PTSERVICEMANAGER_REG_CLIENT, {
            putEntry(HalType::PASSTHROUGH_CLIENTS, {
                .interfaceName =
                        std::string{info.interfaceName.c_str()} + "/" +
                        std::string{info.instanceName.c_str()},
@@ -659,7 +659,7 @@ Status ListCommand::fetchBinderized(const sp<IServiceManager> &manager) {
    }

    for (auto& pair : allTableEntries) {
        putEntry(HWSERVICEMANAGER_LIST, std::move(pair.second));
        putEntry(HalType::BINDERIZED_SERVICES, std::move(pair.second));
    }
    return status;
}
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ protected:
    // Retrieve derived information base on existing table
    virtual void postprocess();
    Status dump();
    void putEntry(TableEntrySource source, TableEntry &&entry);
    void putEntry(HalType type, TableEntry &&entry);
    Status fetchPassthrough(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
    Status fetchBinderized(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
    Status fetchAllLibraries(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
+0 −7
Original line number Diff line number Diff line
@@ -35,13 +35,6 @@ namespace lshal {
using android::procpartition::Partition;
using Pids = std::vector<int32_t>;

enum : unsigned int {
    HWSERVICEMANAGER_LIST, // through defaultServiceManager()->list()
    PTSERVICEMANAGER_REG_CLIENT, // through registerPassthroughClient
    LIST_DLLIB, // through listing dynamic libraries
};
using TableEntrySource = unsigned int;

enum class TableColumnType : unsigned int {
    INTERFACE_NAME,
    TRANSPORT,