Back to index

lshw  02.16
Functions
mem.h File Reference
#include "hw.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool scan_memory (hwNode &n)

Function Documentation

bool scan_memory ( hwNode n)

Definition at line 91 of file mem.cc.

{
  hwNode *memory = n.getChild("core/memory");
  unsigned long long logicalmem = 0;
  unsigned long long kcore = 0;

  logicalmem = get_sysconf_size();
  kcore = get_kcore_size();
  count_memorybanks_size(n);
  claim_memory(n);

  if (!memory)
  {
    hwNode *core = n.getChild("core");

    if (!core)
    {
      n.addChild(hwNode("core", hw::bus));
      core = n.getChild("core");
    }

    if (core)
    {
      core->addChild(hwNode("memory", hw::memory));
      memory = core->getChild("memory");
    }
  }

  if (memory)
  {
    memory->claim();
    memory->addHint("icon", string("memory"));

    if (memory->getDescription() == "")
      memory->setDescription(_("System memory"));

    if (memory->getSize() > logicalmem)           // we already have a value
      return true;

    if ((logicalmem == 0)
      || ((kcore > logicalmem) && (kcore < 2 * logicalmem)))
      memory->setSize(kcore);
    else
      memory->setSize(logicalmem);

    return true;
  }

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function: