• Aucun résultat trouvé

Programming Remote File Access

Dans le document DEenet Phase IV (Page 58-61)

Remo1te File and Record Access

6.1 Programming Remote File Access

To gain access to a remote file, a user program incorporates DECnet I/O calls, which activate remote file access subroutines. The function of these sub-routines is to build, send, and interpret DECnet file access messages. All DECnet systems allow you to perform the following operations on a remote file:

• Open an existing file

• Create a new file

• Read records from a file

• Write records to a file

• Close a file

• Delete a file

In addition to these operations, specific DECnet systems allow user programs to manipulate remote files in other ways. The programmer's reference manual for each system discusses what operations are available and how you specify DECnet calls for remote file access on a specific system. Sections that follow discuss factors in preparing to write remote file access programs that apply to all DECnet implementations.

6.1.1 File System Capabilities

A programmer needs to be familiar with the file system resident at the target node. File organization, access modes, and other characteristics are depend-ent on the type of file system that each operating system supports. When the local and remote nodes have the same operating and file systems, program-rrting remote access is similar to programming locall/O operations. However, when the access operation bridges different types of operating systems, the programmer faces certain variables and restrictions.

Generally, the theory of the lowest common denominator applies: a source program can perform those functions that its local language provides and that the remote file system supports. For example, a VAX/VMS program cannot use all the remote access functions provided by DECnet-VAX if the target node runs RSX-IIM.

By cross-checking the file system characteristics with the available remote access calls, a programmer can find out the kinds of file operations that are possible between two different DECnet implementations. This information is provided in the programmer's reference manual for each DECnet system.

6.1.2 Initiating Remote Access

Like task-to-task communication, remote file access requires a handshake sequence at the beginning of the operation. Not only does DECnet software set up a logical link between the source and target programs, it also exchanges DECnet file access messages to prepare for the file operation that will be performed over the link.

This extended handshake, which is transparent to the source program, hap-pens automatically when the program issues a call to open a remote file. The form of the open call varies from system to system and from language to language, but the call always provides much of the information exchanged in the handshake. Using the information supplied by the call, as well as system-supplied data about the local file system, the remote access subroutines gen-erate DECnet file access messages addressed to the target program. In re-sponse, the target program sends back DECnet file access messages to define characteristics of its local file system.

For most remote access operations, the open call issued by the source program passes the following information to subroutines within the local file system:

• A file specification

• Access control information

• Characteristics of the file to be accessed

Depending on the open call's particular function - for example, open for reading or open for appending - the call passes other information as well.

6.1.3 The File Specification

The file specification identifies the remote file to be accessed. Because the remote file system actually carries out the requested file operation, the pro-grammer must know how the file is identified by users on the node where the file resides. Refer to the programmer's reference manual for the source and target systems for file specification syntax.

6.1.4 Access Control Information

Access control information identifies the program to the remote system and consists of:

• A user identification code or name

• A password associated with the user identification

• Additional accounting information as required by the remote system If this information matches an account or guest account entry in the remote system's user file, the program gains access to that system's resources. Like the file specification, the access control information must be recognizable to the remote system and therefore specified according to its syntax.

Gaining access to the remote system does not guarantee that requested file operations will succeed. In most Digital operating systems, each file has a corresponding protection code that determines the types of access allowed to defined groups of users. The user identification - a code or a name - speci-fied by the accessing program determines the program's group category and therefore determines the types of access it can make to each file.

6.1.5 File Characteristics

File characteristics define the file to be accessed in the following ways:

e Access method - sequential or random. The program requesting file access indicates how it will access the file. All Digital file systems support sequential access in which each I/O operation reads or writes the next rec-ord. Selected file systems permit random access, which allows the program to access a specific record anywhere in the file.

e File organization - sequential, relative, or Indexed. Sequential file or-ganization means that records in a file are arranged one after the other. This organization is supported for all types of devices. Relative file organization means that records within a file are identified by a relative record number.

This number identifies the record's position relative to the beginning of the file. Indexed organization (RMS only) is a complex file structure that allows both sequential and random access and uses record keys for identification.

The keys used to identify individual records are defined at file creation.

Relative organization is supported only for disk devices.

• Data type - ASCII or Image. ASCII data is subject to formatting conver-sion by the DECnet software, depending on the data's record attributes (see below). Image data is a stream of bits to which the DECnet software applies no interpretation.

• Record attributes. This characteristic indicates the type of vertical format control that applies to the file.

e Record format - fixed length, stream, variable length, or variable with fixed length control (VFC). This characteristic indicates the way the re-cords are formatted within the file. A VFC record, supported by RMS only, includes a fixed length control field in addition to the variable length data portion.

Dans le document DEenet Phase IV (Page 58-61)