vfs_mount Entry Point

Purpose

Mounts a virtual file system.

Syntax

int vfs_mount ( vfsp)
struct vfs *vfsp;
struct ucred * crp;

Parameter

Item Description
vfsp Points to the newly created vfs structure.
crp Points to the cred structure. This structure contains data that the file system can use to validate access permission.

Description

The vfs_mount entry point is called by the logical file system to mount a new file system. This entry point is called after the vfs structure is allocated and initialized. Before this structure is passed to the vfs_mount entry point, the logical file system:

  • Guarantees the syntax of the vmount or mount subroutines.
  • Allocates the vfs structure.
  • Resolves the stub to a virtual node (v-node). This is the vfs_mntdover field in the vfs structure.
  • Initializes the following virtual file system fields:
    Field Description
    vfs_flags Initialized depending on the type of mount. This field takes the following values:
    VFS_MOUNTOK
    The user has write permission in the stub's parent directory and is the owner of the stub.
    VFS_SUSER
    The user has root user authority.
    VFS_NOSUID
    Execution of setuid and setgid programs from this mount are not allowed.
    VFS_NODEV
    Opens of devices from this mount are not allowed.
    vfs_type Initialized to the / (root) file system type when the mount subroutine is used. If the vmount subroutine is used, the vfs_type field is set to the type parameter supplied by the user. The logical file system verifies the existence of the type parameter.
    vfs_ops Initialized according to the vfs_type field.
    vfs_mntdover Identifies the v-node that refers to the stub path argument. This argument is supplied by the mount or vmount subroutine.
    vfs_date Holds the time stamp. The time stamp specifies the time to initialize the virtual file system.
    vfs_number Indicates the unique number sequence representing this virtual file system.
    vfs_mdata Initialized with the vmount structure supplied by the user. The virtual file system data is detailed in the /usr/include/sys/vmount.h file. All arguments indicated by this field are copied to kernel space.

Execution Environment

The vfs_mount entry point can be called from the process environment only.

Return Values

Item Description
0 Indicates success.

Nonzero return values are returned from the /usr/include/sys/errno.h file to indicate failure.