MCPcopy Create free account
hub / github.com/MemNixFS/MemNixFS / format_module_info

Function format_module_info

src/os/linux/modules.cpp:185–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185ByteBuf format_module_info(const LoadedModule& m) {
186 std::string out;
187 out.reserve(2048);
188 out += fmt::format("Name: {}\n", m.name);
189 out += fmt::format("Version: {}\n", m.version);
190 out += fmt::format("Srcversion: {}\n", m.srcversion);
191 out += fmt::format("State: {} ({})\n", state_name(m.state), m.state);
192 out += fmt::format("Module VA: {:#018x}\n", m.module_va);
193 out += fmt::format("Args: {}\n", m.args);
194 out += "\nMemory layout:\n";
195
196 static const char* mem_names[MOD_MEM_NUM_TYPES] = {
197 "TEXT", "DATA", "RODATA", "RO_AFTER_INIT",
198 "INIT_TEXT", "INIT_DATA", "INIT_RODATA"
199 };
200 u64 total = 0;
201 for (u32 i = 0; i < MOD_MEM_NUM_TYPES; ++i) {
202 out += fmt::format(" {:<14} {:#018x} {:>10} bytes\n",
203 mem_names[i], m.mem[i].base, m.mem[i].size);
204 total += m.mem[i].size;
205 }
206 out += fmt::format(" {:<14} {:>30} bytes\n", "TOTAL", total);
207 return ByteBuf(out.begin(), out.end());
208}
209
210} // namespace lmpfs::linux

Callers 1

build_sys_treeFunction · 0.85

Calls 1

state_nameFunction · 0.70

Tested by

no test coverage detected