vfs_umount Entry Point
Purpose
Unmounts a virtual file system.
Syntax
Parameters
Item | Description |
---|---|
vfsp | Points to the vfs structure being unmounted. This structure is defined in the /usr/include/sys/vfs.h file. |
crp | Points to the cred structure. This structure contains data that the file system can use to validate access permission. |
Description
The vfs_umount entry point is called to unmount a virtual file system. The logical file system performs services independent of the virtual file system that initiate the unmounting. The logical file system services:
- Guarantee the syntax of the uvmount subroutine.
- Perform permission checks:
- If the vfsp parameter refers to a device mount, then the user must have root user authority to perform the operation.
- If the vfsp parameter does not refer to a device mount, then the user must have root user authority or write permission in the parent directory of the mounted-over virtual node (v-node), as well as write permission to the file represented by the mounted-over v-node.
- Ensure that the virtual file system being unmounted contains no mount points for other virtual file systems.
- Ensure that the root v-node is not in use except for the mount. The root v-node is also referred to as the mounted v-node.
- Clear the v_mvfsp field in the stub v-node. This prevents lookup operations already in progress from traversing the soon-to-be unmounted mount point.
The logical file system assumes that, if necessary, successful vfs_umount entry point calls free the root v-node. An error return from the vfs_umount entry point causes the mount point to be re-established. A 0 (zero) returned from the vfs_umount entry point indicates the routine was successful and that the vfs structure was released.
Execution Environment
The vfs_umount 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.