How HFS Support Processes a File System Job

i5/OS(TM) HFS support and your file system work together to perform the function that an application requests when it calls an HFS API. HFS support is the part of the system that manages the HFS APIs as a group and passes information between the HFS APIs and the file system.


First Call to File System

The first time an application or job specifies a particular file system in a call to an HFS API, HFS support does the following:

  1. Checks the job's authority to the file system by checking its authority to the Start Job Session exit program. The job must have at least *USE authority to the Start Job Session exit program.

  2. Obtains a shared read (*SHRRD) lock on the Start Job Session exit program. This prevents other jobs from deregistering the file system while the current job is using it. This lock remains in effect until the current job ends.

  3. Calls the Start Job Session exit program, supplying the file system's name on the call in case the file system has been renamed during installation.

    The Start Job Session exit program performs any setup that the file system requires and returns a job handle to HFS support. The job handle is an arbitrary identifier that HFS support passes to the file system to help the file system keep track of this job. If the job calls another HFS API for this file system, HFS support passes this job handle as a parameter. The handle is treated as if it were a pointer, but it does not have to contain pointer data.

  4. Calls the file system to complete the job's request by performing the work for the API.

Subsequent Calls to File System

On subsequent calls to the file system, HFS support retrieves the job handle for that file system and calls the file system exit program for the appropriate API. The file system can use the Start Job Session exit program only at the start of a job.


End of Job

When i5/OS work management notifies HFS support that the job has ended, HFS support checks to see if the job has left any files or directories open. If it has, HFS support calls the file system to close them. HFS support then calls the End Job Session exit program to clean up any work areas used by the job. Your file system can use the End Job Session exit program to destroy temporary spaces and remove outstanding locks that were created during the job.

After the End Job Session exit program is run, HFS support unlocks the Start Job Session exit program, which was locked when the job first called the file system through an HFS API. The file system is no longer in use and can be deregistered.


Scenario: File System Job

When the Start Job Session exit program is called, the file system could create a user space in the job's QTEMP library and return a space pointer to that user space as the job handle. On subsequent calls to HFS APIs for that file system, HFS support would pass that space pointer to the file system as the job handle. When the job ends, the file system's End Job Session exit program is called. The file system could use that exit program to delete the user space.


File System--Error Messages

The exceptions that file systems are allowed to use are listed after each of the HFS exit programs. When a file system returns an allowed exception after a call from an HFS API, HFS support either sends the exception to the application or fills in the error code.


Top | Hierarchical File System APIs | APIs by category