Index: trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibSharedFolders.c
===================================================================
--- trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibSharedFolders.c	(revision 77049)
+++ trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibSharedFolders.c	(revision 77054)
@@ -66,8 +66,4 @@
 
 
-/** @todo We only need HGCM, not physical memory, so other guests should also
- *        switch to calling vbglR0HGCMInit() and vbglR0HGCMTerminate() instead
- *        of VbglR0SfInit() and VbglR0SfTerm(). */
-#ifndef RT_OS_LINUX
 DECLVBGL(int) VbglR0SfInit(void)
 {
@@ -79,5 +75,4 @@
     VbglR0TerminateClient();
 }
-#endif
 
 DECLVBGL(int) VbglR0SfConnect(PVBGLSFCLIENT pClient)
Index: trunk/src/VBox/Additions/linux/sharedfolders/Makefile.module
===================================================================
--- trunk/src/VBox/Additions/linux/sharedfolders/Makefile.module	(revision 77049)
+++ trunk/src/VBox/Additions/linux/sharedfolders/Makefile.module	(revision 77054)
@@ -29,7 +29,10 @@
 	regops.o \
 	utils.o \
+	VBoxGuestR0LibGenericRequest.o \
 	VBoxGuestR0LibHGCM.o \
 	VBoxGuestR0LibIdc.o \
 	VBoxGuestR0LibIdc-unix.o \
+	VBoxGuestR0LibInit.o \
+	VBoxGuestR0LibPhysHeap.o \
 	VBoxGuestR0LibSharedFolders.o
 ifeq ($(BUILD_TARGET_ARCH),x86)
@@ -62,4 +65,7 @@
  MOD_DEFS += -DRT_ARCH_X86
 endif
+ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+ MOD_DEFS += -DVBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+endif
 
 ifeq ($(KERN_VERSION), 24)
@@ -86,4 +92,7 @@
  endif
 endif
+ifdef VBOX_NO_OMIT_FRAME_POINTER
+ MOD_CFLAGS += -fno-omit-frame-pointer
+endif
 
 MOD_CLEAN = . linux r0drv r0drv/linux
Index: trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
===================================================================
--- trunk/src/VBox/Additions/linux/sharedfolders/dirops.c	(revision 77049)
+++ trunk/src/VBox/Additions/linux/sharedfolders/dirops.c	(revision 77054)
@@ -32,4 +32,97 @@
 #include <iprt/err.h>
 
+/** Reads or re-reads a directory.
+ *
+ * @note As suggested a couple of other places, we should probably stop
+ *       reading in the whole directory on open.
+ */
+static int sf_dir_open_worker(struct sf_glob_info *sf_g, struct sf_dir_info *sf_d,
+			      struct sf_inode_info *sf_i, const char *pszCaller)
+{
+    int rc;
+    int err;
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+    SHFLCREATEPARMS CreateParms;
+    SHFLCREATEPARMS *pCreateParms = &CreateParms;
+#else
+    union SfDirOpenCloseReq
+    {
+	VBOXSFCREATEREQ Create;
+	VBOXSFCLOSEREQ  Close;
+    } *pReq;
+    SHFLCREATEPARMS *pCreateParms;
+#endif
+
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+    pReq = (union SfDirOpenCloseReq *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String)
+							  + sf_i->path->u16Size);
+    if (pReq) {
+	    memcpy(&pReq->Create.StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size);
+	    pCreateParms = &pReq->Create.CreateParms;
+    } else {
+	    LogRelMaxFunc(64, ("failed to allocate %zu bytes for '%s' [caller: %s]\n",
+			       RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String) + sf_i->path->u16Size,
+			       sf_i->path->String.ach, pszCaller));
+	    return -ENOMEM;
+    }
+#endif
+
+    RT_ZERO(*pCreateParms);
+    pCreateParms->Handle = SHFL_HANDLE_NIL;
+    pCreateParms->CreateFlags = SHFL_CF_DIRECTORY
+			      | SHFL_CF_ACT_OPEN_IF_EXISTS
+			      | SHFL_CF_ACT_FAIL_IF_NEW
+			      | SHFL_CF_ACCESS_READ;
+
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+    LogFunc(("calling VbglR0SfCreate, folder %s, flags %#x [caller: %s]\n",
+	     sf_i->path->String.utf8, pCreateParms->CreateFlags, pszCaller));
+    rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, pCreateParms);
+#else
+    LogFunc(("calling VbglR0SfHostReqCreate on folder %s, flags %#x [caller: %s]\n",
+	     sf_i->path->String.utf8, pCreateParms->CreateFlags, pszCaller));
+    rc = VbglR0SfHostReqCreate(sf_g->map.root, &pReq->Create);
+#endif
+    if (RT_SUCCESS(rc)) {
+	    if (pCreateParms->Result == SHFL_FILE_EXISTS) {
+
+		    /** @todo We could refresh the inode information here since SHFL_FN_CREATE
+		     * returns updated object information. */
+
+		    /** @todo Touch the dentries from here to the mount root since a successful
+		     * open means that the whole path is valid.  I believe CIFS does this. */
+
+		    /** @todo Reading all entries upon opening the directory doesn't seem like
+		     * a good idea. */
+		    sf_dir_info_empty(sf_d);
+		    err = sf_dir_read_all(sf_g, sf_i, sf_d, pCreateParms->Handle);
+	    } else
+		    err = -ENOENT;
+
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	    rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle);
+	    if (RT_FAILURE(rc))
+		    LogFunc(("VbglR0SfClose(%s) after err=%d failed rc=%Rrc caller=%s\n",
+			     sf_i->path->String.utf8, err, rc, pszCaller));
+#else
+	    AssertCompile(RTASSERT_OFFSET_OF(VBOXSFCREATEREQ, CreateParms.Handle) > sizeof(VBOXSFCLOSEREQ)); /* no aliasing issues */
+	    if (pCreateParms->Handle != SHFL_HANDLE_NIL)
+	    {
+		rc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, pCreateParms->Handle);
+		if (RT_FAILURE(rc))
+			LogFunc(("VbglR0SfHostReqCloseSimple(%s) after err=%d failed rc=%Rrc caller=%s\n",
+				 sf_i->path->String.utf8, err, rc, pszCaller));
+	    }
+#endif
+    } else
+	    err = -EPERM;
+
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+    VbglR0PhysHeapFree(pReq);
+#endif
+
+    return err;
+}
+
 /**
  * Open a directory. Read the complete content into a buffer.
@@ -41,10 +134,8 @@
 static int sf_dir_open(struct inode *inode, struct file *file)
 {
-	int rc;
 	int err;
 	struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
 	struct sf_dir_info *sf_d;
 	struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
-	SHFLCREATEPARMS params;
 
 	TRACE();
@@ -53,5 +144,5 @@
 
 	if (file->private_data) {
-		LogFunc(("sf_dir_open() called on already opened directory '%s'\n", sf_i->path->String.utf8));
+		LogFunc(("called on already opened directory '%s'!\n", sf_i->path->String.ach));
 		return 0;
 	}
@@ -59,33 +150,12 @@
 	sf_d = sf_dir_info_alloc();
 	if (!sf_d) {
-		LogRelFunc(("could not allocate directory info for '%s'\n",
-			    sf_i->path->String.utf8));
+		LogRelFunc(("could not allocate directory info for '%s'\n", sf_i->path->String.ach));
 		return -ENOMEM;
 	}
 
-	RT_ZERO(params);
-	params.Handle = SHFL_HANDLE_NIL;
-	params.CreateFlags = 0
-	    | SHFL_CF_DIRECTORY
-	    | SHFL_CF_ACT_OPEN_IF_EXISTS
-	    | SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACCESS_READ;
-
-	LogFunc(("sf_dir_open(): calling VbglR0SfCreate, folder %s, flags %#x\n", sf_i->path->String.utf8, params.CreateFlags));
-	rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, &params);
-	if (RT_SUCCESS(rc)) {
-		if (params.Result == SHFL_FILE_EXISTS) {
-			err = sf_dir_read_all(sf_g, sf_i, sf_d, params.Handle);
-			if (!err)
-				file->private_data = sf_d;
-		} else
-			err = -ENOENT;
-
-		rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
-		if (RT_FAILURE(rc))
-			LogFunc(("sf_dir_open(): VbglR0SfClose(%s) after err=%d failed rc=%Rrc\n", sf_i->path->String.utf8, err, rc));
-	} else
-		err = -EPERM;
-
-	if (err)
+	err = sf_dir_open_worker(sf_g, sf_d, sf_i, "sf_dir_open");
+	if (!err)
+		file->private_data = sf_d;
+	else
 		sf_dir_info_free(sf_d);
 
@@ -178,41 +248,14 @@
 
 	if (sf_i->force_reread) {
-		int rc;
-		int err;
-		SHFLCREATEPARMS params;
-
-		RT_ZERO(params);
-		params.Handle = SHFL_HANDLE_NIL;
-		params.CreateFlags = 0
-		    | SHFL_CF_DIRECTORY
-		    | SHFL_CF_ACT_OPEN_IF_EXISTS
-		    | SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACCESS_READ;
-
-		LogFunc(("sf_getdent: calling VbglR0SfCreate, folder %s, flags %#x\n", sf_i->path->String.utf8, params.CreateFlags));
-		rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path,
-				    &params);
-		if (RT_FAILURE(rc)) {
-			LogFunc(("VbglR0SfCreate(%s) failed rc=%Rrc\n",
-				 sf_i->path->String.utf8, rc));
-			return -EPERM;
-		}
-
-		if (params.Result != SHFL_FILE_EXISTS) {
-			LogFunc(("directory %s does not exist\n",
-				 sf_i->path->String.utf8));
-			sf_dir_info_free(sf_d);
-			return -ENOENT;
-		}
-
-		sf_dir_info_empty(sf_d);
-		err = sf_dir_read_all(sf_g, sf_i, sf_d, params.Handle);
-		rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
-		if (RT_FAILURE(rc))
-			LogFunc(("VbglR0SfClose(%s) failed rc=%Rrc\n",
-				 sf_i->path->String.utf8, rc));
-		if (err)
+		int err = sf_dir_open_worker(sf_g, sf_d, sf_i, "sf_getdent");
+		if (!err) {
+			sf_i->force_reread = 0;
+		} else {
+			if (err == -ENOENT) {
+				sf_dir_info_free(sf_d);
+				dir->private_data = NULL;
+			}
 			return err;
-
-		sf_i->force_reread = 0;
+		}
 	}
 
@@ -233,8 +276,7 @@
 			size_t size;
 
-			size =
-			    offsetof(SHFLDIRINFO,
-				     name.String) + info->name.u16Size;
-			info = (SHFLDIRINFO *) ((uintptr_t) info + size);
+			size = offsetof(SHFLDIRINFO, name.String)
+			     + info->name.u16Size;
+			info = (SHFLDIRINFO *)((uintptr_t)info + size);
 		}
 
@@ -322,7 +364,6 @@
 		}
 #else
-		err =
-		    filldir(opaque, d_name, strlen(d_name), dir->f_pos,
-			    fake_ino, d_type);
+		err = filldir(opaque, d_name, strlen(d_name),
+			      dir->f_pos, fake_ino, d_type);
 		if (err) {
 			LogFunc(("filldir returned error %d\n", err));
@@ -535,8 +576,18 @@
 {
 	int rc, err;
-	SHFLCREATEPARMS params;
-	SHFLSTRING *path;
 	struct sf_inode_info *sf_i = GET_INODE_INFO(parent);
 	struct sf_glob_info *sf_g = GET_GLOB_INFO(parent->i_sb);
+	SHFLSTRING *path;
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	SHFLCREATEPARMS CreateParms;
+	SHFLCREATEPARMS *pCreateParms = &CreateParms;
+#else
+	union CreateAuxReq
+	{
+	    VBOXSFCREATEREQ Create;
+	    VBOXSFCLOSEREQ  Close;
+	} *pReq;
+	SHFLCREATEPARMS *pCreateParms;
+#endif
 
 	TRACE();
@@ -548,41 +599,57 @@
 		goto fail0;
 
-	RT_ZERO(params);
-	params.Handle = SHFL_HANDLE_NIL;
-	params.CreateFlags = 0
-	    | SHFL_CF_ACT_CREATE_IF_NEW
-	    | SHFL_CF_ACT_FAIL_IF_EXISTS
-	    | SHFL_CF_ACCESS_READWRITE | (fDirectory ? SHFL_CF_DIRECTORY : 0);
-	params.Info.Attr.fMode = 0
-	    | (fDirectory ? RTFS_TYPE_DIRECTORY : RTFS_TYPE_FILE)
-	    | (mode & S_IRWXUGO);
-	params.Info.Attr.enmAdditional = RTFSOBJATTRADD_NOTHING;
-
-	LogFunc(("sf_create_aux: calling VbglR0SfCreate, folder %s, flags %#x\n", path->String.utf8, params.CreateFlags));
-	rc = VbglR0SfCreate(&client_handle, &sf_g->map, path, &params);
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	/** @todo combine with sf_path_from_dentry? */
+	pReq = (union CreateAuxReq *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String) + path->u16Size);
+	if (pReq) {
+		memcpy(&pReq->Create.StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size);
+		pCreateParms = &pReq->Create.CreateParms;
+	} else {
+		err = -ENOMEM;
+		goto fail1;
+	}
+#endif
+
+	RT_ZERO(*pCreateParms);
+	pCreateParms->Handle = SHFL_HANDLE_NIL;
+	pCreateParms->CreateFlags = SHFL_CF_ACT_CREATE_IF_NEW
+	                          | SHFL_CF_ACT_FAIL_IF_EXISTS
+	                          | SHFL_CF_ACCESS_READWRITE
+	                          | (fDirectory ? SHFL_CF_DIRECTORY : 0);
+	pCreateParms->Info.Attr.fMode = (fDirectory ? RTFS_TYPE_DIRECTORY : RTFS_TYPE_FILE)
+	                              | (mode & S_IRWXUGO);
+	pCreateParms->Info.Attr.enmAdditional = RTFSOBJATTRADD_NOTHING;
+
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	LogFunc(("calling VbglR0SfCreate, folder %s, flags %#x\n", path->String.utf8, pCreateParms->CreateFlags));
+	rc = VbglR0SfCreate(&client_handle, &sf_g->map, path, pCreateParms);
+#else
+	LogFunc(("calling VbglR0SfHostReqCreate, folder %s, flags %#x\n", path->String.ach, pCreateParms->CreateFlags));
+	rc = VbglR0SfHostReqCreate(sf_g->map.root, &pReq->Create);
+#endif
 	if (RT_FAILURE(rc)) {
 		if (rc == VERR_WRITE_PROTECT) {
 			err = -EROFS;
-			goto fail1;
+			goto fail2;
 		}
 		err = -EPROTO;
-		LogFunc(("(%d): VbglR0SfCreate(%s) failed rc=%Rrc\n",
+		LogFunc(("(%d): SHFL_FN_CREATE(%s) failed rc=%Rrc\n",
 			 fDirectory, sf_i->path->String.utf8, rc));
-		goto fail1;
-	}
-
-	if (params.Result != SHFL_FILE_CREATED) {
+		goto fail2;
+	}
+
+	if (pCreateParms->Result != SHFL_FILE_CREATED) {
 		err = -EPERM;
 		LogFunc(("(%d): could not create file %s result=%d\n",
-			 fDirectory, sf_i->path->String.utf8, params.Result));
-		goto fail1;
-	}
-
-	err = sf_instantiate(parent, dentry, path, &params.Info,
-			     fDirectory ? SHFL_HANDLE_NIL : params.Handle);
+			 fDirectory, sf_i->path->String.utf8, pCreateParms->Result));
+		goto fail2;
+	}
+
+	err = sf_instantiate(parent, dentry, path, &pCreateParms->Info,
+			     fDirectory ? SHFL_HANDLE_NIL : pCreateParms->Handle);
 	if (err) {
 		LogFunc(("(%d): could not instantiate dentry for %s err=%d\n",
 			 fDirectory, sf_i->path->String.utf8, err));
-		goto fail2;
+		goto fail3;
 	}
 
@@ -593,19 +660,38 @@
 	 */
 	if (fDirectory) {
-		rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+		rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle);
 		if (RT_FAILURE(rc))
 			LogFunc(("(%d): VbglR0SfClose failed rc=%Rrc\n",
 				 fDirectory, rc));
+#else
+		AssertCompile(RTASSERT_OFFSET_OF(VBOXSFCREATEREQ, CreateParms.Handle) > sizeof(VBOXSFCLOSEREQ)); /* no aliasing issues */
+		rc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, pCreateParms->Handle);
+		if (RT_FAILURE(rc))
+			LogFunc(("(%d): VbglR0SfHostReqClose failed rc=%Rrc\n", fDirectory, rc));
+#endif
 	}
 
 	sf_i->force_restat = 1;
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	VbglR0PhysHeapFree(pReq);
+#endif
 	return 0;
 
- fail2:
-	rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
+ fail3:
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle);
 	if (RT_FAILURE(rc))
 		LogFunc(("(%d): VbglR0SfClose failed rc=%Rrc\n", fDirectory,
 			 rc));
-
+#else
+	rc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, pCreateParms->Handle);
+	if (RT_FAILURE(rc))
+		LogFunc(("(%d): VbglR0SfHostReqCloseSimple failed rc=%Rrc\n", fDirectory, rc));
+#endif
+ fail2:
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	VbglR0PhysHeapFree(pReq);
+#endif
  fail1:
 	kfree(path);
@@ -638,5 +724,5 @@
 {
 	TRACE();
-	return sf_create_aux(parent, dentry, mode, 0);
+	return sf_create_aux(parent, dentry, mode, 0 /*fDirectory*/);
 }
 
@@ -656,5 +742,5 @@
 {
 	TRACE();
-	return sf_create_aux(parent, dentry, mode, 1);
+	return sf_create_aux(parent, dentry, mode, 1 /*fDirectory*/);
 }
 
@@ -674,5 +760,4 @@
 	struct sf_inode_info *sf_i = GET_INODE_INFO(parent);
 	SHFLSTRING *path;
-	uint32_t fFlags;
 
 	TRACE();
@@ -680,29 +765,39 @@
 
 	err = sf_path_from_dentry(__func__, sf_g, sf_i, dentry, &path);
-	if (err)
-		goto fail0;
-
-	fFlags = fDirectory ? SHFL_REMOVE_DIR : SHFL_REMOVE_FILE;
-	if (dentry->d_inode && ((dentry->d_inode->i_mode & S_IFLNK) == S_IFLNK))
-		fFlags |= SHFL_REMOVE_SYMLINK;
-	rc = VbglR0SfRemove(&client_handle, &sf_g->map, path, fFlags);
-	if (RT_FAILURE(rc)) {
-		LogFunc(("(%d): VbglR0SfRemove(%s) failed rc=%Rrc\n",
-			 fDirectory, path->String.utf8, rc));
-		err = -RTErrConvertToErrno(rc);
-		goto fail1;
-	}
-
-	/* directory access/change time changed */
-	sf_i->force_restat = 1;
-	/* directory content changed */
-	sf_i->force_reread = 1;
-
-	err = 0;
-
- fail1:
-	kfree(path);
-
- fail0:
+	if (!err) {
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+		VBOXSFREMOVEREQ *pReq = (VBOXSFREMOVEREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath.String)
+									       + path->u16Size);
+		if (pReq) {
+			memcpy(&pReq->StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size);
+#endif
+			uint32_t fFlags = fDirectory ? SHFL_REMOVE_DIR : SHFL_REMOVE_FILE;
+			if (dentry->d_inode && ((dentry->d_inode->i_mode & S_IFLNK) == S_IFLNK))
+				fFlags |= SHFL_REMOVE_SYMLINK;
+
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+			rc = VbglR0SfRemove(&client_handle, &sf_g->map, path, fFlags);
+#else
+			rc = VbglR0SfHostReqRemove(sf_g->map.root, pReq, fFlags);
+#endif
+			if (RT_SUCCESS(rc)) {
+				/* directory access/change time changed */
+				sf_i->force_restat = 1;
+				/* directory content changed */
+				sf_i->force_reread = 1;
+
+				err = 0;
+			} else {
+				LogFunc(("(%d): VbglR0SfRemove(%s) failed rc=%Rrc\n",
+					 fDirectory, path->String.utf8, rc));
+				err = -RTErrConvertToErrno(rc);
+			}
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+			VbglR0PhysHeapFree(pReq);
+		} else
+			err = -ENOMEM;
+#endif
+		kfree(path);
+	}
 	return err;
 }
@@ -718,5 +813,5 @@
 {
 	TRACE();
-	return sf_unlink_aux(parent, dentry, 0);
+	return sf_unlink_aux(parent, dentry, 0 /*fDirectory*/);
 }
 
@@ -731,5 +826,5 @@
 {
 	TRACE();
-	return sf_unlink_aux(parent, dentry, 1);
+	return sf_unlink_aux(parent, dentry, 1 /*fDirectory*/);
 }
 
@@ -786,17 +881,34 @@
 			LogFunc(("failed to create new path\n"));
 		else {
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 			int fDir =
 			    ((old_dentry->d_inode->i_mode & S_IFDIR) != 0);
-
 			rc = VbglR0SfRename(&client_handle, &sf_g->map,
 					    old_path, new_path,
 					    fDir ? 0 : SHFL_RENAME_FILE |
 					    SHFL_RENAME_REPLACE_IF_EXISTS);
+#else
+			VBOXSFRENAMEWITHSRCBUFREQ *pReq;
+			pReq = (VBOXSFRENAMEWITHSRCBUFREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFRENAMEWITHSRCBUFREQ,
+											     StrDstPath.String)
+										+ new_path->u16Size);
+			if (pReq) {
+				memcpy(&pReq->StrDstPath, new_path, SHFLSTRING_HEADER_SIZE + new_path->u16Size);
+				rc = VbglR0SfHostReqRenameWithSrcContig(sf_g->map.root, pReq,
+									old_path, virt_to_phys(old_path),
+									old_dentry->d_inode->i_mode & S_IFDIR ? SHFL_RENAME_DIR
+									: SHFL_RENAME_FILE | SHFL_RENAME_REPLACE_IF_EXISTS);
+				VbglR0PhysHeapFree(pReq);
+			} else
+				rc = VERR_NO_MEMORY;
+#endif
 			if (RT_SUCCESS(rc)) {
 				kfree(old_path);
 				sf_new_i->force_restat = 1;
 				sf_old_i->force_restat = 1;	/* XXX: needed? */
+
 				/* Set the new relative path in the inode. */
 				sf_file_i->path = new_path;
+
 			} else {
 				LogFunc(("VbglR0SfRename failed rc=%Rrc\n",
Index: trunk/src/VBox/Additions/linux/sharedfolders/files_vboxsf
===================================================================
--- trunk/src/VBox/Additions/linux/sharedfolders/files_vboxsf	(revision 77049)
+++ trunk/src/VBox/Additions/linux/sharedfolders/files_vboxsf	(revision 77054)
@@ -55,11 +55,15 @@
     ${PATH_ROOT}/include/VBox/VBoxGuestLib.h=>include/VBox/VBoxGuestLib.h \
     ${PATH_ROOT}/include/VBox/VBoxGuestLibSharedFolders.h=>include/VBox/VBoxGuestLibSharedFolders.h \
+    ${PATH_ROOT}/include/VBox/VBoxGuestLibSharedFoldersInline.h=>include/VBox/VBoxGuestLibSharedFoldersInline.h \
     ${PATH_ROOT}/include/VBox/VBoxGuestMangling.h=>include/VBox/VBoxGuestMangling.h \
     ${PATH_ROOT}/include/VBox/VMMDev.h=>include/VBox/VMMDev.h \
     ${PATH_ROOT}/include/VBox/VMMDevCoreTypes.h=>include/VBox/VMMDevCoreTypes.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibInternal.h=>VBoxGuestR0LibInternal.h \
+    ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibGenericRequest.cpp=>VBoxGuestR0LibGenericRequest.c \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibHGCM.cpp=>VBoxGuestR0LibHGCM.c \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibIdc.cpp=>VBoxGuestR0LibIdc.c \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibIdc-unix.cpp=>VBoxGuestR0LibIdc-unix.c \
+    ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibInit.cpp=>VBoxGuestR0LibInit.c \
+    ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibPhysHeap.cpp=>VBoxGuestR0LibPhysHeap.c \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibSharedFolders.c=>VBoxGuestR0LibSharedFolders.c \
     ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.header=>Makefile.include.header \
Index: trunk/src/VBox/Additions/linux/sharedfolders/regops.c
===================================================================
--- trunk/src/VBox/Additions/linux/sharedfolders/regops.c	(revision 77049)
+++ trunk/src/VBox/Additions/linux/sharedfolders/regops.c	(revision 77054)
@@ -438,5 +438,10 @@
 	struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
 	struct sf_reg_info *sf_r;
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	SHFLCREATEPARMS params;
+#else
+	VBOXSFCREATEREQ *pReq;
+#endif
+	SHFLCREATEPARMS *pCreateParms;  /* temp glue */
 
 	TRACE();
@@ -467,28 +472,42 @@
 	}
 
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	RT_ZERO(params);
-	params.Handle = SHFL_HANDLE_NIL;
-	/* We check the value of params.Handle afterwards to find out if
+	pCreateParms = &params;
+#else
+	pReq = (VBOXSFCREATEREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq) + sf_i->path->u16Size);
+	if (!pReq) {
+		kfree(sf_r);
+		LogRelFunc(("Failed to allocate a VBOXSFCREATEREQ buffer!\n"));
+		return -ENOMEM;
+	}
+	memcpy(&pReq->StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size);
+	RT_ZERO(pReq->CreateParms);
+	pCreateParms = &pReq->CreateParms;
+#endif
+	pCreateParms->Handle = SHFL_HANDLE_NIL;
+
+	/* We check the value of pCreateParms->Handle afterwards to find out if
 	 * the call succeeded or failed, as the API does not seem to cleanly
 	 * distinguish error and informational messages.
 	 *
-	 * Furthermore, we must set params.Handle to SHFL_HANDLE_NIL to
+	 * Furthermore, we must set pCreateParms->Handle to SHFL_HANDLE_NIL to
 	 * make the shared folders host service use our fMode parameter */
 
 	if (file->f_flags & O_CREAT) {
 		LogFunc(("O_CREAT set\n"));
-		params.CreateFlags |= SHFL_CF_ACT_CREATE_IF_NEW;
+		pCreateParms->CreateFlags |= SHFL_CF_ACT_CREATE_IF_NEW;
 		/* We ignore O_EXCL, as the Linux kernel seems to call create
 		   beforehand itself, so O_EXCL should always fail. */
 		if (file->f_flags & O_TRUNC) {
 			LogFunc(("O_TRUNC set\n"));
-			params.CreateFlags |= SHFL_CF_ACT_OVERWRITE_IF_EXISTS;
+			pCreateParms->CreateFlags |= SHFL_CF_ACT_OVERWRITE_IF_EXISTS;
 		} else
-			params.CreateFlags |= SHFL_CF_ACT_OPEN_IF_EXISTS;
+			pCreateParms->CreateFlags |= SHFL_CF_ACT_OPEN_IF_EXISTS;
 	} else {
-		params.CreateFlags |= SHFL_CF_ACT_FAIL_IF_NEW;
+		pCreateParms->CreateFlags |= SHFL_CF_ACT_FAIL_IF_NEW;
 		if (file->f_flags & O_TRUNC) {
 			LogFunc(("O_TRUNC set\n"));
-			params.CreateFlags |= SHFL_CF_ACT_OVERWRITE_IF_EXISTS;
+			pCreateParms->CreateFlags |= SHFL_CF_ACT_OVERWRITE_IF_EXISTS;
 		}
 	}
@@ -496,13 +515,13 @@
 	switch (file->f_flags & O_ACCMODE) {
 	case O_RDONLY:
-		params.CreateFlags |= SHFL_CF_ACCESS_READ;
+		pCreateParms->CreateFlags |= SHFL_CF_ACCESS_READ;
 		break;
 
 	case O_WRONLY:
-		params.CreateFlags |= SHFL_CF_ACCESS_WRITE;
+		pCreateParms->CreateFlags |= SHFL_CF_ACCESS_WRITE;
 		break;
 
 	case O_RDWR:
-		params.CreateFlags |= SHFL_CF_ACCESS_READWRITE;
+		pCreateParms->CreateFlags |= SHFL_CF_ACCESS_READWRITE;
 		break;
 
@@ -513,19 +532,30 @@
 	if (file->f_flags & O_APPEND) {
 		LogFunc(("O_APPEND set\n"));
-		params.CreateFlags |= SHFL_CF_ACCESS_APPEND;
-	}
-
-	params.Info.Attr.fMode = inode->i_mode;
-	LogFunc(("sf_reg_open: calling VbglR0SfCreate, file %s, flags=%#x, %#x\n", sf_i->path->String.utf8, file->f_flags, params.CreateFlags));
-	rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, &params);
+		pCreateParms->CreateFlags |= SHFL_CF_ACCESS_APPEND;
+	}
+
+	pCreateParms->Info.Attr.fMode = inode->i_mode;
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	LogFunc(("sf_reg_open: calling VbglR0SfCreate, file %s, flags=%#x, %#x\n", sf_i->path->String.utf8, file->f_flags, pCreateParms->CreateFlags));
+	rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, pCreateParms);
+#else
+	LogFunc(("sf_reg_open: calling VbglR0SfHostReqCreate, file %s, flags=%#x, %#x\n", sf_i->path->String.utf8, file->f_flags, pCreateParms->CreateFlags));
+	rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq);
+#endif
 	if (RT_FAILURE(rc)) {
-		LogFunc(("VbglR0SfCreate failed flags=%d,%#x rc=%Rrc\n",
-			 file->f_flags, params.CreateFlags, rc));
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+		LogFunc(("VbglR0SfCreate failed flags=%d,%#x rc=%Rrc\n", file->f_flags, pCreateParms->CreateFlags, rc));
+#else
+		LogFunc(("VbglR0SfHostReqCreate failed flags=%d,%#x rc=%Rrc\n", file->f_flags, pCreateParms->CreateFlags, rc));
+#endif
 		kfree(sf_r);
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+		VbglR0PhysHeapFree(pReq);
+#endif
 		return -RTErrConvertToErrno(rc);
 	}
 
-	if (SHFL_HANDLE_NIL == params.Handle) {
-		switch (params.Result) {
+	if (pCreateParms->Handle == SHFL_HANDLE_NIL) {
+		switch (pCreateParms->Result) {
 		case SHFL_PATH_NOT_FOUND:
 		case SHFL_FILE_NOT_FOUND:
@@ -541,7 +571,10 @@
 
 	sf_i->force_restat = 1;
-	sf_r->handle = params.Handle;
+	sf_r->handle = pCreateParms->Handle;
 	sf_i->file = file;
 	file->private_data = sf_r;
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	VbglR0PhysHeapFree(pReq);
+#endif
 	return rc_linux;
 }
@@ -578,7 +611,14 @@
 		filemap_fdatawait(inode->i_mapping);
 #endif
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	rc = VbglR0SfClose(&client_handle, &sf_g->map, sf_r->handle);
 	if (RT_FAILURE(rc))
 		LogFunc(("VbglR0SfClose failed rc=%Rrc\n", rc));
+#else
+	rc = VbglR0SfHostReqCloseSimple(sf_g->map.root, sf_r->handle);
+	if (RT_FAILURE(rc))
+		LogFunc(("VbglR0SfHostReqCloseSimple failed rc=%Rrc\n", rc));
+	sf_r->handle = SHFL_HANDLE_NIL;
+#endif
 
 	kfree(sf_r);
Index: trunk/src/VBox/Additions/linux/sharedfolders/utils.c
===================================================================
--- trunk/src/VBox/Additions/linux/sharedfolders/utils.c	(revision 77049)
+++ trunk/src/VBox/Additions/linux/sharedfolders/utils.c	(revision 77054)
@@ -37,6 +37,4 @@
 #include <linux/vfs.h>
 
-/* #define USE_VMALLOC */
-
 /*
  * sf_reg_aops and sf_backing_dev_info are just quick implementations to make
@@ -118,8 +116,8 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 	inode->i_mapping->a_ops = &sf_reg_aops;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0)
+# if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0)
 	/* XXX Was this ever necessary? */
 	inode->i_mapping->backing_dev_info = &sf_g->bdi;
-#endif
+# endif
 #endif
 
@@ -144,9 +142,9 @@
 		inode->i_mode |= S_IFLNK;
 		inode->i_op = &sf_lnk_iops;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
 		set_nlink(inode, 1);
-#else
+# else
 		inode->i_nlink = 1;
-#endif
+# endif
 	}
 #endif
@@ -188,12 +186,17 @@
 
 int sf_stat(const char *caller, struct sf_glob_info *sf_g,
-	    SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail)
+	    SHFLSTRING *path, PSHFLFSOBJINFO result, int ok_to_fail)
 {
 	int rc;
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	SHFLCREATEPARMS params;
+#else
+	VBOXSFCREATEREQ *pReq;
+#endif
 	NOREF(caller);
 
 	TRACE();
 
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	RT_ZERO(params);
 	params.Handle = SHFL_HANDLE_NIL;
@@ -219,4 +222,36 @@
 	*result = params.Info;
 	return 0;
+#else
+	pReq = (VBOXSFCREATEREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq) + path->u16Size);
+	if (pReq) {
+		RT_ZERO(*pReq);
+		memcpy(&pReq->StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size);
+		pReq->CreateParms.Handle = SHFL_HANDLE_NIL;
+		pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW;
+
+		LogFunc(("Calling VbglR0SfHostReqCreate on %s\n", path->String.utf8));
+		rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq);
+		if (RT_SUCCESS(rc)) {
+			if (pReq->CreateParms.Result == SHFL_FILE_EXISTS) {
+				*result = pReq->CreateParms.Info;
+				rc = 0;
+			} else {
+				if (!ok_to_fail)
+					LogFunc(("VbglR0SfHostReqCreate on %s: file does not exist: %d (caller=%s)\n",
+						 path->String.utf8, pReq->CreateParms.Result, caller));
+				rc = -ENOENT;
+			}
+		} else if (rc == VERR_INVALID_NAME) {
+			rc = -ENOENT; /* this can happen for names like 'foo*' on a Windows host */
+		} else {
+			LogFunc(("VbglR0SfHostReqCreate failed on %s: %Rrc (caller=%s)\n", path->String.utf8, rc, caller));
+			rc = -EPROTO;
+		}
+		VbglR0PhysHeapFree(pReq);
+	}
+	else
+		rc = -ENOMEM;
+	return rc;
+#endif
 }
 
@@ -301,15 +336,16 @@
    [generic_fillattr] */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
 int sf_getattr(const struct path *path, struct kstat *kstat, u32 request_mask,
 	       unsigned int flags)
-#else
+# else
 int sf_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat)
-#endif
+# endif
 {
 	int err;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
 	struct dentry *dentry = path->dentry;
-#endif
+# endif
 
 	TRACE();
@@ -326,8 +362,26 @@
 	struct sf_glob_info *sf_g;
 	struct sf_inode_info *sf_i;
-	SHFLCREATEPARMS params;
-	SHFLFSOBJINFO info;
+# ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	SHFLCREATEPARMS CreateParms;
+	SHFLCREATEPARMS *pCreateParms = &CreateParms;
+	SHFLFSOBJINFO InfoBuf;
+	SHFLFSOBJINFO *pInfo = &InfoBuf;
 	uint32_t cbBuffer;
 	int rc, err;
+# else
+	union SetAttrReqs
+	{
+	    VBOXSFCREATEREQ         Create;
+	    VBOXSFOBJINFOREQ        Info;
+	    VBOXSFSETFILESIZEREQ    SetSize;
+	    VBOXSFCLOSEREQ          Close;
+	} *pReq;
+	size_t cbReq;
+	SHFLCREATEPARMS *pCreateParms;
+	SHFLFSOBJINFO *pInfo;
+	SHFLHANDLE hHostFile;
+	int vrc;
+	int err = 0;
+# endif
 
 	TRACE();
@@ -335,16 +389,29 @@
 	sf_g = GET_GLOB_INFO(dentry->d_inode->i_sb);
 	sf_i = GET_INODE_INFO(dentry->d_inode);
+# ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	err = 0;
-
-	RT_ZERO(params);
-	params.Handle = SHFL_HANDLE_NIL;
-	params.CreateFlags = SHFL_CF_ACT_OPEN_IF_EXISTS
-	    | SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACCESS_ATTR_WRITE;
+# else
+	cbReq = RT_MAX(sizeof(pReq->Info), sizeof(pReq->Create) + SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size);
+	pReq = (union SetAttrReqs *)VbglR0PhysHeapAlloc(cbReq);
+	if (!pReq) {
+		LogFunc(("Failed to allocate %#x byte request buffer!\n", cbReq));
+		return -ENOMEM;
+	}
+	pCreateParms = &pReq->Create.CreateParms;
+	pInfo = &pReq->Info.ObjInfo;
+# endif
+
+	RT_ZERO(*pCreateParms);
+	pCreateParms->Handle = SHFL_HANDLE_NIL;
+	pCreateParms->CreateFlags = SHFL_CF_ACT_OPEN_IF_EXISTS
+				  | SHFL_CF_ACT_FAIL_IF_NEW
+				  | SHFL_CF_ACCESS_ATTR_WRITE;
 
 	/* this is at least required for Posix hosts */
 	if (iattr->ia_valid & ATTR_SIZE)
-		params.CreateFlags |= SHFL_CF_ACCESS_WRITE;
-
-	rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, &params);
+		pCreateParms->CreateFlags |= SHFL_CF_ACCESS_WRITE;
+
+# ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, pCreateParms);
 	if (RT_FAILURE(rc)) {
 		LogFunc(("VbglR0SfCreate(%s) failed rc=%Rrc\n",
@@ -353,5 +420,16 @@
 		goto fail2;
 	}
-	if (params.Result != SHFL_FILE_EXISTS) {
+# else
+	memcpy(&pReq->Create.StrPath, sf_i->path, sf_i->path->u16Size);
+	vrc = VbglR0SfHostReqCreate(sf_g->map.root, &pReq->Create);
+	if (RT_SUCCESS(vrc)) {
+		hHostFile = pCreateParms->Handle;
+	} else {
+		err = -RTErrConvertToErrno(vrc);
+		LogFunc(("VbglR0SfCreate(%s) failed vrc=%Rrc err=%d\n", sf_i->path->String.ach, vrc, err));
+		goto fail2;
+	}
+# endif
+	if (pCreateParms->Result != SHFL_FILE_EXISTS) {
 		LogFunc(("file %s does not exist\n", sf_i->path->String.utf8));
 		err = -ENOENT;
@@ -363,36 +441,37 @@
 	 * vbsf.cpp */
 	if (iattr->ia_valid & (ATTR_MODE | ATTR_ATIME | ATTR_MTIME)) {
-#define mode_set(r) ((iattr->ia_mode & (S_##r)) ? RTFS_UNIX_##r : 0)
-
-		RT_ZERO(info);
+# define mode_set(r) ((iattr->ia_mode & (S_##r)) ? RTFS_UNIX_##r : 0)
+
+		RT_ZERO(*pInfo);
 		if (iattr->ia_valid & ATTR_MODE) {
-			info.Attr.fMode = mode_set(IRUSR);
-			info.Attr.fMode |= mode_set(IWUSR);
-			info.Attr.fMode |= mode_set(IXUSR);
-			info.Attr.fMode |= mode_set(IRGRP);
-			info.Attr.fMode |= mode_set(IWGRP);
-			info.Attr.fMode |= mode_set(IXGRP);
-			info.Attr.fMode |= mode_set(IROTH);
-			info.Attr.fMode |= mode_set(IWOTH);
-			info.Attr.fMode |= mode_set(IXOTH);
+			pInfo->Attr.fMode = mode_set(IRUSR);
+			pInfo->Attr.fMode |= mode_set(IWUSR);
+			pInfo->Attr.fMode |= mode_set(IXUSR);
+			pInfo->Attr.fMode |= mode_set(IRGRP);
+			pInfo->Attr.fMode |= mode_set(IWGRP);
+			pInfo->Attr.fMode |= mode_set(IXGRP);
+			pInfo->Attr.fMode |= mode_set(IROTH);
+			pInfo->Attr.fMode |= mode_set(IWOTH);
+			pInfo->Attr.fMode |= mode_set(IXOTH);
 
 			if (iattr->ia_mode & S_IFDIR)
-				info.Attr.fMode |= RTFS_TYPE_DIRECTORY;
+				pInfo->Attr.fMode |= RTFS_TYPE_DIRECTORY;
 			else
-				info.Attr.fMode |= RTFS_TYPE_FILE;
+				pInfo->Attr.fMode |= RTFS_TYPE_FILE;
 		}
 
 		if (iattr->ia_valid & ATTR_ATIME)
-			sf_timespec_from_ftime(&info.AccessTime,
+			sf_timespec_from_ftime(&pInfo->AccessTime,
 					       &iattr->ia_atime);
 		if (iattr->ia_valid & ATTR_MTIME)
-			sf_timespec_from_ftime(&info.ModificationTime,
+			sf_timespec_from_ftime(&pInfo->ModificationTime,
 					       &iattr->ia_mtime);
 		/* ignore ctime (inode change time) as it can't be set from userland anyway */
 
-		cbBuffer = sizeof(info);
-		rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, params.Handle,
+# ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+		cbBuffer = sizeof(*pInfo);
+		rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, pCreateParms->Handle,
 				    SHFL_INFO_SET | SHFL_INFO_FILE, &cbBuffer,
-				    (PSHFLDIRINFO) & info);
+				    (PSHFLDIRINFO)pInfo);
 		if (RT_FAILURE(rc)) {
 			LogFunc(("VbglR0SfFsInfo(%s, FILE) failed rc=%Rrc\n",
@@ -401,13 +480,22 @@
 			goto fail1;
 		}
+# else
+		vrc = VbglR0SfHostReqSetObjInfo(sf_g->map.root, &pReq->Info, hHostFile);
+		if (RT_FAILURE(vrc)) {
+			err = -RTErrConvertToErrno(vrc);
+			LogFunc(("VbglR0SfHostReqSetObjInfo(%s) failed vrc=%Rrc err=%d\n", sf_i->path->String.ach, vrc, err));
+			goto fail1;
+		}
+# endif
 	}
 
 	if (iattr->ia_valid & ATTR_SIZE) {
-		RT_ZERO(info);
-		info.cbObject = iattr->ia_size;
-		cbBuffer = sizeof(info);
-		rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, params.Handle,
+# ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+		RT_ZERO(*pInfo);
+		pInfo->cbObject = iattr->ia_size;
+		cbBuffer = sizeof(*pInfo);
+		rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, pCreateParms->Handle,
 				    SHFL_INFO_SET | SHFL_INFO_SIZE, &cbBuffer,
-				    (PSHFLDIRINFO) & info);
+				    (PSHFLDIRINFO)pInfo);
 		if (RT_FAILURE(rc)) {
 			LogFunc(("VbglR0SfFsInfo(%s, SIZE) failed rc=%Rrc\n",
@@ -416,23 +504,60 @@
 			goto fail1;
 		}
-	}
-
-	rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
+# else
+		vrc = VbglR0SfHostReqSetFileSize(sf_g->map.root, &pReq->SetSize, hHostFile, iattr->ia_size);
+		/** @todo Implement fallback if host is < 6.0? */
+		if (RT_FAILURE(vrc)) {
+			err = -RTErrConvertToErrno(vrc);
+			LogFunc(("VbglR0SfHostReqSetFileSize(%s, %#llx) failed vrc=%Rrc err=%d\n",
+				 sf_i->path->String.ach, (unsigned long long)iattr->ia_size, vrc, err));
+			goto fail1;
+		}
+# endif
+	}
+
+# ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle);
 	if (RT_FAILURE(rc))
 		LogFunc(("VbglR0SfClose(%s) failed rc=%Rrc\n",
 			 sf_i->path->String.utf8, rc));
-
+# else
+	vrc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, hHostFile);
+	if (RT_FAILURE(vrc))
+		LogFunc(("VbglR0SfHostReqClose(%s [%#llx]) failed vrc=%Rrc\n", sf_i->path->String.utf8, hHostFile, vrc));
+	VbglR0PhysHeapFree(pReq);
+# endif
+
+	/** @todo r=bird: I guess we're calling revalidate here to update the inode
+	 * info.  However, due to the TTL optimization this is not guarenteed to happen.
+	 *
+	 * Also, we already have accurate stat information on the file, either from the
+	 * SHFL_FN_CREATE call or from SHFL_FN_INFORMATION, so there is no need to do a
+	 * slow stat()-like operation to retrieve the information again.
+	 *
+	 * What's more, given that the SHFL_FN_CREATE call succeeded, we know that the
+	 * dentry and all its parent entries are valid and could touch their timestamps
+	 * extending their TTL (CIFS does that). */
 	return sf_inode_revalidate(dentry);
 
  fail1:
-	rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
+# ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle);
 	if (RT_FAILURE(rc))
 		LogFunc(("VbglR0SfClose(%s) failed rc=%Rrc\n",
 			 sf_i->path->String.utf8, rc));
+# else
+	vrc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, hHostFile);
+	if (RT_FAILURE(vrc))
+		LogFunc(("VbglR0SfHostReqClose(%s [%#llx]) failed vrc=%Rrc; err=%d\n", sf_i->path->String.utf8, hHostFile, vrc, err));
+# endif
 
  fail2:
+# ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	VbglR0PhysHeapFree(pReq);
+# endif
 	return err;
 }
-#endif				/* >= 2.6.0 */
+
+#endif /* >= 2.6.0 */
 
 static int sf_make_path(const char *caller, struct sf_inode_info *sf_i,
@@ -638,9 +763,5 @@
 		return NULL;
 	}
-#ifdef USE_VMALLOC
-	b->buf = vmalloc(DIR_BUFFER_SIZE);
-#else
 	b->buf = kmalloc(DIR_BUFFER_SIZE, GFP_KERNEL);
-#endif
 	if (!b->buf) {
 		kfree(b);
@@ -662,9 +783,5 @@
 	TRACE();
 	list_del(&b->head);
-#ifdef USE_VMALLOC
-	vfree(b->buf);
-#else
 	kfree(b->buf);
-#endif
 	kfree(b);
 }
@@ -746,4 +863,6 @@
 }
 
+/** @todo r=bird: Why on earth do we read in the entire directory???  This
+ *        cannot be healthy for like big directory and such... */
 int sf_dir_read_all(struct sf_glob_info *sf_g, struct sf_inode_info *sf_i,
 		    struct sf_dir_info *sf_d, SHFLHANDLE handle)
@@ -751,5 +870,7 @@
 	int err;
 	SHFLSTRING *mask;
-	struct sf_dir_buf *b;
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	VBOXSFLISTDIRREQ *pReq = NULL;
+#endif
 
 	TRACE();
@@ -757,10 +878,18 @@
 	if (err)
 		goto fail0;
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	pReq = (VBOXSFLISTDIRREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));
+	if (!pReq)
+		goto fail1;
+#endif
 
 	for (;;) {
 		int rc;
+		struct sf_dir_buf *b;
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 		void *buf;
 		uint32_t cbSize;
 		uint32_t cEntries;
+#endif
 
 		b = sf_get_empty_dir_buf(sf_d);
@@ -770,9 +899,10 @@
 				err = -ENOMEM;
 				LogRelFunc(("could not alloc directory buffer\n"));
-				goto fail1;
+				goto fail2;
 			}
 			list_add(&b->head, &sf_d->info_list);
 		}
 
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 		buf = b->buf;
 		cbSize = b->cbFree;
@@ -792,5 +922,5 @@
 			err = -RTErrConvertToErrno(rc);
 			LogFunc(("VbglR0SfDirInfo failed rc=%Rrc\n", rc));
-			goto fail1;
+			goto fail2;
 		}
 
@@ -801,7 +931,26 @@
 		if (RT_FAILURE(rc))
 			break;
+#else
+		rc = VbglR0SfHostReqListDirContig2x(sf_g->map.root, pReq, handle, mask, virt_to_phys(mask),
+						    0 /*fFlags*/, b->buf, virt_to_phys(b->buf), b->cbFree);
+		if (RT_SUCCESS(rc)) {
+			b->cEntries += pReq->Parms.c32Entries.u.value32;
+			b->cbFree   -= pReq->Parms.cb32Buffer.u.value32;
+			b->cbUsed   += pReq->Parms.cb32Buffer.u.value32;
+		} else if (rc == VERR_NO_MORE_FILES) {
+			break;
+		} else {
+			err = -RTErrConvertToErrno(rc);
+			LogFunc(("VbglR0SfHostReqListDirContig2x failed rc=%Rrc err=%d\n", rc, err));
+			goto fail2;
+		}
+#endif
 	}
 	err = 0;
 
+ fail2:
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+	VbglR0PhysHeapFree(pReq);
+#endif
  fail1:
 	kfree(mask);
@@ -814,31 +963,57 @@
 {
 	struct sf_glob_info *sf_g;
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	SHFLVOLINFO SHFLVolumeInfo;
+	SHFLVOLINFO *pVolInfo = &SHFLVolumeInfo;
 	uint32_t cbBuffer;
+#else
+	VBOXSFVOLINFOREQ *pReq;
+	SHFLVOLINFO *pVolInfo;
+#endif
 	int rc;
 
 	sf_g = GET_GLOB_INFO(sb);
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	cbBuffer = sizeof(SHFLVolumeInfo);
 	rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, 0,
 			    SHFL_INFO_GET | SHFL_INFO_VOLUME, &cbBuffer,
 			    (PSHFLDIRINFO) & SHFLVolumeInfo);
-	if (RT_FAILURE(rc))
-		return -RTErrConvertToErrno(rc);
-
-	stat->f_type = NFS_SUPER_MAGIC;	/* XXX vboxsf type? */
-	stat->f_bsize = SHFLVolumeInfo.ulBytesPerAllocationUnit;
-	stat->f_blocks = SHFLVolumeInfo.ullTotalAllocationBytes
-	    / SHFLVolumeInfo.ulBytesPerAllocationUnit;
-	stat->f_bfree = SHFLVolumeInfo.ullAvailableAllocationBytes
-	    / SHFLVolumeInfo.ulBytesPerAllocationUnit;
-	stat->f_bavail = SHFLVolumeInfo.ullAvailableAllocationBytes
-	    / SHFLVolumeInfo.ulBytesPerAllocationUnit;
-	stat->f_files = 1000;
-	stat->f_ffree = 1000;	/* don't return 0 here since the guest may think
-				 * that it is not possible to create any more files */
-	stat->f_fsid.val[0] = 0;
-	stat->f_fsid.val[1] = 0;
-	stat->f_namelen = 255;
-	return 0;
+#else
+	pReq = VbglR0PhysHeapAlloc(sizeof(*pReq));
+	if (pReq) {
+		pVolInfo = &pReq->VolInfo;
+		rc = VbglR0SfHostReqQueryVolInfo(sf_g->map.root, pReq, SHFL_HANDLE_ROOT);
+#endif
+		if (RT_SUCCESS(rc)) {
+			stat->f_type   = NFS_SUPER_MAGIC;	/* XXX vboxsf type? */
+			stat->f_bsize  = pVolInfo->ulBytesPerAllocationUnit;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 73)
+			stat->f_frsize = pVolInfo->ulBytesPerAllocationUnit;
+#endif
+			stat->f_blocks = pVolInfo->ullTotalAllocationBytes
+				       / pVolInfo->ulBytesPerAllocationUnit;
+			stat->f_bfree  = pVolInfo->ullAvailableAllocationBytes
+				       / pVolInfo->ulBytesPerAllocationUnit;
+			stat->f_bavail = pVolInfo->ullAvailableAllocationBytes
+				       / pVolInfo->ulBytesPerAllocationUnit;
+			stat->f_files  = 1000;
+			stat->f_ffree  = 1000; /* don't return 0 here since the guest may think
+						* that it is not possible to create any more files */
+			stat->f_fsid.val[0] = 0;
+			stat->f_fsid.val[1] = 0;
+			stat->f_namelen = 255;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 73)
+			stat->f_flags = 0; /* not valid */
+#endif
+			RT_ZERO(stat->f_spare);
+			rc = 0;
+		} else
+			rc = -RTErrConvertToErrno(rc);
+#ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
+		VbglR0PhysHeapFree(pReq);
+	} else
+		rc = -ENOMEM;
+#endif
+	return rc;
 }
 
@@ -857,5 +1032,5 @@
 
 	sf_g->bdi.ra_pages = 0;	/* No readahead */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)
 	sf_g->bdi.capabilities = BDI_CAP_MAP_DIRECT	/* MAP_SHARED */
 	    | BDI_CAP_MAP_COPY	/* MAP_PRIVATE */
@@ -863,14 +1038,14 @@
 	    | BDI_CAP_WRITE_MAP	/* can be mapped for writing */
 	    | BDI_CAP_EXEC_MAP;	/* can be mapped for execution */
-#endif				/* >= 2.6.12 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
+# endif				/* >= 2.6.12 */
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
 	rc = bdi_init(&sf_g->bdi);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+#  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
 	if (!rc)
 		rc = bdi_register(&sf_g->bdi, NULL, "vboxsf-%llu",
 				  (unsigned long long)u64CurrentSequence);
-#endif				/* >= 2.6.26 */
-#endif				/* >= 2.6.24 */
-#endif				/* >= 2.6.0 && <= 3.19.0 */
+#  endif /* >= 2.6.26 */
+# endif	 /* >= 2.6.24 */
+#endif   /* >= 2.6.0 && <= 3.19.0 */
 	return rc;
 }
@@ -882,2 +1057,3 @@
 #endif
 }
+
Index: trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
===================================================================
--- trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c	(revision 77049)
+++ trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c	(revision 77054)
@@ -40,9 +40,9 @@
 #include "revision-generated.h"
 #include "product-generated.h"
-#include "VBoxGuestR0LibInternal.h"
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
 # include <linux/mount.h>
 #endif
 #include <linux/seq_file.h>
+#include <iprt/path.h>
 
 MODULE_DESCRIPTION(VBOX_PRODUCT " VFS Module for Host File System Access");
@@ -58,4 +58,6 @@
 /* globals */
 VBGLSFCLIENT client_handle;
+VBGLSFCLIENT g_SfClient;      /* temporary? */
+uint32_t g_fHostFeatures = 0; /* temporary? */
 
 /* forward declarations */
@@ -105,8 +107,6 @@
 	memcpy(str_name->String.utf8, info->name, name_len + 1);
 
-#define _IS_UTF8(_str) \
-    (strcmp(_str, "utf8") == 0)
-#define _IS_EMPTY(_str) \
-    (strcmp(_str, "") == 0)
+#define _IS_UTF8(_str)  (strcmp(_str, "utf8") == 0)
+#define _IS_EMPTY(_str) (strcmp(_str, "") == 0)
 
 	/* Check if NLS charset is valid and not points to UTF8 table */
@@ -136,15 +136,20 @@
 		sf_g->nls = NULL;
 #endif
+	}
 
 #undef _IS_UTF8
 #undef _IS_EMPTY
-	}
-
+
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	rc = VbglR0SfMapFolder(&client_handle, str_name, &sf_g->map);
+#else
+	rc = VbglR0SfHostReqMapFolderWithContigSimple(str_name, virt_to_phys(str_name), RTPATH_DELIMITER,
+						      true /*fCaseSensitive*/, &sf_g->map.root);
+#endif
 	kfree(str_name);
 
 	if (RT_FAILURE(rc)) {
 		err = -EPROTO;
-		LogFunc(("VbglR0SfMapFolder failed rc=%d\n", rc));
+		LogFunc(("SHFL_FN_MAP_FOLDER failed rc=%Rrc\n", rc));
 		goto fail2;
 	}
@@ -193,7 +198,13 @@
 
 	TRACE();
+#ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE
 	rc = VbglR0SfUnmapFolder(&client_handle, &sf_g->map);
 	if (RT_FAILURE(rc))
 		LogFunc(("VbglR0SfUnmapFolder failed rc=%d\n", rc));
+#else
+	rc = VbglR0SfHostReqUnmapFolderSimple(sf_g->map.root);
+	if (RT_FAILURE(rc))
+		LogFunc(("VbglR0SfHostReqUnmapFolderSimple failed rc=%Rrc\n", rc));
+#endif
 
 	if (sf_g->nls)
@@ -455,6 +466,5 @@
 	BUG_ON(!sf_g);
 	if (data && data[0] != 0) {
-		struct vbsf_mount_info_new *info =
-		    (struct vbsf_mount_info_new *)data;
+		struct vbsf_mount_info_new *info = (struct vbsf_mount_info_new *)data;
 		if (info->signature[0] == VBSF_MOUNT_SIGNATURE_BYTE_0
 		    && info->signature[1] == VBSF_MOUNT_SIGNATURE_BYTE_1
@@ -599,5 +609,5 @@
 static int __init init(void)
 {
-	int rcVBox;
+	int vrc;
 	int rcRet = 0;
 	int err;
@@ -620,21 +630,30 @@
 	}
 
-	rcVBox = VbglR0HGCMInit();
-	if (RT_FAILURE(rcVBox)) {
-		LogRelFunc(("VbglR0HGCMInit failed, rc=%d\n", rcVBox));
+	vrc = VbglR0SfInit();
+	if (RT_FAILURE(vrc)) {
+		LogRelFunc(("VbglR0SfInit failed, vrc=%Rrc\n", vrc));
 		rcRet = -EPROTO;
 		goto fail0;
 	}
 
-	rcVBox = VbglR0SfConnect(&client_handle);
-	if (RT_FAILURE(rcVBox)) {
-		LogRelFunc(("VbglR0SfConnect failed, rc=%d\n", rcVBox));
+	vrc = VbglR0SfConnect(&client_handle);
+	g_SfClient = client_handle; /* temporary */
+	if (RT_FAILURE(vrc)) {
+		LogRelFunc(("VbglR0SfConnect failed, vrc=%Rrc\n", vrc));
 		rcRet = -EPROTO;
 		goto fail1;
 	}
 
-	rcVBox = VbglR0SfSetUtf8(&client_handle);
-	if (RT_FAILURE(rcVBox)) {
-		LogRelFunc(("VbglR0SfSetUtf8 failed, rc=%d\n", rcVBox));
+	vrc = VbglR0QueryHostFeatures(&g_fHostFeatures);
+	if (RT_FAILURE(vrc))
+	{
+		LogRelFunc(("VbglR0QueryHostFeatures failed: vrc=%Rrc (ignored)\n", vrc));
+		g_fHostFeatures = 0;
+	}
+	LogRelFunc(("g_fHostFeatures=%#x\n", g_fHostFeatures));
+
+	vrc = VbglR0SfSetUtf8(&client_handle);
+	if (RT_FAILURE(vrc)) {
+		LogRelFunc(("VbglR0SfSetUtf8 failed, vrc=%Rrc\n", vrc));
 		rcRet = -EPROTO;
 		goto fail2;
@@ -642,9 +661,9 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 	if (!follow_symlinks) {
-		rcVBox = VbglR0SfSetSymlinks(&client_handle);
-		if (RT_FAILURE(rcVBox)) {
+		vrc = VbglR0SfSetSymlinks(&client_handle);
+		if (RT_FAILURE(vrc)) {
 			printk(KERN_WARNING
-			       "vboxsf: Host unable to show symlinks, rc=%d\n",
-			       rcVBox);
+			       "vboxsf: Host unable to show symlinks, vrc=%d\n",
+			       vrc);
 		}
 	}
@@ -659,7 +678,8 @@
  fail2:
 	VbglR0SfDisconnect(&client_handle);
+	g_SfClient = client_handle; /* temporary */
 
  fail1:
-	VbglR0HGCMTerminate();
+	VbglR0SfTerm();
 
  fail0:
@@ -673,5 +693,6 @@
 
 	VbglR0SfDisconnect(&client_handle);
-	VbglR0HGCMTerminate();
+	g_SfClient = client_handle; /* temporary */
+	VbglR0SfTerm();
 	unregister_filesystem(&vboxsf_fs_type);
 }
Index: trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
===================================================================
--- trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h	(revision 77049)
+++ trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h	(revision 77054)
@@ -35,4 +35,7 @@
 #endif
 
+/* VBOXSF_USE_DEPRECATED_VBGL_INTERFACE is also settable in make env. */
+/*#define VBOXSF_USE_DEPRECATED_VBGL_INTERFACE*/
+
 #define LOG_GROUP LOG_GROUP_SHARED_FOLDERS
 #include "the-linux-kernel.h"
@@ -44,4 +47,5 @@
 
 #include <VBox/VBoxGuestLibSharedFolders.h>
+#include <VBox/VBoxGuestLibSharedFoldersInline.h>
 #include "vbsfmount.h"
 
