Re-add the code to automatically load the smbfs.ko module if necessary.

We can't realy on the mount(2) system call to do it for us here because
smb_lib_init() needs the module and we call it before mount().  The old
code has been slightly modified to not use the getvfsent(3) API which
is now retired.

Noticed by:     many
This commit is contained in:
Maxime Henrion 2004-06-20 14:30:33 +00:00
parent 4456263490
commit 56cb1e8cca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130789

View File

@ -35,6 +35,7 @@
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <sys/linker.h>
#include <sys/mount.h>
#include <stdio.h>
@ -75,6 +76,8 @@ main(int argc, char *argv[])
#ifdef APPLE
extern void dropsuid();
extern int loadsmbvfs();
#else
struct xvfsconf vfc;
#endif
char *next;
int opt, error, mntflags, caseopt;
@ -97,9 +100,16 @@ main(int argc, char *argv[])
#ifdef APPLE
error = loadsmbvfs();
#else
error = getvfsbyname(SMBFS_VFSNAME, &vfc);
if (error) {
if (kldload(SMBFS_VFSNAME))
err(EX_OSERR, "kldload("SMBFS_VFSNAME")");
error = getvfsbyname(SMBFS_VFSNAME, &vfc);
}
#endif
if (error)
errx(EX_OSERR, "SMB filesystem is not available");
#endif
if (smb_lib_init() != 0)
exit(1);