Function
The vn_create operation creates
a new file using the file type and attributes that are provided by
the caller.
Input parameter format
vn_create (Token_structure,
OSI_structure,
Audit_structure,
Name_length,
Name,
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 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 file that is to be created. This name is not null-terminated.
- Attribute_structure
- Supplied parameter
- Type:
- ATTR
- Length:
- Specified by ATTR.at_hdr.cblen.
An area that is to be used by the vn_create operation
to set the attributes of the file that is to be created. This area
is mapped by typedef ATTR in the BPXYVFSI header file (see Interface structures for C language servers and clients).
- Vnode_token
- Returned parameter
- Type:
- Token
- Length:
- 8 bytes
An area in which the vn_create operation returns
the vnode token that is created.
- Return_value
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
A fullword in which the vn_create operation 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_create operation stores
the return code. The vn_create operation returns Return_code only
if Return_value is -1. For a complete list of supported
return code values, see z/OS UNIX System Services Messages and Codes.
The vn_create operation should support at least the following
error values:
Return_code |
Explanation |
---|
EACCES |
The caller does not have write permission for the parent directory. |
EEXIST |
A file with the same name already exists. |
- Reason_code
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
A fullword in which the vn_create operation stores
the reason code. The vn_create operation 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_create processing
Creating files provides an overview of file
creation processing.
- Specific processing notes
- The token structure that is passed on input represents the directory
in which the file is created.
- The following attribute_structure fields are provided by the LFS:
- ATTR.at_hdr.cbid
- Contains Attr_ID (from the BPXYVFSI header file)
- ATTR.at_hdr.cblen
- Specifies the length of the attribute_structure
- ATTR.at_mode
- Specifies the file type and permission bits. See the ATTR typedef
in Interface structures for C language servers and clients for the mapping of this field.
The
user's file creation mask, umask() value, has already been applied
to the permission bits.
- ATTR.at_major
- Specifies the major number for character-special files. This is
provided only when the file type is character-special.
- ATTR.at_minor
- Specifies the minor number for character-special files. This is
provided only when the file type is character-special.
- If the file that is named in the Name parameter already exists,
the vn_create operation returns a return code of EEXIST, and the output
vnode_token is optional.
- Serialization provided by the LFS
The vn_create 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.