z/OS UNIX System Services File System Interface Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


vn_link — Create a link to a file

z/OS UNIX System Services File System Interface Reference
SA23-2285-00

Function

The vn_link operation creates a link to the file that is specified by Token_structure in the directory that is specified by Directory_token_structure. The link is a new name that identifies an existing file. The new name does not replace the old one, but provides an additional way to refer to the file.

Environment on entry and exit

See Environment for PFS operations.

Input parameter format

vn_link     (Token_structure,
             OSI_structure,
             Audit_structure,
             Link_name_length,
             Link_name,
             Directory_token_structure,
             Return_value,
             Return_code,
             Reason_code)

Parameters

Token_structure
Supplied parameter
Type:
TOKSTR
Length:
Specified by TOKSTR.ts_hdr.cblen.

The Token_structure represents the file (vnode) that is being operated on. It contains the PFS's initialization token, mount token, and the file token. Refer to LFS/PFS control block structure for a discussion of this structure, and to the TOKSTR typedef in BPXYPFSI in Interface structures for C language servers and clients for its mapping.

OSI_structure
Supplied and returned parameter
Type:
OSI
Length:
Specified by OSI.osi_hdr.cblen.

The OSI_structure contains information that is used by the OSI operations that may be called by the PFS. See OSI services for more information.

It also contains MVS-specific information that needs to be passed to the PFS, including SMF accounting fields, a work area, a recovery area, and an optional pointer to an output ATTR structure. For more details on the OSI structure, see The OSI structure.

This area is mapped by the OSI typedef in BPXYPFSI in Interface structures for C language servers and clients.

Audit_structure
Supplied parameter
Type:
CRED
Length:
Specified by CRED.cred_hdr.cblen.

The Audit_structure contains information that is used by the security product for access checks and auditing. It is passed to most SAF routines that are invoked by the PFS.

See Security responsibilities and considerations for a discussion of security processing, and to the CRED typedef in BPXYPFSI in Interface structures for C language servers and clients for the mapping of this structure.

Link_name_length
Supplied parameter
Type:
Integer
Length:
Fullword

A fullword that contains the length of Link_name. The name can be between 1 and 255 bytes long.

Link_name
Supplied parameter
Type:
String
Length:
Specified by Link_name_length

An area, of length Link_name_length, that contains the new name by which the file is to be known. This name contains no nulls.

Directory_token_structure
Supplied parameter
Type:
TOKSTR
Length:
Specified by TOKStr.ts_hdr.cblen.

The Directory_token_structure represents the vnode of the directory that is to contain Link_name.

This area is mapped by the TOKSTR typedef in the BPXYPFSI header file (see Interface structures for C language servers and clients) for details.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword
A fullword in which the vn_link service returns the results of the operation, as one of the following:
Return_value
Meaning
-1
The operation was not successful. The Return_code and Reason_Code values must be filled in by the PFS when Return_value is -1.
0
The operation was successful.
Return_code
Returned parameter
Type:
Integer
Length:
Fullword

A fullword in which the vn_link service stores the return code. The vn_link service returns Return_code only if Return_value is -1. See z/OS UNIX System Services Messages and Codes for a complete list of supported return code values.

The vn_link service should support at least the following error values:
Return_code Explanation
EEXIST A file with the same name already exists.
ENAMETOOLONG The length of Link_name exceeds the length that is supported by this PFS.
EROFS The file system is mounted read-only.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

A fullword in which the vn_link service stores the reason code. The vn_link service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. These reason codes are documented by the PFS.

Implementation notes

Overview of vn_link processing

vn_link must create an entry in the directory that is specified by Directory_token_structure, pointing to the file that is specified by Token_structure.

Specific processing notes
  • If the link is created successfully, the operation increments the link count of the file. The link count shows how many links to a file exist. (If the link is not created successfully, the link count is not incremented.)
  • The LFS does not permit links to directories.
  • If the link is created successfully, the change time of the linked-to file is updated, as are the change and modification times of the directory that contains Link_name, that is, the directory that holds the link.
  • For more information about the semantics of this operation for a POSIX-conforming PFS, refer to the link() function in the POSIX .1 standard (IEEE Std 1003.1-1990).
Serialization provided by the LFS

The vn_link operation is invoked with an exclusive latch held on the vnodes of the directory and the file.

Security calls to be made by the PFS

The PFS is expected to invoke SAF's Check Access callable service to verify that the user has any access to the file, and has write access to the directory.

For a discussion of vn_link processing in a multilevel security environment, see PFS support for multilevel security.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014