### Exclusive Access File Library

An exclusive access file is a file which is generated and/or read by a single process of a distributed parallel application. Files are not shared between different processes. The library is an abstract high-performance file system which provides a common interface for a variety of architecture specific parallel storage systems. The library also makes available features like asynchronous input and output to Fortran. EAF's syntax is similar to the standard Unix C file operations, differences indicate new semantics or extended features available through EAF.

EAF_Open

Description:

Open a file.

Prototype:

    integer EAF_Open(fname, type, fh)

    character *(*) fname

    integer type

    integer fd

Parameters:

`fname`

Character string of a globally unique filename (path may be fully qualified)

`type`

Read write permissions. Legal values are EAF_W, EAF_R, and EAF_RW

fh

File descriptor (handle).

Returns:

0 or error code

EAF_Write

Description:

Synchronously write to the file specified by the file handle

Prototype:

    integer EAF_Write(fh, offset, buf, bytes)

    integer fh

    double offset

    _______ buf

    double bytes

Parameters:

`fh`

File Handle offset Absolute offset, in bytes, to start writing at

`buf`

Scalar or array of data

`bytes`

Size of buffer in bytes

Returns:

0 or error code if an error occured

EAF_AWrite

Description:

Asynchronously write to the file specified by the file handle, and return a handle to the asynchronous operation.

If there are more than MAX_AIO_REQ asynchronous requests (reading and/or writing) pending, the operation is handled in a synchronous fashion and returns a CHEMIO_DONE handle.

On architectures where asynchronous I/O operations are not supported, all requests are handled synchronously, returning a CHEMIO_DONE handle.

Prototype:

    integer EAF_AWrite(fh, offset, buf, bytes, req_id)

    integer fh

    double offset

    _______
        buf

    double bytes

    integer req_id

Parameters:

`fh`

File Handle

`offset`

Absolute offset, in bytes, to start writing at

`buf`

Scalar or array of data

`bytes`

Size of buffer, in bytes

`req_id`

Handle of asynchronous operation

Returns:

0 or error code if an error occured

EAF_Read

Description:

Synchronously read from the file specified by the file handle

Prototype:

    integer EAF_Read(fh, offset, buf, bytes)

    integer fh

    double offset

    _______
        buf

    double bytes

    integer req_id

Parameters:

`fh`

File Handle

`offset`

Absolute offset, in bytes, to start writing at

`buf`

Scalar or array of data

`bytes`

Size of buffer, in bytes

Returns:

0, or error code if an error occured

EAF_ARead

Description:

Asynchronously read from the file specified by the file handle, and return a handle to the asynchronous operation.

If there are more than MAX_AIO_REQ asynchronous requests (reading and/or writing) pending, the operation is handled in a synchronous fashion and returns a EAF_DONE handle.

On architectures where asynchronous I/O operations are not supported, all requests are handled synchronously, returning a EAF_DONE handle.

Prototype:

    integer EAF_ARead(fh, offset, buf,bytes, req_id)

    integer fh

    double offset

    _______
        buf

    double bytes

    integer req_id

Parameters:

`fh`

File Handle

`offset`

Absolute offset, in bytes, to start reading from

`buf`

Scalar or array of data

`bytes`

Size of buffer, in bytes

`req_id`

Handle of asynchronous operation

Returns:

0 if succeeded, or error code if an error occured

EAF_Probe

Description:

Determine if an asynchronous request has completed or is pending.

Prototype:

    integer EAF_Probe(id, status)

    integer id

    integer status

Parameters:

`id`

Handle of asynchronous request

`status` Pending or completed status argument

Returns:

0 if probe succeeded, else returns error code .

status returns 0 if the asynchronous operation is complete, or 1 otherwise.

If the asynchronous request is complete, id is invalidated.

EAF_Wait

Description:

Wait for the completion of the asynchronous request associated with id

Prototype:

    integer EAF_Wait(id)

    integer id

Parameters:

`id`

Handle of asynchronous request

Returns:

0 if EAF is able to wait for completion, else returns error code.

id is invalidated.

EAF_Close

Description:

Close a file

Prototype:

    integer EAF_Close(fh)

    integer fh

Parameters:

`fh`

File Handle

Returns:

0 if the file was closed, else returns error code.

EAF_Delete

Description:

Delete a file

Prototype:

    integer EAF_Delete(fname)

    character*(*) fname

Parameters:

`fname`

File name

Returns:

0 if the file was deleted, else returns error code.

EAF_Length

Description:

Determine the length of a file

Prototype:

    double EAF_Length(fh)

    integer fh

Parameters:

`fh`

File Handle

Returns:

file length in bytes

EAF_Eof

Description:

Determines if the enod of file was reached

Prototype:

    logical EAF_Eof(ierr)

    integer ierr

Parameters:

`ierr`

error code

Returns:

true if the end of file was reached, else returns false.

ierr=0 means success, otherwise an error.

EAF_Truncate

Description:

Truncate a file at specified offset

Prototype:

    integer EAF_Close(fh, offset)

    integer fh

    double offset

Parameters:

`fh`

File Handle

`offset`

offset in bytes

Returns:

0 if the file was truncated, else returns error code.

EAF_Stat

Description:

Determine available disk space and type for a filesystem

Prototype:

    integer EAF_Stat(fname, avail, fstype)

    character*(*) fname

    integer avail

    integer fstype

Parameters:

`fname`

File/directory name

`avail`

amount of available disk space in kilobytes

`fstype`

filesystem type (Unix/PIOFS/PFS/...)

Returns:

0 if success, else returns error code.

EAF_Errmsg

Description:

Prints to stdout an error message associated with error code

Prototype:

    subroutine EAF_Errmsg(ierr)

    integer ierr

Parameters:

`ierr`

error code returned from other EAF routines

Returns:

nothing