From owner-svn-soc-all@FreeBSD.ORG Tue Sep 10 08:00:29 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3C4E1DF6 for ; Tue, 10 Sep 2013 08:00:29 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0FEB72223 for ; Tue, 10 Sep 2013 08:00:29 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8A80Shj031956 for ; Tue, 10 Sep 2013 08:00:28 GMT (envelope-from oleksandr@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r8A80SAx031937 for svn-soc-all@FreeBSD.org; Tue, 10 Sep 2013 08:00:28 GMT (envelope-from oleksandr@FreeBSD.org) Date: Tue, 10 Sep 2013 08:00:28 GMT Message-Id: <201309100800.r8A80SAx031937@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to oleksandr@FreeBSD.org using -f From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r257183 - soc2013/oleksandr/SharedFolder-head/sbin/mount_vboxfs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Sep 2013 08:00:29 -0000 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 +#include #include -#include +#include +#include +#include #include +#include #include #include - + #include -#include +#include #include +#include #include #include #include @@ -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) {