summaryrefslogtreecommitdiffstats
path: root/contrib/smbfs/mount_smbfs
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2004-06-20 14:30:33 +0000
committermux <mux@FreeBSD.org>2004-06-20 14:30:33 +0000
commiteb7afb3b32f4fc99a9b9c88a4f470b386df0bc3b (patch)
tree02a0d869da82f2ecacbd97aca6632abe31e78a53 /contrib/smbfs/mount_smbfs
parent850ccbe37b878ac825850729d1c0a717cddb02e3 (diff)
downloadFreeBSD-src-eb7afb3b32f4fc99a9b9c88a4f470b386df0bc3b.zip
FreeBSD-src-eb7afb3b32f4fc99a9b9c88a4f470b386df0bc3b.tar.gz
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
Diffstat (limited to 'contrib/smbfs/mount_smbfs')
-rw-r--r--contrib/smbfs/mount_smbfs/mount_smbfs.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/smbfs/mount_smbfs/mount_smbfs.c b/contrib/smbfs/mount_smbfs/mount_smbfs.c
index dee8711..2ba41f0 100644
--- a/contrib/smbfs/mount_smbfs/mount_smbfs.c
+++ b/contrib/smbfs/mount_smbfs/mount_smbfs.c
@@ -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);
OpenPOWER on IntegriCloud