lshal: Put more description to output
Split the output by three parts according to the source of information.
Describe each part before the table.
--sort will be applied to each table individually.
Bug: 35803917
Test: lshal
Change-Id: Ief0dae21fdeb58ebaed46d2aa68f298b8b75218d
diff --git a/cmds/lshal/TableEntry.h b/cmds/lshal/TableEntry.h
index 8154cb2..2407b42 100644
--- a/cmds/lshal/TableEntry.h
+++ b/cmds/lshal/TableEntry.h
@@ -51,7 +51,6 @@
uint64_t serverObjectAddress;
Pids clientPids;
std::vector<std::string> clientCmdlines;
- TableEntrySource source;
Architecture arch;
static bool sortByInterfaceName(const TableEntry &a, const TableEntry &b) {
@@ -62,7 +61,17 @@
};
};
-using Table = std::vector<TableEntry>;
+struct Table {
+ using Entries = std::vector<TableEntry>;
+ std::string description;
+ Entries entries;
+
+ Entries::iterator begin() { return entries.begin(); }
+ Entries::const_iterator begin() const { return entries.begin(); }
+ Entries::iterator end() { return entries.end(); }
+ Entries::const_iterator end() const { return entries.end(); }
+};
+
using TableEntryCompare = std::function<bool(const TableEntry &, const TableEntry &)>;
enum : unsigned int {