xref: /freebsd/share/man/man9/vfsconf.9 (revision ea906c4152774dff300bb26fbfc1e4188351c89a)
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 file system type known to the kernel has a
46.Vt vfsconf
47structure that contains the
48information required to create a new mount of that file systems type.
49.Bd -literal
50struct vfsconf {
51	struct	vfsops *vfc_vfsops;	/* file system operations vector */
52	char	vfc_name[MFSNAMELEN];	/* file system type name */
53	int	vfc_typenum;		/* historic file system type number */
54	int	vfc_refcount;		/* number mounted of this type */
55	int	vfc_flags;		/* permanent flags */
56	struct	vfsconf *vfc_next;	/* next in list */
57};
58.Ed
59.Pp
60When a new file system is mounted,
61.Xr vfs_mount 9
62does a lookup of the
63.Vt vfsconf
64structure by its name, and if it is not already registered,
65attempts to load a kernel module for it.
66The file system operations for the new mount point are taken from
67.Va vfc_vfsops ,
68and
69.Va mnt_vfc
70in the
71.Vt mount
72structure is made to point directly at the
73.Vt vfsconf
74structure for the
75file system type.
76The file system type number is taken from
77.Va vfc_typenum
78which was assigned in
79.Fn vfs_register ,
80and the mount flags are taken from a mask of
81.Va vfc_flags .
82Each time a file system of a given type is mounted,
83.Va vfc_refcount
84is incremented.
85.Pp
86.Fn vfs_register
87takes a new
88.Vt vfsconf
89structure and adds it to the list of existing file systems.
90If the type has not already been registered, it is initialized by calling the
91.Fn vfs_init
92function in the file system operations vector.
93.Fn vfs_register
94also updates the oid's of any sysctl nodes for this file system type
95to be the same as the newly assigned type number.
96.Pp
97.Fn vfs_unregister
98unlinks
99.Fa vfc
100from the list of registered file system types if there are currently no mounted instances.
101If the
102.Fn vfs_uninit
103function in the file systems initialization vector is defined, it is called.
104.Pp
105.Fn vfs_modevent
106is registered by
107.Fn VFS_SET
108to handle the loading and unloading of file system kernel modules.
109In the case of
110.Dv MOD_LOAD ,
111.Fn vfs_register
112is called.
113In the case of
114.Dv MOD_UNLOAD ,
115.Fn vfs_unregister
116is called.
117.Sh RETURN VALUES
118.Fn vfs_register
119returns 0 if successful; otherwise,
120.Er EEXIST
121is returned indicating that the file system type has already been registered.
122.Pp
123.Fn vfs_unregister
124returns 0 if successful.
125If no
126.Vt vfsconf
127entry can be found matching the name in
128.Fa vfc ,
129.Er EINVAL
130is returned.
131If the reference count of mounted instances of the file system type is not zero,
132.Er EBUSY
133is returned.
134If
135.Fn vfs_uninit
136is called, any errors it returns will be returned by
137.Fn vfs_unregister .
138.Pp
139.Fn vfs_modevent
140returns the result of the call to
141.Fn vfs_register
142or
143.Fn vfs_unregister ,
144whatever the case.
145.Sh SEE ALSO
146.Xr vfs_mount 9 ,
147.Xr vfs_rootmountalloc 9 ,
148.Xr VFS_SET 9
149.Sh AUTHORS
150This manual page was written by
151.An Chad David Aq davidc@acns.ab.ca .
152