The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Filesys::Ext2 - Interface to e2fs filesystem attributes

SYNOPSIS

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

DESCRIPTION

chattr($mask, @files)

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

lsattr($file)

In list context it returns a list containing symbols representing the symbolic mode of $file. In scalar context it returns a bitmask.

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

Accepts a bitmask and returns the symbolic mode. In list context it returns a symbol list like lsattr, in scalar mode it returns a string that matches the -------- region of lsattr(1) (akin to that of ls -l e.g. drwxr-x---)

SEE ALSO

chattr(1), lsattr(1)

NOTES

Of course, this would be more efficient if it were an XSUB.

The bit mappings for attributes, from ext2_fs.h

        s #define EXT2_SECRM_FL           0x00000001 /* Secure deletion */
        u #define EXT2_UNRM_FL            0x00000002 /* Undelete */
        c #define EXT2_COMPR_FL           0x00000004 /* Compress file */
        S #define EXT2_SYNC_FL            0x00000008 /* Synchronous updates */
        i #define EXT2_IMMUTABLE_FL       0x00000010 /* Immutable file */
        a #define EXT2_APPEND_FL          0x00000020 /* writes to file may only append */
        d #define EXT2_NODUMP_FL          0x00000040 /* do not dump file */
        A #define EXT2_NOATIME_FL         0x00000080 /* do not update atime */

AUTHOR

Jerrad Pierce <belg4mit@mit.edu>, <webmaster@pthbb.org>