socsvn commit: r257183 - soc2013/oleksandr/SharedFolder-head/sbin/mount_vboxfs

oleksandr at FreeBSD.org oleksandr at FreeBSD.org
Tue Sep 10 08:00:29 UTC 2013


Author: oleksandr
Date: Tue Sep 10 08:00:28 2013
New Revision: 257183
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257183

Log:
  Initial ontly RDONLY support

Modified:
  soc2013/oleksandr/SharedFolder-head/sbin/mount_vboxfs/mount_vboxfs.c

Modified: soc2013/oleksandr/SharedFolder-head/sbin/mount_vboxfs/mount_vboxfs.c
==============================================================================
--- soc2013/oleksandr/SharedFolder-head/sbin/mount_vboxfs/mount_vboxfs.c	Tue Sep 10 05:59:09 2013	(r257182)
+++ soc2013/oleksandr/SharedFolder-head/sbin/mount_vboxfs/mount_vboxfs.c	Tue Sep 10 08:00:28 2013	(r257183)
@@ -26,17 +26,20 @@
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */
-
-#include <sys/param.h>
+#include <sys/cdio.h>
 #include <sys/stat.h>
-#include <sys/errno.h>
+#include <sys/file.h>
+#include <sys/iconv.h>
+#include <sys/param.h>
 #include <sys/linker.h>
+#include <sys/module.h>
 #include <sys/mount.h>
 #include <sys/uio.h>
-
+	
 #include <err.h>
-#include <stdio.h>
+#include <errno.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <sysexits.h>
 #include <unistd.h>
@@ -80,7 +83,7 @@
 	mode_t dir_mode, file_mode;
 	int iovlen;
 	int error, ch, ronly = 0;
-	int mntflags = MNT_RDONLY;
+	int mntflags;
 
 	iov = NULL;
 	iovlen = 0;
@@ -142,11 +145,14 @@
 	if (dir_mode & S_IROTH)
 		dir_mode |= S_IXOTH;
 	}
-
+	
+	/*
+	 * VBOXFS file systems are not writeable.
+	 */
+	mntflags |= MNT_RDONLY;
 	build_iovec(&iov, &iovlen, "fstype", vboxfs_vfsname, (size_t)-1);
 	build_iovec(&iov, &iovlen, "fspath", mount_point, (size_t)-1);
-	build_iovec(&iov, &iovlen, "hostname", host_name, -1);
-	build_iovec(&iov, &iovlen, "mountpoint", mount_point, -1);
+	build_iovec(&iov, &iovlen, "from", host_name, (size_t)-1);
 	build_iovec_argf(&iov, &iovlen, "uid", "%d", uid);
 	build_iovec_argf(&iov, &iovlen, "gid", "%d", gid);
 	build_iovec_argf(&iov, &iovlen, "file_mode", "%d", file_mode);
@@ -161,8 +167,7 @@
          	 * un-mangle it again. */
         	char szCWD[4096];
         	size_t cchCWD;
-        	if (!getcwd(szCWD, sizeof(szCWD)))
-            		printf("%s: failed to get the current working directory", argv[0]);
+
         		cchCWD = strlen(szCWD);
         	if (!strncmp(host_name, szCWD, cchCWD))
         	{
@@ -172,7 +177,7 @@
             		strcpy(host_name, host_name + cchCWD);
         	}
 		error = nmount(iov, iovlen, mntflags);
-    }
+	}
 
 	if (error) {
 		if (errmsg[0] != 0) {


More information about the svn-soc-all mailing list