1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1994-09-25 01:38:30 +00:00
|
|
|
.\" Written by Garrett A. Wollman, September 1994.
|
|
|
|
.\" This manual page is in the public domain.
|
|
|
|
.\"
|
|
|
|
.Dd September 24, 1994
|
1998-05-30 18:20:37 +00:00
|
|
|
.Dt GETVFSENT 3
|
1994-09-25 01:38:30 +00:00
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm getvfsent ,
|
|
|
|
.Nm setvfsent ,
|
|
|
|
.Nm endvfsent ,
|
|
|
|
.Nm vfsisloadable ,
|
|
|
|
.Nm vfsload
|
|
|
|
.Nd manage virtual filesystem modules
|
2000-04-21 09:42:15 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
1994-09-25 01:38:30 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/param.h
|
|
|
|
.In sys/mount.h
|
1998-03-23 13:02:37 +00:00
|
|
|
.Ft struct ovfsconf *
|
1994-09-25 01:38:30 +00:00
|
|
|
.Fn getvfsent "void"
|
|
|
|
.Ft void
|
|
|
|
.Fn setvfsent "int cachelist"
|
|
|
|
.Ft void
|
|
|
|
.Fn endvfsent "void"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfsisloadable "const char *name"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfsload "const char *name"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn getvfsent
|
1998-05-30 18:20:37 +00:00
|
|
|
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
|
1998-03-23 13:02:37 +00:00
|
|
|
.Dq Li struct ovfsconf
|
1994-09-25 01:38:30 +00:00
|
|
|
are as follows:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -compact -width vfc_refcount
|
|
|
|
.It vfc_name
|
|
|
|
the name of the filesystem
|
1997-03-03 06:02:54 +00:00
|
|
|
.It vfc_index
|
1994-09-25 01:38:30 +00:00
|
|
|
the filesystem type number assigned by the kernel and used in calls to
|
|
|
|
.Xr mount 2
|
|
|
|
.It 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)
|
|
|
|
.It vfc_flags
|
2001-06-28 06:50:19 +00:00
|
|
|
flag bits
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The flags are defined as follows:
|
2001-07-04 10:42:03 +00:00
|
|
|
.Pp
|
|
|
|
.Bl -tag -width VFCF_SYNTHETIC -compact
|
2001-06-28 06:50:19 +00:00
|
|
|
.It Dv VFCF_STATIC
|
|
|
|
statically compiled into kernel
|
|
|
|
.It Dv VFCF_NETWORK
|
|
|
|
may get data over the network
|
|
|
|
.It Dv VFCF_READONLY
|
|
|
|
writes are not implemented
|
|
|
|
.It Dv VFCF_SYNTHETIC
|
|
|
|
data does not represent real files
|
|
|
|
.It Dv VFCF_LOOPBACK
|
|
|
|
aliases some other mounted FS
|
|
|
|
.It Dv VFCF_UNICODE
|
|
|
|
stores file names as Unicode
|
1994-09-25 01:38:30 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn setvfsent
|
|
|
|
and
|
|
|
|
.Fn endvfsent
|
|
|
|
functions are used to control caching of the filesystem list, which is
|
|
|
|
obtained in toto from the kernel via
|
|
|
|
.Xr sysctl 3 .
|
|
|
|
If the
|
|
|
|
.Fa cachelist
|
|
|
|
parameter to
|
|
|
|
.Fn setvfsent
|
|
|
|
is non-zero, the list will be retrieved only once, upon the first call
|
|
|
|
to one of the retrieval functions, until
|
|
|
|
.Fn endvfsent
|
|
|
|
is called to clear the cache. In general,
|
|
|
|
.Fn setvfsent 1
|
|
|
|
should be called by programs using the
|
|
|
|
.Fn getvfsent
|
|
|
|
function, and
|
|
|
|
.Fn setvfsent 0
|
|
|
|
(which is also the default state)
|
|
|
|
should be called by programs using the
|
|
|
|
.Fn vfsload
|
|
|
|
function.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn vfsisloadable
|
|
|
|
function returns a non-zero value if a later call to
|
|
|
|
.Fn vfsload name
|
2000-10-30 13:23:19 +00:00
|
|
|
is likely to succeed. We say
|
1999-04-20 20:36:36 +00:00
|
|
|
.Dq likely
|
|
|
|
because
|
1994-09-25 01:38:30 +00:00
|
|
|
.Fn vfsisloadable
|
1999-04-20 20:36:36 +00:00
|
|
|
does not check any of the conditions necessary for
|
1994-09-25 01:38:30 +00:00
|
|
|
.Fn vfsload
|
1999-04-20 20:36:36 +00:00
|
|
|
to succeed.
|
1994-09-25 01:38:30 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn vfsload
|
|
|
|
function attempts to load a kernel module implementing filesystem
|
|
|
|
.Fa 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:
|
|
|
|
.Bl -enum
|
|
|
|
.It
|
1998-05-30 18:20:37 +00:00
|
|
|
.Fn getvfsbyname
|
|
|
|
has been called and returned a non-zero value.
|
1994-09-25 01:38:30 +00:00
|
|
|
.It
|
1998-05-30 18:20:37 +00:00
|
|
|
.Fn vfsisloadable
|
1994-09-25 01:38:30 +00:00
|
|
|
has been called and returned a non-zero value.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Here is an example, taken from the source to
|
|
|
|
.Xr mount_cd9660 8 :
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
1998-05-30 18:20:37 +00:00
|
|
|
struct vfsconf *vfc;
|
1998-05-25 21:42:51 +00:00
|
|
|
int error;
|
1994-09-25 01:38:30 +00:00
|
|
|
|
|
|
|
/* setup code here */
|
|
|
|
|
1998-05-25 21:42:51 +00:00
|
|
|
error = getvfsbyname("cd9660", &vfc);
|
1998-05-26 02:53:06 +00:00
|
|
|
if (error && vfsisloadable("cd9660")) {
|
|
|
|
if (vfsload("cd9660"))
|
1998-05-25 21:42:51 +00:00
|
|
|
err(EX_OSERR, "vfsload(cd9660)");
|
1994-09-25 01:38:30 +00:00
|
|
|
endvfsent(); /* flush cache */
|
1998-05-25 21:42:51 +00:00
|
|
|
error = getvfsbyname("cd9660", &vfc);
|
1994-09-25 01:38:30 +00:00
|
|
|
}
|
1998-05-25 21:42:51 +00:00
|
|
|
if (error)
|
|
|
|
errx(1, "cd9660 filesystem is not available");
|
1994-09-25 01:38:30 +00:00
|
|
|
|
1998-05-25 21:42:51 +00:00
|
|
|
if (mount(vfc.vfc_name, dir, mntflags, &args) < 0)
|
|
|
|
err(1, NULL);
|
1994-09-25 01:38:30 +00:00
|
|
|
|
|
|
|
.Ed
|
|
|
|
.Sh RETURN VALUES
|
|
|
|
The
|
|
|
|
.Fn getvfsent
|
1998-05-30 18:20:37 +00:00
|
|
|
routine returns a pointer to a static data structure when
|
|
|
|
it succeeds, and returns a null pointer when it fails. On failure,
|
1994-09-25 01:38:30 +00:00
|
|
|
.Va errno
|
|
|
|
may be set to one of the values documented for
|
|
|
|
.Xr sysctl 3
|
|
|
|
or
|
|
|
|
.Xr malloc 3 ,
|
|
|
|
if a failure of that function was the cause; otherwise
|
|
|
|
.Va errno
|
|
|
|
will be unmodified.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn vfsload
|
|
|
|
function returns a non-zero value on failure, or zero on success. If
|
|
|
|
.Fn vfsload
|
|
|
|
fails,
|
|
|
|
.Va errno
|
|
|
|
may be set to one of the values documented for
|
1999-04-20 20:36:36 +00:00
|
|
|
.Xr kldload 2 .
|
1994-09-25 01:38:30 +00:00
|
|
|
.Sh SEE ALSO
|
1999-04-20 20:36:36 +00:00
|
|
|
.Xr kldload 2 ,
|
1999-08-15 09:51:25 +00:00
|
|
|
.Xr mount 2 ,
|
1994-09-25 01:38:30 +00:00
|
|
|
.Xr mount 8
|
1998-03-19 07:34:22 +00:00
|
|
|
.Sh AUTHORS
|
2000-11-22 09:23:54 +00:00
|
|
|
.An -nosplit
|
1998-03-19 07:34:22 +00:00
|
|
|
The loadable filesystem support was written by
|
|
|
|
.An Garrett A. Wollman ,
|
|
|
|
based on generic loadable kernel module support by
|
|
|
|
.An Terry Lambert .
|
1994-09-25 01:38:30 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
1998-05-30 18:20:37 +00:00
|
|
|
.Fn getvfsent
|
1996-08-21 22:10:36 +00:00
|
|
|
family of functions first appeared in
|
|
|
|
.Fx 2.0 .
|