diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/solaris | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/solaris')
21 files changed, 152 insertions, 143 deletions
diff --git a/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c b/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c index 344c44bb..9ec00b8a 100644 --- a/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c +++ b/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/Installer/makepackage.sh b/src/VBox/Additions/solaris/Installer/makepackage.sh index 4080e644..0fe9aeb0 100755 --- a/src/VBox/Additions/solaris/Installer/makepackage.sh +++ b/src/VBox/Additions/solaris/Installer/makepackage.sh @@ -2,7 +2,7 @@ # # VirtualBox Solaris Guest Additions package creation script. # -# Copyright (C) 2008-2010 Oracle Corporation +# Copyright (C) 2008-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/Installer/postinstall.sh b/src/VBox/Additions/solaris/Installer/postinstall.sh index 85049175..9ddd152e 100755 --- a/src/VBox/Additions/solaris/Installer/postinstall.sh +++ b/src/VBox/Additions/solaris/Installer/postinstall.sh @@ -1,8 +1,11 @@ #!/bin/sh +# $Id: postinstall.sh $ +## @file +# VirtualBox postinstall script for Solaris Guest Additions. # -# VirtualBox postinstall script for Solaris. + # -# Copyright (C) 2008-2010 Oracle Corporation +# Copyright (C) 2008-2013 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -48,26 +51,12 @@ uncompress_file() uncompress -f "$1/$2.Z" > /dev/null 2>&1 } +# uncompress_files(directory_with_*.Z_files) uncompress_files() { - # VBox guest files - uncompress_file "$1" "VBoxClient" - uncompress_file "$1" "VBoxService" - uncompress_file "$1" "VBoxControl" - - # VBox Xorg Video drivers - uncompress_file "$1" "vboxvideo_drv_13.so" - uncompress_file "$1" "vboxvideo_drv_14.so" - uncompress_file "$1" "vboxvideo_drv_15.so" - uncompress_file "$1" "vboxvideo_drv_16.so" - uncompress_file "$1" "vboxvideo_drv_17.so" - uncompress_file "$1" "vboxvideo_drv_18.so" - uncompress_file "$1" "vboxvideo_drv_19.so" - uncompress_file "$1" "vboxvideo_drv_110.so" - uncompress_file "$1" "vboxvideo_drv_111.so" - uncompress_file "$1" "vboxvideo_drv_112.so" - uncompress_file "$1" "vboxvideo_drv_70.so" - uncompress_file "$1" "vboxvideo_drv_71.so" + for i in "${1}/"*.Z; do + uncompress_file "${1}" "`basename \"${i}\" .Z`" + done } solaris64dir="amd64" @@ -143,43 +132,20 @@ if test ! -z "$xorgbin"; then xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X.Org X Server \([^ ]*\)'` fi - vboxvideo_src="" + # "X.Y.Z" - strip off all numerics after the 2nd '.' character, e.g. "1.11.3" -> "1.11" + # Then the next sed, strips of all '.' characters, "1.11" -> "111". + fileversion=`echo $xorgversion | sed "s/\.[0-9]*//2" | sed "s/\.//"` + vboxvideo_src="vboxvideo_drv_$fileversion.so" + # Handle exceptions now where the X.org version does not exactly match the file-version. case "$xorgversion" in - 1.3.* ) - vboxvideo_src="vboxvideo_drv_13.so" - ;; - 1.4.* ) - vboxvideo_src="vboxvideo_drv_14.so" - ;; - 1.5.99 | 1.6.* ) + 1.5.99 ) vboxvideo_src="vboxvideo_drv_16.so" ;; - 1.5.* ) - vboxvideo_src="vboxvideo_drv_15.so" - ;; - 1.7.*) - vboxvideo_src="vboxvideo_drv_17.so" - ;; - 1.8.*) - vboxvideo_src="vboxvideo_drv_18.so" - ;; - 1.9.*) - vboxvideo_src="vboxvideo_drv_19.so" - ;; - 1.10.*) - vboxvideo_src="vboxvideo_drv_110.so" - ;; - 1.11.*) - vboxvideo_src="vboxvideo_drv_111.so" - ;; - 1.12.*) - vboxvideo_src="vboxvideo_drv_112.so" - ;; - 7.1.* | *7.2.* ) + 7.2.* ) vboxvideo_src="vboxvideo_drv_71.so" ;; - 6.9.* | 7.0.* ) + 6.9.* ) vboxvideo_src="vboxvideo_drv_70.so" ;; esac @@ -191,6 +157,12 @@ if test ! -z "$xorgbin"; then # Exit as partially failed installation retval=2 + elif test ! -f "$vboxadditions32_path/$vboxvideo_src" && test ! -f "$vboxadditions64_path/$vboxvideo_src"; then + echo "*** $vboxadditions32_path/$vboxvideo_src or $vboxadditions64_path/$vboxvideo_src not found!" + echo "*** Failed to install the VirtualBox X.org drivers." + + # Exit as partially failed installation + retval=2 else echo "Installing video driver for X.Org $xorgversion..." @@ -378,9 +350,8 @@ if test "$currentzone" = "global"; then # take a while to complete, using disable/enable -s doesn't work either. So we restart it, and poll in # 1 second intervals to see if our service has been successfully imported and timeout after 'cmax' seconds. /usr/sbin/svcadm restart svc:system/manifest-import:default - ## @todo why do we redirect to /dev/null and then save the output? - is_import=`/usr/bin/svcs virtualbox/vboxservice >/dev/null 2>&1 && /usr/bin/svcs virtualbox/vboxmslnk >/dev/null 2>&1` - while test $? -ne 0; + /usr/bin/svcs virtualbox/vboxservice virtualbox/vboxmslnk >/dev/null 2>&1 + while test "$?" -ne 0; do sleep 1 cslept=`expr $cslept + 1` @@ -388,7 +359,7 @@ if test "$currentzone" = "global"; then success=1 break fi - is_import=`/usr/bin/svcs virtualbox/vboxservice >/dev/null 2>&1 && /usr/bin/svcs virtualbox/vboxmslnk >/dev/null 2>&1` + /usr/bin/svcs virtualbox/vboxservice virtualbox/vboxmslnk >/dev/null 2>&1 done if test "$success" -eq 0; then echo "Enabling services..." diff --git a/src/VBox/Additions/solaris/Installer/preremove.sh b/src/VBox/Additions/solaris/Installer/preremove.sh index 688df266..b8bc54f7 100755 --- a/src/VBox/Additions/solaris/Installer/preremove.sh +++ b/src/VBox/Additions/solaris/Installer/preremove.sh @@ -1,8 +1,11 @@ #!/bin/sh +# $Id: preremove.sh $ +## @file +# VirtualBox preremove script for Solaris Guest Additions. # -# VirtualBox pre-remove script for Solaris Guest Additions. + # -# Copyright (C) 2008-2010 Oracle Corporation +# Copyright (C) 2008-2013 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/Installer/vboxguest.sh b/src/VBox/Additions/solaris/Installer/vboxguest.sh index bb0d0b9d..8c8781f7 100755 --- a/src/VBox/Additions/solaris/Installer/vboxguest.sh +++ b/src/VBox/Additions/solaris/Installer/vboxguest.sh @@ -2,7 +2,7 @@ # # VirtualBox Guest Additions kernel module control script for Solaris. # -# Copyright (C) 2008-2010 Oracle Corporation +# Copyright (C) 2008-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/Installer/vboxservice.xml b/src/VBox/Additions/solaris/Installer/vboxservice.xml index 1a2ebef6..61f896d5 100644 --- a/src/VBox/Additions/solaris/Installer/vboxservice.xml +++ b/src/VBox/Additions/solaris/Installer/vboxservice.xml @@ -3,7 +3,7 @@ # # Solaris SMF service manifest for VBoxService (timesync). # - Copyright (C) 2008-2010 Oracle Corporation + Copyright (C) 2008-2012 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/Makefile.kmk b/src/VBox/Additions/solaris/Makefile.kmk index e70d6110..eea2f304 100644 --- a/src/VBox/Additions/solaris/Makefile.kmk +++ b/src/VBox/Additions/solaris/Makefile.kmk @@ -195,6 +195,8 @@ SOLARIS_ADD_XORG_DRIVERS = \ vboxvideo_drv_110.so \ vboxvideo_drv_111.so \ vboxvideo_drv_112.so \ + vboxvideo_drv_113.so \ + vboxvideo_drv_114.so \ vboxvideo_drv_70.so \ vboxvideo_drv_71.so diff --git a/src/VBox/Additions/solaris/Mouse/testcase/tstVBoxMouse-solaris.c b/src/VBox/Additions/solaris/Mouse/testcase/tstVBoxMouse-solaris.c index 65f09be5..1f60a8db 100644 --- a/src/VBox/Additions/solaris/Mouse/testcase/tstVBoxMouse-solaris.c +++ b/src/VBox/Additions/solaris/Mouse/testcase/tstVBoxMouse-solaris.c @@ -22,7 +22,7 @@ * You may elect to license modified versions of this file under the * terms and conditions of either the GPL or the CDDL or both. */ - + /****************************************************************************** * Header Files * ******************************************************************************/ diff --git a/src/VBox/Additions/solaris/Mouse/vboxms.c b/src/VBox/Additions/solaris/Mouse/vboxms.c index 3547520d..0768e8b7 100644 --- a/src/VBox/Additions/solaris/Mouse/vboxms.c +++ b/src/VBox/Additions/solaris/Mouse/vboxms.c @@ -117,7 +117,7 @@ static struct qinit g_vbmsSolRInit = NULL /* module statistics structure */ }; -/* +/* * winit: write queue structure for handling messages coming from above. Above * means user space applications: either Guest Additions user space tools or * applications reading pointer input. Messages from the last most likely pass @@ -511,7 +511,7 @@ int vbmsSolOpen(queue_t *pReadQueue, dev_t *pDev, int fFlag, int fMode, /** - * Notification callback, called when the VBoxGuest mouse pointer is moved. + * Notification callback, called when the VBoxGuest mouse pointer is moved. * We send a VUID event up to user space. We may send a miscalculated event * if a resolution change is half-way through, but that is pretty much to be * expected, so we won't worry about it. @@ -1091,7 +1091,7 @@ static int vbmsSolDispatchIOCtl(PVBMSSTATE pState, mblk_t *pMBlk) case VUIOC: { unsigned i; - + for (i = 0; i < RT_ELEMENTS(g_aVUIDIOCtlDescriptions); ++i) if (g_aVUIDIOCtlDescriptions[i].iCmd == iCmd) { @@ -1248,9 +1248,9 @@ int vbmsSolHandleTransparentIOCtl(PVBMSSTATE pState, mblk_t *pMBlk, /* We only need state data if there is something to copy back. */ if (enmDirection == BOTH) pUserAddr = *(void **)pMBlk->b_cont->b_rptr; - mcopyin(pMBlk, pUserAddr /* state data */, cbCmd, NULL); - } - else if (enmDirection == OUT) + mcopyin(pMBlk, pUserAddr /* state data */, cbCmd, NULL); + } + else if (enmDirection == OUT) { mblk_t *pMBlkOut = allocb(cbCmd, BPRI_MED); void *pvData; @@ -1273,7 +1273,7 @@ int vbmsSolHandleTransparentIOCtl(PVBMSSTATE pState, mblk_t *pMBlk, } return err; } - + /** * Helper for vbmsSolHandleIOCtl. This rather complicated-looking * code is basically the standard boilerplate for handling any streams IOCtl. @@ -1287,7 +1287,7 @@ static int vbmsSolHandleIStrIOCtl(PVBMSSTATE pState, mblk_t *pMBlk, void *pvData = NULL; int err, rc = 0; size_t cbData = 0; - + LogFlowFunc(("iCmd=0x%x, cbBuffer=%u, b_cont=%p\n", (unsigned)iCmd, cbBuffer, (void *)pMBlk->b_cont)); if (cbBuffer && !pMBlk->b_cont) diff --git a/src/VBox/Additions/solaris/Mouse/vboxmslnk.c b/src/VBox/Additions/solaris/Mouse/vboxmslnk.c index f2f3a740..a1fdde87 100644 --- a/src/VBox/Additions/solaris/Mouse/vboxmslnk.c +++ b/src/VBox/Additions/solaris/Mouse/vboxmslnk.c @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) void handleArgs(int argc, char *argv[], int *pfNoLogo) { int fNoLogo = 0, fShowUsage = 0, fShowVersion = 0; - + if (argc != 1 && argc != 2) fShowUsage = 1; if (argc == 2) diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c b/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c index 1851ed6a..3e5356eb 100644 --- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c +++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c @@ -6,7 +6,7 @@ */ /* - * Copyright (C) 2009-2010 Oracle Corporation + * Copyright (C) 2009-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.c b/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.c index 766941ed..c19f264b 100644 --- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.c +++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2008-2010 Oracle Corporation + * Copyright (C) 2008-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -40,6 +40,7 @@ #include <sys/ddi.h> #include <sys/sunddi.h> #include <sys/dirent.h> +#include <sys/file.h> #include "vboxfs_prov.h" #ifdef u #undef u @@ -356,7 +357,7 @@ sfprov_create( } int -sfprov_open(sfp_mount_t *mnt, char *path, sfp_file_t **fp) +sfprov_diropen(sfp_mount_t *mnt, char *path, sfp_file_t **fp) { int rc; SHFLCREATEPARMS parms; @@ -364,40 +365,34 @@ sfprov_open(sfp_mount_t *mnt, char *path, sfp_file_t **fp) int size; sfp_file_t *newfp; - /* - * First we attempt to open it read/write. If that fails we - * try read only. - */ bzero(&parms, sizeof(parms)); str = sfprov_string(path, &size); parms.Handle = SHFL_HANDLE_NIL; parms.Info.cbObject = 0; - parms.CreateFlags = SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACCESS_READWRITE; + parms.CreateFlags = SHFL_CF_DIRECTORY + | SHFL_CF_ACCESS_READ + | SHFL_CF_ACT_OPEN_IF_EXISTS + | SHFL_CF_ACT_FAIL_IF_NEW; + + /* + * Open the host directory. + */ rc = vboxCallCreate(&vbox_client, &mnt->map, str, &parms); - if (RT_FAILURE(rc) && rc != VERR_ACCESS_DENIED) { + + /* + * Our VBoxFS interface here isn't very clear regarding failure and informational status. + * Check the file-handle as well as the return code to make sure the operation succeeded. + */ + if (RT_FAILURE(rc)) { kmem_free(str, size); return (sfprov_vbox2errno(rc)); } + if (parms.Handle == SHFL_HANDLE_NIL) { - if (parms.Result == SHFL_PATH_NOT_FOUND || - parms.Result == SHFL_FILE_NOT_FOUND) { - kmem_free(str, size); - return (ENOENT); - } - parms.CreateFlags = - SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACCESS_READ; - rc = vboxCallCreate(&vbox_client, &mnt->map, str, &parms); - if (RT_FAILURE(rc)) { - kmem_free(str, size); - return (sfprov_vbox2errno(rc)); - } - if (parms.Handle == SHFL_HANDLE_NIL) { - kmem_free(str, size); - return (ENOENT); - } - } - else kmem_free(str, size); + return (ENOENT); + } + newfp = kmem_alloc(sizeof(sfp_file_t), KM_SLEEP); newfp->handle = parms.Handle; newfp->map = mnt->map; @@ -406,28 +401,62 @@ sfprov_open(sfp_mount_t *mnt, char *path, sfp_file_t **fp) } int -sfprov_trunc(sfp_mount_t *mnt, char *path) +sfprov_open(sfp_mount_t *mnt, char *path, sfp_file_t **fp, int flag) { int rc; SHFLCREATEPARMS parms; SHFLSTRING *str; int size; + sfp_file_t *newfp; - /* - * open it read/write. - */ + bzero(&parms, sizeof(parms)); str = sfprov_string(path, &size); - parms.Handle = 0; + parms.Handle = SHFL_HANDLE_NIL; parms.Info.cbObject = 0; - parms.CreateFlags = SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACCESS_READWRITE | - SHFL_CF_ACT_OVERWRITE_IF_EXISTS; + + /* + * Translate file modes. + */ + if (flag & FCREAT) { + parms.CreateFlags |= SHFL_CF_ACT_CREATE_IF_NEW; + if (!(flag & FTRUNC)) + parms.CreateFlags |= SHFL_CF_ACT_OPEN_IF_EXISTS; + } + else + parms.CreateFlags |= SHFL_CF_ACT_FAIL_IF_NEW; + + if (flag & FTRUNC) + parms.CreateFlags |= SHFL_CF_ACT_OVERWRITE_IF_EXISTS | SHFL_CF_ACCESS_WRITE; + if (flag & FWRITE) + parms.CreateFlags |= SHFL_CF_ACCESS_WRITE; + if (flag & FREAD) + parms.CreateFlags |= SHFL_CF_ACCESS_READ; + if (flag & FAPPEND) + parms.CreateFlags |= SHFL_CF_ACCESS_APPEND; + + /* + * Open/create the host file. + */ rc = vboxCallCreate(&vbox_client, &mnt->map, str, &parms); - kmem_free(str, size); + /* + * Our VBoxFS interface here isn't very clear regarding failure and informational status. + * Check the file-handle as well as the return code to make sure the operation succeeded. + */ if (RT_FAILURE(rc)) { - return (EINVAL); + kmem_free(str, size); + return (sfprov_vbox2errno(rc)); + } + + if (parms.Handle == SHFL_HANDLE_NIL) { + kmem_free(str, size); + return (ENOENT); } - (void)vboxCallClose(&vbox_client, &mnt->map, parms.Handle); + + newfp = kmem_alloc(sizeof(sfp_file_t), KM_SLEEP); + newfp->handle = parms.Handle; + newfp->map = mnt->map; + *fp = newfp; return (0); } @@ -889,7 +918,8 @@ int sfprov_readdir( sfp_mount_t *mnt, char *path, - sffs_dirents_t **dirents) + sffs_dirents_t **dirents, + int flag) { int error; char *cp; @@ -910,7 +940,7 @@ sfprov_readdir( *dirents = NULL; - error = sfprov_open(mnt, path, &fp); + error = sfprov_diropen(mnt, path, &fp); if (error != 0) return (ENOENT); diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h b/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h index 40ce7c06..f7e97fb2 100644 --- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h +++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2009-2010 Oracle Corporation + * Copyright (C) 2009-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -100,7 +100,8 @@ typedef struct sfp_file sfp_file_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_diropen(sfp_mount_t *mnt, char *path, sfp_file_t **fp); +extern int sfprov_open(sfp_mount_t *, char *path, sfp_file_t **fp, int flag); extern int sfprov_close(sfp_file_t *fp); extern int sfprov_read(sfp_file_t *, char * buffer, uint64_t offset, uint32_t *numbytes); @@ -126,7 +127,6 @@ 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, uint_t is_link); extern int sfprov_mkdir(sfp_mount_t *, char *path, mode_t mode, sfp_file_t **fp, sffs_stat_t *stat); @@ -164,7 +164,7 @@ typedef struct sffs_dirents { #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); + sffs_dirents_t **dirents, int flag); #ifdef __cplusplus } diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.c b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.c index 6a06e5cd..09ed0dae 100644 --- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.c +++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2009-2010 Oracle Corporation + * Copyright (C) 2009-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.h b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.h index ab4d9cb4..8b6e6b0e 100644 --- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.h +++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2009-2010 Oracle Corporation + * Copyright (C) 2009-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c index 7acac060..c30dfb7d 100644 --- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c +++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2009-2010 Oracle Corporation + * Copyright (C) 2009-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -185,16 +185,21 @@ sfnode_clear_dir_list(sfnode_t *node) * same host file in the host in light of the possibility of host side renames. */ static void -sfnode_open(sfnode_t *node) +sfnode_open(sfnode_t *node, int flag) { int error; sfp_file_t *fp; if (node->sf_file != NULL) return; - error = sfprov_open(node->sf_sffs->sf_handle, node->sf_path, &fp); + error = sfprov_open(node->sf_sffs->sf_handle, node->sf_path, &fp, flag); if (error == 0) + { node->sf_file = fp; + node->sf_flag = flag; + } + else + node->sf_flag = ~0; } /* @@ -255,6 +260,7 @@ sfnode_make( node->sf_type = type; node->sf_is_stale = 0; /* never stale at creation */ node->sf_file = fp; + node->sf_flag = ~0; node->sf_vnode = NULL; /* do this before any sfnode_get_vnode() */ node->sf_children = 0; node->sf_parent = parent; @@ -698,7 +704,7 @@ sffs_readdir( cred_t *cred, int *eofp, caller_context_t *ct, - int flags) + int flag) { sfnode_t *dir = VN2SFN(vp); sfnode_t *node; @@ -733,7 +739,7 @@ sffs_readdir( if (dir->sf_dir_list == NULL) { error = sfprov_readdir(dir->sf_sffs->sf_handle, dir->sf_path, - &dir->sf_dir_list); + &dir->sf_dir_list, flag); if (error != 0) goto done; } @@ -1031,10 +1037,11 @@ sffs_read( return (0); mutex_enter(&sffs_lock); - sfnode_open(node); if (node->sf_file == NULL) { - mutex_exit(&sffs_lock); - return (EINVAL); + ASSERT(node->sf_flag != ~0); + sfnode_open(node, node->sf_flag); + if (node->sf_file == NULL) + return (EBADF); } do { @@ -1082,10 +1089,11 @@ sffs_write( * multiple FAPPEND writes from intermixing */ mutex_enter(&sffs_lock); - sfnode_open(node); if (node->sf_file == NULL) { - mutex_exit(&sffs_lock); - return (EINVAL); + ASSERT(node->sf_flag != ~0); + sfnode_open(node, node->sf_flag); + if (node->sf_file == NULL) + return (EBADF); } sfnode_invalidate_stat_cache(node); @@ -1304,16 +1312,11 @@ sffs_create( */ if (vp->v_type == VREG && (vap->va_mask & AT_SIZE) && vap->va_size == 0) { - sfnode_open(node); - if (node->sf_path == NULL) - error = ENOENT; - else - error = sfprov_trunc(node->sf_sffs->sf_handle, - node->sf_path); - if (error) { + sfnode_open(node, flag | FTRUNC); + if (node->sf_path == NULL) { mutex_exit(&sffs_lock); VN_RELE(vp); - return (error); + return (ENOENT); } } mutex_exit(&sffs_lock); @@ -2218,7 +2221,7 @@ sffs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct) } /* - * All the work for this is really done in lookup. + * All the work for this is really done in sffs_lookup(). */ /*ARGSUSED*/ static int @@ -2230,10 +2233,9 @@ sffs_open(vnode_t **vpp, int flag, cred_t *cr, caller_context_t *ct) mutex_enter(&sffs_lock); node = VN2SFN(*vpp); - sfnode_open(node); + sfnode_open(node, flag); if (node->sf_file == NULL) error = EINVAL; - mutex_exit(&sffs_lock); return (error); diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.h b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.h index f76795fe..70ab06af 100644 --- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.h +++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2009-2010 Oracle Corporation + * Copyright (C) 2009-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -52,6 +52,7 @@ typedef struct sfnode { uint64_t sf_ino; /* assigned unique ID number */ vnode_t *sf_vnode; /* vnode if active */ sfp_file_t *sf_file; /* non NULL if open */ + int sf_flag; /* last opened file-mode. */ struct sfnode *sf_parent; /* parent sfnode of this one */ uint16_t sf_children; /* number of children sfnodes */ uint8_t sf_type; /* VDIR or VREG */ diff --git a/src/VBox/Additions/solaris/Virtio/Virtio-solaris.c b/src/VBox/Additions/solaris/Virtio/Virtio-solaris.c index 77170670..04863b08 100644 --- a/src/VBox/Additions/solaris/Virtio/Virtio-solaris.c +++ b/src/VBox/Additions/solaris/Virtio/Virtio-solaris.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/Virtio/VirtioNet-solaris.c b/src/VBox/Additions/solaris/Virtio/VirtioNet-solaris.c index cd201abe..4511b49b 100644 --- a/src/VBox/Additions/solaris/Virtio/VirtioNet-solaris.c +++ b/src/VBox/Additions/solaris/Virtio/VirtioNet-solaris.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/Virtio/VirtioPci-solaris.c b/src/VBox/Additions/solaris/Virtio/VirtioPci-solaris.c index a34c951c..7eab19e1 100644 --- a/src/VBox/Additions/solaris/Virtio/VirtioPci-solaris.c +++ b/src/VBox/Additions/solaris/Virtio/VirtioPci-solaris.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/solaris/Virtio/VirtioRing-solaris.c b/src/VBox/Additions/solaris/Virtio/VirtioRing-solaris.c index 4a9f8acb..51d9f6a8 100644 --- a/src/VBox/Additions/solaris/Virtio/VirtioRing-solaris.c +++ b/src/VBox/Additions/solaris/Virtio/VirtioRing-solaris.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; |