Procedure 3 |
Open File |
REQUEST The device specified by the client identifier is prepared for data transfer. In the case of read access the file is located on the medium. In the case of write access the medium is positioned and file labels written. |
Client identifier identifies the device for the client and capability is the corresponding access key provided by the server for the device.
access mode |
label type |
record length |
block length |
If record format = F then block length must be a multiple of record length.
file name specifies the name of the file to be accessed.
label type = 0 may be used if the server system determines this information
from the medium volume label.
record length and block length need not be
supplied for read access if the
server system determines this information from the device file labels.
access mode = RAW may be used by clients
writting data in undefined formats. In this
case the remaining fields may be set as undefined. The server system may place restrictions
on the use of this option for reasons of data security.
The current stream state for the stream must be
dev_mount otherwise the request will fail.
RESPONSE procedure status indicates the result of the request. |
procedure status |
If procedure status = accepted the current value of the stream status for this stream changes to dev_opening.
When the open operation has been completed successfully (which could take some time) then stream state for the stream changes to dev_open.
Should the open fail (for example there is an i/o error positioning the device) then stream state reverts to dev_mount and procedure status is set appropiately.
Implementation
This procedure is used to prepare the device referred to by the supplied client identifier to accept event-by-event data. The device must currently be in the mounted state when the request is received. The procedure specification allows for a number of options to be supplied by the client. However only the default options need be provided.
access mode |
2 |
write |
label type |
2 |
ANSI labels |
record length |
16384 |
F format with 16 Kbyte blocks |
block length |
2 |
16384 |
The Euroball server should implement F and FB file format and be prepared to accept data blocks
greater than 16K bytes in length. Note however that some UNIX systems find it hard to read magnetic
tapes with physical data blocks greater than 64 Kbytes.
The volume name supplied during the Mount or
Identify procedure and the file name supplied by the Open File request are used to write the
file header labels. The Eurogam server protects data already on the tape by only appending new files
after any existing files already on the tape. Existing data files are never overwritten by the
Open procedure. The only method provided by the server to reuse a data tape is by the
Initialise procedure which will remove all files on the tape.
The server locates the double file mark which marks the end of information on the
tape (note - care must be taken not to confuse the 2 consecutive file marks which occur as a result
of an empty file for the double file mark which marks the end of information). The second of the
two file marks is then overwritten with the new file header labels which consist of a HDR1, HDR2
and file mark. The device status then changes to the Open state and is ready to accept event data.
In the case of the SINK special device no action need be taken and the device immediately
changes to the Open state.
The FILE special device simulates the structure of tapes on disc by creating a directory with
the name of the tape volume and then creates files within that directory with the name of
the tape file.
The server logs the result of the procedure into the System Log recording the drive name,
volume name and file name.