xref: /freebsd/share/man/man9/vfsconf.9 (revision ffc0b97fd087519392b19a9d43056d7099b831eb)
1.\"
2.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice(s), this list of conditions and the following disclaimer as
9.\"    the first lines of this file unmodified other than the possible
10.\"    addition of one or more copyright notices.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice(s), this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
16.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
19.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25.\" DAMAGE.
26.\"
27.\" $FreeBSD$
28.\"
29.Dd November 21, 2001
30.Dt VFSCONF 9
31.Os
32.Sh NAME
33.Nm vfsconf
34.Nd "vfs configuration information"
35.Sh SYNOPSIS
36.In sys/param.h
37.In sys/mount.h
38.Ft int
39.Fn vfs_register "struct vfsconf *vfc"
40.Ft int
41.Fn vfs_unregister "struct vfsconf *vfc"
42.Ft int
43.Fn vfs_modevent "module_t mod" "int type" "void *data"
44.Sh DESCRIPTION
45Each filesystem type known to the kernel has a vfsconf structure that contains the
46information required to create a new mount of that filesystems type.
47.Bd -literal
48	struct vfsconf {
49		struct	vfsops *vfc_vfsops;	/* filesystem operations vector */
50		char	vfc_name[MFSNAMELEN];	/* filesystem type name */
51		int	vfc_typenum;		/* historic filesystem type number */
52		int	vfc_refcount;		/* number mounted of this type */
53		int	vfc_flags;		/* permanent flags */
54		struct	vfsconf *vfc_next;	/* next in list */
55	};
56
57.Ed
58When a new filesystem is mounted
59.Fn vfs_mount
60does a lookup of the vfcconf structure by its name, and if it is not already registered,
61attempts to load a kernel module for it.
62The filesystem operations for the new mount point are taken from vfc_vfsops, and mnt_vfc
63in the mount structure is made to point directly at the vfcconf structure for the
64filesystem type.
65The filesystem type number is taken from vfs_typenum which was assigned in
66.Fn vfs_register ,
67and the mount flags are taken from a mask of vfc_flags.
68Each time a filesystem of a given type is mounted vfc_refcount is incremented.
69.Pp
70.Fn vfs_register
71takes a new vfsconf structure and adds it to the list of existing filesystems.
72If the type has not already been registered it is initialize by calling the
73.Fn vfs_init
74function in the filesystem operations vector.
75.Fn vfs_register
76also updates the oid's of any sysctl nodes for this filesystem type
77to be the same as the newly assigned type number.
78.Pp
79.Fn vfs_unregister
80unlinks
81.Fa vfc
82from the list of registered filesystem types if there are currently no mounted instances.
83If the
84.Fn vfs_uninit
85function in the filesystems initialization vector is defined it is called.
86.Pp
87.Fn vfs_modevent
88is registered by
89.Fn VFS_SET
90to handle the loading and unloading of filesystem kernel modules.
91In the case of
92.Dv MOD_LOAD
93.Fn vfs_register
94is called.
95In the case of
96.Dv MOD_UNLOAD
97.Fn vfs_unregister
98is called.
99.Sh RETURN VALUES
100.Fn vfs_register
101returns 0 if successful; otherwise,
102.Dv EEXIST
103is returned indicating that the filesystem type has already been registered.
104.Pp
105.Fn vfs_unregister
106returns 0 if successful.
107If no vfsconf entry can be found matching the name in
108.Fa vfc ,
109.Dv EINVAL
110is returned.
111If the reference count of mounted instances of the filesystem type is not zero
112.Dv EBUSY
113is returned.
114If
115.Fn vfs_uninit
116is called any errors it returns will be returned by
117.Fn vfs_unregister .
118.Pp
119.Fn vfs_modevent
120returns the result of the call to
121.Fn vfs_register
122or
123.Fn vfs_unregister
124whatever the case.
125.Sh SEE ALSO
126.Xr vfs_rootmountalloc 9 ,
127.Xr vfs_mount ,
128.Xr VFS_SET 9
129.Sh AUTHORS
130This man page was written by
131.An Chad David Aq davidc@acns.ab.ca .
132