
    EFSlib

* What is this?

    Here you can find some source code to read EFS filesystems
    by accessing the raw device from IRIX and WinNT systems.

* What I get?

    You can compile a library you can link later against your
    own code; so your program will be able to read disks which
    use the "old" EFS IRIX format.
    Most IRIX 5.x and earlier disks still use EFS, as well as
    lots of IRIX install CD-ROMs.


    You will get also a small binary, named "efssh" which should
    be considered more as an example of how to use the library
    than as a finished program; but you can find it useful "as is".

    "efssh" will open a minimal shell rooted at the EFS of your
    choice, and from that shell you will be able to:

    - get the current path on the EFS ('pwd')

    - change the current path on the host system ('lcd')

    - change the current path on the EFS ('cd')

    - view files on the EFS by piping them to host pager ('more')
    (IRIX only; NT less is not too reliable)

    - copy files or directories from the EFS to the host filesystem ('cp')


    And at last you will get also a simple "efs.c" source code
    file which reads the EFS whitout using the library, so you
    can understand more easily how EFS works.


* How can I use the library?.


    Well, I'll try to sumarize here the usage (which is pretty simple)
    Anyway you should read efssh.c


    Your program should include "irix_efs.h"
    The rest of the files are:

        irix_efs.h      generic library include

        irix_io.h       implementation dependent
        efs_db.c        debug
        efs_db.h        debug headers
        efs_file.c      file/dir reading
        efs_fs.c        generic file system functions
        efs_io.c        inode/block operations
        efs_io.h        inode/block headers


    The generic operation goes like this:

    First you have to select a disk using
    * efs_open_disk
        <- raw device name
        -> EFS_DISK *

        on error: NULL and sets efs_errno or errno
        scan partitions using
            efs_empty_partition( disk, partition )
            and
            efs_partition_size( disk, partition )


        Then you mount a partition by:
        * efs_mount
            <- disk
            <- partition
            <- flags
            -> EFS_FS *
                on error: NULL and sets efs_errno or errno
                flags:
                    EFS_FMOUNTALL: allows mounting of swap/overlap
                    EFS_FMOUNTSTD: standard partitions only

            = sets default fs if there is none.

            *set_default_fs
                <- EFS_FS *
            *get_default_fs
                -> EFS_FS *

                default fs is used for all I/O operations.

            And the rest of the operations are POSIX-like:

            * efs_getwd
                -> path (path can hold MAXPATHLEN chars)
                on error return NULL

            * efs_chdir
                <- path
                on error return -1

            * efs_stat
                <- path
                -> stat

                (note: you have a efs_istat, i-node based which can
                save you some cycles. See efssh.c)

            * efs_opendir
                * efs_readdir
            * efs_closedir

            * efs_fopen
                rb, ignored
                * efs_fread
                    buffered input
            * efs_close
            * efs_feof

        * efs_umount
            <- *efs

    * efs_close_disk
        <- EFS_DISK *


* What I need?

    I have compiled this on

    - IRIX 5.3, 6.x compilers
    - IRIX 6.2, 7.x compilers
    - WinNT x86, MSVC 6.0

    For compiling in WinNT you will need to create the appropiate irix
    headers. See irix/README


* Who can I blame if my NT crashes?

    I have no idea :-)

    All this code does is to open a raw device (this, usually requires
    root/administrator privs) and read it; so it hardly can panic your
    system or erase your data.

    (Well, the 'cp' code in "efssh.c" is somewhat quick and dirty; and
    it does modify the host filesystem. Use it at your own risk, and
    re-write it if you are planning to use it at any serious work)


    You can send fixes to spd@daphne.cps.unizar.es


* Thanks:

    to unknown author of "efslook".
    to wpaul@ctr.columbia.edu (Bill Paul) for SuperBlock Checksum code.


