| Solaris-DeviceTree documentation | Contained in the Solaris-DeviceTree distribution. |
Solaris::DeviceTree::Libdevinfo::MinorNode - Minor node of the Solaris devicetree
use Solaris::DeviceTree::Libdevinfo;
$tree = new Solaris::DeviceTree::Libdevinfo;
@disks = $tree->find_nodes( type => 'disk' );
@minor = @disks->minor_nodes;
$name = $minor->name
$path = $minor->devfs_path
($majnum,$minnum) = $minor->devt
$type = $minor->nodetype
$spectype = $minor->spectype
if( $minor->is_raw_device ) { ... }
if( $minor->is_block_device ) { ... }
$treenode = $minor->node
This class implements a minor node in the libdevinfo devicetree.
This is an internal class to Solaris::DeviceTree::Libdevinfo. There should be
no need to generate instances of this class in an application explicitly.
Instances are generated only from Solaris::DeviceTree::Libdevinfo::minor_nodes().
The following methods are available:
Return the name of the minor node. This is used e.g. as suffix of the device filename. For disks this is something like ':a' or ':a,raw'.
Return the complete physical path including the minor node
Returns the major and minor device number as a list for the node. The major numbers should be the same for all minor nodes returned by a Solaris::DeviceTree::Libdevinfo node.
Returns the nodetype of the minor node. Legal return values
can be taken from <sys/sunddi.h>. With this call you
can differentiate between pseudo nodes, displays and stuff.
Returns the type of the minor node. Returns raw for a raw device block for a block device
Returns true if the minor node is a raw device.
Returns true if the minor node is a block device.
Returns the associated Solaris::DevinfoTree::Libdevinfo node. One treenode can (and usually does) have multiple minor nodes.
Copyright 1999-2003 Dagobert Michelsen.
Solaris::DeviceTree::Libdevinfo, Solaris::DeviceTree::MinorNode.
| Solaris-DeviceTree documentation | Contained in the Solaris-DeviceTree distribution. |
# # $Header: /cvsroot/devicetool/Solaris-DeviceTree/lib/Solaris/DeviceTree/Libdevinfo/MinorNode.pm,v 1.5 2003/12/09 13:04:47 honkbude Exp $ # package Solaris::DeviceTree::Libdevinfo::MinorNode; use 5.006; use strict; use warnings; use Solaris::DeviceTree::Libdevinfo::Impl; our $VERSION = do { my @r = (q$Revision: 1.5 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
# The constructor takes a SWIG-pointer to the C data structure # of a minor node C<di_minor_t> and a backreference to the # C<Solaris::DeviceTree::Libdevinfo> object which generates this # instance. sub new { my ($class, $minor, $node) = @_; my $this = bless { _minor => $minor, _node => $node, # if we need infos about the upper node }, ref( $class ) || $class; return $this; }
sub name { my $this = shift; return di_minor_name( $this->{_minor} ); }
sub devfs_path { my $this = shift; return $this->node->devfs_path . ":" . $this->name; }
sub devt { my $this = shift; my $devt = di_minor_devt( $this->{_minor} ); my ($major, $minor) = devt_majorminor( $devt ); return ($major, $minor); }
sub nodetype { my $this = shift; return di_minor_nodetype( $this->{_minor} ); }
sub spectype { my $this = shift; my $result; my $spectype = di_minor_spectype( $this->{_minor} ); if( $spectype == $S_IFCHR ) { $result = "raw"; } elsif( $spectype == $S_IFBLK ) { $result = "block"; } return $result; }
sub is_raw_device { my $this = shift; return di_minor_spectype( $this->{_minor} ) == $S_IFCHR; }
sub is_block_device { my $this = shift; return di_minor_spectype( $this->{_minor} ) == $S_IFBLK; }
sub node { my $this = shift; return $this->{_node}; }
1;