|
The Pedigree Project 0.1
|
#include <DeviceHashTree.h>
Collaboration diagram for DeviceHashTree: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.
| DeviceHashTree::DeviceHashTree | ( | ) |
Definition at line 30 of file DeviceHashTree.cc.
|
virtual |
Definition at line 32 of file DeviceHashTree.cc.
| void DeviceHashTree::add | ( | Device * | p | ) |
Adds a device, if it doesn't already exist
Definition at line 47 of file DeviceHashTree.cc.
References Device::dump(), getHash(), Tree< K, E >::insert(), and Tree< K, E >::lookup().
| 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 41 of file DeviceHashTree.cc.
References Device::foreach().
Gets a device from a string hash
Definition at line 66 of file DeviceHashTree.cc.
References Tree< K, E >::lookup().
| Device * DeviceHashTree::getDevice | ( | uint32_t | hash | ) |
Gets a device from an integer hash
Definition at line 59 of file DeviceHashTree.cc.
References Tree< K, E >::lookup().
| size_t DeviceHashTree::getHash | ( | Device * | p | ) |
Grabs the hash for a given device
Definition at line 75 of file DeviceHashTree.cc.
References Device::dump(), Device::getName(), Device::getPciBusPosition(), Device::getPciDevicePosition(), and Device::getPciFunctionNumber().
Referenced by add().
Here is the caller graph for this function:
|
inline |
Whether or not the hash tree is ready for use.
Definition at line 48 of file DeviceHashTree.h.
|
inlinestatic |
Definition at line 43 of file DeviceHashTree.h.
|
private |
Definition at line 75 of file DeviceHashTree.h.
Definition at line 77 of file DeviceHashTree.h.
|
staticprivate |
Definition at line 73 of file DeviceHashTree.h.