From owner-svn-ports-all@freebsd.org Tue Jul 18 16:39:29 2017 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34B11D993D7; Tue, 18 Jul 2017 16:39:29 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF49674244; Tue, 18 Jul 2017 16:39:28 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6IGdSrQ032677; Tue, 18 Jul 2017 16:39:28 GMT (envelope-from mmokhi@FreeBSD.org) Received: (from mmokhi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6IGdRP1032666; Tue, 18 Jul 2017 16:39:27 GMT (envelope-from mmokhi@FreeBSD.org) Message-Id: <201707181639.v6IGdRP1032666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmokhi set sender to mmokhi@FreeBSD.org using -f From: Mahdi Mokhtari Date: Tue, 18 Jul 2017 16:39:27 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r446145 - in head/emulators: virtualbox-ose-additions virtualbox-ose/files X-SVN-Group: ports-head X-SVN-Commit-Author: mmokhi X-SVN-Commit-Paths: in head/emulators: virtualbox-ose-additions virtualbox-ose/files X-SVN-Commit-Revision: 446145 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jul 2017 16:39:29 -0000 Author: mmokhi Date: Tue Jul 18 16:39:27 2017 New Revision: 446145 URL: https://svnweb.freebsd.org/changeset/ports/446145 Log: emulators/virtualbox-ose-additions: Add support for VirtualBox SharedFolder This is an experimental implementation of VirtualBox SharedFolder subsystem support for FreeBSD. The implementation is based on github.com/lwhsu/freebsd-vboxfs. It's tested and worked as expected. The locking mechanism may need enhancements. Reviewed by: jkim (vbox), mat (mentor) Approved by: jkim (vbox), mat (mentor) Sponsored by: Netzkommune GmbH Differential Revision: https://reviews.freebsd.org/D11602 Added: head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile (contents, props changed) head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk (contents, props changed) head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.8 (contents, props changed) head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.c (contents, props changed) head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_Makefile.kmk (contents, props changed) head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs.h (contents, props changed) head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__prov.c (contents, props changed) head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vfsops.c (contents, props changed) head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__vnops.c (contents, props changed) head/emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_memobj-r0drv-freebsd.c (contents, props changed) Deleted: head/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c Modified: head/emulators/virtualbox-ose-additions/Makefile head/emulators/virtualbox-ose-additions/pkg-plist head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk Modified: head/emulators/virtualbox-ose-additions/Makefile ============================================================================== --- head/emulators/virtualbox-ose-additions/Makefile Tue Jul 18 14:43:22 2017 (r446144) +++ head/emulators/virtualbox-ose-additions/Makefile Tue Jul 18 16:39:27 2017 (r446145) @@ -3,7 +3,7 @@ PORTNAME= virtualbox-ose PORTVERSION= 5.1.22 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= emulators MASTER_SITES= http://download.virtualbox.org/virtualbox/${PORTVERSION}/ PKGNAMESUFFIX?= -additions @@ -70,7 +70,8 @@ INPUTDIR= ${PREFIX}/lib/xorg/modules/input VBOX_BIN= ${WRKSRC}/out/${KMK_ARCH}/${KMK_BUILDTYPE}/bin/additions VBOX_SBINS= VBoxControl \ - VBoxService + VBoxService \ + mount_vboxvfs BUILD_WRKSRC= ${VBOX_BIN}/src @@ -125,9 +126,9 @@ EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-src-VBox-Additi .endif .endif -pre-everything:: .if ${ARCH} == "amd64" .if !exists(/usr/lib32/libc.so) +pre-everything:: @${ECHO} 'Requires 32-bit libraries installed under /usr/lib32.' @${ECHO} 'Do: cd /usr/src; make build32 install32; service ldconfig restart' @${FALSE} @@ -177,47 +178,41 @@ do-install: ${MKDIR} ${STAGEDIR}${KMODDIR} ${INSTALL_KLD} ${VBOX_BIN}/src/vboxguest/vboxguest.ko \ ${STAGEDIR}${KMODDIR} -.if ${PORT_OPTIONS:MDEBUG} - ${INSTALL_KLD} ${VBOX_BIN}/src/vboxguest/vboxguest.ko.symbols \ - ${STAGEDIR}${KMODDIR} -.endif - + ${INSTALL_KLD} ${VBOX_BIN}/vboxvfs.ko ${STAGEDIR}${KMODDIR} ${INSTALL_LIB} ${VBOX_BIN}/pam_vbox.so ${STAGEDIR}${PREFIX}/lib ${INSTALL_PROGRAM} ${VBOX_SBINS:S|^|${VBOX_BIN}/|} \ ${STAGEDIR}${PREFIX}/sbin/ -.if ${PORT_OPTIONS:MX11} +do-install-DEBUG-on: + ${INSTALL_KLD} ${VBOX_BIN}/src/vboxguest/vboxguest.ko.symbols \ + ${STAGEDIR}${KMODDIR} + +do-install-X11-on: ${INSTALL_PROGRAM} ${VBOX_BIN}/VBoxClient ${STAGEDIR}${PREFIX}/bin/ ${INSTALL_SCRIPT} \ ${WRKSRC}/src/VBox/Additions/x11/Installer/98vboxadd-xclient \ ${STAGEDIR}${PREFIX}/bin/VBoxClient-all - # X11 autostart ${MKDIR} ${STAGEDIR}${PREFIX}/etc/xdg/autostart/ ${INSTALL_DATA} \ ${WRKSRC}/src/VBox/Additions/x11/Installer/vboxclient.desktop \ ${STAGEDIR}${PREFIX}/etc/xdg/autostart/ - # KDE autostart ${MKDIR} ${STAGEDIR}${PREFIX}/share/autostart/ ${INSTALL_DATA} \ ${WRKSRC}/src/VBox/Additions/x11/Installer/vboxclient.desktop \ ${STAGEDIR}${PREFIX}/share/autostart/ - ${MKDIR} ${STAGEDIR}${VIDEODIR} ${INSTALL_DATA} ${VBOX_BIN}/vboxvideo_drv_$$(${XORG_DRV_ABI}).so \ ${STAGEDIR}${VIDEODIR}/vboxvideo_drv.so - ${MKDIR} ${STAGEDIR}${INPUTDIR} ${INSTALL_DATA} ${VBOX_BIN}/vboxmouse_drv_$$(${XORG_DRV_ABI}).so \ ${STAGEDIR}${INPUTDIR}/vboxmouse_drv.so -.endif -.if ${PORT_OPTIONS:MOPENGL} +do-install-OPENGL-on: ${INSTALL_DATA} ${FILESDIR}/vboxvideo.conf \ ${STAGEDIR}${PREFIX}/etc/libmap.d/ ${INSTALL_DATA} ${VBOX_LIBS:S|^|${VBOX_BIN}/|} \ ${STAGEDIR}${PREFIX}/lib/ -.endif .include Modified: head/emulators/virtualbox-ose-additions/pkg-plist ============================================================================== --- head/emulators/virtualbox-ose-additions/pkg-plist Tue Jul 18 14:43:22 2017 (r446144) +++ head/emulators/virtualbox-ose-additions/pkg-plist Tue Jul 18 16:39:27 2017 (r446145) @@ -15,6 +15,8 @@ lib/pam_vbox.so %%X11%%lib/xorg/modules/input/vboxmouse_drv.so sbin/VBoxControl sbin/VBoxService +sbin/mount_vboxvfs %%X11%%share/autostart/vboxclient.desktop /%%KMODDIR%%/vboxguest.ko +/%%KMODDIR%%/vboxvfs.ko %%DEBUG%%/%%KMODDIR%%/vboxguest.ko.symbols Added: head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile Tue Jul 18 16:39:27 2017 (r446145) @@ -0,0 +1,38 @@ +--- src/VBox/Additions/freebsd/Makefile.orig 2017-04-28 16:59:22.000000000 +0200 ++++ src/VBox/Additions/freebsd/Makefile 2017-07-13 00:04:11.766870597 +0200 +@@ -31,6 +31,14 @@ + cp vboxvfs/vboxvfs.ko .; \ + fi; \ + fi ++ @echo ++ @if [ -d mount_vboxvfs ]; then \ ++ echo "=== Building mount_vboxvfs binary ==="; \ ++ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C mount_vboxvfs clean obj depend all; \ ++ if [ -f mount_vboxvfs ]; then \ ++ cp mount_vboxvfs/mount_vboxvfs .; \ ++ fi; \ ++ fi + + + install: +@@ -38,13 +46,19 @@ + @if [ -d vboxvfs ]; then \ + $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvfs install; \ + fi ++ @if [ -d mount_vboxvfs ]; then \ ++ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C mount_vboxvfs install; \ ++ fi + + clean: + @$(MAKE) -C vboxguest clean + @if [ -d vboxvfs ]; then \ + $(MAKE) -C vboxvfs clean; \ + fi +- rm -f vboxguest.*o vboxvfs.*o ++ @if [ -d mount_vboxvfs ]; then \ ++ $(MAKE) -C mount_vboxvfs clean; \ ++ fi ++ rm -f vboxguest.*o vboxvfs.*o mount_vboxvfs + + load: + @/sbin/kldunload vboxvfs || true Modified: head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk ============================================================================== --- head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk Tue Jul 18 14:43:22 2017 (r446144) +++ head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk Tue Jul 18 16:39:27 2017 (r446145) @@ -1,11 +1,13 @@ --- src/VBox/Additions/freebsd/Makefile.kmk.orig 2016-07-18 11:50:44 UTC +++ src/VBox/Additions/freebsd/Makefile.kmk -@@ -24,7 +24,7 @@ endif +@@ -24,7 +24,8 @@ endif # Include sub-makefiles. - #include $(PATH_SUB_CURRENT)/vboxvfs/Makefile.kmk +-#include $(PATH_SUB_CURRENT)/vboxvfs/Makefile.kmk -include $(PATH_SUB_CURRENT)/drm/Makefile.kmk ++include $(PATH_SUB_CURRENT)/vboxvfs/Makefile.kmk +#include $(PATH_SUB_CURRENT)/drm/Makefile.kmk ++include $(PATH_SUB_CURRENT)/mount_vboxvfs/Makefile.kmk # # Globals @@ -17,13 +19,16 @@ VBoxOGLarrayspu.so \ VBoxOGLcrutil.so \ VBoxOGLerrorspu.so \ -@@ -76,8 +77,7 @@ VBOX_FBSD_ADD_STRIP_BIN = \ - VBoxOGL.so +@@ -76,8 +76,9 @@ VBOX_FBSD_ADD_STRIP_BIN = \ +- VBoxOGL.so ++ VBoxOGL.so \ ++ mount_vboxvfs VBOX_FBSD_ADD_MODULES = \ - vboxguest \ - vboxvideo_drm -+ vboxguest ++ vboxguest \ ++ vboxvfs # # All the bin files that go into the archives. Added: head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_Makefile.kmk Tue Jul 18 16:39:27 2017 (r446145) @@ -0,0 +1,27 @@ +--- src/VBox/Additions/freebsd/mount_vboxvfs/Makefile.kmk.orig 1970-01-01 01:00:00.000000000 +0100 ++++ src/VBox/Additions/freebsd/mount_vboxvfs/Makefile.kmk 2017-07-13 00:17:45.342815229 +0200 +@@ -0,0 +1,24 @@ ++# $Id: Makefile.kmk $ ++## @file ++# Sub-Makefile for the FreeBSD Shared folder mount utility. ++# ++ ++SUB_DEPTH = ../../../../.. ++include $(KBUILD_PATH)/subheader.kmk ++ ++ifneq ($(KBUILD_HOST),freebsd) ++$(error "The FreeBSD guest additions can only be built on FreeBSD!") ++endif ++ ++FREEBSD_SRC= /usr/src ++MOUNT= ${FREEBSD_SRC}/sbin/mount ++ ++CFLAGS+=-I${MOUNT} ++ ++PROGRAMS += mount_vboxvfs ++mount_vboxvfs_TEMPLATE = NewVBoxGuestR3Exe ++mount_vboxvfs_SOURCES = ${MOUNT}/getmntopts.c \ ++ mount_vboxvfs.c ++ ++include $(FILE_KBUILD_SUB_FOOTER) ++ Added: head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.8 Tue Jul 18 16:39:27 2017 (r446145) @@ -0,0 +1,56 @@ +--- src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.8.orig 1970-01-01 01:00:00.000000000 +0100 ++++ src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.8 2017-07-12 19:24:26.106029000 +0200 +@@ -0,0 +1,53 @@ ++.\" ++.\" Copyright (c) 1992, 1993, 1994 ++.\" The Regents of the University of California. All rights reserved. ++.\" ++.\" Redistribution and use in source and binary forms, with or without ++.\" modification, are permitted provided that the following conditions ++.\" are met: ++.\" 1. Redistributions of source code must retain the above copyright ++.\" notice, this list of conditions and the following disclaimer. ++.\" 2. Redistributions in binary form must reproduce the above copyright ++.\" notice, this list of conditions and the following disclaimer in the ++.\" documentation and/or other materials provided with the distribution. ++.\" 4. Neither the name of the University nor the names of its contributors ++.\" may be used to endorse or promote products derived from this software ++.\" without specific prior written permission. ++.\" ++.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++.\" SUCH DAMAGE. ++.\" ++.Dd August 5, 2013 ++.Dt MOUNT_VBOXFS 8 ++.Os ++.Sh NAME ++.Nm mount_vboxfs ++.Nd "Mount the VirtualBox shared folder NAME from the host system to MOUNTPOINT" ++.Sh SYNOPSIS ++.Nm ++.Op Fl o Ar options ++.Ar NAME ++.Ar MOUNTPOINT ++.Sh DESCRIPTION ++The ++.Nm ++Mount the VirtualBox shared folder NAME from the host system to MOUNTPOINT ++.Pp ++The options are as follows: ++.Bl -tag -width indent ++.Fl w ++mount the shared folder writably (the default) ++.Fl r ++mount the shared folder read-only ++.Fl o ++OPTION[,OPTION...] use the mount options specified ++.El Added: head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_mount__vboxvfs_mount__vboxvfs.c Tue Jul 18 16:39:27 2017 (r446145) @@ -0,0 +1,171 @@ +--- src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.c.orig 1970-01-01 01:00:00.000000000 +0100 ++++ src/VBox/Additions/freebsd/mount_vboxvfs/mount_vboxvfs.c 2017-07-12 19:24:26.106029000 +0200 +@@ -0,0 +1,168 @@ ++/* ++* Copyright (c) 1992, 1993, 1994 ++* The Regents of the University of California. All rights reserved. ++* ++* Redistribution and use in source and binary forms, with or without ++* modification, are permitted provided that the following conditions ++* are met: ++* 1. Redistributions of source code must retain the above copyright ++* notice, this list of conditions and the following disclaimer. ++* 2. Redistributions in binary form must reproduce the above copyright ++* notice, this list of conditions and the following disclaimer in the ++* documentation and/or other materials provided with the distribution. ++* 4. Neither the name of the University nor the names of its contributors ++* may be used to endorse or promote products derived from this software ++* without specific prior written permission. ++* ++* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++* 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 "mntopts.h" ++ ++#define MAX_HOST_NAME 256 ++static char mount_point[MAXPATHLEN + 1]; ++static char vboxfs_vfsname[] = "vboxvfs"; ++static struct mntopt mopts[] = { ++ MOPT_STDOPTS, ++ MOPT_END ++}; ++ ++static void usage(void) __dead2; ++ ++static void ++usage(void) ++{ ++ fprintf(stderr, ++ "Usage: [OPTIONS] NAME MOUNTPOINT\n" ++ "Mount the VirtualBox shared folder NAME to MOUNTPOINT.\n" ++ "\nOptions:\n" ++ " -w mount the shared folder writable \n" ++ " -r mount the shared folder read-only (the default)\n"); ++ exit(1); ++} ++ ++int ++main(int argc, char *argv[]) ++{ ++ struct iovec *iov; ++ struct stat st; ++ char *host_name; ++ char errmsg[255]; ++ uid_t uid; ++ gid_t gid; ++ mode_t dir_mode, file_mode; ++ int iovlen; ++ int ronly = 0; ++ int error, ch; ++ int mntflags = 0; ++ ++ iov = NULL; ++ iovlen = 0; ++ errmsg[0] = '\0'; ++ uid = (uid_t)-1; ++ gid = (gid_t)-1; ++ file_mode = 0; ++ dir_mode = 0; ++ ++ while ((ch = getopt(argc, argv, "rwo:h")) != -1) ++ switch(ch) { ++ default: ++ fprintf(stderr, "unknown option `%c:%#x'\n", ch, ch); ++ return (1); ++ ++ case '?': ++ case 'h': ++ usage(); ++ case 'r': ++ ronly = 1; ++ break; ++ case 'w': ++ ronly = 0; ++ break; ++ case 'o': ++ getmntopts(optarg, mopts, &mntflags, 0); ++ break; ++ } ++ ++ if (argc - optind < 2) ++ usage(); ++ ++ host_name = argv[optind]; ++ realpath(argv[optind+1], mount_point); ++ ++ if (stat(mount_point, &st) == -1) ++ err(EX_OSERR, "could not find mount point %s", mount_point); ++ ++ if (!S_ISDIR(st.st_mode)) { ++ errno = ENOTDIR; ++ err(EX_OSERR, "can't mount on %s", mount_point); ++ } ++ ++ if (strlen(host_name) > MAX_HOST_NAME - 1) ++ err(EX_OSERR, "host name is too big %s", host_name); ++ ++ if (ronly == 0) ++ mntflags |= MNT_ASYNC; ++ if (uid == (uid_t)-1) ++ uid = st.st_uid; ++ if (gid == (gid_t)-1) ++ gid = st.st_gid; ++ if (file_mode == 0) ++ file_mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); ++ if (dir_mode == 0) { ++ dir_mode = file_mode; ++ if (dir_mode & S_IRUSR) ++ dir_mode |= S_IXUSR; ++ if (dir_mode & S_IRGRP) ++ dir_mode |= S_IXGRP; ++ if (dir_mode & S_IROTH) ++ dir_mode |= S_IXOTH; ++ } ++ ++ build_iovec(&iov, &iovlen, "fstype", vboxfs_vfsname, (size_t)-1); ++ build_iovec(&iov, &iovlen, "fspath", mount_point, (size_t)-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", "%o", file_mode); ++ build_iovec_argf(&iov, &iovlen, "dir_mode", "%o", dir_mode); ++ build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); ++ ++ error = nmount(iov, iovlen, mntflags); ++ if (error == -1) { ++ if (errmsg[0] != '\0') ++ err(1, "%s: error: %s", mount_point, errmsg); ++ else ++ err(1, "%s: error %d", mount_point, error); ++ } ++ ++ return (0); ++} Added: head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_Makefile.kmk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_Makefile.kmk Tue Jul 18 16:39:27 2017 (r446145) @@ -0,0 +1,49 @@ +--- src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk.orig 2017-04-28 16:59:22.000000000 +0200 ++++ src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk 2017-07-13 00:52:49.020669620 +0200 +@@ -33,32 +33,36 @@ + $(vboxvfs_0_OUTDIR) + vboxvfs_SOURCES = \ + vboxvfs_vfsops.c \ +- vboxvfs_vnops.c ++ vboxvfs_vnops.c \ ++ vboxvfs_prov.c + vboxvfs_LIBS = \ + $(VBOX_LIB_VBGL_R0) \ + $(VBOX_LIB_IPRT_GUEST_R0) + vboxvfs_DEPS = \ +- $$(vboxvfs_0_OUTDIR)/vnode_if.h \ +- $$(vboxvfs_0_OUTDIR)/vnode_if_newproto.h \ +- $$(vboxvfs_0_OUTDIR)/vnode_if_typedef.h ++ $(vboxvfs_0_OUTDIR)/vnode_if.h \ ++ $(vboxvfs_0_OUTDIR)/vnode_if_newproto.h \ ++ $(vboxvfs_0_OUTDIR)/vnode_if_typedef.h + vboxvfs_CLEAN += $(vboxvfs_DEPS) + + VBOX_AWK := /usr/bin/awk + +-$$(vboxvfs_0_OUTDIR)/vnode_if.h: $(VBOX_FREEBSD_SRC)/kern/vnode_if.src ++$$(vboxvfs_0_OUTDIR): ++ $(QUIET)$(MKDIR) -p $(vboxvfs_0_OUTDIR) ++ ++$$(vboxvfs_0_OUTDIR)/vnode_if.h: $$(vboxvfs_0_OUTDIR) $(VBOX_FREEBSD_SRC)/kern/vnode_if.src + $(call MSG_TOOL,awk,VBoxGuest,$<,$@) + $(QUIET)$(VBOX_AWK) -f $(VBOX_FREEBSD_SRC)/tools/vnode_if.awk $(VBOX_FREEBSD_SRC)/kern/vnode_if.src -h +- $(QUIET)$(MV) $(vboxvfs_0_OUTDIR)/vnode_if.h $(vboxvfs_0_OUTDIR)/vnode_if.h ++ $(QUIET)$(MV) vnode_if.h $(vboxvfs_0_OUTDIR)/vnode_if.h + +-$$(vboxvfs_0_OUTDIR)/vnode_if_newproto.h: $(VBOX_FREEBSD_SRC)/kern/vnode_if.src ++$$(vboxvfs_0_OUTDIR)/vnode_if_newproto.h: $$(vboxvfs_0_OUTDIR) $(VBOX_FREEBSD_SRC)/kern/vnode_if.src + $(call MSG_TOOL,awk,VBoxGuest,$<,$@) + $(QUIET)$(VBOX_AWK) -f $(VBOX_FREEBSD_SRC)/tools/vnode_if.awk $(VBOX_FREEBSD_SRC)/kern/vnode_if.src -p +- $(QUIET)$(MV) $(vboxvfs_0_OUTDIR)/vnode_if_newproto.h $(vboxvfs_0_OUTDIR)/vnode_if_newproto.h ++ $(QUIET)$(MV) vnode_if_newproto.h $(vboxvfs_0_OUTDIR)/vnode_if_newproto.h + +-$$(vboxvfs_0_OUTDIR)/vnode_if_typedef.h: $(VBOX_FREEBSD_SRC)/kern/vnode_if.src ++$$(vboxvfs_0_OUTDIR)/vnode_if_typedef.h: $$(vboxvfs_0_OUTDIR) $(VBOX_FREEBSD_SRC)/kern/vnode_if.src + $(call MSG_TOOL,awk,VBoxGuest,$<,$@) + $(QUIET)$(VBOX_AWK) -f $(VBOX_FREEBSD_SRC)/tools/vnode_if.awk $(VBOX_FREEBSD_SRC)/kern/vnode_if.src -q +- $(QUIET)$(MV) $(vboxvfs_0_OUTDIR)/vnode_if_typedef.h $(vboxvfs_0_OUTDIR)/vnode_if_typedef.h ++ $(QUIET)$(MV) vnode_if_typedef.h $(vboxvfs_0_OUTDIR)/vnode_if_typedef.h + + include $(FILE_KBUILD_SUB_FOOTER) + Added: head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs.h Tue Jul 18 16:39:27 2017 (r446145) @@ -0,0 +1,470 @@ +--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h.orig 2017-04-28 16:59:22.000000000 +0200 ++++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h 2017-07-13 01:05:04.399618524 +0200 +@@ -1,10 +1,5 @@ +-/* $Id: vboxvfs.h $ */ +-/** @file +- * Description. +- */ +- + /* + * Copyright (C) 2010-2016 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; +@@ -21,72 +16,418 @@ + #define VBOXVFS_VFSNAME "vboxvfs" + #define VBOXVFS_VERSION 1 + +-#define MAX_HOST_NAME 256 +-#define MAX_NLS_NAME 32 ++#define MAX_HOST_NAME 256 ++#define MAX_NLS_NAME 32 ++//#define MODEMASK 07777 /* mode bits plus permission bits */ ++/** Helper macros */ ++#define VFSTOVBOXFS(mp) ((struct vboxfs_mnt *)((mp)->mnt_data)) ++#define VP_TO_VBOXFS_NODE(vp) ((struct vboxfs_node *)(vp)->v_data) ++#define VBOXTOV(np) ((struct vnode *)(np)->n_vnode) ++ ++#define ROOTDIR_INO 1 ++#define THEFILE_INO 2 ++#define THEFILE_NAME "thefile" ++ ++#define VBOXFS_NODE_LOCK(node) mtx_lock(&(node)->sf_interlock) ++#define VBOXFS_NODE_UNLOCK(node) mtx_unlock(&(node)->sf_interlock) ++#define VBOXFS_NODE_MTX(node) (&(node)->sf_interlock) ++#define VBOXFS_NODE_ASSERT_LOCKED(node) mtx_assert(VBOXFS_NODE_MTX(node), \ ++ MA_OWNED) ++ ++#ifdef INVARIANTS ++#define VBOXFS_ASSERT_LOCKED(node) do { \ ++ MPASS(node != NULL); \ ++ MPASS(node->sf_vnode != NULL); \ ++ if (!VOP_ISLOCKED(node->sf_vnode) && \ ++ !mtx_owned(VBOXFS_NODE_MTX(node))) \ ++ panic("vboxfs: node is not locked: %p", node); \ ++ } while (0) ++#define VBOXFS_ASSERT_ELOCKED(node) do { \ ++ MPASS((node) != NULL); \ ++ MPASS((node)->sf_vnode != NULL); \ ++ mtx_assert(VBOXFS_NODE_MTX(node), MA_OWNED); \ ++ ASSERT_VOP_LOCKED((node)->sf_vnode, "vboxfs"); \ ++ } while (0) ++#else ++#define VBOXFS_ASSERT_LOCKED(node) (void)0 ++#define VBOXFS_ASSERT_ELOCKED(node) (void)0 ++#endif + +-struct vboxvfs_mount_info { +- char name[MAX_HOST_NAME]; +- char nls_name[MAX_NLS_NAME]; +- int uid; +- int gid; +- int ttl; +-}; ++#define VBOXFS_VNODE_ALLOCATING 1 ++#define VBOXFS_VNODE_WANT 2 ++#define VBOXFS_VNODE_DOOMED 4 ++#define VBOXFS_VNODE_WRECLAIM 8 ++ ++MALLOC_DECLARE(M_VBOXVFS); + + #ifdef _KERNEL ++#ifndef FREEBSD_STYLE ++#include "../../../../../include/iprt/nocrt/limits.h" ++#include "../../../../../include/iprt/alloc.h" ++#include "../../../../../include/iprt/asm.h" ++#include "../../../../../include/iprt/asm-amd64-x86.h" ++#include "../../../../../include/iprt/asm-math.h" ++#include "../../../../../include/iprt/assert.h" ++#include "../../../../../include/iprt/cdefs.h" ++#include "../../../../../include/iprt/err.h" ++#include "../../../../../include/iprt/fs.h" ++#include "../../../../../include/iprt/log.h" ++#include "../../../../../include/iprt/mangling.h" ++#include "../../../../../include/iprt/mem.h" ++#include "../../../../../include/iprt/param.h" ++#include "../../../../../include/iprt/path.h" ++#include "../../../../../include/iprt/semaphore.h" ++#include "../../../../../include/iprt/stdarg.h" ++#include "../../../../../include/iprt/stdint.h" ++#include "../../../../../include/iprt/string.h" ++#include "../../../../../include/iprt/time.h" ++#include "../../../../../include/iprt/types.h" ++#include "../../../../../include/iprt/uni.h" ++#include "../../../../../include/iprt/nocrt/limits.h" ++#include "../../../../../include/iprt/alloc.h" ++#include "../../../../../include/iprt/asm.h" ++#include "../../../../../include/iprt/asm-amd64-x86.h" ++#include "../../../../../include/iprt/asm-math.h" ++#include "../../../../../include/iprt/assert.h" ++#include "../../../../../include/iprt/cdefs.h" ++#include "../../../../../include/iprt/err.h" ++#include "../../../../../include/iprt/fs.h" ++#include "../../../../../include/iprt/log.h" ++#include "../../../../../include/iprt/mangling.h" ++#include "../../../../../include/iprt/mem.h" ++#include "../../../../../include/iprt/param.h" ++#include "../../../../../include/iprt/path.h" ++#include "../../../../../include/iprt/semaphore.h" ++#include "../../../../../include/iprt/stdarg.h" ++#include "../../../../../include/iprt/stdint.h" ++#include "../../../../../include/iprt/string.h" ++#include "../../../../../include/iprt/time.h" ++#include "../../../../../include/iprt/types.h" ++#include "../../../../../include/iprt/uni.h" ++ ++#include "../../common/VBoxGuestLib/SysHlp.h" ++ ++#else ++ ++#include "iprt/nocrt/limits.h" ++#include "iprt/alloc.h" ++#include "iprt/asm.h" ++#include "iprt/asm-amd64-x86.h" ++#include "iprt/asm-math.h" ++#include "iprt/assert.h" ++#include "iprt/cdefs.h" ++#include "iprt/err.h" ++#include "iprt/fs.h" ++#include "iprt/log.h" ++#include "iprt/mem.h" ++#include "iprt/param.h" ++#include "iprt/path.h" ++#include "iprt/semaphore.h" ++#include "iprt/stdarg.h" ++#include "iprt/stdint.h" ++#include "iprt/string.h" ++#include "iprt/time.h" ++#include "iprt/types.h" ++#include "iprt/uni.h" ++#include "iprt/nocrt/limits.h" ++#include "iprt/alloc.h" ++#include "iprt/asm.h" ++#include "iprt/asm-amd64-x86.h" ++#include "iprt/asm-math.h" ++#include "iprt/assert.h" ++#include "iprt/cdefs.h" ++#include "iprt/err.h" ++#include "iprt/fs.h" ++#include "iprt/log.h" ++#include "iprt/mem.h" ++#include "iprt/param.h" ++#include "iprt/path.h" ++#include "iprt/semaphore.h" ++#include "iprt/stdarg.h" ++#include "iprt/stdint.h" ++#include "iprt/string.h" ++#include "iprt/time.h" ++#include "iprt/types.h" ++#include "iprt/uni.h" ++ ++#include "common/VBoxGuestLib/SysHlp.h" ++ ++#endif /* !FREEBSD_STYLE */ + +-#include + #include + #include ++#include ++ ++#if defined(RT_OS_FREEBSD) && defined(_KERNEL) ++# undef PVM /** XXX: For not conflict with PVM in sys/priority.h */ ++#endif ++#include ++ ++#define VBOXVFS_DEBUG(lvl, ...) do { \ ++ if (vboxvfs_debug >= (lvl)) { \ ++ printf("VBOXVFS[%u]: ", lvl); \ ++ printf(__VA_ARGS__); \ ++ printf("\n"); \ ++ } \ ++} while (0) ++ ++/* ++ * representation of an active mount point ++ */ ++struct sfp_mount { ++ VBGLSFMAP map; ++}; ++ ++/* ++ * Mount / Unmount a shared folder. ++ * ++ * sfprov_mount() takes as input the connection pointer and the name of ++ * the shared folder. On success, it returns zero and supplies an ++ * sfp_mount_t handle. On failure it returns any relevant errno value. ++ * ++ * sfprov_unmount() unmounts the mounted file system. It returns 0 on ++ * success and any relevant errno on failure. ++ */ ++typedef struct sfp_mount sfp_mount_t; ++ ++struct sfp_file { ++ SHFLHANDLE handle; ++ VBGLSFMAP map; /* need this again for the close operation */ ++}; ++ ++typedef struct sfp_file sfp_file_t; ++ ++/* ++ * File operations: open/close/read/write/etc. ++ * ++ * open/create can return any relevant errno, however ENOENT ++ * generally means that the host file didn't exist. ++ */ ++typedef struct sffs_stat { ++ mode_t sf_mode; ++ off_t sf_size; ++ off_t sf_alloc; ++ struct timespec sf_atime; ++ struct timespec sf_mtime; ++ struct timespec sf_ctime; ++} sffs_stat_t; ++ ++/* ++ * Read directory entries. ++ */ ++/* ++ * a singly linked list of buffers, each containing an array of stat's+dirent's. ++ * sf_len is length of the sf_entries array, in bytes. ++ */ ++typedef struct sffs_dirents { ++ struct sffs_dirents *sf_next; ++ long long sf_len; ++ struct sffs_dirent { ++ sffs_stat_t sf_stat; ++ struct dirent sf_entry; /* this is variable length */ ++ off_t sf_off; ++ } sf_entries[1]; ++} sffs_dirents_t; ++ ++/* ++ * Shared Folders filesystem per-mount data structure. ++ */ ++struct vboxfs_mnt { ++ struct mount *sf_vfsp; /* filesystem's vfs struct */ ++ sfp_mount_t *sf_handle; /* guest-host communication handle */ ++ uid_t sf_uid; /* owner of all shared folders */ ++ gid_t sf_gid; /* group of all shared folders */ ++ mode_t sf_dmode; /* mode of all directories */ ++ mode_t sf_fmode; /* mode of all files */ ++ mode_t sf_dmask; /* mask of all directories */ ++ mode_t sf_fmask; /* mask of all files */ ++ int sf_stat_ttl; /* ttl for stat caches (in ms) */ ++ int sf_fsync; /* whether to honor fsync or not */ ++ uint64_t sf_ino; /* per FS ino generator */ ++ uma_zone_t sf_node_pool; ++ struct vboxfs_node *sf_root; ++}; ++ ++/* ++ * vboxfs_node is the file system dependent vnode data for vboxfs. ++ * vboxfs_node's also track all files ever accessed, both open and closed. ++ * It duplicates some of the information in vnode, since it holds ++ * information for files that may have been completely closed. ++ * ++ */ ++struct vboxfs_node { ++ struct vboxfs_mnt *vboxfsmp; /* containing mounted file system */ ++ char *sf_path; /* full pathname to file or dir */ ++ uint64_t sf_ino; /* assigned unique ID number */ ++ struct vnode *sf_vnode; /* vnode if active */ ++ sfp_file_t *sf_file; /* non NULL if open */ ++ struct vboxfs_node *sf_parent; /* parent sfnode of this one */ ++ uint16_t sf_children; /* number of children sfnodes */ ++ uint8_t sf_type; /* VDIR or VREG */ ++ uint8_t sf_vpstate; /* XXX: ADD COMMENT */ ++ uint8_t sf_is_stale; /* this is stale and should be purged */ ++ sffs_stat_t sf_stat; /* cached file attrs for this node */ ++ uint64_t sf_stat_time; /* last-modified time of sf_stat */ ++ sffs_dirents_t *sf_dir_list; /* list of entries for this directory */ + +-struct vboxvfsmount { +- uid_t uid; +- gid_t gid; +- mode_t file_mode; +- mode_t dir_mode; +- struct mount *mp; +- struct ucred *owner; +- u_int flags; +- long nextino; +- int caseopt; +- int didrele; ++ /* interlock to protect sf_vpstate */ ++ struct mtx sf_interlock; ++}; ++ ++struct vboxfs_mount_info { ++ char name[MAX_HOST_NAME]; /* share name */ ++ char nls_name[MAX_NLS_NAME];/* name of an I/O charset */ ++ int uid; /* user ID for all entries, default 0=root */ ++ int gid; /* group ID for all entries, default 0=root */ ++ int ttl; /* time to live */ ++ int dmode; /* mode for directories if != 0xffffffff */ ++ int fmode; /* mode for regular files if != 0xffffffff */ ++ int dmask; /* umask applied to directories */ ++ int fmask; /* umask applied to regular files */ + }; + +-/* structs - stolen from the linux shared module code */ + struct sf_glob_info { +- VBGLSFMAP map; +-/* struct nls_table *nls;*/ +- int ttl; +- int uid; +- int gid; +- struct vnode *vnode_root; ++ VBGLSFMAP map; ++/* struct nls_table *nls;*/ ++ int ttl; ++ int uid; ++ int gid; ++ struct vnode *vnode_root; + }; + ++/** Per-file system mount instance data. */ ++typedef struct vboxfs_globinfo ++{ ++ VBGLSFMAP Map; ++ int Ttl; ++ int Uid; ++ int Gid; ++ struct mount *pVFS; ++ struct vboxfs_node *pVNodeRoot; ++} vboxfs_globinfo_t; ++ + struct sf_inode_info { +- SHFLSTRING *path; +- int force_restat; ++ SHFLSTRING *path; ++ int force_restat; + }; + + #if 0 + struct sf_dir_info { +- struct list_head info_list; ++ struct list_head info_list; + }; + #endif + + struct sf_dir_buf { +- size_t nb_entries; +- size_t free_bytes; +- size_t used_bytes; +- void *buf; ++ size_t nb_entries; ++ size_t free_bytes; ++ size_t used_bytes; ++ void *buf; + #if 0 +- struct list_head head; ++ struct list_head head; + #endif + }; + + struct sf_reg_info { +- SHFLHANDLE handle; ++ SHFLHANDLE handle; + }; + ++int vboxfs_alloc_vp(struct mount *, struct vboxfs_node *, int, ++ struct vnode **); ++void vboxfs_free_vp(struct vnode *); ++ ++int vboxfs_alloc_node(struct mount *, struct vboxfs_mnt *, const char*, ++ enum vtype, uid_t, gid_t, mode_t, struct vboxfs_node *, ++ struct vboxfs_node **); ++void vboxfs_free_node(struct vboxfs_mnt *, struct vboxfs_node *); ++ ++/* ++ * These are the provider interfaces used by sffs to access the underlying ++ * shared file system. ++ */ ++#define SFPROV_VERSION 1 ++ ++/* ++ * Initialization and termination. ++ * sfprov_connect() is called once before any other interfaces and returns ++ * a handle used in further calls. The argument should be SFPROV_VERSION ++ * from above. On failure it returns a NULL pointer. ++ * ++ * sfprov_disconnect() must only be called after all sf file systems have been ++ * unmounted. ++ */ ++typedef struct sfp_connection sfp_connection_t; ++ ++extern sfp_connection_t *sfprov_connect(int); ++extern void sfprov_disconnect(void); ++ ++extern int sfprov_mount(char *, sfp_mount_t **); ++extern int sfprov_unmount(sfp_mount_t *); ++ ++/* ++ * query information about a mounted file system ++ */ ++typedef struct sffs_fsinfo { ++ uint64_t blksize; ++ uint64_t blksused; ++ uint64_t blksavail; ++ uint32_t maxnamesize; ++ uint32_t readonly; ++ uint32_t serial; ++} sffs_fsinfo_t; ++ ++extern int sfprov_get_fsinfo(sfp_mount_t *, sffs_fsinfo_t *); ++ ++extern int sfprov_create(sfp_mount_t *, char *path, mode_t mode, ++ sfp_file_t **fp, sffs_stat_t *stat); ++extern int sfprov_open(sfp_mount_t *, char *path, sfp_file_t **fp); ++extern int sfprov_close(sfp_file_t *fp); ++extern int sfprov_read(sfp_file_t *, char * buffer, uint64_t offset, ++ uint32_t *numbytes, int buflocked); ++extern int sfprov_write(sfp_file_t *, char * buffer, uint64_t offset, ++ uint32_t *numbytes, int buflocked); ++extern int sfprov_fsync(sfp_file_t *fp); ++ ++ ++/* ++ * get/set information about a file (or directory) using pathname ++ */ ++extern int sfprov_get_mode(sfp_mount_t *, char *, mode_t *); ++extern int sfprov_get_size(sfp_mount_t *, char *, uint64_t *); ++extern int sfprov_get_atime(sfp_mount_t *, char *, struct timespec *); ++extern int sfprov_get_mtime(sfp_mount_t *, char *, struct timespec *); ++extern int sfprov_get_ctime(sfp_mount_t *, char *, struct timespec *); ++extern int sfprov_get_attr(sfp_mount_t *, char *, sffs_stat_t *); ++extern int sfprov_set_attr(sfp_mount_t *, char *, mode_t, ++ struct timespec, struct timespec, struct timespec); ++extern int sfprov_set_size(sfp_mount_t *, char *, uint64_t); ++ ++ ++/* ++ * File/Directory operations ++ */ ++extern int sfprov_trunc(sfp_mount_t *, char *); ++extern int sfprov_remove(sfp_mount_t *, char *path, u_int is_link); ++extern int sfprov_mkdir(sfp_mount_t *, char *path, mode_t mode, ++ sfp_file_t **fp, sffs_stat_t *stat); ++extern int sfprov_rmdir(sfp_mount_t *, char *path); ++extern int sfprov_rename(sfp_mount_t *, char *from, char *to, u_int is_dir); ++ ++ ++/* ++ * Symbolic link operations ++ */ ++extern int sfprov_set_show_symlinks(void); ++extern int sfprov_readlink(sfp_mount_t *, char *path, char *target, ++ size_t tgt_size); ++extern int sfprov_symlink(sfp_mount_t *, char *linkname, char *target, ++ sffs_stat_t *stat); ++ ++#define SFFS_DIRENTS_SIZE 8192 ++#define SFFS_DIRENTS_OFF (offsetof(sffs_dirents_t, sf_entries[0])) ++ ++extern int sfprov_readdir(sfp_mount_t *mnt, char *path, ++ sffs_dirents_t **dirents); ++ + #endif /* KERNEL */ + + #endif /* !___VBOXVFS_H___ */ +- Added: head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__prov.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_vboxvfs_vboxvfs__prov.c Tue Jul 18 16:39:27 2017 (r446145) @@ -0,0 +1,1024 @@ +--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_prov.c.orig 1970-01-01 01:00:00.000000000 +0100 ++++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_prov.c 2017-07-12 19:24:26.109029000 +0200 +@@ -0,0 +1,1021 @@ ++/* ++ * Copyright (C) 2008-2016 Oracle Corporation ++ * ++ * This file is part of VirtualBox Open Source Edition (OSE), as ++ * available from http://www.virtualbox.org. This file is free software; ++ * you can redistribute it and/or modify it under the terms of the GNU ++ * General Public License (GPL) as published by the Free Software ++ * Foundation, in version 2 as it comes in the "COPYING" file of the ++ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the ++ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. ++ * ++ * The contents of this file may alternatively be used under the terms ++ * of the Common Development and Distribution License Version 1.0 ++ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the ++ * VirtualBox OSE distribution, in which case the provisions of the ++ * CDDL are applicable instead of those of the GPL. ++ * ++ * You may elect to license modified versions of this file under the ++ * terms and conditions of either the GPL or the CDDL or both. ++ */ ++ ++/* ++ * Provider interfaces for shared folder file system. ++ */ ++ ++#include ++#include ++#include ++#include *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***