summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libc/gen/Makefile.inc7
-rw-r--r--lib/libc/gen/getvfsent.3187
-rw-r--r--lib/libc/gen/getvfsent.c150
-rw-r--r--sys/sys/mount.h6
4 files changed, 2 insertions, 348 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 987a3c7..01844e5 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -15,7 +15,7 @@ SRCS+= __xuname.c _pthread_stubs.c _rand48.c _spinlock_stub.c _thread_init.c \
gethostname.c getloadavg.c getlogin.c getmntinfo.c getnetgrent.c \
getobjformat.c getosreldate.c getpagesize.c \
getpeereid.c getprogname.c getpwent.c getttyent.c \
- getusershell.c getvfsbyname.c getvfsent.c glob.c \
+ getusershell.c getvfsbyname.c glob.c \
initgroups.c isatty.c jrand48.c lcong48.c \
lockf.c lrand48.c mrand48.c nice.c \
nlist.c nrand48.c ntp_gettime.c opendir.c \
@@ -48,7 +48,7 @@ MAN+= alarm.3 arc4random.3 \
getgrent.3 getgrouplist.3 gethostname.3 getloadavg.3 \
getmntinfo.3 getnetgrent.3 getobjformat.3 getosreldate.3 \
getpagesize.3 getpass.3 getpeereid.3 getprogname.3 getpwent.3 \
- getttyent.3 getusershell.3 getvfsbyname.3 getvfsent.3 \
+ getttyent.3 getusershell.3 getvfsbyname.3 \
glob.3 initgroups.3 isgreater.3 ldexp.3 lockf.3 makecontext.3 \
modf.3 msgctl.3 msgget.3 msgrcv.3 msgsnd.3 \
nice.3 nlist.3 pause.3 popen.3 pselect.3 psignal.3 pwcache.3 \
@@ -103,9 +103,6 @@ MLINKS+=getttyent.3 endttyent.3 getttyent.3 getttynam.3 \
getttyent.3 isdialuptty.3 getttyent.3 isnettty.3 \
getttyent.3 setttyent.3
MLINKS+=getusershell.3 endusershell.3 getusershell.3 setusershell.3
-MLINKS+=getvfsent.3 endvfsent.3 getvfsent.3 getvfsbytype.3 \
- getvfsent.3 setvfsent.3 getvfsent.3 vfsisloadable.3 \
- getvfsent.3 vfsload.3
MLINKS+=glob.3 globfree.3
MLINKS+=isgreater.3 isgreaterequal.3 isgreater.3 isless.3 \
isgreater.3 islessequal.3 isgreater.3 islessgreater.3 \
diff --git a/lib/libc/gen/getvfsent.3 b/lib/libc/gen/getvfsent.3
deleted file mode 100644
index 7c4a934..0000000
--- a/lib/libc/gen/getvfsent.3
+++ /dev/null
@@ -1,187 +0,0 @@
-.\" $FreeBSD$
-.\" Written by Garrett A. Wollman, September 1994.
-.\" This manual page is in the public domain.
-.\"
-.Dd September 24, 1994
-.Dt GETVFSENT 3
-.Os
-.Sh NAME
-.Nm getvfsent ,
-.Nm setvfsent ,
-.Nm endvfsent ,
-.Nm vfsisloadable ,
-.Nm vfsload
-.Nd manage virtual file system modules
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/mount.h
-.Ft struct ovfsconf *
-.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
-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
-.Dq Li struct ovfsconf
-are as follows:
-.Pp
-.Bl -tag -compact -width vfc_refcount
-.It vfc_name
-the name of the file system
-.It vfc_index
-the file system type number assigned by the kernel and used in calls to
-.Xr mount 2
-.It 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 kernel)
-.It vfc_flags
-flag bits
-.El
-.Pp
-The flags are defined as follows:
-.Pp
-.Bl -tag -width VFCF_SYNTHETIC -compact
-.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
-.El
-.Pp
-The
-.Fn setvfsent
-and
-.Fn endvfsent
-functions are used to control caching of the file system list, which is
-obtained in toto from the kernel via
-.Xr sysctl 3 .
-If the
-.Fa cachelist
-argument 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
-is likely to succeed. We say
-.Dq likely
-because
-.Fn vfsisloadable
-does not check any of the conditions necessary for
-.Fn vfsload
-to succeed.
-.Pp
-The
-.Fn vfsload
-function attempts to load a kernel module implementing file system
-.Fa 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:
-.Bl -enum
-.It
-The
-.Fn getvfsbyname
-function
-has been called and returned a non-zero value.
-.It
-The
-.Fn vfsisloadable
-function
-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
-
-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);
-
-.Ed
-.Sh RETURN VALUES
-The
-.Fn getvfsent
-routine returns a pointer to a static data structure when
-it succeeds, and returns a null pointer when it fails. On failure,
-.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
-.Xr kldload 2 .
-.Sh SEE ALSO
-.Xr kldload 2 ,
-.Xr mount 2 ,
-.Xr mount 8
-.Sh AUTHORS
-.An -nosplit
-The loadable file system support was written by
-.An Garrett A. Wollman ,
-based on generic loadable kernel module support by
-.An Terry Lambert .
-.Sh HISTORY
-The
-.Fn getvfsent
-family of functions first appeared in
-.Fx 2.0 .
diff --git a/lib/libc/gen/getvfsent.c b/lib/libc/gen/getvfsent.c
deleted file mode 100644
index 87ebfab..0000000
--- a/lib/libc/gen/getvfsent.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * getvfsent.c - get a listing of installed filesystems
- * Written September 1994 by Garrett A. Wollman
- * This file is in the public domain.
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/linker.h>
-#include <sys/mount.h>
-#include <sys/sysctl.h>
-#include <unistd.h>
-#include <sys/file.h>
-#include <sys/wait.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <paths.h>
-
-/* XXX hide some compatibility problems. */
-#define vfsconf ovfsconf
-
-static struct vfsconf *_vfslist = 0;
-static struct vfsconf _vfsconf;
-static size_t _vfslistlen = 0;
-static int _vfs_keeplist = 0;
-static int _vfs_index = 0;
-
-static int
-initvfs(void)
-{
- int mib[2] = { CTL_VFS, VFS_VFSCONF };
- size_t size = 0;
- int rv;
-
- rv = sysctl(mib, 2, (void *)0, &size, (void *)0, (size_t)0);
- if(rv < 0)
- return 0;
-
- if(_vfslist)
- free(_vfslist);
- _vfslist = malloc(size);
- if(!_vfslist)
- return 0;
-
- rv = sysctl(mib, 2, _vfslist, &size, (void *)0, (size_t)0);
- if(rv < 0) {
- free(_vfslist);
- _vfslist = 0;
- return 0;
- }
-
- _vfslistlen = size / sizeof _vfslist[0];
- return 1;
-}
-
-struct vfsconf *
-getvfsent(void)
-{
- if(!_vfslist && !initvfs()) {
- return 0;
- }
-
- do {
- if(_vfs_index >= _vfslistlen) {
- return 0;
- }
-
- _vfsconf = _vfslist[_vfs_index++];
- } while(!_vfsconf.vfc_vfsops);
-
- if(!_vfs_keeplist) {
- free(_vfslist);
- _vfslist = 0;
- }
- return &_vfsconf;
-}
-
-struct vfsconf *
-getvfsbytype(int type)
-{
- int i;
-
- if(!_vfslist && !initvfs()) {
- return 0;
- }
-
- for(i = 0; i < _vfslistlen; i++) {
- if(_vfslist[i].vfc_index == type)
- break;
- }
-
- if(i < _vfslistlen) {
- _vfsconf = _vfslist[i];
- }
-
- if(!_vfs_keeplist) {
- free(_vfslist);
- _vfslist = 0;
- }
-
- if(i < _vfslistlen) {
- return &_vfsconf;
- } else {
- return 0;
- }
-}
-
-void
-setvfsent(int keep)
-{
- if(_vfslist && !keep) {
- free(_vfslist);
- _vfslist = 0;
- }
-
- _vfs_keeplist = keep;
- _vfs_index = 0;
-}
-
-void
-endvfsent(void)
-{
- if(_vfslist) {
- free(_vfslist);
- _vfslist = 0;
- }
-
- _vfs_index = 0;
-}
-
-int
-vfsisloadable(const char *name)
-{
- return 1;
-}
-
-int
-vfsload(const char *name)
-{
- int status;
-
- status = kldload(name);
- return status == -1 ? status : 0;
-}
-
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index be25137..07d8d59 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -555,13 +555,7 @@ int statfs(const char *, struct statfs *);
int unmount(const char *, int);
/* C library stuff */
-void endvfsent(void);
int getvfsbyname(const char *, struct xvfsconf *);
-struct ovfsconf *getvfsbytype(int);
-struct ovfsconf *getvfsent(void);
-void setvfsent(int);
-int vfsisloadable(const char *);
-int vfsload(const char *);
__END_DECLS
#endif /* _KERNEL */
OpenPOWER on IntegriCloud