
Solaris::DeviceTree - Perl interface to the Solaris devicetree

use Solaris::DeviceTree my $tree = new Solaris::DeviceTree; my @children = $tree->children;

The Solaris::DeviceTree module implements access to the Solaris device information. The information is collected from the kernel via access to libdevinfo, the contents of the file /etc/path_to_inst and the filesystem entries below /dev and /devices. The devicetree is presented as a hierarchical collection of node. Each node contains the unified information from all available resources.
The following methods are available:
The constructor returns a reference to a Solaris::DeviceTree object which itself implements the Solaris::DeviceTree::Node interface. The instance returned represents the root-node of the devicetree.
This methos removes all internal data structures which are associated with this object.
This method returns a list with all children.
Returns the parent node for the object. If the object is toplevel, then undef is returned.
Returns the root node of the tree.
Returns the list of siblings for the object. A sibling is a child from our parent, but not ourselves.
Returns the physical path assocatiated with this node.
Returns the name of the node.
Returns the binding name for this node. The binding name is the name used by the system to select a driver for the device.
Returns the address on the bus for this node. undef is returned if a bus address has not been assigned to the device. A zero-length string may be returned and is considered a valid bus address.
Returns the instance number of the driver bound to the node. If no driver is bound to the node undef is returned.
Returns the list of names from compatible device for the current node. See the discussion of generic names in "Writing Device Drivers" for a description of how compatible names are used by Solaris to achieve driver binding for the node.
Returns the device ID for the node, if it is registered. Otherwise, undef is returned.
Returns the name of the driver for the node or undef if the node is not bound to any driver.
Returns a list of all minor nodes which are associated with this node. The minor nodes are of class Solaris::DeviceTree::MinorNode.

/etc/path_to_inst use Solaris::DeviceTree;
my $t = Solaris::DeviceTree->new( use => [ qw( path_to_inst ) ] );
my @nodes = ( $t );
while( @nodes > 0 ) {
my $node = shift @nodes;
print $node->devfs_path, "\n";
unshift @nodes, $node->child_nodes;
}

Copyright 1999-2003 Dagobert Michelsen.

Solaris::DeviceTree::PathToInst, Solaris::DeviceTree::Filesystem, Solaris::DeviceTree::Libdevinfo.

* As an additional feature access to the libcfgadm should be included.