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


vn_mkdir — Create a directory

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

Function

The vn_mkdir operation creates a directory using the attributes that are provided by the caller.

Environment on entry and exit

See Environment for PFS operations.

Input parameter format

vn_mkdir    (Token_structure,
             OSI_structure,
             Audit_structure,
             Name_length,
             Name,
             File_attribute_structure,
             Vnode_token,
             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 the directory name that is to be created. The name can be 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 directory that is to be created. This name contains no nulls.

File_Attribute_Structure
Supplied parameter
Type:
Structure
Length:
Specified by the ATTR.attr_hdr.cblen field

An area that contains the attributes of the directory that is to be created. This area is mapped by the ATTR typedef in the BPXYVFSI header file (see Interface structures for C language servers and clients). See "Specific processing notes" for details on how the fields in this structure are processed.

Vnode_token
Returned parameter
Type:
Token
Length:
8 bytes

An area in which the vn_mkdir service returns the vnode_token for the new directory.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword
A fullword in which the vn_mkdir 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_mkdir service stores the return code. The vn_mkdir 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_mkdir service should support the following error values:
Return_code Explanation
EACCES The caller does not have write authority for the parent directory.
EEXIST A directory with the same name already exists.
ENOENT The parent directory has been marked for deletion.
ENAMETOOLONG The length of the name is greater than the maximum supported length.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

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

Creating, referring to, and inactivating file vnodes provides an overview of directory creation processing.

For more information about the semantics of this operation for a POSIX-conforming PFS, refer to the mkdir() function in the POSIX .1 standard (IEEE Std 1003.1-1990).

Specific processing notes
  • The token structure that is passed on input represents the parent directory in which the new directory is created.
  • The following ATTR fields are provided by the LFS:
    Attr.at_hdr.cbid
    Contains Attr_ID (from the BPXYVFSI header file)
    Attr.attr_hdr.cblen
    Specifies the length of the File_Attribute_Structure
    ATTR.at_mode
    Specifies the directory permission bits. See Interface structures for C language servers and clients for the mapping of this field.
  • If the directory that is named in the Name parameter already exists, the vn_mkdir service returns a return code of EEXIST, and the output vnode_token is optional.
Serialization provided by the LFS

The vn_mkdir operation is invoked with an exclusive latch held on the vnode of the parent directory.

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. The PFS is also expected to invoke SAF's Make FSP callable service to create a file security packet.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014