*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> getvfsent (3)              



NAME    [Toc]    [Back]

     getvfsent, setvfsent, endvfsent, vfsisloadable, vfsload -- manage virtual
     file system modules

LIBRARY    [Toc]    [Back]

     Standard C Library (libc, -lc)

SYNOPSIS    [Toc]    [Back]

     #include <sys/param.h>
     #include <sys/mount.h>

     struct ovfsconf *

     setvfsent(int cachelist);


     vfsisloadable(const char *name);

     vfsload(const char *name);

DESCRIPTION    [Toc]    [Back]

     The getvfsent() function provides convenient access to a list of
     installed virtual file system modules managed by the kernel.  It steps
     through the list of file systems 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 file system
     vfc_index	   the file system type number assigned by the kernel and used
		   in calls to mount(2)
     vfc_refcount  the number of references to this file system (usually the
		   number of mounts, but one greater for file systems which
		   cannot be unloaded or which are statically linked into the
     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 file system list, which is obtained in toto from the kernel via
     sysctl(3).  If the cachelist argument 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 file
     system name.  It returns zero if the file system module was successfully
     located and loaded, or non-zero otherwise.  It should only be called in
     the following circumstances:

     1.   The getvfsbyname() function has been called and returned a non-zero

     2.   The vfsisloadable() function has been called and returned a non-zero

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

RETURN VALUES    [Toc]    [Back]

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

SEE ALSO    [Toc]    [Back]

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

AUTHORS    [Toc]    [Back]

     The loadable file system support was written by Garrett A. Wollman, based
     on generic loadable kernel module support by Terry Lambert.

HISTORY    [Toc]    [Back]

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

FreeBSD 5.2.1		      September 24, 1994		 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
autopush HP-UX manage system database of automatically pushed STREAMS modules
kcmodule HP-UX manage kernel modules and subsystems
getvfsbynumber Tru64 Get the virtual file system type name
getvfsbyname Tru64 Get the virtual file system type number
mmap Tru64 Map a file system object into virtual memory
extattr FreeBSD virtual file system named extended attributes
acl FreeBSD virtual file system access control lists
extattr OpenBSD virtual file system named extended attributes
vm_map_unwire FreeBSD manage page wiring within a virtual memory map
vm_map_wire FreeBSD manage page wiring within a virtual memory map
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service