1 .\" $FreeBSD: src/lib/libc/gen/getvfsent.3,v 1.24 2001/10/01 16:08:51 ru Exp $
2 .\" Written by Garrett A. Wollman, September 1994.
3 .\" This manual page is in the public domain.
14 .Nd manage virtual filesystem modules
23 .Fn setvfsent "int cachelist"
27 .Fn vfsisloadable "const char *name"
29 .Fn vfsload "const char *name"
33 function provides convenient access to a list of installed virtual
34 filesystem modules managed by the kernel. It steps through the
35 list of filesystems one at a time. A null pointer is returned when
36 no more data is available. The fields in a
37 .Dq Li struct ovfsconf
40 .Bl -tag -compact -width vfc_refcount
42 the name of the filesystem
44 the filesystem type number assigned by the kernel and used in calls to
47 the number of references to this filesystem
48 (usually the number of mounts, but one greater for filesystems which
49 cannot be unloaded or which are statically linked into the kernel)
54 The flags are defined as follows:
56 .Bl -tag -width VFCF_SYNTHETIC -compact
58 statically compiled into kernel
60 may get data over the network
62 writes are not implemented
64 data does not represent real files
66 aliases some other mounted FS
68 stores file names as Unicode
75 functions are used to control caching of the filesystem list, which is
76 obtained in toto from the kernel via
82 is non-zero, the list will be retrieved only once, upon the first call
83 to one of the retrieval functions, until
85 is called to clear the cache. In general,
87 should be called by programs using the
91 (which is also the default state)
92 should be called by programs using the
98 function returns a non-zero value if a later call to
100 is likely to succeed. We say
104 does not check any of the conditions necessary for
110 function attempts to load a kernel module implementing filesystem
112 It returns zero if the filesystem module was successfully located and
113 loaded, or non-zero otherwise. It should only be called in the
114 following circumstances:
118 has been called and returned a non-zero value.
121 has been called and returned a non-zero value.
124 Here is an example, taken from the source to
126 .Bd -literal -offset indent
131 /* setup code here */
133 error = getvfsbyname("cd9660", &vfc);
134 if (error && vfsisloadable("cd9660")) {
135 if (vfsload("cd9660"))
136 err(EX_OSERR, "vfsload(cd9660)");
137 endvfsent(); /* flush cache */
138 error = getvfsbyname("cd9660", &vfc);
141 errx(1, "cd9660 filesystem is not available");
143 if (mount(vfc.vfc_name, dir, mntflags, &args) < 0)
150 routine returns a pointer to a static data structure when
151 it succeeds, and returns a null pointer when it fails. On failure,
153 may be set to one of the values documented for
157 if a failure of that function was the cause; otherwise
163 function returns a non-zero value on failure, or zero on success. If
167 may be set to one of the values documented for
175 The loadable filesystem support was written by
176 .An Garrett A. Wollman ,
177 based on generic loadable kernel module support by
182 family of functions first appeared in