The Pedigree Project
0.1
|
#include <DeviceHashTree.h>
Public Member Functions | |
bool | initialised () |
void | fill (Device *root=0) |
void | add (Device *p) |
Device * | getDevice (uint32_t hash) |
Device * | getDevice (const String &hash) |
size_t | getHash (Device *p) |
Static Public Member Functions | |
static DeviceHashTree & | instance () |
Private Attributes | |
bool | m_bInitialised |
Tree< size_t, Device * > | m_DeviceTree |
Static Private Attributes | |
static DeviceHashTree | m_Instance |
DeviceHashTree: Name-based device access
This class provides access to devices via a SHA1 hash generated from several unique identifers of the device. These hashes are deterministic across boots and are therefore ideal for use in addressing devices in userspace scripts or in configuration files.
Definition at line 38 of file DeviceHashTree.h.
void DeviceHashTree::add | ( | Device * | p | ) |
Adds a device, if it doesn't already exist
Definition at line 52 of file DeviceHashTree.cc.
References Device::dump(), and NOTICE.
void DeviceHashTree::fill | ( | Device * | root = 0 | ) |
Fills the hash tree, starting at the given Device and recursively traversing each device with children.
Definition at line 45 of file DeviceHashTree.cc.
References Device::foreach().
Device * DeviceHashTree::getDevice | ( | uint32_t | hash | ) |
Gets a device from an integer hash
Definition at line 65 of file DeviceHashTree.cc.
Gets a device from a string hash
Definition at line 73 of file DeviceHashTree.cc.
size_t DeviceHashTree::getHash | ( | Device * | p | ) |
Grabs the hash for a given device
Definition at line 85 of file DeviceHashTree.cc.
References Device::dump(), Device::getName(), Device::getPciBusPosition(), Device::getPciDevicePosition(), and Device::getPciFunctionNumber().
|
inline |
Whether or not the hash tree is ready for use.
Definition at line 50 of file DeviceHashTree.h.