vfsconf.9 (ffc0b97fd087519392b19a9d43056d7099b831eb) vfsconf.9 (1f620c2ead117e9b4f698560053721d05a6637a3)
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

--- 28 unchanged lines hidden (view full) ---

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
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

--- 28 unchanged lines hidden (view full) ---

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