|
PTools::SDF::File::Mnttab - Parser for "/etc/mnttab" file. |
PTools::SDF::File::Mnttab - Parser for ``/etc/mnttab'' (/etc/fstab) file.
This document describes version 0.08, released October, 2004.
use PTools::SDF::File::Mnttab;
or use PTools::SDF::File::Mnttab qw( followPath );
$mntRef = new PTools::SDF::File::Mnttab; # load /etc/mnttab
($mount,$type) = $mntRef->findMountPoint("/some/dir/path");
or $mount = $mntRef->findMountPoint("/some/dir/path");
($mount,$type) = $mntRef->findMountDev("/dev/vg00/lvol6");
or $mount = $mntRef->findMountDev("/dev/someDevice");
($stat,$err) = $mntRef->status; # returns any fatal error
$mntRef->mountIsLocal and print "FS is local\n";
$mntRef->mountNotLocal and print "FS is NOT local\n";
$mntRef->validMountPoint or print "path: no directory found\n";
$mount = $mntRef->getMountPoint; # dir from findMountPoint|Dev
$type = $mntRef->getMountType; # type from findMountPoint|Dev
$device= $mntRef->getMountDevice; # dev from findMountPoint|Dev
This class is a simple parser for the file /etc/mnttab on Unix systems. It is used to easily find mount point information for various file paths.
$mntRef = new PTools::SDF::File::Mnttab( $path );
$mntRef = new PTools::SDF::File::Mnttab( $path, $depth );
Note: By default, any path with relative directory components or symbolic links is NOT recognized as valid. To allow these path components, add the ``followPath'' parameter to the ``use'' statement, as shown above. To ensure that mount points can be found, the full /etc/mnttab file is loaded in this case, and any $path and $depth parameters to the new method are ignored.
Examples:
($mount,$type) = $mntRef->findMountPoint("/some/dir/path");
$mount = $mntRef->findMountPoint("/some/dir/path");
($mount,$type) = $mntRef->findMountDev("/dev/vg00/lvol6");
$mount = $mntRef->findMountDev("/dev/someDevice");
Example:
$i=0;
foreach $mount ( $mntRef->listMountPoints ) {
printf(" dir %3.3d: %s\n", $i++, $mount );
}
Examples:
$mount = $mntRef->getMountPoint;
$type = $mntRef->getMountType;
$device= $mntRef->getMountDevice;
Examples:
$mntRef->mountIsLocal and print "FS is local\n";
$mntRef->mountNotLocal and print "FS is NOT local\n";
$mntRef->validMountPoint or print "path: no directory found\n";
This class inherits from PTools::SDF::SDF which in turn inherits from PTools::SDF::File.
For additional methods see the PTools::SDF::SDF manpage and the PTools::SDF::File manpage.
Chris Cobb, <nospamplease@ccobb.net>
Copyright (c) 2002-2007 by Chris Cobb. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
PTools::SDF::File::Mnttab - Parser for "/etc/mnttab" file. |