DragonFly On-Line Manual Pages

Search: Section:  

GETVFSENT(3)          DragonFly Library Functions Manual          GETVFSENT(3)


getvfsent, setvfsent, endvfsent, vfsisloadable, vfsload -- manage virtual filesystem modules


Standard C Library (libc, -lc)


#include <sys/param.h> #include <sys/mount.h> struct ovfsconf * getvfsent(void); void setvfsent(int cachelist); void endvfsent(void); int vfsisloadable(const char *name); int vfsload(const char *name);


The getvfsent() function provides convenient access to a list of installed virtual filesystem modules managed by the kernel. It steps through the list of filesystems one at a time. A null pointer is returned when no more data is available. The fields in a ``struct ovfsconf'' are as follows: vfc_name the name of the filesystem vfc_index the filesystem type number assigned by the kernel and used in calls to mount(2) vfc_refcount the number of references to this filesystem (usually the number of mounts, but one greater for filesystems which cannot be unloaded or which are statically linked into the kernel) vfc_flags flag bits The flags are defined as follows: VFCF_STATIC statically compiled into kernel VFCF_NETWORK may get data over the network VFCF_READONLY writes are not implemented VFCF_SYNTHETIC data does not represent real files VFCF_LOOPBACK aliases some other mounted FS VFCF_UNICODE stores file names as Unicode The setvfsent() and endvfsent() functions are used to control caching of the filesystem list, which is obtained in toto from the kernel via sysctl(3). If the cachelist parameter to setvfsent() is non-zero, the list will be retrieved only once, upon the first call to one of the retrieval functions, until endvfsent() is called to clear the cache. In general, setvfsent(1) should be called by programs using the getvfsent() function, and setvfsent(0) (which is also the default state) should be called by programs using the vfsload() function. The vfsisloadable() function returns a non-zero value if a later call to vfsload(name) is likely to succeed. We say ``likely'' because vfsisloadable() does not check any of the conditions necessary for vfsload() to succeed. The vfsload() function attempts to load a kernel module implementing filesystem name. It returns zero if the filesystem module was successfully located and loaded, or non-zero otherwise. It should only be called in the following circumstances: 1. getvfsbyname() has been called and returned a non-zero value. 2. vfsisloadable() has been called and returned a non-zero value. Here is an example, taken from the source to mount_cd9660(8): struct vfsconf *vfc; int error; /* setup code here */ error = getvfsbyname("cd9660", &vfc); if (error && vfsisloadable("cd9660")) { if (vfsload("cd9660")) err(EX_OSERR, "vfsload(cd9660)"); endvfsent(); /* flush cache */ error = getvfsbyname("cd9660", &vfc); } if (error) errx(1, "cd9660 filesystem is not available"); if (mount(vfc.vfc_name, dir, mntflags, &args) < 0) err(1, NULL);


The getvfsent() routine returns a pointer to a static data structure when it succeeds, and returns a null pointer when it fails. On failure, errno may be set to one of the values documented for sysctl(3) or malloc(3), if a failure of that function was the cause; otherwise errno will be unmodified. The vfsload() function returns a non-zero value on failure, or zero on success. If vfsload() fails, errno may be set to one of the values documented for kldload(2).


kldload(2), mount(2), mount(8)


The getvfsent() family of functions first appeared in FreeBSD 2.0.


The loadable filesystem support was written by Garrett A. Wollman, based on generic loadable kernel module support by Terry Lambert. DragonFly 4.3 September 24, 1994 DragonFly 4.3

Search: Section: