diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-03-02 18:07:37 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-03-02 18:07:37 +0000 |
commit | ee0e06c99e2cf44c23984e84b592ff82af68b19b (patch) | |
tree | e3c8fc7310253671fcc7d1b77a4b308013da72dd /xpp/perl_modules/Dahdi/Span.pm | |
parent | ff09b1ff474333d8f7e51a8f4ef84a2f9cd9e395 (diff) |
DAHDI-perl: allow setting base of system files with DAHDI_VIRT_TOP
If the user set DAHDI_VIRT_TOP in the environment, consider it as a path
under which to look for ProcFS and SysFS files. This allows running the
DAHDI-perl tools on filesystem dumps generated by
build_tools/dump_sys_state .
To reduce the number of dependencies between various modules, the 'xpd'
member of a Dahdi::Span is removed. Dahdi::Xpp::xpd_of_span() can be
used if needed.
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@8215 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'xpp/perl_modules/Dahdi/Span.pm')
-rw-r--r-- | xpp/perl_modules/Dahdi/Span.pm | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/xpp/perl_modules/Dahdi/Span.pm b/xpp/perl_modules/Dahdi/Span.pm index 943ab2b..9f4ca65 100644 --- a/xpp/perl_modules/Dahdi/Span.pm +++ b/xpp/perl_modules/Dahdi/Span.pm @@ -10,7 +10,6 @@ package Dahdi::Span; use strict; use Dahdi::Utils; use Dahdi::Chans; -use Dahdi::Xpp::Xpd; =head1 NAME @@ -113,8 +112,6 @@ actually set in the module as capital-letter propeties. To look at e.g. =cut -my $proc_base = "/proc/dahdi"; - sub chans($) { my $span = shift; return @{$span->{CHANS}}; @@ -176,17 +173,13 @@ sub init_proto($$) { sub new($$) { my $pack = shift or die "Wasn't called as a class method\n"; - my $num = shift or die "Missing a span number parameter\n"; + my $proc_file = shift or die "Missing a proc file parameter\n"; + $proc_file =~ m{[^/]*/(\d+)$}; + my $num = $1 or die " Invalid span file name: $proc_file\n"; my $self = { NUM => $num }; bless $self, $pack; $self->{TYPE} = "UNKNOWN"; - my @xpds = Dahdi::Xpp::Xpd::xpds_by_spanno; - my $xpd = $xpds[$num]; - if(defined $xpd) { - die "Spanno mismatch: $xpd->spanno, $num" unless $xpd->spanno == $num; - $self->{XPD} = $xpd; - } - open(F, "$proc_base/$num") or die "Failed to open '$proc_base/$num\n"; + open(F, "$proc_file") or die "Failed to open '$proc_file\n"; my $head = <F>; chomp $head; $self->{IS_DIGITAL} = 0; |