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


vn_remove — Remove a link to a file

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

Function

The vn_remove service removes a link to a file. The input Name can identify a file, a link-name of a file, or a symbolic link.

Environment on entry and exit

See Environment for PFS operations.

Input parameter format

vn_remove   (Token_structure,
             OSI_structure,
             Audit_structure,
             Name_length,
             Name,
             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.

Refer to 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.

Name_length
Supplied parameter
Type:
Integer
Length:
Fullword

A fullword that contains the length of Name. The name is between 1 and 255 bytes long.

Name
Supplied parameter
Type:
String
Length:
Specified by Name_length

An area, of length Name_length, that contains the name of the link that is to be deleted. This name contains no nulls.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword
A fullword in which the vn_remove 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_remove service stores the return code. The vn_remove 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_remove service should support at least the following error values:
Return_code Explanation
ENAMETOOLONG The value of Name_length exceeds the length that is supported by this PFS.
ENOENT Name is marked for deletion.
EROFS The file system is mounted read-only.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

A fullword in which the vn_remove service stores the reason code. The vn_remove 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_remove processing

Deleting files provides an overview of file deletion processing.

Specific processing notes
  • The system data fields of the Token_structure contain the PFS's file token for the file that is being removed.
  • If the name that is specified refers to a symbolic link, the symbolic link file that is named by Name should be deleted.
  • If the link name is successfully removed from the directory, and the link count becomes zero, the deletion of the file is recorded for audit purposes. The actual deletion of the file object, and the inode, is done when the vnode is inactivated.

    If a regular file is not open when its link count goes to zero, the space that is occupied by its data should be freed for reuse before the return from vn_remove.

    If a regular file is still open when the link count goes to zero, its contents are not deleted at this point, but remain accessible until the open count goes to zero.

  • When the vn_remove service is successful in removing a directory entry and decrementing the link count, even if the link count is not zero, it must return control to the caller with Return_value set to 0. It must update the change and modification times for the parent directory, and the change time for the file itself (unless the file is deleted).
  • For more information about the semantics of this operation for a POSIX-conforming PFS, refer to the unlink() function in the POSIX .1 standard (IEEE Std 1003.1-1990).
Serialization provided by the LFS

The vn_remove operation is invoked with an exclusive latch held on the vnode of the file that is to be removed, and on the directory that contains that file name.

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 write permission to the directory, and the Audit callable service to record the deletion of the file.

SAF's Check2Owners service is called whenever the sticky bit is on in the parent directory.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014