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


v_lookup (BPX1VLK, BPX4VLK) — Look up a file or directory

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

Function

The v_lookup service accepts a vnode token that represents a directory and a name that identifies a file. The directory is searched for this file, and if it is found, a vnode token for this file and its file attributes are returned. The file vnode token that is returned must be supplied by the server on all subsequent VFS callable services that are related to this file.

Requirements

Operation Environment
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1VLK): 31-bit
AMODE (BPX4VLK): 64-bit
ASC mode: Primary mode
Interrupt status: Enabled for interrupts
Locks: Unlocked
Control parameters: All parameters must be addressable by the caller and in the primary address space.

Format

CALL BPX1VLK,(Directory_vnode_token,
              OSS,
              Name_length,
              Name,
              Attr_length,
              Attr,
              File_vnode_token,
              Return_value,
              Return_code,
              Reason_code)

AMODE 64 callers use BPX4VLK with the same parameters.

Parameters

Directory_vnode_token
Supplied parameter
Type:
Token
Length:
8 bytes

The name of an 8-byte area that contains a vnode token that represents the directory in which the v_lookup service searches for the file that is supplied in the Name parameter.

OSS
Supplied and returned parameter
Type:
Structure
Length:
OSS#LENGTH (from the BPXYOSS macro)

The name of an area that contains operating-system-specific parameters. This area is mapped by the BPXYOSS macro (see BPXYOSS — Map operating system specific information).

Name_length
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the length of the filename that is to be searched for. The name can be up to 255 bytes long.

Name
Supplied parameter
Type:
Character string
Length:
Specified by Name_length parameter

The name of an area, of length Name_length, that contains the filename to be searched for. It must not contain null characters (X'00').

Attr_length
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the length of the area that is passed in the Attr parameter. To determine the value of Attr_length, use the ATTR structure (see BPXYATTR — Map file attributes for v_ system calls).

Attr
Returned parameter
Type:
Structure
Length:
Specified by the Attr_length parameter

The name of an area, of length Attr_length, in which the v_lookup service returns the file attribute structure for the file that is supplied in the Name parameter. This area is mapped by the ATTR structure (see BPXYATTR — Map file attributes for v_ system calls).

The file attributes information is returned only if the file is found.

File_vnode_token
Returned parameter
Type:
Token
Length:
8 bytes

The name of an 8-byte area in which the v_lookup service returns a vnode token of the file that is supplied in the Name parameter.

The token is returned only if the file is found.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the v_lookup service returns 0 if the request is successful, or -1 if it is not successful.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the v_lookup service stores the return code. The v_lookup service returns Return_code only if Return_value is -1. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values. The v_lookup service can return one of the following values in the Return_code parameter:
Return_code Explanation
EINVAL Parameter error; for example, a supplied area was too small. The following reason codes can accompany the return code: JRSmallAttr, JRNoName, JrNullInPath, JRVTokenFreed, JRWrongPID, JRStaleVnodeTok, JRInvalidVnodeTok, JRInvalidOSS.
EMFILE The maximum number of vnode tokens have been created.
ENAMETOOLONG The name is longer than 255 characters.
ENFILE An error occurred while storage was being obtained for a vnode token.
ENOENT Name was not found.
ENOTDIR The supplied token did not represent a directory.
EPERM The operation is not permitted. The caller of the service is not registered as a server.
ERREMOTE Object is remote. The following reason code can accompany the return code: JrNoRemote.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the v_lookup service stores the reason code. The v_lookup service returns a Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. See z/OS UNIX System Services Messages and Codes for the reason codes.

Usage notes

  1. Vnode tokens that are returned by the v_lookup service are not inherited across a fork callable service.
  2. The caller is responsible for freeing vnode tokens that are returned by the v_lookup service, by calling to the v_rel service when they are no longer needed.
  3. Local mount points are not crossed unless the OssXmtpt flag is set in the input OSS structure. When that flag is on and the name looked up turns out to be a mount point directory, the root directory of the file system that is mounted there is returned instead of the named directory. This is called "crossing down the mount point tree". When the specified name is ".." and the specified directory is a local root, the parent directory of the underlying mount point is returned instead of the parent of the specified directory. This is called "crossing up the mount point tree".

    In these situations, the OssXmtpt flag is left on and the VFS_Token of the crossed into file system is returned in the AttrCharSetID field of the returned ATTR structure. If a mount point is not encountered, the OssXmtpt flag is turned off.

  4. When the OssNoRemote flag and the OssXmtpt flag are both set, v_lookup will not allow crossing over into a remote file system. Remote file systems are NFS Client and DFS Client file systems. If a remote file system is encountered, v_lookup will fail with a return code of ERREMOTE.

Characteristics and restrictions

A process must be registered as a server before the v_lookup service is permitted; see v_reg (BPX1VRG, BPX4VRG) — Register a process as a server.

Examples

For an example using this callable service, see BPX1VLK, BPX4VLK (v_lookup).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014