From ee0e06c99e2cf44c23984e84b592ff82af68b19b Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 2 Mar 2010 18:07:37 +0000 Subject: 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 --- xpp/perl_modules/Dahdi.pm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'xpp/perl_modules/Dahdi.pm') diff --git a/xpp/perl_modules/Dahdi.pm b/xpp/perl_modules/Dahdi.pm index fa5955a..e17b939 100644 --- a/xpp/perl_modules/Dahdi.pm +++ b/xpp/perl_modules/Dahdi.pm @@ -32,7 +32,11 @@ hardware and loaded Dahdi devices. } =cut -my $proc_base = "/proc/dahdi"; +our $virt_base; +our $proc_dahdi_base; +our $proc_xpp_base; +our $proc_usb_base; +our $sys_base; =head1 spans() @@ -43,10 +47,9 @@ Returns a list of span objects, ordered by span number. sub spans() { my @spans; - -d $proc_base or return (); - foreach my $zfile (glob "$proc_base/*") { - $zfile =~ s:$proc_base/::; - next unless ($zfile =~ /^\d+$/); + -d $proc_dahdi_base or return (); + foreach my $zfile (glob "$proc_dahdi_base/*") { + next unless ($zfile =~ m{^$proc_dahdi_base/\d+$}); my $span = Dahdi::Span->new($zfile); push(@spans, $span); } @@ -54,6 +57,13 @@ sub spans() { return @spans; } +=head1 ENVIRONMENT + +If C is set in the environment, it will be considered +as a path to a directory that holds a dump (copy) of all the required +files from /proc and /sys . You can generate that directory using the +script C . + =head1 SEE ALSO Span objects: L. -- cgit v1.2.3