/usr/share/perl5/Sys/Filesystem/Aix.pm is in libsys-filesystem-perl 1.406-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | ############################################################
#
# $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<Sys::Filesystem>.
=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<Sys::Filesystem> 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<Sys::Filesystem>
=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.
*
* <snip>
*
* 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 <nicolaw@cpan.org> - L<http://perlgirl.org.uk>
Jens Rehsack <rehsack@cpan.org> - L<http://www.rehsack.de/>
=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<http://www.apache.org/licenses/LICENSE-2.0>
=cut
|