---
name: "vfs_mount"
section: "9"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/vfs_mount"
---

# vfs\_mount(9)

generic file system mount function

## NAME

**vfs\_mount** – generic file system mount function

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<sys/mount.h\>**

*int*\

**vfs\_mount**(*struct thread \*td*, *const char \*fstype*, *char \*fspath*, *int fsflags*, *void \*fsdata*);

## DESCRIPTION

The **vfs\_mount**() function handles the generic portion of mounting a file system, and calls the file system specific mount function after verifying its parameters and setting up the structures expected by the underlying mount code.

**vfs\_mount**() is called directly by the [mount(2)](/mount/2.md) system call.

Its arguments are:

- *td*

  The thread responsible for this call.

- *fstype*

  The type of file system being mounted.

- *fspath*

  The path to the mount point of the file system.

- *fsflags*

  Flags controlling the mount. See [mount(2)](/mount/2.md) for details.

  MNT\_EXPORTED, MNT\_NOSUID, MNT\_UPDATE, MNT\_RELOAD, MNT\_FORCE, MNT\_ASYNC, MNT\_SYNCHRONOUS, MNT\_UNION, MNT\_NOATIME, MNT\_SNAPSHOT, MNT\_NOCLUSTERR, MNT\_NOCLUSTERW, MNT\_IGNORE, MNT\_UNION, MNT\_NOSYMFOLLOW

- *fsdata*

  File system specific data structure. It is in userspace when passed to **vfs\_mount**() and is left untouched when passed to file system's **mount**().

## RETURN VALUES

A 0 value is returned on success.

## ERRORS

- \[ENAMETOOLONG\]

  The fs type or the mount point path is too long or any individual path component is too long.

- \[EPERM\]

  Permission denied. There are a number of reason this can occur ranging from the user not having permission to mount a file system to the securelevel being to high to load the *fstype* module.

- \[EINVAL\]

  Invalid operation (ex: trying to update a non mount-point).

- \[ENOENT\]

  The mount point does not exist (from **namei**()).

- \[ELOOP\]

  The mount point is a muddle of links (from **namei**()).

- \[EOPNOTSUPP\]

  The operation is not supported (ex: reloading a r/w file system).

- \[EBUSY\]

  The mount point is busy or is not really a mount point (on update).

- \[ENOTDIR\]

  The mount point is not a directory.

- \[ENODEV\]

  The kernel linker was unable to load the specified *fstype* or was unable to find the specified *fstype* module.

Other errors can be returned by the file system's **mount**() and you should check the specific file system for details. Also this call relies on a large number of other kernel services whose errors it returns so this list may not be exhaustive.

## SEE ALSO

[mount(2)](/mount/2.md), [mount(8)](/mount/8.md), [vfs\_mountedon(9)](/vfs_mountedon/9.md)

*vfs.usermount*

## AUTHORS

This manual page was written by Chad David ⟨davidc@acns.ab.ca⟩.
