During these operations the PFS must:
- Fail the operation if the object already exists—that is, if the
name is already in the directory.
- Otherwise, create the object and add an entry to the parent directory.
A
unique nonzero inode number that corresponds to the st_ino
value of POSIX must be assigned to this object. This value only has
to be unique within this file system and at this time. It may be
reused after the object is deleted. For additional information about
reusing file identifiers, see Exporting files to a VFS server.
A
directory object should be initialized by the PFS with the "." and ".."
entries. For a root, ".." refers to itself,
but for any other directory ".." refers to its
parent directory. These entries are not strictly required by POSIX.
- Store at least the file's type, major number, and minor number
from the passed ATTR structure with the stored attributes of the file.
Whenever osi_getvnode is called, the PFS must construct and pass an
ATTR structure, as would be returned by vn_getattr, so that the vnode
can be built properly.
- Call SAF to create the FSP. The user credentials and ATTR mode
bits from
the interface and the FSP of the parent directory are passed to SAF,
so that it can construct the FSP and do any auditing that is necessary.
See Security responsibilities and considerations.
- Store the FSP with the rest of the attributes of the file.
- For vn_create and vn_mkdir, build an inode-vnode pair,
as it would for a vn_lookup of this object, and return the corresponding
vnode token.
The PFS is responsible for link counts, which must be initialized
here. The link count of an object is the number
of directory entries within the file system that point to the object.
It is reported to a caller via vn_getattr, and changed by vn_link,
vn_remove, vn_rmdir, and vn_rename.
Special consideration must be made for the "."
and ".." entries when creating directories. "." implies
that a directory's initial link count would be two. ".." implies
that a directory's parent directory's link count has to be incremented
when the child directory is created and decremented when it is deleted.
vn_link creates a new node in the file hierarchy, but it does not
create a new object.
The LFS does not allow the creation of links (vn_link) to a directory.