1 .\" $FreeBSD: src/lib/libc/gen/getvfsent.3,v 1.17.2.5 2001/12/14 18:33:51 ru Exp $
2 .\" $DragonFly: src/lib/libc/gen/getvfsent.3,v 1.3 2006/02/17 19:35:06 swildner Exp $
3 .\" Written by Garrett A. Wollman, September 1994.
4 .\" This manual page is in the public domain.
15 .Nd manage virtual filesystem modules
24 .Fn setvfsent "int cachelist"
28 .Fn vfsisloadable "const char *name"
30 .Fn vfsload "const char *name"
34 function provides convenient access to a list of installed virtual
35 filesystem modules managed by the kernel. It steps through the
36 list of filesystems one at a time. A null pointer is returned when
37 no more data is available. The fields in a
38 .Dq Li struct ovfsconf
41 .Bl -tag -compact -width vfc_refcount
43 the name of the filesystem
45 the filesystem type number assigned by the kernel and used in calls to
48 the number of references to this filesystem
49 (usually the number of mounts, but one greater for filesystems which
50 cannot be unloaded or which are statically linked into the kernel)
55 The flags are defined as follows:
57 .Bl -tag -width VFCF_SYNTHETIC -compact
59 statically compiled into kernel
61 may get data over the network
63 writes are not implemented
65 data does not represent real files
67 aliases some other mounted FS
69 stores file names as Unicode
76 functions are used to control caching of the filesystem list, which is
77 obtained in toto from the kernel via
83 is non-zero, the list will be retrieved only once, upon the first call
84 to one of the retrieval functions, until
86 is called to clear the cache. In general,
88 should be called by programs using the
92 (which is also the default state)
93 should be called by programs using the
99 function returns a non-zero value if a later call to
101 is likely to succeed. We say
105 does not check any of the conditions necessary for
111 function attempts to load a kernel module implementing filesystem
113 It returns zero if the filesystem module was successfully located and
114 loaded, or non-zero otherwise. It should only be called in the
115 following circumstances:
119 has been called and returned a non-zero value.
122 has been called and returned a non-zero value.
125 Here is an example, taken from the source to
127 .Bd -literal -offset indent
132 /* setup code here */
134 error = getvfsbyname("cd9660", &vfc);
135 if (error && vfsisloadable("cd9660")) {
136 if (vfsload("cd9660"))
137 err(EX_OSERR, "vfsload(cd9660)");
138 endvfsent(); /* flush cache */
139 error = getvfsbyname("cd9660", &vfc);
142 errx(1, "cd9660 filesystem is not available");
144 if (mount(vfc.vfc_name, dir, mntflags, &args) < 0)
151 routine returns a pointer to a static data structure when
152 it succeeds, and returns a null pointer when it fails. On failure,
154 may be set to one of the values documented for
158 if a failure of that function was the cause; otherwise
164 function returns a non-zero value on failure, or zero on success. If
168 may be set to one of the values documented for
177 family of functions first appeared in
181 The loadable filesystem support was written by
182 .An Garrett A. Wollman ,
183 based on generic loadable kernel module support by