Sys-Filesystem-1.406/000755 000765 000024 00000000000 12334422062 014364 5ustar00snostaff000000 000000 Sys-Filesystem-1.406/Changes000644 000765 000024 00000015011 12334407002 015652 0ustar00snostaff000000 000000 Revision history for CPAN distribution Sys-Filesystem 1.406 2014-05-13 - always use global kernel mount table (/proc/mounts), not the process mirror - add support for getting canonical device path - add support for package wide settings to tune Sys::Filesystem even when used indirectly 1.405 2013-10-28 - Fix Mswin32 mounted/unmounted support (thanks to Christian "Mithaldu" Walde for remote testing support) - skip format test in case of unmounted device (unmounted devices might or might not know in before the fstype) - clean up basic tests and BAIL_OUT when unsupported environment encountered 1.404 2013-10-26 - move to Makefile.PL in favour of developer reqs - change required perl version to 5.8.1 - rewrite core routines of Sys::Filesystem - don't search for Darwin tools in path, rely on some well known paths - general, minor code cleanup 1.403 2013-10-23 - Honor PATH_FSTAB in the environment on a NetBSD system if present (Thanks to dholland@NetBSD.org) - try improve error handling on Darwin to avoid smoke errors - be noisy about where we're running on during tests - remove runtime recommends for author tests - bump required version of Module::Pluggable to avoid blead whining - include p5-toolchain gang recommended way to declare developer dependencies - use proper indenting for Changes 1.402 2013-09-24 - remove Makefile.PL passthrough - don't prove whether Win32 is supported - we know it (should fix RT#88901 - thanks Michiel Beijen) - try to improve supported control - put Win32::DriveInfo into feature "Win32" (I'd like to get feedback whether it helps) 1.401 2013-09-08 - Fix MacOS X / Darwin without diskutil - Changes reformatted as per CPAN::Changes::Spec 1.400 2013-09-03 - Moving to GitHub for easier contributing - Pod typo / encoding fixes (rt#85898, rt#77699), thanks to Slaven Rezić, Andreas J. König and Gregor Herrmann - Fix MacOS X 10.8 (diskutil vs. disktool) - Update requirements / recommendations - Fix AIX (rt#79188) - thanks to David Lee - Fix Solaris debug leftover (rt#72717) - thanks to Kenneth Ölwing - Fix Tests (rt#62248) - thanks to Daphne Pfister - Fix configure_requires (rt#62249) - thanks to Daphne Pfister 1.30 2010-07-15 - Fixing MSWin32 1.29 2010-07-02 - Fixing MacOS X 1.28 2010-05-14 - Adding more special file systems for Linux (looks in Linux soon everything is a file system), Fixes RT#55059 (Thanks to Reed Loden) - Improving documentation about selections in filesystems method, - Fixes RT#55058 (Thanks to Reed Loden) - Fixes RT#65504 (Thanks to Brett Gersekowski) - Improve MSWin32 support 1.27 2010-02-20 - Fixing RT#54406 (patch from Robert Bohne with some modifications) - Fixing RT#54599 (patch from Jonathan Yu) - Fixing wrong dependencies detection on Windows - Fixing generic fstab/mnttab reading 1.26 2010-02-12 - Adding more special file systems for Linux - Prefer /proc/self/mounts over /etc/mtab (when available), fixes RT #51151 (Thanks Tyler MacDonald) - Fix some tests to skip when no regular file systems could be found - Some Win32 fixes - Switch to Module::Pluggable to load OS-plugins 1.25 2009-10-30 - Fixed support for FreeBSD and generalize BSD support - Fixed support for AIX - Fixed aliased attribute support for Sys::Filesystem->filesystems - Fix "Sys::Filesystem->filesystems ()" and "Sys::Filesystem::filesystems" (reported by H.Merijn Brand) by using Params::Util - Add keyword "Id" to be used/expanded by svn - Explain how restrictions on method filesystem works in Sys::Filesystem - Add a version method to all fs plugins - Update documentation - Correct t/03test.t to use format instead of type (recommended) 1.24 2009-10-17 - Added support for NetBSD (Jens Rehsack) - Added support for HP-UX (H.Merijn Brand) - Fixed POD a little - Add a simple test to see whether it's working or not - Increased required perl version (suggested by H.Merijn Brand) 1.23 2009-05-10 - Fixed Aix.pm (RT #34577), patches from LEMBARK, REHSACK - Fixed failing on OS X (RT #7958, RT #43681), patch from Dirk Langer - Taking Co-Maintainership (Jens Rehsack, CPAN Id: REHSACK) - Changing debug environment flag from DEBUG to SYS_FILESYSTEM_DEBUG 1.22 2006-06-01 - Added CREDITS. - Fixed logic in Filesystem.pm:filesystems() where the inversion of the 'regaular' and 'special' paramaters was not being handled correctly, causing an incorrect selection of filesystems to be returned sometimes. - Added fd ctfs devfs objfs and procfs as special filesystem types in Solaris.pm. - Added procfs as a special filesyetem type to Aix.pm. - Changed Aix.pm to extract the filesystem type from the vfs field in /etc/filesystems. - Added note in main POD warning people not to confuse "type" and "vfs" when querying values under AIX. - Altered unit tests to be more reliable over different setups. 1.21 2006-05-23 - Typo in Build.PL. Changed "build_requires" to be "recommends". 1.20 2006-05-23 - Fixed POD to reflect functionality that existed but wasn't documented, or that was documented incorrectly. 1.19 2006-05-23 - Changed license to Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0 - Fixed a couple of module file names. - Added additional unit tests. - Fixed loading of failover modules. - A few small bug fixes in parsing of some tab files. 1.18 2005-12-29 - Modified Makefile.PL to submit information to perlgirl.org.uk if the user agrees. Tweaked the POD slightly. 1.16 2005-12-08 - Modified POD 1.15 2005-12-02 - Updated for revision number and email address 1.14 2005-01-30 - Added some new filesystem property aliases and reference to AIX helper module 1.13 2005-01-26 - Added extra documentation and the device option for the filesystems method. 1.12 2005-01-13 - Updated POD 1.11 2004-10-06 1.10 2004-10-06 - Fix from Win32 to MSWin32 1.09 2004-10-05 - Updated Linux.pm to properly detect some more special fs types 1.08 2004-09-30 - Added regular_filesystems() method - Added autofs and mntfs as special filesystems for Solaris 1.07 2004-09-30 - Added solaris mnttab support - Fixed an AUTOLOAD and DESTROY issue 1.06 2004-09-29 - Added alias support and more POD docs 1.04 2004-09-29 - Initial release to get the code out there Sys-Filesystem-1.406/CREDITS000644 000765 000024 00000000570 12334420571 015411 0ustar00snostaff000000 000000 Christian Renz Brad Greenlee Nicola Worthington Jim Pirzyk Ying-Chieh Liao Dintelmann, Peter Artur Penttinen Dirk Langer Jens Rehsack H.Merijn Brand Sys-Filesystem-1.406/INSTALL000644 000765 000024 00000000074 12200240042 015402 0ustar00snostaff000000 000000 perl Build.PL perl Build perl Build test perl Build install Sys-Filesystem-1.406/lib/000755 000765 000024 00000000000 12334422062 015132 5ustar00snostaff000000 000000 Sys-Filesystem-1.406/LICENSE000644 000765 000024 00000026136 12200240042 015365 0ustar00snostaff000000 000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Sys-Filesystem-1.406/Makefile.PL000644 000765 000024 00000011542 12334420375 016346 0ustar00snostaff000000 000000 # vim:ts=4:sw=4:tw=78 # $Id$ use 5.008001; use strict; use vars qw($build); use FindBin; use File::Spec; use lib File::Spec->catdir( $FindBin::Bin, 'lib' ); use ExtUtils::MakeMaker; $@ = undef; my @fs; $^O eq 'MSWin32' or eval { require Sys::Filesystem; unless ( Sys::Filesystem->supported ) { printf( STDERR "Can't be used ($@) - OS not supported or bad maintained?" ); exit(0); } }; my %RUN_DEPS = ( 'Carp' => 0, 'Cwd' => 0, 'File::Spec' => 0, 'FindBin' => 0, 'IO' => 0, 'IPC::Cmd' => '0.80', 'Module::Pluggable' => '4.8', 'Params::Util' => '1.00', ( $^O eq 'MSWin32' ? ( 'Win32::DriveInfo' => 0, ) : () ), ); my %CONFIGURE_DEPS = ( 'ExtUtils::MakeMaker' => 0, %RUN_DEPS ); my %BUILD_DEPS = (); my %TEST_DEPS = ( 'Test::More' => 0.90, ); WriteMakefile1( MIN_PERL_VERSION => '5.008001', META_ADD => { 'meta-spec' => { version => 2 }, resources => { homepage => 'https://metacpan.org/release/Sys-Filesystem', repository => { url => 'git@github.com:rehsack/Sys-Filesystem.git', web => 'https://github.com/rehsack/Sys-Filesystem', type => 'git', }, bugtracker => { web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Sys-Filesystem', mailto => 'fsys-filesystem@rt.cpan.org', }, }, prereqs => { develop => { requires => { 'Test::CPAN::Changes' => 0, 'Test::CheckManifest' => 0, 'Test::Pod' => 0, 'Test::Pod::Coverage' => 0, 'Test::Pod::Spelling::CommonMistakes' => 0, }, }, configure => { requires => {%CONFIGURE_DEPS}, }, build => { requires => {%BUILD_DEPS} }, test => { requires => {%TEST_DEPS} }, runtime => { recommends => { 'perl' => '5.018001', }, requires => { %RUN_DEPS, }, }, }, }, NAME => 'Sys::Filesystem', VERSION_FROM => 'lib/Sys/Filesystem.pm', ABSTRACT_FROM => 'lib/Sys/Filesystem.pm', LICENSE => 'Apache', AUTHOR => [ q{Nicola Worthington }, q{Jens Rehsack } ], PREREQ_PM => \%RUN_DEPS, BUILD_REQUIRES => \%BUILD_DEPS, TEST_REQUIRES => \%TEST_DEPS, test => { TESTS => 't/*.t xt/*.t' }, ); sub WriteMakefile1 { # originally written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade. my %params = @_; my $eumm_version = $ExtUtils::MakeMaker::VERSION; $eumm_version = eval $eumm_version; die "EXTRA_META is deprecated" if ( exists( $params{EXTRA_META} ) ); die "License not specified" if ( !exists( $params{LICENSE} ) ); if ( $params{TEST_REQUIRES} and ( $eumm_version < 6.6303 ) ) { if ( $params{BUILD_REQUIRES} ) { $params{BUILD_REQUIRES} = { %{ $params{BUILD_REQUIRES} }, %{ $params{TEST_REQUIRES} } }; } else { $params{BUILD_REQUIRES} = delete $params{TEST_REQUIRES}; } } if ( $params{BUILD_REQUIRES} and ( $eumm_version < 6.5503 ) ) { #EUMM 6.5502 has problems with BUILD_REQUIRES $params{PREREQ_PM} = { %{ $params{PREREQ_PM} || {} }, %{ $params{BUILD_REQUIRES} } }; delete $params{BUILD_REQUIRES}; } delete $params{CONFIGURE_REQUIRES} if ( $eumm_version < 6.52 ); delete $params{MIN_PERL_VERSION} if ( $eumm_version < 6.48 ); delete $params{META_MERGE} if ( $eumm_version < 6.46 ); delete $params{META_ADD}{prereqs} if ( $eumm_version < 6.58 ); delete $params{META_ADD}{'meta-spec'} if ( $eumm_version < 6.58 ); delete $params{META_ADD} if ( $eumm_version < 6.46 ); delete $params{LICENSE} if ( $eumm_version < 6.31 ); delete $params{AUTHOR} if ( $] < 5.005 ); delete $params{ABSTRACT_FROM} if ( $] < 5.005 ); delete $params{BINARY_LOCATION} if ( $] < 5.005 ); # more or less taken from Moose' Makefile.PL if ( $params{CONFLICTS} ) { my $ok = CheckConflicts(%params); exit(0) if ( $params{PREREQ_FATAL} and not $ok ); my $cpan_smoker = grep { $_ =~ m/(?:CR_SMOKER|CPAN_REPORTER|AUTOMATED_TESTING)/ } keys %ENV; unless ( $cpan_smoker || $ENV{PERL_MM_USE_DEFAULT} ) { sleep 4 unless ($ok); } delete $params{CONFLICTS}; } WriteMakefile(%params); } Sys-Filesystem-1.406/MANIFEST000644 000765 000024 00000001242 12334422062 015514 0ustar00snostaff000000 000000 Changes CREDITS INSTALL lib/Sys/Filesystem.pm lib/Sys/Filesystem/Aix.pm lib/Sys/Filesystem/Cygwin.pm lib/Sys/Filesystem/Darwin.pm lib/Sys/Filesystem/Dummy.pm lib/Sys/Filesystem/Freebsd.pm lib/Sys/Filesystem/Hpux.pm lib/Sys/Filesystem/Linux.pm lib/Sys/Filesystem/Mswin32.pm lib/Sys/Filesystem/Netbsd.pm lib/Sys/Filesystem/Solaris.pm lib/Sys/Filesystem/Unix.pm LICENSE Makefile.PL MANIFEST MANIFEST.SKIP NOTICE README t/01_load.t t/02_basic.t t/03_whereami.t t/04_special.t t/05_error.t t/06_settings.t TODO META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Sys-Filesystem-1.406/MANIFEST.SKIP000644 000765 000024 00000000437 12334377277 016307 0ustar00snostaff000000 000000 \B\.svn\b \B\.git \.[Bb][Aa][Kk]$ \.orig$ \.old$ \.tdy$ \..*swp ^Makefile$ ^Build$ ^Build\.bat$ CVS/.* \.svn/.* \.cvsignore$ \.Inline/.* _Inline/.* \.bak$ \.tar$ \.tgz$ \.tar\.gz$ ^mess/ ^tmp/ ^testdata/ ^blib/ ^pm_to_blib$ ^_build/.* ~$ Sys-Filesystem-.* ^MYMETA\..*$ \bxt \.travis.yml Sys-Filesystem-1.406/META.json000644 000765 000024 00000004176 12334422062 016015 0ustar00snostaff000000 000000 { "abstract" : "Retrieve list of filesystems and their properties", "author" : [ "Nicola Worthington ", "Jens Rehsack " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141170", "license" : [ "apache_2_0" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Sys-Filesystem", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : {} }, "configure" : { "requires" : { "Carp" : "0", "Cwd" : "0", "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "FindBin" : "0", "IO" : "0", "IPC::Cmd" : "0.80", "Module::Pluggable" : "4.8", "Params::Util" : "1.00" } }, "develop" : { "requires" : { "Test::CPAN::Changes" : "0", "Test::CheckManifest" : "0", "Test::Pod" : "0", "Test::Pod::Coverage" : "0", "Test::Pod::Spelling::CommonMistakes" : "0" } }, "runtime" : { "recommends" : { "perl" : "5.018001" }, "requires" : { "Carp" : "0", "Cwd" : "0", "File::Spec" : "0", "FindBin" : "0", "IO" : "0", "IPC::Cmd" : "0.80", "Module::Pluggable" : "4.8", "Params::Util" : "1.00" } }, "test" : { "requires" : { "Test::More" : "0.9" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "fsys-filesystem@rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=Sys-Filesystem" }, "homepage" : "https://metacpan.org/release/Sys-Filesystem", "repository" : { "type" : "git", "web" : "https://github.com/rehsack/Sys-Filesystem" } }, "version" : "1.406" } Sys-Filesystem-1.406/META.yml000644 000765 000024 00000002024 12334422062 015633 0ustar00snostaff000000 000000 --- abstract: 'Retrieve list of filesystems and their properties' author: - 'Nicola Worthington ' - 'Jens Rehsack ' build_requires: Test::More: '0.9' configure_requires: Carp: '0' Cwd: '0' ExtUtils::MakeMaker: '0' File::Spec: '0' FindBin: '0' IO: '0' IPC::Cmd: '0.80' Module::Pluggable: '4.8' Params::Util: '1.00' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141170' license: apache meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Sys-Filesystem no_index: directory: - t - inc recommends: perl: '5.018001' requires: Carp: '0' Cwd: '0' File::Spec: '0' FindBin: '0' IO: '0' IPC::Cmd: '0.80' Module::Pluggable: '4.8' Params::Util: '1.00' resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Sys-Filesystem homepage: https://metacpan.org/release/Sys-Filesystem repository: https://github.com/rehsack/Sys-Filesystem version: '1.406' Sys-Filesystem-1.406/NOTICE000644 000765 000024 00000000131 12200240042 015247 0ustar00snostaff000000 000000 Contains software written by Nicola Worthington, nicolaw@cpan.org http://perlgirl.org.uk Sys-Filesystem-1.406/README000644 000765 000024 00000026343 12334417552 015264 0ustar00snostaff000000 000000 NAME Sys::Filesystem - Retrieve list of filesystems and their properties SYNOPSIS use strict; use Sys::Filesystem (); # Method 1 my $fs = Sys::Filesystem->new(); my @filesystems = $fs->filesystems(); for (@filesystems) { printf("%s is a %s filesystem mounted on %s\n", $fs->mount_point($_), $fs->format($_), $fs->device($_) ); } # Method 2 my $weird_fs = Sys::Filesystem->new( fstab => '/etc/weird/vfstab.conf', mtab => '/etc/active_mounts', xtab => '/etc/nfs/mounts' ); my @weird_filesystems = $weird_fs->filesystems(); # Method 3 (nice but naughty) my @filesystems = Sys::Filesystem->filesystems(); DESCRIPTION Sys::Filesystem is intended to be a portable interface to list and query filesystem names and their properties. At the time of writing there were only Solaris and Win32 modules available on CPAN to perform this kind of operation. This module hopes to provide a consistent API to list all, mounted, unmounted and special filesystems on a system, and query as many properties as possible with common aliases wherever possible. INHERITANCE Sys::Filesystem ISA UNIVERSAL METHODS new Creates a new Sys::Filesystem object. "new" accepts following optional key value pairs to help or force where mount information is gathered from. These values are not otherwise defaulted by the main Sys::Filesystem object, but left to the platform specific helper modules to determine as an exercise of common sense. canondev Specify whether device path's shall be resolved when they're a symbolic link. $Sys::Filesystem::CANONDEV is used when no key "canondev" is passed. fstab Specify the full path and filename of the filesystem table (or fstab for short). Not all platforms have such a file and so this option may be ignored on some systems. $Sys::Filesystem::FSTAB is used when no key "fstab" is passed. mtab Specify the full path and filename of the mounted filesystem table (or mtab for short). Not all platforms have such a file and so this option may be ignored on some systems. $Sys::Filesystem::MTAB is used when no key "mtab" is passed. xtab DEPRECIATED Specify the full path and filename of the mounted NFS filesystem table (or xtab for short). This is usually only pertinant to Unix bases systems. Not all helper modules will query NFS mounts as a separate exercise, and therefore this option may be ignored on some systems. None of the OS plugins use that tunable (anymore?), so it now a warning is raised when it's used. The entire support will be removed not before 2015. Once that happened, using "xtab" will raise an exception. aliases Overrides internal aliasing table used to match queries against OS plugin. This should be used only when dealing with closed source platform helper module(s). supported Returns true if the operating system is supported by Sys::Filesystem. Unsupported operating systems may get less information, e.g. the mount state couldn't determined or which file system type is special ins't known. Listing Filesystems filesystems() Returns a list of all filesystem. May accept an optional list of key pair values in order to filter/restrict the results which are returned. The restrictions are evaluated to match as much as possible, so asking for regular and special file system (or mounted and special file systems), you'll get all. For better understanding, please imagine the parameters like: @fslist = $fs->filesystems( mounted => 1, special => 1 ); # results similar as SELECT mountpoint FROM filesystems WHERE mounted = 1 OR special = 1 If you need other selection choices, please take a look at DBD::Sys. Valid values are as follows: device => "string" Returns only filesystems that are mounted using the device of "string". For example: my $fdd_filesytem = Sys::Filesystem->filesystems(device => "/dev/fd0"); mounted => 1 Returns only filesystems which can be confirmed as actively mounted. (Filesystems which are mounted). The mounted_filesystems() method is an alias for this syntax. unmounted => 1 Returns only filesystems which cannot be confirmed as actively mounted. (Filesystems which are not mounted). The unmounted_filesystems() method is an alias for this syntax. special => 1 Returns only filesystems which are regarded as special in some way. A filesystem is marked as special by the operating specific helper module. For example, a tmpfs type filesystem on one operating system might be regarded as a special filesystem, but not on others. Consult the documentation of the operating system specific helper module for further information about your system. (Sys::Filesystem::Linux for Linux or Sys::Filesystem::Solaris for Solaris etc). This parameter is mutually exclusive to "regular". The special_filesystems() method is an alias for this syntax. regular => 1 Returns only fileystems which are not regarded as special. (Normal filesystems). This parameter is mutually exclusive to "special". The regular_filesystems() method is an alias for this syntax. mounted_filesystems() Returns a list of all filesystems which can be verified as currently being mounted. unmounted_filesystems() Returns a list of all filesystems which cannot be verified as currently being mounted. special_filesystems() Returns a list of all fileystems which are considered special. This will usually contain meta and swap partitions like /proc and /dev/shm on Linux. regular_filesystems() Returns a list of all filesystems which are not considered to be special. Filesystem Properties Available filesystem properties and their names vary wildly between platforms. Common aliases have been provided wherever possible. You should check the documentation of the specific platform helper module to list all of the properties which are available for that platform. For example, read the Sys::Filesystem::Linux documentation for a list of all filesystem properties available to query under Linux. mount_point() or filesystem() Returns the friendly name of the filesystem. This will usually be the same name as appears in the list returned by the filesystems() method. mounted() Returns boolean true if the filesystem is mounted. label() Returns the fileystem label. This functionality may need to be retrofitted to some original OS specific helper modules as of Sys::Filesystem 1.12. volume() Returns the volume that the filesystem belongs to or is mounted on. This functionality may need to be retrofitted to some original OS specific helper modules as of Sys::Filesystem 1.12. device() Returns the physical device that the filesystem is connected to. special() Returns boolean true if the filesystem type is considered "special". type() or format() Returns the type of filesystem format. fat32, ntfs, ufs, hpfs, ext3, xfs etc. options() Returns the options that the filesystem was mounted with. This may commonly contain information such as read-write, user and group settings and permissions. mount_order() Returns the order in which this filesystem should be mounted on boot. check_order() Returns the order in which this filesystem should be consistency checked on boot. check_frequency() Returns how often this filesystem is checked for consistency. OS SPECIFIC HELPER MODULES Dummy The Dummy module is there to provide a default failover result to the main Sys::Filesystem module if no suitable platform specific module can be found or successfully loaded. This is the last module to be tried, in order of platform, Unix (if not on Win32), and then Dummy. Unix The Unix module is intended to provide a "best guess" failover result to the main Sys::Filesystem module if no suitable platform specific module can be found, and the platform is not 'MSWin32'. This module requires additional work to improve it's guestimation abilities. Darwin First written by Christian Renz . Win32 Provides "mount_point" and "device" of mounted filesystems on Windows. AIX Please be aware that the AIX /etc/filesystems file has both a "type" and "vfs" field. The "type" field should not be confused with the filesystem format/type (that is stored in the "vfs" field). You may wish to use the "format" field when querying for filesystem types, since it is aliased to be more reliable accross different platforms. Other Linux, Solaris, Cygwin, FreeBSD, NetBSD, HP-UX. OS Identifiers The following list is taken from perlport. Please refer to the original source for the most up to date version. This information should help anyone who wishes to write a helper module for a new platform. Modules should have the same name as ^O in title caps. Thus 'openbsd' becomes 'Openbsd.pm'. REQUIREMENTS Sys::Filesystem requires Perl >= 5.6 to run. TODO Add support for Tru64, MidnightBSD, Haiku, Minix, DragonflyBSD and OpenBSD. Please contact me if you would like to provide code for these operating systems. SUPPORT You can find documentation for this module with the perldoc command. perldoc Sys::Filesystem You can also look for information at: * RT: CPAN's request tracker * AnnoCPAN: Annotated CPAN documentation * CPAN Ratings * Search CPAN SEE ALSO perlport, Solaris::DeviceTree, Win32::DriveInfo VERSION $Id$ AUTHOR Nicola Worthington - Jens Rehsack - ACKNOWLEDGEMENTS See CREDITS in the distribution tarball. COPYRIGHT Copyright 2004,2005,2006 Nicola Worthington. Copyright 2008-2014 Jens Rehsack. This software is licensed under The Apache Software License, Version 2.0. Sys-Filesystem-1.406/t/000755 000765 000024 00000000000 12334422062 014627 5ustar00snostaff000000 000000 Sys-Filesystem-1.406/TODO000644 000765 000024 00000000417 12200240042 015042 0ustar00snostaff000000 000000 I need to rewrite this code from the ground up really. It was written to fill a gap which existing at a time when I was writing a backup script. Hopefully this will happen sooner rather than later. Any help, patches, rewrites and/or suggestions will be greatly accepted. Sys-Filesystem-1.406/t/01_load.t000644 000765 000024 00000000611 12334421511 016227 0ustar00snostaff000000 000000 #!perl use strict; use warnings; use Test::More tests => 2; require_ok('Sys::Filesystem'); use_ok('Sys::Filesystem'); use Config; my $os_info = join( "-", $Config{osname}, $Config{osvers} ); $^O eq "MSWin32" and eval "use Win32;" and $os_info = join( "-", Win32::GetOSName(), Win32::GetOSVersion() ); diag("Testing Sys::Filesystem $Sys::Filesystem::VERSION, Perl $] ($^X) on $os_info"); Sys-Filesystem-1.406/t/02_basic.t000644 000765 000024 00000004734 12334421511 016404 0ustar00snostaff000000 000000 #!perl use strict; use warnings; use Test::More; use Sys::Filesystem; my ( $fs, @filesystems ); eval { $fs = Sys::Filesystem->new(); @filesystems = $fs->filesystems(); }; $@ and plan skip_all => "Cannot initialize Sys::Filesystem: $@"; @filesystems or BAIL_OUT("Badly poor supported OS or no file systems found."); ok( ref($fs) eq 'Sys::Filesystem', 'Create new Sys::Filesystem object' ); my @mounted_filesystems = $fs->mounted_filesystems(); my @mounted_filesystems2 = $fs->filesystems( mounted => 1 ); ok( "@mounted_filesystems" eq "@mounted_filesystems2", 'Compare mounted methods' ); my @unmounted_filesystems = $fs->unmounted_filesystems(); my @special_filesystems = $fs->special_filesystems(); my @regular_filesystems = $fs->regular_filesystems(); ok( @regular_filesystems, 'Get list of regular filesystems' ); ok( @filesystems, 'Get list of all filesystems' ); diag( join( ' - ', qw(filesystem mounted special device options format volume label type) ) ); for my $filesystem (@filesystems) { my $mounted = $fs->mounted($filesystem) || 0; my $unmounted = !$mounted; ok( $mounted == grep( /^\Q$filesystem\E$/, @mounted_filesystems ), 'Mounted' ); ok( $unmounted == grep( /^\Q$filesystem\E$/, @unmounted_filesystems ), 'Unmounted' ); my $special = $fs->special($filesystem) || 0; my $regular = !$special; ok( $special == grep( /^\Q$filesystem\E$/, @special_filesystems ), 'Special' ); ok( $regular == grep( /^\Q$filesystem\E$/, @regular_filesystems ), 'Regular' ); my ( $device, $options, $format, $volume, $label, $type ); ok( $device = $fs->device($filesystem), "Get device for $filesystem" ); ok( defined( $options = $fs->options($filesystem) ), "Get options for $filesystem: $options" ); SKIP: { $format = $fs->format($filesystem); $mounted or skip( "Format might be unavailable unless mounted", 1 ); ok( $format, "Get format for $filesystem" ); } ok( $volume = $fs->volume($filesystem) || 1, "Get volume type for $filesystem" ); ok( $label = $fs->label($filesystem) || 1, "Get label for $filesystem" ); $type = $fs->type($filesystem); diag( join( ' - ', $filesystem, $mounted, $special, $device, $options, $format || 'n/a', $volume || 'n/a', $label || 'n/a', $type || 'n/a' ) ); } my $device = $fs->device( $filesystems[0] ); ok( my $foo_filesystem = Sys::Filesystem::filesystems( device => $device ), "Get filesystem attached to $device" ); done_testing(); Sys-Filesystem-1.406/t/03_whereami.t000644 000765 000024 00000003271 12334421511 017120 0ustar00snostaff000000 000000 #!perl use strict; use warnings; use Test::More; use Sys::Filesystem; use Cwd qw(abs_path); use Config; my $RealTest = abs_path(__FILE__); my $RealPerl = abs_path( $Config{perlpath} ); if ( $^O ne 'VMS' ) { $RealPerl .= $Config{_exe} unless $RealPerl =~ m/$Config{_exe}$/i; } $RealTest = ucfirst($RealTest) if ( $^O =~ m/Win32/ ); my $sfs; eval { $sfs = Sys::Filesystem->new(); }; $@ and plan skip_all => "Cannot initialize Sys::Filesystem: $@"; ok( ref($sfs) eq 'Sys::Filesystem', 'Create new Sys::Filesystem object' ); my ( $binmount, $mymount ); my @mounted_filesystems = sort { length($b) <=> length($a) } $sfs->filesystems( mounted => 1 ); SKIP: { unless (@mounted_filesystems) { if ( $sfs->supported() ) { diag("Unexpected empty list of mounted filesystems"); } skip( 'Badly poor supported OS or no file systems found.', 2 ); } foreach my $fs (@mounted_filesystems) { diag("Checking '$fs' being mountpoint for '$RealPerl' or '$RealTest' ...") if ( $^O eq 'MSWin32' or $^O eq 'cygwin' ); if ( !defined($binmount) && ( 0 == index( $RealPerl, $fs ) ) ) { $binmount = $fs; } if ( !defined($mymount) && ( 0 == index( $RealTest, $fs ) ) ) { $mymount = $fs; } } TODO: { local $TODO = "Known fail for MSWin32, cygwin & Co. - let's make it not so important ..."; ok( $mymount, sprintf( q{Found mountpoint for test file '%s' at '%s'}, $RealTest, $mymount || '' ) ); ok( $binmount, sprintf( q{Found mountpoint for perl executable '%s' at '%s'}, $RealPerl, $binmount || '' ) ); } } done_testing(); Sys-Filesystem-1.406/t/04_special.t000644 000765 000024 00000002017 12334421511 016735 0ustar00snostaff000000 000000 #!perl use strict; use warnings; use Test::More; use Sys::Filesystem; my $fs; eval { $fs = Sys::Filesystem->new(); }; $@ and plan skip_all => "Cannot initialize Sys::Filesystem: $@"; ok( ref($fs) eq 'Sys::Filesystem', 'Create new Sys::Filesystem object' ); my @special_filesystems = $fs->special_filesystems(); my @regular_filesystems = $fs->regular_filesystems(); SKIP: { skip( 'Badly poor supported OS or no file systems found.', 0 ) unless (@regular_filesystems); ok( @regular_filesystems, 'Get list of regular filesystems' ); for my $filesystem (@regular_filesystems) { my $special = $fs->special($filesystem) || 0; ok( !$special, "Regular" ); } } SKIP: { skip( 'Badly poor supported OS or no file systems found.', 0 ) unless (@special_filesystems); ok( @special_filesystems, 'Get list of regular filesystems' ); for my $filesystem (@special_filesystems) { my $special = $fs->special($filesystem) || 0; ok( $special, "Special" ); } } done_testing(); Sys-Filesystem-1.406/t/05_error.t000644 000765 000024 00000001054 12334421511 016447 0ustar00snostaff000000 000000 #!perl use strict; use warnings; use Test::More; use Sys::Filesystem; my $fs; eval { $fs = Sys::Filesystem->new(); }; $@ and plan skip_all => "Cannot initialize Sys::Filesystem: $@"; eval { $fs = $fs->new(); }; like( $@, qr/Class name required/, "No object new" ); eval { $fs = Sys::Filesystem->new( insane => 1 ); }; like( $@, qr/Unrecognised.*insane.*/, "No insane parameters" ); eval { $fs = Sys::Filesystem->new('insane'); }; like( $@, qr/Odd number of elements passed when even number was expected/, "No odd parameter list" ); done_testing(); Sys-Filesystem-1.406/t/06_settings.t000644 000765 000024 00000002731 12334421511 017162 0ustar00snostaff000000 000000 #!perl use strict; use warnings; use Test::More; use Sys::Filesystem; delete @ENV{qw(CANONDEV FSTAB MTAB)}; my ( $fs, @filesystems ); eval { $fs = Sys::Filesystem->new(); }; $@ and plan skip_all => "Cannot initialize Sys::Filesystem: $@"; @filesystems = $fs->filesystems; my %devsymlinks; for my $filesystem (@filesystems) { my $device = $fs->device($filesystem); -l $device and $devsymlinks{$filesystem} = $device; } $fs = Sys::Filesystem->new( canondev => 1 ); @filesystems = $fs->filesystems; for my $filesystem (@filesystems) { my $device = $fs->device($filesystem); ok( !-l $device, "$device is not a symlink (canondev => 1)" ); } SCOPE: { local $Sys::Filesystem::CANONDEV = 0; $fs = Sys::Filesystem->new(); @filesystems = $fs->filesystems; my %symdevs; for my $filesystem (@filesystems) { my $device = $fs->device($filesystem); -l $device and $symdevs{$filesystem} = $device; } is_deeply( \%symdevs, \%devsymlinks, "\$S::F::CANONDEV = 0 works as expected" ); } SCOPE: { local $Sys::Filesystem::CANONDEV = 1; $fs = Sys::Filesystem->new(); @filesystems = $fs->filesystems; for my $filesystem (@filesystems) { my $device = $fs->device($filesystem); ok( !-l $device, "$device is not a symlink (\$S::F::CANONDEV = 1)" ); } } # Testing $S::F::MTAB and/or $S::F::FSTAB is pointless - half of the # plugins ignore at least one, likely both # devnull done_testing; Sys-Filesystem-1.406/lib/Sys/000755 000765 000024 00000000000 12334422062 015710 5ustar00snostaff000000 000000 Sys-Filesystem-1.406/lib/Sys/Filesystem/000755 000765 000024 00000000000 12334422062 020034 5ustar00snostaff000000 000000 Sys-Filesystem-1.406/lib/Sys/Filesystem.pm000644 000765 000024 00000042032 12334421026 020372 0ustar00snostaff000000 000000 ############################################################ # # $Id$ # Sys::Filesystem - Retrieve list of filesystems and their properties # # Copyright 2004,2005,2006 Nicola Worthington # Copyright 2008,2009 Jens Rehsack # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################ package Sys::Filesystem; # vim:ts=4:sw=4:tw=78 use 5.008001; my @query_order; use strict; use warnings; use vars qw($VERSION $AUTOLOAD $CANONDEV $FSTAB $MTAB); use Carp qw(croak cluck confess); use Module::Pluggable require => 1, only => [ @query_order = map { __PACKAGE__ . '::' . $_ } ( ucfirst( lc $^O ), $^O =~ m/Win32/i ? 'Win32' : 'Unix', 'Dummy' ) ], inner => 0, search_path => ['Sys::Filesystem'], sub_name => '_plugins'; use Params::Util qw(_INSTANCE); use Scalar::Util qw(blessed); use List::Util qw(first); use constant DEBUG => $ENV{SYS_FILESYSTEM_DEBUG} ? 1 : 0; use constant SPECIAL => ( 'darwin' eq $^O ) ? 0 : undef; $VERSION = '1.406'; my ( $FsPlugin, $Supported ); BEGIN { Sys::Filesystem->_plugins(); foreach my $qo (@query_order) { next unless ( UNIVERSAL::isa( $qo, $qo ) ); $FsPlugin = $qo; last; } $Supported = $FsPlugin ne 'Sys::Filesystem::Unix' and $FsPlugin ne 'Sys::Filesystem::Dummy'; } sub new { # Check we're being called correctly with a class name ref( my $class = shift ) and croak 'Class name required'; # Check we've got something sane passed croak 'Odd number of elements passed when even number was expected' if ( @_ % 2 ); my %args = @_; exists $args{xtab} and carp("Using xtab is depreciated") and delete $args{xtab}; defined $FSTAB and not exists $args{fstab} and $args{fstab} = $FSTAB; defined $MTAB and not exists $args{mtab} and $args{mtab} = $MTAB; defined $CANONDEV and not exists $args{canondev} and $args{canondev} = $CANONDEV; # Double check the key pairs for stuff we recognise my @sane_keys = qw(aliases canondev fstab mtab); my %sane_args; @sane_args{@sane_keys} = delete @args{@sane_keys}; scalar keys %args and croak( "Unrecognised parameter(s) '" . join( "', '", sort keys %args ) . "' passed to module $class" ); my $self = {%sane_args}; # Filesystem property aliases - unless caller knows better ... defined $self->{aliases} or $self->{aliases} = { device => [qw(fs_spec dev)], filesystem => [qw(fs_file mount_point)], mount_point => [qw(fs_file filesystem)], type => [qw(fs_vfstype vfs)], format => [qw(fs_vfstype vfs vfstype)], options => [qw(fs_mntops)], check_frequency => [qw(fs_freq)], check_order => [qw(fs_passno)], boot_order => [qw(fs_mntno)], volume => [qw(fs_volume fs_vol vol)], label => [qw(fs_label)], }; # Debug DUMP( '$self', $self ) if (DEBUG); $self->{filesystems} = $FsPlugin->new(%sane_args); # Maybe upchuck a little croak "Unable to create object for OS type '$self->{osname}'" unless ( $self->{filesystems} ); # Bless and return bless( $self, $class ); return $self; } sub filesystems { my $self = shift; unless ( defined( _INSTANCE( $self, __PACKAGE__ ) ) ) { unshift @_, $self unless ( 0 == ( scalar(@_) % 2 ) ); $self = __PACKAGE__->new(); } # Check we've got something sane passed @_ % 2 and croak 'Odd number of elements passed when even number was expected'; my $params = {@_}; for my $param ( keys %{$params} ) { croak "Illegal paramater '$param' passed to filesystems() method" unless grep( m/^$param$/, qw(mounted unmounted special device regular) ); } # Invert logic for regular if ( exists $params->{regular} ) { delete $params->{regular}; exists( $params->{special} ) and carp("Mutual exclusive parameters 'special' and 'regular' specified together"); $params->{special} = SPECIAL; } my @filesystems = (); # Return list of all filesystems keys %{$params} or return sort( keys( %{ $self->{filesystems} } ) ); for my $fsname ( sort( keys( %{ $self->{filesystems} } ) ) ) { for my $requirement ( keys( %{$params} ) ) { my $fs = $self->{filesystems}->{$fsname}; my $fsreqname = ( !exists $fs->{$requirement} and exists $self->{aliases}->{$requirement} ) ? first { exists $fs->{$_} } @{ $self->{aliases}->{$requirement} } : $requirement; defined $params->{$requirement} and exists $fs->{$fsreqname} and $fs->{$fsreqname} eq $params->{$requirement} and push( @filesystems, $fsname ) and last; push( @filesystems, $fsname ) and last unless defined( $params->{$requirement} ) or exists( $fs->{$fsreqname} ); } } # Return return @filesystems; } sub supported { return $Supported; } sub mounted_filesystems { return $_[0]->filesystems( mounted => 1 ); } sub unmounted_filesystems { return $_[0]->filesystems( unmounted => 1 ); } sub special_filesystems { return $_[0]->filesystems( special => 1 ); } sub regular_filesystems { return $_[0]->filesystems( special => SPECIAL ); } sub DESTROY { } sub AUTOLOAD { my ( $self, $fsname ) = @_; croak "$self is not an object" unless ( blessed($self) ); croak "No filesystem passed where expected" unless ($fsname); ( my $name = $AUTOLOAD ) =~ s/.*://; # No such filesystem exists $self->{filesystems}->{$fsname} or croak "No such filesystem"; # Found the property my $fs = $self->{filesystems}->{$fsname}; exists $fs->{$name} and return $fs->{$name}; # Didn't find the property, but check any aliases exists $self->{aliases}->{$name} and $name = first { exists $fs->{$_} } @{ $self->{aliases}->{$name} } and return $fs->{$name}; return; } sub TRACE { return unless DEBUG; warn( $_[0] ); } sub DUMP { return unless DEBUG; eval { require Data::Dumper; warn( shift() . ': ' . Data::Dumper::Dumper( shift() ) ); }; } 1; =pod =head1 NAME Sys::Filesystem - Retrieve list of filesystems and their properties =head1 SYNOPSIS use strict; use Sys::Filesystem (); # Method 1 my $fs = Sys::Filesystem->new(); my @filesystems = $fs->filesystems(); for (@filesystems) { printf("%s is a %s filesystem mounted on %s\n", $fs->mount_point($_), $fs->format($_), $fs->device($_) ); } # Method 2 my $weird_fs = Sys::Filesystem->new( fstab => '/etc/weird/vfstab.conf', mtab => '/etc/active_mounts', xtab => '/etc/nfs/mounts' ); my @weird_filesystems = $weird_fs->filesystems(); # Method 3 (nice but naughty) my @filesystems = Sys::Filesystem->filesystems(); =head1 DESCRIPTION Sys::Filesystem is intended to be a portable interface to list and query filesystem names and their properties. At the time of writing there were only Solaris and Win32 modules available on CPAN to perform this kind of operation. This module hopes to provide a consistent API to list all, mounted, unmounted and special filesystems on a system, and query as many properties as possible with common aliases wherever possible. =head1 INHERITANCE Sys::Filesystem ISA UNIVERSAL =head1 METHODS =over 4 =item new Creates a new Sys::Filesystem object. C accepts following optional key value pairs to help or force where mount information is gathered from. These values are not otherwise defaulted by the main Sys::Filesystem object, but left to the platform specific helper modules to determine as an exercise of common sense. =over 4 =item canondev Specify whether device path's shall be resolved when they're a symbolic link. C<$Sys::Filesystem::CANONDEV> is used when no key C is passed. =item fstab Specify the full path and filename of the filesystem table (or fstab for short). Not all platforms have such a file and so this option may be ignored on some systems. C<$Sys::Filesystem::FSTAB> is used when no key C is passed. =item mtab Specify the full path and filename of the mounted filesystem table (or mtab for short). Not all platforms have such a file and so this option may be ignored on some systems. C<$Sys::Filesystem::MTAB> is used when no key C is passed. =item xtab B Specify the full path and filename of the mounted NFS filesystem table (or xtab for short). This is usually only pertinant to Unix bases systems. Not all helper modules will query NFS mounts as a separate exercise, and therefore this option may be ignored on some systems. B of the OS plugins use that tunable (anymore?), so it now a warning is raised when it's used. The entire support will be removed not before 2015. Once that happened, using C will raise an exception. =item aliases Overrides internal aliasing table used to match queries against OS plugin. This should be used only when dealing with closed source platform helper module(s). =back =item supported Returns true if the operating system is supported by Sys::Filesystem. Unsupported operating systems may get less information, e.g. the mount state couldn't determined or which file system type is special ins't known. =back =head2 Listing Filesystems =over 4 =item filesystems() Returns a list of all filesystem. May accept an optional list of key pair values in order to filter/restrict the results which are returned. The restrictions are evaluated to match as much as possible, so asking for regular and special file system (or mounted and special file systems), you'll get all. For better understanding, please imagine the parameters like: @fslist = $fs->filesystems( mounted => 1, special => 1 ); # results similar as SELECT mountpoint FROM filesystems WHERE mounted = 1 OR special = 1 If you need other selection choices, please take a look at L. Valid values are as follows: =over 4 =item device => "string" Returns only filesystems that are mounted using the device of "string". For example: my $fdd_filesytem = Sys::Filesystem->filesystems(device => "/dev/fd0"); =item mounted => 1 Returns only filesystems which can be confirmed as actively mounted. (Filesystems which are mounted). The mounted_filesystems() method is an alias for this syntax. =item unmounted => 1 Returns only filesystems which cannot be confirmed as actively mounted. (Filesystems which are not mounted). The unmounted_filesystems() method is an alias for this syntax. =item special => 1 Returns only filesystems which are regarded as special in some way. A filesystem is marked as special by the operating specific helper module. For example, a tmpfs type filesystem on one operating system might be regarded as a special filesystem, but not on others. Consult the documentation of the operating system specific helper module for further information about your system. (Sys::Filesystem::Linux for Linux or Sys::Filesystem::Solaris for Solaris etc). This parameter is mutually exclusive to C. The special_filesystems() method is an alias for this syntax. =item regular => 1 Returns only fileystems which are not regarded as special. (Normal filesystems). This parameter is mutually exclusive to C. The regular_filesystems() method is an alias for this syntax. =back =item mounted_filesystems() Returns a list of all filesystems which can be verified as currently being mounted. =item unmounted_filesystems() Returns a list of all filesystems which cannot be verified as currently being mounted. =item special_filesystems() Returns a list of all fileystems which are considered special. This will usually contain meta and swap partitions like /proc and /dev/shm on Linux. =item regular_filesystems() Returns a list of all filesystems which are not considered to be special. =back =head2 Filesystem Properties Available filesystem properties and their names vary wildly between platforms. Common aliases have been provided wherever possible. You should check the documentation of the specific platform helper module to list all of the properties which are available for that platform. For example, read the Sys::Filesystem::Linux documentation for a list of all filesystem properties available to query under Linux. =over 4 =item mount_point() or filesystem() Returns the friendly name of the filesystem. This will usually be the same name as appears in the list returned by the filesystems() method. =item mounted() Returns boolean true if the filesystem is mounted. =item label() Returns the fileystem label. This functionality may need to be retrofitted to some original OS specific helper modules as of Sys::Filesystem 1.12. =item volume() Returns the volume that the filesystem belongs to or is mounted on. This functionality may need to be retrofitted to some original OS specific helper modules as of Sys::Filesystem 1.12. =item device() Returns the physical device that the filesystem is connected to. =item special() Returns boolean true if the filesystem type is considered "special". =item type() or format() Returns the type of filesystem format. fat32, ntfs, ufs, hpfs, ext3, xfs etc. =item options() Returns the options that the filesystem was mounted with. This may commonly contain information such as read-write, user and group settings and permissions. =item mount_order() Returns the order in which this filesystem should be mounted on boot. =item check_order() Returns the order in which this filesystem should be consistency checked on boot. =item check_frequency() Returns how often this filesystem is checked for consistency. =back =head1 OS SPECIFIC HELPER MODULES =head2 Dummy The Dummy module is there to provide a default failover result to the main Sys::Filesystem module if no suitable platform specific module can be found or successfully loaded. This is the last module to be tried, in order of platform, Unix (if not on Win32), and then Dummy. =head2 Unix The Unix module is intended to provide a "best guess" failover result to the main Sys::Filesystem module if no suitable platform specific module can be found, and the platform is not 'MSWin32'. This module requires additional work to improve it's guestimation abilities. =head2 Darwin First written by Christian Renz . =head2 Win32 Provides C and C of mounted filesystems on Windows. =head2 AIX Please be aware that the AIX /etc/filesystems file has both a "type" and "vfs" field. The "type" field should not be confused with the filesystem format/type (that is stored in the "vfs" field). You may wish to use the "format" field when querying for filesystem types, since it is aliased to be more reliable accross different platforms. =head2 Other Linux, Solaris, Cygwin, FreeBSD, NetBSD, HP-UX. =head2 OS Identifiers The following list is taken from L. Please refer to the original source for the most up to date version. This information should help anyone who wishes to write a helper module for a new platform. Modules should have the same name as ^O in title caps. Thus 'openbsd' becomes 'Openbsd.pm'. =head1 REQUIREMENTS Sys::Filesystem requires Perl >= 5.6 to run. =head1 TODO Add support for Tru64, MidnightBSD, Haiku, Minix, DragonflyBSD and OpenBSD. Please contact me if you would like to provide code for these operating systems. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Sys::Filesystem You can also look for information at: =over 4 =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 SEE ALSO L, L, L =head1 VERSION $Id$ =head1 AUTHOR Nicola Worthington - L Jens Rehsack - L =head1 ACKNOWLEDGEMENTS See CREDITS in the distribution tarball. =head1 COPYRIGHT Copyright 2004,2005,2006 Nicola Worthington. Copyright 2008-2014 Jens Rehsack. This software is licensed under The Apache Software License, Version 2.0. L =cut Sys-Filesystem-1.406/lib/Sys/Filesystem/Aix.pm000644 000765 000024 00000023353 12334421025 021117 0ustar00snostaff000000 000000 ############################################################ # # $Id$ # Sys::Filesystem - Retrieve list of filesystems and their properties # # Copyright 2004,2005,2006 Nicola Worthington # Copyright 2008,2009 Jens Rehsack # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################ package Sys::Filesystem::Aix; # vim:ts=4:sw=4:tw=78 use 5.008001; use strict; use warnings; use vars qw($VERSION); use Carp qw(croak); use Cwd 'abs_path'; use IO::File; $VERSION = '1.406'; sub version() { return $VERSION; } my @fstab_keys = qw(account boot check dev mount nodename size type vfs vol log); my %special_fs = ( swap => 1, procfs => 1, proc => 1, tmpfs => 1, mntfs => 1, autofs => 1, ); # see AIX commands at # http://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.doc/doc/base/alphabeticallistofcommands.htm sub new { ref( my $class = shift ) && croak 'Class name required'; my %args = @_; my $self = bless( {}, $class ); $args{fstab} ||= '/etc/filesystems'; local $/ = "\n"; my %curr_mountz = map { my $path = $_ =~ m/^\s/ ? (split)[1] : (split)[2]; ( $path => 1 ); } qx( /usr/sbin/mount ); my %fs_info = map { my ( $path, $device, $vfs, $nodename, $type, $size, $options, $mount, $account ) = split( m/:/, $_ ); ( $path => [ $device, $vfs, $nodename, $type, $size, $options, $mount, $account ] ) } grep { m/^[^#]/ } qx( /usr/sbin/lsfs -c ); foreach my $current_filesystem ( keys %fs_info ) { $self->{$current_filesystem}->{filesystem} = $current_filesystem; my ( $device, $vfs, $nodename, $type, $size, $options, $mount, $account ) = @{ $fs_info{$current_filesystem} }; $args{canondev} and -l $device and $device = abs_path($device); $self->{$current_filesystem}->{dev} = $device; $self->{$current_filesystem}->{vfs} = $vfs; $self->{$current_filesystem}->{options} = $options; $self->{$current_filesystem}->{nodename} = $nodename; $self->{$current_filesystem}->{type} = $type; $self->{$current_filesystem}->{size} = $size; $self->{$current_filesystem}->{mount} = $mount; $self->{$current_filesystem}->{account} = $account; $self->{$current_filesystem}->{special} = 1 if ( defined($vfs) && defined( $special_fs{$vfs} ) ); # the filesystem is either currently mounted or is not, # this does not need to be checked for each individual # attribute. my $state = defined( $curr_mountz{$current_filesystem} ) ? 'mounted' : 'unmounted'; $self->{$current_filesystem}->{$state} = 1; } my @active_vgs = qx(/usr/sbin/lsvg -Lo); scalar @active_vgs and %fs_info = map { my ( $lvname, $type, $lps, $pps, $pvs, $lvstate, $path ) = split( m/\s+/, $_ ); ( $path => [ $lvname, $type, $lps, $pps, $pvs, $lvstate ] ) } grep { $_ !~ m/^\w+:$/ } grep { $_ !~ m/^LV\sNAME\s+/ } grep { $_ !~ m(N/A$) } qx( /usr/sbin/lsvg -Ll `/usr/sbin/lsvg -Lo` ); foreach my $current_filesystem ( keys %fs_info ) { $self->{$current_filesystem}->{filesystem} = $current_filesystem; my ( $lvname, $type, $lps, $pps, $pvs, $lvstate ) = @{ $fs_info{$current_filesystem} }; $args{canondev} and -l $lvname and $lvname = abs_path($lvname); $self->{$current_filesystem}->{dev} = $lvname; $self->{$current_filesystem}->{vfs} = $type; $self->{$current_filesystem}->{LPs} = $lps; $self->{$current_filesystem}->{PPs} = $pps; $self->{$current_filesystem}->{PVs} = $pvs; $self->{$current_filesystem}->{lvstate} = $lvstate; $self->{$current_filesystem}->{special} = 1 if ( defined($type) && defined( $special_fs{$type} ) ); # the filesystem is either currently mounted or is not, # this does not need to be checked for each individual # attribute. my $state = defined( $curr_mountz{$current_filesystem} ) ? 'mounted' : 'unmounted'; $self->{$current_filesystem}->{$state} = 1; } # Read the fstab if ( my $fstab = IO::File->new( $args{fstab}, 'r' ) ) { my $current_filesystem = '*UNDEFINED*'; while (<$fstab>) { # skip comments and blank lines. next if m{^ [*] }x || m{^ \s* $}x; # Found a new filesystem group if (/^\s*(.+?):\s*$/) { $current_filesystem = $1; $self->{$current_filesystem}->{filesystem} = $1; # the filesystem is either currently mounted or is not, # this does not need to be checked for each individual # attribute. my $state = defined( $curr_mountz{$current_filesystem} ) ? 'mounted' : 'unmounted'; $self->{$current_filesystem}{$state} = 1; # This matches a filesystem attribute } elsif ( my ( $key, $value ) = $_ =~ /^\s*([a-z]{3,8})\s+=\s+"?(.+)"?\s*$/ ) { # do not overwrite already known data defined $self->{$current_filesystem}->{$key} and next; $key eq "dev" and $args{canondev} and -l $value and $value = abs_path($value); $self->{$current_filesystem}->{$key} = $value; if ( ( $key eq 'vfs' ) && defined( $special_fs{$value} ) ) { $self->{$current_filesystem}->{special} = 1; } } } $fstab->close(); } else { croak "Unable to open fstab file ($args{fstab})\n"; } $self; } 1; =pod =head1 NAME Sys::Filesystem::Aix - Return AIX filesystem information to Sys::Filesystem =head1 SYNOPSIS See L. =head1 INHERITANCE Sys::Filesystem::Aix ISA UNIVERSAL =head1 METHODS =over 4 =item version () Return the version of the (sub)module. =back =head1 ATTRIBUTES The following is a list of filesystem properties which may be queried as methods through the parent L object. =over 4 =item account Used by the dodisk command to determine the filesystems to be processed by the accounting system. =item boot Used by the mkfs command to initialize the boot block of a new filesystem. =item check Used by the fsck command to determine the default filesystems to be checked. =item dev Identifies, for local mounts, either the block special file where the filesystem resides or the file or directory to be mounted. =item free This value can be either true or false. (Obsolete and ignored). =item mount Used by the mount command to determine whether this file system should be mounted by default. =item nodename Used by the mount command to determine which node contains the remote filesystem. =item size Used by the mkfs command for reference and to build the file system. =item type Used to group related mounts. =item vfs Specifies the type of mount. For example, vfs=nfs specifies the virtual filesystem being mounted is an NFS filesystem. =item vol Used by the mkfs command when initializing the label on a new filesystem. The value is a volume or pack label using a maximum of 6 characters. =item log The LVName must be the full path name of the filesystem logging logical volume name to which log data is written as this file system is modified. This is only valid for journaled filesystems. =back =head1 SEE ALSO L =head2 Example /etc/filesystems * @(#)filesystems @(#)29 1.22 src/bos/etc/filesystems/filesystems, cmdfs, bos530 9/8/00 13:57:45 * IBM_PROLOG_BEGIN_TAG * This is an automatically generated prolog. * * * * This version of /etc/filesystems assumes that only the root file system * is created and ready. As new file systems are added, change the check, * mount, free, log, vol and vfs entries for the appropriate stanza. /: dev = /dev/hd4 vol = "root" mount = automatic check = false free = true vfs = jfs2 log = /dev/hd8 type = bootfs /proc: dev = /proc vol = "/proc" mount = true check = false free = false vfs = procfs /scratch: dev = /dev/fslv02 vfs = jfs2 log = INLINE mount = true account = false =head2 Example /usr/sbin/mount output node mounted mounted over vfs date options -------- --------------- --------------- ------ ------------ --------------- /dev/hd4 / jfs2 Mar 24 12:14 rw,log=/dev/hd8 /proc /proc procfs Mar 24 12:15 rw /dev/fslv02 /scratch jfs2 Mar 24 12:15 rw,log=INLINE =head2 filesystems(4) Manpage includes all known options, describes the format and comment char's. =head1 VERSION $Id$ =head1 AUTHOR Nicola Worthington - L Jens Rehsack - L =head1 COPYRIGHT Copyright 2004,2005,2006 Nicola Worthington. Copyright 2008-2014 Jens Rehsack. This software is licensed under The Apache Software License, Version 2.0. L =cut Sys-Filesystem-1.406/lib/Sys/Filesystem/Cygwin.pm000644 000765 000024 00000006400 12334421025 021630 0ustar00snostaff000000 000000 ############################################################ # # $Id$ # Sys::Filesystem - Retrieve list of filesystems and their properties # # Copyright 2004,2005,2006 Nicola Worthington # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################ package Sys::Filesystem::Cygwin; # vim:ts=4:sw=4:tw=78 use 5.008001; use strict; use warnings; use vars qw($VERSION @ISA); use Carp qw(croak); require Sys::Filesystem::Unix; $VERSION = '1.406'; @ISA = qw(Sys::Filesystem::Unix); sub version() { return $VERSION; } my @keys = qw(fs_spec fs_file fs_vfstype fs_mntops); my %special_fs = ( swap => 1, proc => 1, devpts => 1, tmpfs => 1, ); my $mount_rx = qr/^\s*(.+?)\s+on\s+(\/.+?)\s+type\s+(\S+)\s+\((\S+)\)\s*$/; sub new { ref( my $class = shift ) && croak 'Class name required'; my %args = @_; my $self = bless( {}, $class ); $args{canondev} and $self->{canondev} = 1; local $/ = "\n"; my @mounts = qx( mount ); $self->readMounts( $mount_rx, [ 0, 1, 2 ], \@keys, \%special_fs, @mounts ); delete $self->{canondev}; $self; } 1; #worthn01@PC-L438082~ $ mount #d:\cygwin\bin on /usr/bin type user (binmode) #d:\cygwin\lib on /usr/lib type user (binmode) #d:\cygwin on / type user (binmode) #c: on /cygdrive/c type user (binmode,noumount) #d: on /cygdrive/d type user (binmode,noumount) #f: on /cygdrive/f type user (binmode,noumount) #i: on /cygdrive/i type user (binmode,noumount) #j: on /cygdrive/j type user (binmode,noumount) #l: on /cygdrive/l type user (binmode,noumount) #s: on /cygdrive/s type user (binmode,noumount) #z: on /cygdrive/z type user (binmode,noumount) #worthn01@PC-L438082~ $ =pod =head1 NAME Sys::Filesystem::Cygwin - Return Cygwin filesystem information to Sys::Filesystem =head1 SYNOPSIS See L. =head1 INHERITANCE Sys::Filesystem::Cygwin ISA Sys::Filesystem::Unix ISA UNIVERSAL =head1 METHODS =over 4 =item version() Return the version of the (sub)module. =back =head1 ATTRIBUTES The following is a list of filesystem properties which may be queried as methods through the parent L object. =over 4 =item device Device mounted. =item mount_point Mount point. =item fs_vfstype Filesystem type. =item fs_mntops Mount options. =back =head1 SEE ALSO L =head1 VERSION $Id$ =head1 AUTHOR Nicola Worthington - L Jens Rehsack - L =head1 COPYRIGHT Copyright 2004,2005,2006 Nicola Worthington. Copyright 2008-2014 Jens Rehsack. This software is licensed under The Apache Software License, Version 2.0. L =cut Sys-Filesystem-1.406/lib/Sys/Filesystem/Darwin.pm000644 000765 000024 00000013604 12334421025 021620 0ustar00snostaff000000 000000 ############################################################ # # $Id$ # Sys::Filesystem - Retrieve list of filesystems and their properties # # Copyright 2004,2005,2006 Nicola Worthington # Copyright 2008,2009 Jens Rehsack # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################ package Sys::Filesystem::Darwin; # vim:ts=4:sw=4:tw=78 use 5.008001; use strict; use warnings; use vars qw(@ISA $VERSION); require Sys::Filesystem::Unix; use IPC::Cmd (); use Carp qw(croak); $VERSION = '1.406'; @ISA = qw(Sys::Filesystem::Unix); sub version() { return $VERSION; } my @dt_keys = qw(fs_spec fs_file fs_vfstype fs_name); my @mount_keys1 = qw(fs_spec fs_file fs_vfstype); my @mount_keys2 = qw(fs_spec fs_file fs_mntops); my %special_fs = ( devfs => 1, autofs => 1, ); my $dt_rx = qr/Disk\sAppeared\s+\('([^']+)',\s* Mountpoint\s*=\s*'([^']+)',\s* fsType\s*=\s*'([^']*)',\s* volName\s*=\s*'([^']*)'\)/x; my $mount_rx1 = qr/(.*) on (.*) \((\w+),?.*\)/; # /dev/disk on / (hfs,...) my $mount_rx2 = qr/(.*) on (.*) \(([^)]*)\)/; # /dev/disk on / (hfs,...) sub new { my ( $class, %args ) = @_; my $self = bless( {}, $class ); $args{canondev} and $self->{canondev} = 1; foreach my $prog (qw(diskutil disktool mount)) { defined $args{$prog} or $args{$prog} = ( grep { defined $_ and -x $_ } ( "/usr/sbin/$prog", "/sbin/$prog" ) )[0]; } my @list_fs_cmd; defined $args{diskutil} and $args{diskutil} and @list_fs_cmd = ( $args{diskutil}, "list" ); ( 0 == scalar @list_fs_cmd ) and defined $args{disktool} and $args{disktool} and @list_fs_cmd = ( $args{disktool}, "-l" ); @list_fs_cmd or croak("No command to list file systems ..."); # don't use backticks, don't use the shell my @fslist = (); my @mntlist = (); open( my $dt_fh, '-|' ) or exec(@list_fs_cmd) or croak( "Cannot execute " . join( " ", @list_fs_cmd ) . ": $!" ); @fslist = <$dt_fh>; close($dt_fh); open( my $m_fh, '-|' ) or exec( $args{mount} ) or croak("Cannot execute $args{mount}: $!"); @mntlist = <$m_fh>; close($m_fh); $self->readMounts( $dt_rx, [ 0, 1, 2 ], \@dt_keys, \%special_fs, @fslist ); #foreach (@fslist) #{ # # For mounted FTP servers, fsType and volName are empty on Mac OS X 10.3 # # However, Mountpoint should not be empty. # next unless (/Disk Appeared \('([^']+)',Mountpoint = '([^']+)', fsType = '([^']*)', volName = '([^']*)'\)/); # my ( $device, $mount_point, $fstype, $name ) = ( $1, $2, $3, $4 ); # $self->{$mount_point}->{mounted} = 1; # $self->{$mount_point}->{special} = 0; # $self->{$mount_point}->{device} = $device; # $self->{$mount_point}->{mount_point} = $mount_point; # $self->{$mount_point}->{fs_vfstype} = $fstype; # $self->{$mount_point}->{fs_mntops} = ''; # $self->{$mount_point}->{label} = $name; #} $self->readMounts( $mount_rx1, [ 0, 1, 2 ], \@mount_keys1, \%special_fs, @mntlist ); $self->readMounts( $mount_rx2, [ 0, 1 ], \@mount_keys2, undef, @mntlist ); # set the mount options #foreach (@mntlist) #{ # next unless (/(.*) on (.*) \((.*)\)/); # /dev/disk on / (hfs,...) # my ( $device, $mount_point, $mntopts ) = ( $1, $2, $3 ); # if ( exists( $self->{$mount_point} ) ) # { # $self->{$mount_point}->{fs_mntops} = $mntopts; # } #} delete $self->{canondev}; $self; } 1; =head1 NAME Sys::Filesystem::Darwin - Return Darwin (Mac OS X) filesystem information to Sys::Filesystem =head1 SYNOPSIS See L. =head1 DESCRIPTION The filesystem information is taken from diskutil, the system utility supplied on Mac OS X. =head1 INHERITANCE Sys::Filesystem::Darwin ISA Sys::Filesystem::Unix ISA UNIVERSAL =head1 METHODS =over 4 =item version () Return the version of the (sub)module. =back =head1 ATTRIBUTES The following is a list of filesystem properties which may be queried as methods through the parent L object. The property 'label' is also set, but cannot be queried by L yet. =over 4 =item mount_point The mount point (usually either '/' or '/Volumes/...'). =item device The mounted device =item format Describes the type of the filesystem. So far I encountered the following types: =over 4 =item hfs The standard Mac OS X HFS(+) filesystem. Disk images (.dmg) and Mac Software DVDs normally also use the HFS(+) format. =item msdos DOS image files (e.g. floppy disk images) =item cd9660 CD-ROM image files or real CD-ROMs =item cddafs Audio CDs =item udf UDF filesystem (e.g. DVDs) =back =item (empty) For mounted FTP servers, disktool returns an empty filesystem type (ie, ''). =back =head1 BUGS Doesn't take /etc/fstab or /etc/xtab into account right now, since they are normally not used. Contact the author if you need this. =head1 SEE ALSO L, L =head1 VERSION $Id$ =head1 AUTHOR Christian Renz Jens Rehsack - L =head1 COPYRIGHT Copyright 2004,2005,2006 Nicola Worthington. Copyright 2009-2014 Jens Rehsack. This software is licensed under The Apache Software License, Version 2.0. L =cut Sys-Filesystem-1.406/lib/Sys/Filesystem/Dummy.pm000644 000765 000024 00000003435 12334421025 021470 0ustar00snostaff000000 000000 ############################################################ # # $Id$ # Sys::Filesystem - Retrieve list of filesystems and their properties # # Copyright 2004,2005,2006 Nicola Worthington # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################ package Sys::Filesystem::Dummy; # vim:ts=4:sw=4:tw=78 use 5.008001; use strict; use Carp qw(croak); use vars qw($VERSION); $VERSION = '1.406'; sub version() { return $VERSION; } sub new { ref( my $class = shift ) && croak 'Class name required'; my %args = @_; my $self = bless( {}, $class ); $self; } 1; =pod =head1 NAME Sys::Filesystem::Dummy - Returns nothing to Sys::Filesystem =head1 SYNOPSIS See L. =head1 INHERITANCE Sys::Filesystem::Dummy ISA UNIVERSAL =head1 METHODS =over 4 =item version () Return the version of the (sub)module. =back =head1 VERSION $Id$ =head1 AUTHOR Nicola Worthington - L Jens Rehsack - L =head1 COPYRIGHT Copyright 2004,2005,2006 Nicola Worthington. Copyright 2009-2014 Jens Rehsack. This software is licensed under The Apache Software License, Version 2.0. L =cut Sys-Filesystem-1.406/lib/Sys/Filesystem/Freebsd.pm000644 000765 000024 00000011230 12334421025 021737 0ustar00snostaff000000 000000 ############################################################ # # $Id$ # Sys::Filesystem - Retrieve list of filesystems and their properties # # Copyright 2004,2005,2006 Nicola Worthington # Copyright 2009 Jens Rehsack # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################ package Sys::Filesystem::Freebsd; # vim:ts=4:sw=4:tw=78 use 5.008001; use strict; use warnings; use vars qw(@ISA $VERSION); require Sys::Filesystem::Unix; use Carp qw(croak); $VERSION = '1.406'; @ISA = qw(Sys::Filesystem::Unix); sub version() { return $VERSION; } my @keys = qw(fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno); my %special_fs = ( swap => 1, proc => 1, devpts => 1, tmpfs => 1, ); my $mount_rx = qr|^([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)|; my $swap_rx = qr|^(/[/\w]+)\s+|; sub new { ref( my $class = shift ) && croak 'Class name required'; my %args = @_; my $self = bless( {}, $class ); $args{canondev} and $self->{canondev} = 1; $args{fstab} ||= $ENV{PATH_FSTAB} || '/etc/fstab'; my @mounts = map { $_ =~ s/[\cI]+/ /g; chomp; $_ } qx( /sbin/mount -p ); $self->readMounts( $mount_rx, [ 0, 1, 2 ], \@keys, \%special_fs, @mounts ); $self->readSwap( $swap_rx, qx( /sbin/swapctl -l ) ); unless ( $self->readFsTab( $args{fstab}, \@keys, [ 0, 1, 2 ], \%special_fs ) ) { croak "Unable to open fstab file ($args{fstab})\n"; } delete $self->{canondev}; $self; } 1; # See the fstab(5) manual page for important information on automatic mounts # of network filesystems before modifying this file. # # Device Mountpoint FStype Options Dump Pass# #/dev/da0s1b none swap sw 0 0 #/dev/da1s1b none swap sw 0 0 #/dev/da0s1a / ufs rw 1 1 #/dev/da1s1e /home ufs rw 2 2 #/dev/da0s1e /usr ufs rw 2 2 #/dev/da1s1f /var ufs rw 2 2 #/dev/acd0c /cdrom cd9660 ro,noauto 0 0 #/var/tmp /tmp null rw 0 0 #proc /proc procfs rw 0 0 #/etc/portal.conf /p portal rw 0 0 ############################################################################### # POD =pod =head1 NAME Sys::Filesystem::Freebsd - Return Freebsd filesystem information to Sys::Filesystem =head1 SYNOPSIS See L. =head1 INHERITANCE Sys::Filesystem::Freebsd ISA Sys::Filesystem::Unix ISA UNIVERSAL =head1 METHODS =over 4 =item version () Return the version of the (sub)module. =back =head1 ATTRIBUTES The following is a list of filesystem properties which may be queried as methods through the parent L object. =over 4 =item fs_spec Describes the block special device or remote filesystem to be mounted. =item fs_file Describes the mount point for the filesystem. For swap partitions, this field should be specified as none. If the name of the mount point contains spaces these can be escaped as \040. =item fs_vfstype Dscribes the type of the filesystem. =item fs_mntops Describes the mount options associated with the filesystem. =item fs_freq Used for these filesystems by the L command to determine which filesystems need to be dumped. =item fs_passno Used by the L program to determine the order in which filesystem checks are done at reboot time. =back =head1 SEE ALSO L, L, L =head1 VERSION $Id$ =head1 AUTHOR Nicola Worthington - L Jens Rehsack - L =head1 COPYRIGHT Copyright 2004,2005,2006 Nicola Worthington. Copyright 2009-2014 Jens Rehsack. This software is licensed under The Apache Software License, Version 2.0. L =cut Sys-Filesystem-1.406/lib/Sys/Filesystem/Hpux.pm000644 000765 000024 00000005066 12334421025 021323 0ustar00snostaff000000 000000 # Sys::Filesystem - Retrieve list of filesystems and their properties # $Id$ # # Copyright (c) 2009 H.Merijn Brand, All rights reserved. # Copyright (c) 2009 Jens Rehsack, All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################ package Sys::Filesystem::Hpux; use 5.008001; use strict; use warnings; use vars qw($VERSION @ISA); require Sys::Filesystem::Unix; use Carp qw(croak); $VERSION = '1.406'; @ISA = qw(Sys::Filesystem::Unix); sub version() { return $VERSION; } # Default fstab and mtab layout my @fstabkeys = qw(fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno); my @mnttabkeys = qw(fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno mount_time); my %special_fs = ( swap => 1, proc => 1 ); sub new { my $proto = shift; my $class = ref($proto) || $proto or croak 'Class name required'; my %args = @_; my $self = bless( {}, $class ); $args{canondev} and $self->{canondev} = 1; # Defaults $args{fstab} ||= '/etc/fstab'; $args{mtab} ||= '/etc/mnttab'; unless ( $self->readFsTab( $args{fstab}, \@fstabkeys, [ 0, 1, 2 ], \%special_fs ) ) { croak "Unable to open fstab file ($args{fstab})\n"; } unless ( $self->readMntTab( $args{mtab}, \@mnttabkeys, [ 0, 1, 2 ], \%special_fs ) ) { croak "Unable to open fstab file ($args{mtab})\n"; } delete $self->{canondev}; $self; } 1; =pod =head1 NAME Sys::Filesystem::Hpux - Return HP-UX filesystem information to Sys::Filesystem =head1 SYNOPSIS See L. =head1 INHERITANCE Sys::Filesystem::Hpux ISA Sys::Filesystem::Unix ISA UNIVERSAL =head1 METHODS =over 4 =item version () Return the version of the (sub)module. =back =head1 VERSION $Id$ =head1 AUTHOR H.Merijn Brand, PROCURA B.V. =head1 COPYRIGHT Copyright 2009 H.Merijn Brand PROCURA B.V. Copyright 2009-2014 Jens Rehsack. This software is licensed under The Apache Software License, Version 2.0. L =cut Sys-Filesystem-1.406/lib/Sys/Filesystem/Linux.pm000644 000765 000024 00000016331 12334421025 021473 0ustar00snostaff000000 000000 ############################################################ # # $Id$ # Sys::Filesystem - Retrieve list of filesystems and their properties # # Copyright 2004,2005,2006 Nicola Worthington # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################ package Sys::Filesystem::Linux; # vim:ts=4:sw=4:tw=78 use 5.008001; use strict; use warnings; use vars qw($VERSION @ISA); use Carp qw(croak); use Cwd 'abs_path'; use IO::File (); use Sys::Filesystem::Unix (); $VERSION = '1.406'; @ISA = qw(Sys::Filesystem::Unix); sub version() { return $VERSION; } # Default fstab and mtab layout my @keys = qw(fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno); my %special_fs = ( binfmt_misc => 1, debugfs => 1, devpts => 1, fusectl => 1, 'fuse.gvfs-fuse-daemon' => 1, mini_fo => 1, nfsd => 1, proc => 1, procbususb => 1, securityfs => 1, swap => 1, sysfs => 1, tmpfs => 1, udev => 1, ); sub new { ref( my $class = shift ) && croak 'Class name required'; my %args = @_; my $self = bless( {}, $class ); # Defaults $args{fstab} ||= '/etc/fstab'; $args{mtab} ||= -r '/proc/mounts' ? '/proc/mounts' : '/etc/mtab'; #$args{xtab} ||= '/etc/lib/nfs/xtab'; $args{canondev} and $self->{canondev} = 1; local $/ = "\n"; # Read the fstab if ( my $fstab = IO::File->new( $args{fstab}, 'r' ) ) { while (<$fstab>) { next if ( /^\s*#/ || /^\s*$/ ); my @vals = split( ' ', $_ ); $vals[0] =~ /^\s*LABEL=(.+)\s*$/ and $self->{ $vals[1] }->{label} = $1; $args{canondev} and -l $vals[0] and $vals[0] = abs_path( $vals[0] ); $self->{ $vals[1] }->{mount_point} = $vals[1]; $self->{ $vals[1] }->{device} = $vals[0]; $self->{ $vals[1] }->{unmounted} = 1; defined $special_fs{ $vals[2] } and $self->{ $vals[1] }->{special} = 1; @{ $self->{ $vals[1] } }{@keys} = @vals; } $fstab->close(); } else { croak "Unable to open fstab file ($args{fstab})\n"; } # Read the mtab unless ( $self->readMntTab( $args{mtab}, \@keys, [ 0, 1, 2 ], \%special_fs ) ) { croak "Unable to open fstab file ($args{mtab})\n"; } delete $self->{canondev}; $self; } 1; =pod =head1 NAME Sys::Filesystem::Linux - Return Linux filesystem information to Sys::Filesystem =head1 SYNOPSIS See L. =head1 INHERITANCE Sys::Filesystem::Linux ISA Sys::Filesystem::Unix ISA UNIVERSAL =head1 METHODS =over 4 =item version () Return the version of the (sub)module. =back =head1 ATTRIBUTES The following is a list of filesystem properties which may be queried as methods through the parent L object. =over 4 =item fs_spec Describes the block special device or remote filesystem to be mounted. For ordinary mounts it will hold (a link to) a block special device node (as created by L) for the device to be mounted, like '/dev/cdrom' or '/dev/sdb7'. For NFS mounts one will have :, e.g., 'knuth.aeb.nl:/'. For procfs, use 'proc'. Instead of giving the device explicitly, one may indicate the (ext2 or xfs) filesystem that is to be mounted by its UUID or volume label (cf. L or L), writing LABEL=