The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Filesys::Ext2 - Interface to ext2 and ext3 filesystem attributes

SYNOPSIS

  use Filesys::Ext2 qw(:all);
  eval { $mode = lsattr("/etc/passwd"); }
  eval { chattr("+aud", "/etc/passwd"); }
  #or equivalently
  #chattr($mode|0x0062, "/etc/passwd");

DESCRIPTION

You may specify the path of the e2fsprogs upon use

  use Filesys::Ext2 {PATH=>'/path/to/binaries'};

Otherwise the module will use the default path /usr/bin/

chattr($mask, @files)

Change the mode of @files to match $mask. $mask may be a bitmask or symbolic mode eg;

  =DIE
  +cad
  -s-i

Throws an exception upon failure.

lsattr(@files)

Returns bitmasks respresenting the attributes of @files.

Throws an exception upon failure.

lstat($file)

Same as CORE::lstat, but appends the numerical attribute bitmask.

stat($file)

Same as CORE::stat, but appends the numerical attribute bitmask.

calcSymMask($mask)

Accepts a bitmask and returns the symbolic mode. In list context it returns a symbol list like lsattr, in scalar context it returns a string that matches the - region of lsattr(1) eg;

  s-----A------

SEE ALSO

chattr(1), lsattr(1)

NOTES

Ideally this would be implemented with XS, maybe someday.

The bit mappings for attributes, from other/ext2_fs.h

0x00000001 == s

Secure deletion

0x00000002 == u

Undelete

0x00000004 == c

Compress file

0x00000008 == S

Synchronous updates

0x00000010 == i

Immutable file

0x00000020 == a

Writes to file may only append

0x00000040 == d

Do not dump file

0x00000080 == A

Do not update atime

0x00000100 == Z

Dirty compressed data

Not user modifiable.

0x00000400 == X

Access raw compressed data

Not (currently) user modifiable.

0x00000800 == E

Compression error.

Not user modifiable.

0x00001000 == I

btree format dir / hash-indexed directory

Not user modifiable.

0x00004000 == j

File data should be journaed

0x00008000 == t

File tail should not be merged

0x00010000 == D

Synchronous directory modifications

0x00020000 == T

Top of directory hierarchies

AUTHOR

Jerrad Pierce <jpierce@cpan.org>