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

# vfs\_modevent(9)

vfs configuration information

## NAME

**vfsconf** – vfs configuration information

## SYNOPSIS

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

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

*int*\

**vfs\_register**(*struct vfsconf \*vfc*);

*int*\

**vfs\_unregister**(*struct vfsconf \*vfc*);

*int*\

**vfs\_modevent**(*module\_t mod*, *int type*, *void \*data*);

## DESCRIPTION

Each file system type known to the kernel has a *vfsconf* structure that contains the information required to create a new mount of that file systems type.

```
struct vfsconf {
	struct	vfsops *vfc_vfsops;	/* file system operations vector */
	char	vfc_name[MFSNAMELEN];	/* file system type name */
	int	vfc_typenum;		/* historic file system type number */
	int	vfc_refcount;		/* number mounted of this type */
	int	vfc_flags;		/* permanent flags */
	struct	vfsconf *vfc_next;	/* next in list */
};
```

When a new file system is mounted, [vfs\_mount(9)](/vfs_mount/9.md) does a lookup of the *vfsconf* structure by its name, and if it is not already registered, attempts to load a kernel module for it. The file system operations for the new mount point are taken from *vfc\_vfsops*, and *mnt\_vfc* in the *mount* structure is made to point directly at the *vfsconf* structure for the file system type. The file system type number is taken from *vfc\_typenum* which was assigned in **vfs\_register**(), and the mount flags are taken from a mask of *vfc\_flags*. Each time a file system of a given type is mounted, *vfc\_refcount* is incremented.

**vfs\_register**() takes a new *vfsconf* structure and adds it to the list of existing file systems. If the type has not already been registered, it is initialized by calling the **vfs\_init**() function in the file system operations vector. **vfs\_register**() also updates the oid's of any sysctl nodes for this file system type to be the same as the newly assigned type number.

**vfs\_unregister**() unlinks *vfc* from the list of registered file system types if there are currently no mounted instances. If the **vfs\_uninit**() function in the file systems initialization vector is defined, it is called.

**vfs\_modevent**() is registered by **VFS\_SET**() to handle the loading and unloading of file system kernel modules. In the case of MOD\_LOAD, **vfs\_register**() is called. In the case of MOD\_UNLOAD, **vfs\_unregister**() is called.

## RETURN VALUES

**vfs\_register**() returns 0 if successful; otherwise, EEXIST is returned indicating that the file system type has already been registered.

**vfs\_unregister**() returns 0 if successful. If no *vfsconf* entry can be found matching the name in *vfc*, EINVAL is returned. If the reference count of mounted instances of the file system type is not zero, EBUSY is returned. If **vfs\_uninit**() is called, any errors it returns will be returned by **vfs\_unregister**().

**vfs\_modevent**() returns the result of the call to **vfs\_register**() or **vfs\_unregister**(), whatever the case.

## SEE ALSO

[vfs\_mount(9)](/vfs_mount/9.md), [vfs\_rootmountalloc(9)](/vfs_rootmountalloc/9.md), [VFS\_SET(9)](/VFS_SET/9.md)

## AUTHORS

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