NAME

Solaris::DeviceTree::Util - Mixin class devicetrees

DESCRIPTION

This class acts as a mixin class for several methods which are available to all subclasses of Solaris::DeviceTree.

METHODS

The following methods are available:

    if( $node->is_network_node ) { ... }

    This method returns true if the node represents a network card.

    if( $node->is_block_node ) { ... }

    This method returns true if the node represents a block device (which is essentially a disk).

    @network_nodes = $node->network_nodes

    This method returns all nodes for network cards in the tree.

    @block_nodes = $node->block_nodes

    This method returns all nodes for disks in the tree.

    $node = $node->find_nodes( devfs_path => '/pci@1f,0/pci@1f,2000' );

    This method returns nodes matching certain criteria. Currently it is possible to match against a physical path or to specify a subroutine where the node is returned if the subroutine returns true. As in Perl grep $_ is locally bound to the node being checked.

    In a scalar context the method returns only the first node found. In an array context the method returns all matching nodes.

    $node = $node->find_nodes( devfs_path => '/pci@1f,0/pci@1f,2000' );
    @nodes = $node->find_nodes( func => sub { $_->is_network_node } );

    my $prop = $node->find_prop( devfs_path => '/aliases', prop_name => 'disk' );

    This method picks a node by criteria from the devicetree and then selects either a property or a prom property depending on the options given. At least one of

    prop_name
    prom_prop_name

    must be specified. All options valid for find_nodes are also applicable to this method.

    find_minor_node( name => ':a' );

    my $solaris_path = $node->solaris_path

    This method converts between an OBP device path and a Solaris device path.

    The conversion is quite complex. As a first step the IOCTLS OPROMDEV2PROMNAME (OIOC | 15) /* Convert devfs path to prom path */ OPROMPROM2DEVNAME (OIOC | 16) /* Convert devfs path to prom path */ might be taken. However, some older machines are not aware of that. It would be optimal to use devfs_dev_to_prom_name from libdevinfo, but that one is static and reprogramming that one is *not* fun.

    %aliases = %{$node->aliases};

    This method returns a hash reference which maps all aliases to their corresponding pathes.

    $chosen_boot_device = $root->obp_chosen_boot_device;

    This method returns the device from which the system has most recently booted.

    @boot_devices = $root->obp_boot_devices;

    This method returns a list with all boot devices entered in the obp.

    @diag_devices = $root->obp_diag_devices;

    This methos returns a lst with all diag devices entered in the obp.

EXAMPLES

AUTHOR

Copyright 1999-2003 Dagobert Michelsen.

SEE ALSO

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 38:

You can't have =items (as at line 93) unless the first thing after the =over is an =item

Around line 583:

You forgot a '=back' before '=head1'