Blame 010-linux-4.16-mount-fixes.patch

56bd2d
This ghetto patch attempts to fix shared folder automounting for guests running
56bd2d
Linux 4.16, and also suggests an alternative to mount.vboxsf.
56bd2d
56bd2d
diff -uprb VirtualBox-5.2.8.orig/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp VirtualBox-5.2.8/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
56bd2d
--- VirtualBox-5.2.8.orig/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp	2018-02-26 17:57:30.000000000 +0200
56bd2d
+++ VirtualBox-5.2.8/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp	2018-04-07 21:00:05.785735622 +0300
56bd2d
@@ -329,6 +329,13 @@ static int vbsvcAutoMountSharedFolder(co
56bd2d
                       "vboxsf",
56bd2d
                       fFlags,
56bd2d
                       szOptBuf);
56bd2d
+        if (r == -1 && errno == EINVAL)
56bd2d
+        {
56bd2d
+            /* Mainline vboxsf accepts regular mount opts. */
56bd2d
+            char mount_opts[1024];
56bd2d
+            snprintf(mount_opts, 1024, "%s,dmode=0770,fmode=0770", szOptBuf);
56bd2d
+            r = mount(pszShareName, pszMountPoint, "vboxsf", fFlags, mount_opts);
56bd2d
+        }
56bd2d
         if (r == 0)
56bd2d
         {
56bd2d
             VGSvcVerbose(0, "vbsvcAutoMountWorker: Shared folder '%s' was mounted to '%s'\n", pszShareName, pszMountPoint);
56bd2d
diff -uprb VirtualBox-5.2.8.orig/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c VirtualBox-5.2.8/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c
56bd2d
--- VirtualBox-5.2.8.orig/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c	2018-02-26 17:57:34.000000000 +0200
56bd2d
+++ VirtualBox-5.2.8/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c	2018-04-07 21:39:38.121577588 +0300
56bd2d
@@ -485,6 +485,11 @@ main(int argc, char **argv)
56bd2d
      *       to keep this code here slick without having VbglR3.
56bd2d
      */
56bd2d
     err = mount(host_name, mount_point, "vboxsf", flags, &mntinf);
56bd2d
+    if (err == -1 && errno == EINVAL)
56bd2d
+    {
56bd2d
+        /* The mount.vboxsf helper should not be used with mainline vboxsf. */
56bd2d
+        panic("mount.vboxsf cannot be used with mainline vboxsf; instead use:\n\n    mount -cit vboxsf NAME MOUNTPOINT\n\n");
56bd2d
+    }
56bd2d
     if (err == -1 && errno == EPROTO)
56bd2d
     {
56bd2d
         /* Sometimes the mount utility messes up the share name.  Try to