From 56cb1e8cca78396cb5cb2bb3e16066707ed8f43f Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Sun, 20 Jun 2004 14:30:33 +0000 Subject: [PATCH] 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 --- contrib/smbfs/mount_smbfs/mount_smbfs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/contrib/smbfs/mount_smbfs/mount_smbfs.c b/contrib/smbfs/mount_smbfs/mount_smbfs.c index dee87116244c..2ba41f054809 100644 --- a/contrib/smbfs/mount_smbfs/mount_smbfs.c +++ b/contrib/smbfs/mount_smbfs/mount_smbfs.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -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);