]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
UBUNTU: ubuntu: vbox -- update to 5.0.14-dfsg-2
authorAndy Whitcroft <apw@canonical.com>
Sat, 6 Feb 2016 21:59:18 +0000 (21:59 +0000)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 29 Feb 2016 16:02:19 +0000 (09:02 -0700)
BugLink: http://bugs.launchpad.net/bugs/1542728
Signed-off-by: Andy Whitcroft <apw@canonical.com>
139 files changed:
ubuntu/vbox/BOM
ubuntu/vbox/include/VBox/VBoxGuest.h
ubuntu/vbox/include/VBox/VBoxGuest2.h
ubuntu/vbox/include/VBox/VBoxGuestLib.h
ubuntu/vbox/include/VBox/VBoxGuestLibSharedFolders.h [new file with mode: 0644]
ubuntu/vbox/include/VBox/VMMDev.h
ubuntu/vbox/include/VBox/VMMDev2.h
ubuntu/vbox/include/VBox/cdefs.h
ubuntu/vbox/include/VBox/err.h
ubuntu/vbox/include/VBox/hgcmsvc.h
ubuntu/vbox/include/VBox/log.h
ubuntu/vbox/include/VBox/shflsvc.h
ubuntu/vbox/include/VBox/types.h
ubuntu/vbox/include/iprt/asm-amd64-x86.h
ubuntu/vbox/include/iprt/asm.h
ubuntu/vbox/include/iprt/assert.h
ubuntu/vbox/include/iprt/cdefs.h
ubuntu/vbox/include/iprt/err.h
ubuntu/vbox/include/iprt/fs.h
ubuntu/vbox/include/iprt/heap.h
ubuntu/vbox/include/iprt/initterm.h
ubuntu/vbox/include/iprt/latin1.h [new file with mode: 0644]
ubuntu/vbox/include/iprt/list.h
ubuntu/vbox/include/iprt/lockvalidator.h
ubuntu/vbox/include/iprt/log.h
ubuntu/vbox/include/iprt/mangling.h
ubuntu/vbox/include/iprt/mem.h
ubuntu/vbox/include/iprt/net.h
ubuntu/vbox/include/iprt/path.h
ubuntu/vbox/include/iprt/process.h
ubuntu/vbox/include/iprt/semaphore.h
ubuntu/vbox/include/iprt/string.h
ubuntu/vbox/include/iprt/thread.h
ubuntu/vbox/include/iprt/types.h
ubuntu/vbox/include/iprt/utf16.h [new file with mode: 0644]
ubuntu/vbox/include/iprt/x86.h
ubuntu/vbox/r0drv/alloc-r0drv.c
ubuntu/vbox/r0drv/generic/semspinmutex-r0drv-generic.c
ubuntu/vbox/r0drv/initterm-r0drv.c
ubuntu/vbox/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c
ubuntu/vbox/r0drv/linux/alloc-r0drv-linux.c
ubuntu/vbox/r0drv/linux/assert-r0drv-linux.c
ubuntu/vbox/r0drv/linux/initterm-r0drv-linux.c
ubuntu/vbox/r0drv/linux/memobj-r0drv-linux.c
ubuntu/vbox/r0drv/linux/memuserkernel-r0drv-linux.c
ubuntu/vbox/r0drv/linux/mp-r0drv-linux.c
ubuntu/vbox/r0drv/linux/mpnotification-r0drv-linux.c
ubuntu/vbox/r0drv/linux/process-r0drv-linux.c
ubuntu/vbox/r0drv/linux/semevent-r0drv-linux.c
ubuntu/vbox/r0drv/linux/semeventmulti-r0drv-linux.c
ubuntu/vbox/r0drv/linux/semfastmutex-r0drv-linux.c
ubuntu/vbox/r0drv/linux/semmutex-r0drv-linux.c
ubuntu/vbox/r0drv/linux/spinlock-r0drv-linux.c
ubuntu/vbox/r0drv/linux/the-linux-kernel.h
ubuntu/vbox/r0drv/linux/thread-r0drv-linux.c
ubuntu/vbox/r0drv/linux/thread2-r0drv-linux.c
ubuntu/vbox/r0drv/linux/time-r0drv-linux.c
ubuntu/vbox/r0drv/linux/timer-r0drv-linux.c
ubuntu/vbox/r0drv/memobj-r0drv.c
ubuntu/vbox/r0drv/mpnotification-r0drv.c
ubuntu/vbox/r0drv/powernotification-r0drv.c
ubuntu/vbox/vboxguest/GenericRequest.c
ubuntu/vbox/vboxguest/HGCMInternal.c
ubuntu/vbox/vboxguest/Init.c
ubuntu/vbox/vboxguest/PhysHeap.c
ubuntu/vbox/vboxguest/SysHlp.c
ubuntu/vbox/vboxguest/SysHlp.h
ubuntu/vbox/vboxguest/VBGLInternal.h
ubuntu/vbox/vboxguest/VBox/log-vbox.c
ubuntu/vbox/vboxguest/VBox/logbackdoor.c
ubuntu/vbox/vboxguest/VBoxGuest-linux.c
ubuntu/vbox/vboxguest/VBoxGuest.c
ubuntu/vbox/vboxguest/VBoxGuestIDC-unix.c.h
ubuntu/vbox/vboxguest/VBoxGuestInternal.h
ubuntu/vbox/vboxguest/VMMDev.c
ubuntu/vbox/vboxguest/common/alloc/alloc.c
ubuntu/vbox/vboxguest/common/alloc/heapsimple.c
ubuntu/vbox/vboxguest/common/err/RTErrConvertFromErrno.c
ubuntu/vbox/vboxguest/common/err/RTErrConvertToErrno.c
ubuntu/vbox/vboxguest/common/log/log.c
ubuntu/vbox/vboxguest/common/log/logcom.c
ubuntu/vbox/vboxguest/common/log/logellipsis.c
ubuntu/vbox/vboxguest/common/log/logformat.c
ubuntu/vbox/vboxguest/common/log/logrel.c
ubuntu/vbox/vboxguest/common/log/logrelellipsis.c
ubuntu/vbox/vboxguest/common/misc/RTAssertMsg1Weak.c
ubuntu/vbox/vboxguest/common/misc/RTAssertMsg2.c
ubuntu/vbox/vboxguest/common/misc/RTAssertMsg2Add.c
ubuntu/vbox/vboxguest/common/misc/RTAssertMsg2AddWeak.c
ubuntu/vbox/vboxguest/common/misc/RTAssertMsg2AddWeakV.c
ubuntu/vbox/vboxguest/common/misc/RTAssertMsg2Weak.c
ubuntu/vbox/vboxguest/common/misc/RTAssertMsg2WeakV.c
ubuntu/vbox/vboxguest/common/misc/assert.c
ubuntu/vbox/vboxguest/common/misc/thread.c
ubuntu/vbox/vboxguest/common/string/RTStrCopy.c
ubuntu/vbox/vboxguest/common/string/RTStrCopyEx.c
ubuntu/vbox/vboxguest/common/string/RTStrCopyP.c
ubuntu/vbox/vboxguest/common/string/strformat.c
ubuntu/vbox/vboxguest/common/string/strformatrt.c
ubuntu/vbox/vboxguest/common/string/strformattype.c
ubuntu/vbox/vboxguest/common/string/strprintf.c
ubuntu/vbox/vboxguest/common/string/strtonum.c
ubuntu/vbox/vboxguest/common/table/avlpv.c
ubuntu/vbox/vboxguest/common/time/time.c
ubuntu/vbox/vboxguest/generic/RTAssertShouldPanic-generic.c
ubuntu/vbox/vboxguest/generic/RTLogWriteStdErr-stub-generic.c
ubuntu/vbox/vboxguest/generic/RTLogWriteStdOut-stub-generic.c
ubuntu/vbox/vboxguest/generic/RTMpGetCoreCount-generic.c
ubuntu/vbox/vboxguest/generic/RTSemEventMultiWait-2-ex-generic.c
ubuntu/vbox/vboxguest/generic/RTSemEventMultiWaitNoResume-2-ex-generic.c
ubuntu/vbox/vboxguest/generic/RTSemEventWait-2-ex-generic.c
ubuntu/vbox/vboxguest/generic/RTSemEventWaitNoResume-2-ex-generic.c
ubuntu/vbox/vboxguest/generic/errvars-generic.c
ubuntu/vbox/vboxguest/generic/mppresent-generic.c
ubuntu/vbox/vboxguest/product-generated.h
ubuntu/vbox/vboxguest/revision-generated.h
ubuntu/vbox/vboxguest/version-generated.h
ubuntu/vbox/vboxsf/GenericRequest.c
ubuntu/vbox/vboxsf/HGCM.c
ubuntu/vbox/vboxsf/Init.c
ubuntu/vbox/vboxsf/PhysHeap.c
ubuntu/vbox/vboxsf/SysHlp.c
ubuntu/vbox/vboxsf/SysHlp.h
ubuntu/vbox/vboxsf/VBGLInternal.h
ubuntu/vbox/vboxsf/VBoxGuestR0LibSharedFolders.c
ubuntu/vbox/vboxsf/VMMDev.c
ubuntu/vbox/vboxsf/dirops.c
ubuntu/vbox/vboxsf/lnkops.c
ubuntu/vbox/vboxsf/product-generated.h
ubuntu/vbox/vboxsf/regops.c
ubuntu/vbox/vboxsf/utils.c
ubuntu/vbox/vboxsf/version-generated.h
ubuntu/vbox/vboxsf/vfsmod.c
ubuntu/vbox/vboxsf/vfsmod.h
ubuntu/vbox/vboxvideo/Makefile
ubuntu/vbox/vboxvideo/product-generated.h
ubuntu/vbox/vboxvideo/vboxvideo_drm.c
ubuntu/vbox/vboxvideo/vboxvideo_drm.h
ubuntu/vbox/vboxvideo/version-generated.h

index 4198d4b9896f43d836c4ed3633c4714e6d9d3c6b..f8b2a6698286f5ba9b42a27710ef35df26e4b81e 100644 (file)
@@ -1,2 +1,2 @@
-Source: http://ports.ubuntu.com/pool/multiverse/v/virtualbox/virtualbox-guest-dkms_5.0.0-dfsg-1_all.deb
-Version: 5.0.0-dfsg-1
+Source: http://ports.ubuntu.com/pool/multiverse/v/virtualbox/virtualbox-guest-dkms_5.0.14-dfsg-2_all.deb
+Version: 5.0.14-dfsg-2
index d355f002ba56978af77b6ef1234c2f25f65606f3..5e1b19eac7f35ab320d27db2e1e7c908b903bf57 100644 (file)
 #include <VBox/VBoxGuest2.h>
 
 
-/** @defgroup grp_vboxguest     VirtualBox Guest Additions Driver Interface
+/** @defgroup grp_vboxguest  VirtualBox Guest Additions Device Driver
+ *
+ * Also know as VBoxGuest.
+ *
+ * @{
+ */
+
+/** @defgroup grp_vboxguest_ioc  VirtualBox Guest Additions Driver Interface
  * @{
  */
 
@@ -553,5 +560,6 @@ typedef VBOXGUESTOS2IDCCONNECT *PVBOXGUESTOS2IDCCONNECT;
 
 /** @} */
 
+/** @} */
 #endif
 
index 5abe726c0ff81db952299b567c289e265f1dbf21..a2032c75f547f8262217861a6eba864b4748f4fb 100644 (file)
@@ -32,6 +32,8 @@
 #ifdef VBOX_WITH_HGCM
 # include <VBox/VMMDev2.h>
 
+/** @addtogroup grp_vmmdev
+ * @{ */
 
 /**
  * HGCM connect info structure.
@@ -102,6 +104,8 @@ typedef struct VBoxGuestHGCMCallInfoTimed
 AssertCompileSize(VBoxGuestHGCMCallInfoTimed, 8+16);
 # pragma pack()
 
+/** @} */
+
 #endif /* VBOX_WITH_HGCM */
 
 #endif
index 1d3dda2a4c7ccc37a31a4b323435b58fd4b8a449..9d9c3e0471e8b86e972d3f48f60971d36c5c220e 100644 (file)
@@ -35,7 +35,8 @@
 #endif
 
 
-/** @defgroup grp_guest_lib     VirtualBox Guest Additions Library
+/** @defgroup grp_vboxguest_lib     VirtualBox Guest Additions Library
+ * @ingroup grp_vboxguest
  * @{
  */
 
 
 RT_C_DECLS_BEGIN
 
-/** @defgroup grp_guest_lib_r0     Ring-0 interface.
+/** HGCM client ID.
+ * @todo Promote to VBox/types.h  */
+typedef uint32_t HGCMCLIENTID;
+
+
+/** @defgroup grp_vboxguest_lib_r0     Ring-0 interface.
  * @{
  */
 #if defined(IN_RING0) && !defined(IN_RING0_AGNOSTIC)
@@ -92,8 +98,6 @@ RT_C_DECLS_BEGIN
 # endif
 # define DECLVBGL(type) DECLR0VBGL(type)
 
-typedef uint32_t VBGLIOPORT; /**< @todo r=bird: We have RTIOPORT (uint16_t) for this. */
-
 
 # ifdef VBGL_VBOXGUEST
 
@@ -103,7 +107,7 @@ typedef uint32_t VBGLIOPORT; /**< @todo r=bird: We have RTIOPORT (uint16_t) for
  *
  * @return VBox status code.
  */
-DECLVBGL(int) VbglInit (VBGLIOPORT portVMMDev, struct VMMDevMemory *pVMMDevMemory);
+DECLVBGL(int) VbglInitPrimary(RTIOPORT portVMMDev, struct VMMDevMemory *pVMMDevMemory);
 
 # else
 
@@ -113,14 +117,14 @@ DECLVBGL(int) VbglInit (VBGLIOPORT portVMMDev, struct VMMDevMemory *pVMMDevMemor
  *
  * @return VBox status code.
  */
-DECLVBGL(int) VbglInit (void);
+DECLVBGL(int) VbglInitClient(void);
 
 # endif
 
 /**
  * The library termination function.
  */
-DECLVBGL(void) VbglTerminate (void);
+DECLVBGL(void) VbglTerminate(void);
 
 
 /** @name Generic request functions.
@@ -130,13 +134,12 @@ DECLVBGL(void) VbglTerminate (void);
 /**
  * Allocate memory for generic request and initialize the request header.
  *
- * @param ppReq    pointer to resulting memory address.
- * @param cbSize   size of memory block required for the request.
- * @param reqType  the generic request type.
- *
- * @return VBox status code.
+ * @returns VBox status code.
+ * @param   ppReq       Where to return the pointer to the allocated memory.
+ * @param   cbReq       Size of memory block required for the request.
+ * @param   enmReqType  the generic request type.
  */
-DECLVBGL(int) VbglGRAlloc (VMMDevRequestHeader **ppReq, uint32_t cbSize, VMMDevRequestType reqType);
+DECLVBGL(int) VbglGRAlloc(VMMDevRequestHeader **ppReq, size_t cbReq, VMMDevRequestType enmReqType);
 
 /**
  * Perform the generic request.
@@ -145,7 +148,7 @@ DECLVBGL(int) VbglGRAlloc (VMMDevRequestHeader **ppReq, uint32_t cbSize, VMMDevR
  *
  * @return VBox status code.
  */
-DECLVBGL(int) VbglGRPerform (VMMDevRequestHeader *pReq);
+DECLVBGL(int) VbglGRPerform(VMMDevRequestHeader *pReq);
 
 /**
  * Free the generic request memory.
@@ -154,7 +157,7 @@ DECLVBGL(int) VbglGRPerform (VMMDevRequestHeader *pReq);
  *
  * @return VBox status code.
  */
-DECLVBGL(void) VbglGRFree (VMMDevRequestHeader *pReq);
+DECLVBGL(void) VbglGRFree(VMMDevRequestHeader *pReq);
 
 /**
  * Verify the generic request header.
@@ -166,7 +169,7 @@ DECLVBGL(void) VbglGRFree (VMMDevRequestHeader *pReq);
  *
  * @return VBox status code.
  */
-DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq);
+DECLVBGL(int) VbglGRVerify(const VMMDevRequestHeader *pReq, size_t cbReq);
 /** @} */
 
 # ifdef VBOX_WITH_HGCM
@@ -201,8 +204,8 @@ typedef FNVBGLHGCMCALLBACK *PFNVBGLHGCMCALLBACK;
  * @return  VBox status code.
  */
 
-DECLR0VBGL(int) VbglR0HGCMInternalConnect (VBoxGuestHGCMConnectInfo *pConnectInfo,
-                                           PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
+DECLR0VBGL(int) VbglR0HGCMInternalConnect(VBoxGuestHGCMConnectInfo *pConnectInfo,
+                                          PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
 
 
 /**
@@ -222,8 +225,8 @@ DECLR0VBGL(int) VbglR0HGCMInternalConnect (VBoxGuestHGCMConnectInfo *pConnectInf
  * @return  VBox status code.
  */
 
-DECLR0VBGL(int) VbglR0HGCMInternalDisconnect (VBoxGuestHGCMDisconnectInfo *pDisconnectInfo,
-                                              PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
+DECLR0VBGL(int) VbglR0HGCMInternalDisconnect(VBoxGuestHGCMDisconnectInfo *pDisconnectInfo,
+                                             PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
 
 /** Call a HGCM service.
  *
@@ -239,8 +242,8 @@ DECLR0VBGL(int) VbglR0HGCMInternalDisconnect (VBoxGuestHGCMDisconnectInfo *pDisc
  *
  * @return VBox status code.
  */
-DECLR0VBGL(int) VbglR0HGCMInternalCall (VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
-                                        PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
+DECLR0VBGL(int) VbglR0HGCMInternalCall(VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
+                                       PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
 
 /** Call a HGCM service. (32 bits packet structure in a 64 bits guest)
  *
@@ -256,8 +259,8 @@ DECLR0VBGL(int) VbglR0HGCMInternalCall (VBoxGuestHGCMCallInfo *pCallInfo, uint32
  *
  * @return  VBox status code.
  */
-DECLR0VBGL(int) VbglR0HGCMInternalCall32 (VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
-                                          PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
+DECLR0VBGL(int) VbglR0HGCMInternalCall32(VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
+                                         PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
 
 /** @name VbglR0HGCMInternalCall flags
  * @{ */
@@ -292,7 +295,7 @@ typedef struct VBGLHGCMHANDLEDATA *VBGLHGCMHANDLE;
  *
  * @return VBox status code.
  */
-DECLVBGL(int) VbglHGCMConnect (VBGLHGCMHANDLE *pHandle, VBoxGuestHGCMConnectInfo *pData);
+DECLVBGL(int) VbglHGCMConnect(VBGLHGCMHANDLE *pHandle, VBoxGuestHGCMConnectInfo *pData);
 
 /**
  * Connect to a service.
@@ -302,7 +305,7 @@ DECLVBGL(int) VbglHGCMConnect (VBGLHGCMHANDLE *pHandle, VBoxGuestHGCMConnectInfo
  *
  * @return VBox status code.
  */
-DECLVBGL(int) VbglHGCMDisconnect (VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData);
+DECLVBGL(int) VbglHGCMDisconnect(VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData);
 
 /**
  * Call to a service.
@@ -313,7 +316,7 @@ DECLVBGL(int) VbglHGCMDisconnect (VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnect
  *
  * @return VBox status code.
  */
-DECLVBGL(int) VbglHGCMCall (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
+DECLVBGL(int) VbglHGCMCall(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
 
 /**
  * Call to a service with user-mode data received by the calling driver from the User-Mode process.
@@ -325,7 +328,7 @@ DECLVBGL(int) VbglHGCMCall (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData,
  *
  * @return VBox status code.
  */
-DECLVBGL(int) VbglHGCMCallUserData (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
+DECLVBGL(int) VbglHGCMCallUserData(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
 
 /**
  * Call to a service with timeout.
@@ -337,8 +340,18 @@ DECLVBGL(int) VbglHGCMCallUserData (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo
  *
  * @return VBox status code.
  */
-DECLVBGL(int) VbglHGCMCallTimed (VBGLHGCMHANDLE handle,
-                                 VBoxGuestHGCMCallInfoTimed *pData, uint32_t cbData);
+DECLVBGL(int) VbglHGCMCallTimed(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfoTimed *pData, uint32_t cbData);
+/** @} */
+
+/** @name Undocumented helpers for talking to the Chromium OpenGL Host Service
+ * @{ */
+typedef VBGLHGCMHANDLE VBGLCRCTLHANDLE;
+DECLVBGL(int) VbglR0CrCtlCreate(VBGLCRCTLHANDLE *phCtl);
+DECLVBGL(int) VbglR0CrCtlDestroy(VBGLCRCTLHANDLE hCtl);
+DECLVBGL(int) VbglR0CrCtlConConnect(VBGLCRCTLHANDLE hCtl, HGCMCLIENTID *pidClient);
+DECLVBGL(int) VbglR0CrCtlConDisconnect(VBGLCRCTLHANDLE hCtl, HGCMCLIENTID idClient);
+DECLVBGL(int) VbglR0CrCtlConCall(VBGLCRCTLHANDLE hCtl, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo);
+DECLVBGL(int) VbglR0CrCtlConCallUserData(VBGLCRCTLHANDLE hCtl, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo);
 /** @} */
 
 #  endif /* !VBGL_VBOXGUEST */
@@ -349,67 +362,62 @@ DECLVBGL(int) VbglHGCMCallTimed (VBGLHGCMHANDLE handle,
 /**
  * Initialize the heap.
  *
- * @return VBox error code.
+ * @returns VBox status code.
  */
-DECLVBGL(int) VbglPhysHeapInit (void);
+DECLVBGL(int) VbglPhysHeapInit(void);
 
 /**
  * Shutdown the heap.
  */
-DECLVBGL(void) VbglPhysHeapTerminate (void);
-
+DECLVBGL(void) VbglPhysHeapTerminate(void);
 
 /**
  * Allocate a memory block.
  *
- * @param cbSize    Size of block to be allocated.
- * @return Virtual address of allocated memory block.
+ * @returns Virtual address of the allocated memory block.
+ * @param   cbSize    Size of block to be allocated.
  */
-DECLVBGL(void *) VbglPhysHeapAlloc (uint32_t cbSize);
+DECLVBGL(void *) VbglPhysHeapAlloc(uint32_t cbSize);
 
 /**
- * Get physical address of memory block pointed by
- * the virtual address.
+ * Get physical address of memory block pointed by the virtual address.
  *
  * @note WARNING!
  *       The function does not acquire the Heap mutex!
- *       When calling the function make sure that
- *       the pointer is a valid one and is not being
- *       deallocated.
- *       This function can NOT be used for verifying
- *       if the given pointer is a valid one allocated
- *       from the heap.
- *
+ *       When calling the function make sure that the pointer is a valid one and
+ *       is not being deallocated.  This function can NOT be used for verifying
+ *       if the given pointer is a valid one allocated from the heap.
  *
- * @param p    Virtual address of memory block.
- * @return Physical address of the memory block.
+ * @param   pv      Virtual address of memory block.
+ * @returns Physical address of the memory block.
  */
-DECLVBGL(uint32_t) VbglPhysHeapGetPhysAddr (void *p);
+DECLVBGL(uint32_t)  VbglPhysHeapGetPhysAddr(void *pv);
 
 /**
  * Free a memory block.
  *
- * @param p    Virtual address of memory block.
+ * @param   pv    Virtual address of memory block.
  */
-DECLVBGL(void) VbglPhysHeapFree (void *p);
+DECLVBGL(void)      VbglPhysHeapFree(void *pv);
 
-DECLVBGL(int) VbglQueryVMMDevMemory (VMMDevMemory **ppVMMDevMemory);
-DECLR0VBGL(bool) VbglR0CanUsePhysPageList(void);
+DECLVBGL(int)       VbglQueryVMMDevMemory(VMMDevMemory **ppVMMDevMemory);
+DECLR0VBGL(bool)    VbglR0CanUsePhysPageList(void);
 
 # ifndef VBOX_GUEST
 /** @name Mouse
  * @{ */
-DECLVBGL(int)     VbglSetMouseNotifyCallback(PFNVBOXGUESTMOUSENOTIFY pfnNotify, void *pvUser);
-DECLVBGL(int)     VbglGetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
-DECLVBGL(int)     VbglSetMouseStatus(uint32_t fFeatures);
+DECLVBGL(int)       VbglSetMouseNotifyCallback(PFNVBOXGUESTMOUSENOTIFY pfnNotify, void *pvUser);
+DECLVBGL(int)       VbglGetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
+DECLVBGL(int)       VbglSetMouseStatus(uint32_t fFeatures);
 /** @}  */
 # endif /* VBOX_GUEST */
 
 #endif /* IN_RING0 && !IN_RING0_AGNOSTIC */
+
 /** @} */
 
 
-/** @defgroup grp_guest_lib_r3     Ring-3 interface.
+/** @defgroup grp_vboxguest_lib_r3      Ring-3 interface.
  * @{
  */
 #ifdef IN_RING3
@@ -437,7 +445,8 @@ VBGLR3DECL(void)    VbglR3ClosePidFile(const char *pszPath, RTFILE hFile);
 VBGLR3DECL(int)     VbglR3SetGuestCaps(uint32_t fOr, uint32_t fNot);
 VBGLR3DECL(int)     VbglR3WaitEvent(uint32_t fMask, uint32_t cMillies, uint32_t *pfEvents);
 
-VBGLR3DECL(int)     VbglR3ReportAdditionsStatus(VBoxGuestFacilityType Facility, VBoxGuestFacilityStatus StatusCurrent, uint32_t uFlags);
+VBGLR3DECL(int)     VbglR3ReportAdditionsStatus(VBoxGuestFacilityType Facility, VBoxGuestFacilityStatus StatusCurrent,
+                                                uint32_t fFlags);
 VBGLR3DECL(int)     VbglR3GetAdditionsVersion(char **ppszVer, char **ppszVerEx, char **ppszRev);
 VBGLR3DECL(int)     VbglR3GetAdditionsInstallationPath(char **ppszPath);
 VBGLR3DECL(int)     VbglR3GetSessionId(uint64_t *pu64IdSession);
@@ -446,12 +455,12 @@ VBGLR3DECL(int)     VbglR3GetSessionId(uint64_t *pu64IdSession);
 
 /** @name Shared clipboard
  * @{ */
-VBGLR3DECL(int)     VbglR3ClipboardConnect(uint32_t *pu32ClientId);
-VBGLR3DECL(int)     VbglR3ClipboardDisconnect(uint32_t u32ClientId);
-VBGLR3DECL(int)     VbglR3ClipboardGetHostMsg(uint32_t u32ClientId, uint32_t *pMsg, uint32_t *pfFormats);
-VBGLR3DECL(int)     VbglR3ClipboardReadData(uint32_t u32ClientId, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb);
-VBGLR3DECL(int)     VbglR3ClipboardReportFormats(uint32_t u32ClientId, uint32_t fFormats);
-VBGLR3DECL(int)     VbglR3ClipboardWriteData(uint32_t u32ClientId, uint32_t fFormat, void *pv, uint32_t cb);
+VBGLR3DECL(int)     VbglR3ClipboardConnect(HGCMCLIENTID *pidClient);
+VBGLR3DECL(int)     VbglR3ClipboardDisconnect(HGCMCLIENTID idClient);
+VBGLR3DECL(int)     VbglR3ClipboardGetHostMsg(HGCMCLIENTID idClient, uint32_t *pMsg, uint32_t *pfFormats);
+VBGLR3DECL(int)     VbglR3ClipboardReadData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb);
+VBGLR3DECL(int)     VbglR3ClipboardReportFormats(HGCMCLIENTID idClient, uint32_t fFormats);
+VBGLR3DECL(int)     VbglR3ClipboardWriteData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb);
 /** @} */
 
 /** @name Seamless mode
@@ -473,42 +482,32 @@ VBGLR3DECL(int)     VbglR3SetMouseStatus(uint32_t fFeatures);
  * @{ */
 VBGLR3DECL(int)     VbglR3VideoAccelEnable(bool fEnable);
 VBGLR3DECL(int)     VbglR3VideoAccelFlush(void);
-VBGLR3DECL(int)     VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvImg, size_t cbImg);
+VBGLR3DECL(int)     VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
+                                          const void *pvImg, size_t cbImg);
 VBGLR3DECL(int)     VbglR3SetPointerShapeReq(struct VMMDevReqMousePointer *pReq);
 /** @}  */
 
 /** @name Display
  * @{ */
 /** The folder for the video mode hint unix domain socket on Unix-like guests.
- */
-/** @note This can be safely changed as all users are rebuilt in lock-step. */
-#define VBGLR3HOSTDISPSOCKETPATH "/tmp/.VBoxService"
+ * @note This can be safely changed as all users are rebuilt in lock-step. */
+#define VBGLR3HOSTDISPSOCKETPATH    "/tmp/.VBoxService"
 /** The path to the video mode hint unix domain socket on Unix-like guests. */
-#define VBGLR3HOSTDISPSOCKET     VBGLR3VIDEOMODEHINTSOCKETPATH \
-    "/VideoModeHint"
+#define VBGLR3HOSTDISPSOCKET        VBGLR3VIDEOMODEHINTSOCKETPATH "/VideoModeHint"
 
 /** The folder for saving video mode hints to between sessions. */
 #define VBGLR3HOSTDISPSAVEDMODEPATH "/var/lib/VBoxGuestAdditions"
 /** The path to the file for saving video mode hints to between sessions. */
-#define VBGLR3HOSTDISPSAVEDMODE     VBGLR3HOSTDISPSAVEDMODEPATH \
-    "/SavedVideoModes"
-
-VBGLR3DECL(int)     VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy,
-                                                  uint32_t *pcBits,
-                                                  uint32_t *piDisplay,
-                                                  uint32_t *pdx, uint32_t *pdy,
-                                                  bool *pfEnabled,
-                                                  bool *pfChangeOrigin,
-                                                  bool fAck);
+#define VBGLR3HOSTDISPSAVEDMODE     VBGLR3HOSTDISPSAVEDMODEPATH "/SavedVideoModes"
+
+VBGLR3DECL(int)     VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay,
+                                                  uint32_t *pdx, uint32_t *pdy, bool *pfEnabled, bool *pfChangeOrigin, bool fAck);
 VBGLR3DECL(bool)    VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits);
 VBGLR3DECL(int)     VbglR3VideoModeGetHighestSavedScreen(unsigned *pcScreen);
-VBGLR3DECL(int)     VbglR3SaveVideoMode(unsigned cScreen, unsigned cx,
-                                        unsigned cy, unsigned cBits, unsigned x,
-                                        unsigned y, bool fEnabled);
-VBGLR3DECL(int)     VbglR3RetrieveVideoMode(unsigned cScreen, unsigned *pcx,
-                                            unsigned *pcy, unsigned *pcBits,
-                                            unsigned *px, unsigned *py,
-                                            bool *pfEnabled);
+VBGLR3DECL(int)     VbglR3SaveVideoMode(unsigned cScreen, unsigned cx, unsigned cy, unsigned cBits,
+                                        unsigned x, unsigned y, bool fEnabled);
+VBGLR3DECL(int)     VbglR3RetrieveVideoMode(unsigned cScreen, unsigned *pcx, unsigned *pcy, unsigned *pcBits,
+                                            unsigned *px, unsigned *py, bool *pfEnabled);
 /** @}  */
 
 /** @name VM Statistics
@@ -536,37 +535,47 @@ VBGLR3DECL(int)     VbglR3WriteCoreDump(void);
 typedef struct VBGLR3GUESTPROPENUM VBGLR3GUESTPROPENUM;
 /** @todo Docs. */
 typedef VBGLR3GUESTPROPENUM *PVBGLR3GUESTPROPENUM;
-VBGLR3DECL(int)     VbglR3GuestPropConnect(uint32_t *pu32ClientId);
-VBGLR3DECL(int)     VbglR3GuestPropDisconnect(uint32_t u32ClientId);
-VBGLR3DECL(int)     VbglR3GuestPropWrite(uint32_t u32ClientId, const char *pszName, const char *pszValue, const char *pszFlags);
-VBGLR3DECL(int)     VbglR3GuestPropWriteValue(uint32_t u32ClientId, const char *pszName, const char *pszValue);
-VBGLR3DECL(int)     VbglR3GuestPropWriteValueV(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, va_list va);
-VBGLR3DECL(int)     VbglR3GuestPropWriteValueF(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, ...);
-VBGLR3DECL(int)     VbglR3GuestPropRead(uint32_t u32ClientId, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue, uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
-VBGLR3DECL(int)     VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue, uint32_t *pcchValueActual);
-VBGLR3DECL(int)     VbglR3GuestPropReadValueAlloc(uint32_t u32ClientId, const char *pszName, char **ppszValue);
+VBGLR3DECL(int)     VbglR3GuestPropConnect(uint32_t *pidClient);
+VBGLR3DECL(int)     VbglR3GuestPropDisconnect(HGCMCLIENTID idClient);
+VBGLR3DECL(int)     VbglR3GuestPropWrite(HGCMCLIENTID idClient, const char *pszName, const char *pszValue, const char *pszFlags);
+VBGLR3DECL(int)     VbglR3GuestPropWriteValue(HGCMCLIENTID idClient, const char *pszName, const char *pszValue);
+VBGLR3DECL(int)     VbglR3GuestPropWriteValueV(HGCMCLIENTID idClient, const char *pszName,
+                                               const char *pszValueFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);
+VBGLR3DECL(int)     VbglR3GuestPropWriteValueF(HGCMCLIENTID idClient, const char *pszName,
+                                               const char *pszValueFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
+VBGLR3DECL(int)     VbglR3GuestPropRead(HGCMCLIENTID idClient, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue,
+                                        uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
+VBGLR3DECL(int)     VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue,
+                                             uint32_t *pcchValueActual);
+VBGLR3DECL(int)     VbglR3GuestPropReadValueAlloc(HGCMCLIENTID idClient, const char *pszName, char **ppszValue);
 VBGLR3DECL(void)    VbglR3GuestPropReadValueFree(char *pszValue);
-VBGLR3DECL(int)     VbglR3GuestPropEnumRaw(uint32_t u32ClientId, const char *paszPatterns, char *pcBuf, uint32_t cbBuf, uint32_t *pcbBufActual);
-VBGLR3DECL(int)     VbglR3GuestPropEnum(uint32_t u32ClientId, char const * const *ppaszPatterns, uint32_t cPatterns, PVBGLR3GUESTPROPENUM *ppHandle,
-                                        char const **ppszName, char const **ppszValue, uint64_t *pu64Timestamp, char const **ppszFlags);
-VBGLR3DECL(int)     VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle, char const **ppszName, char const **ppszValue, uint64_t *pu64Timestamp,
-                                            char const **ppszFlags);
+VBGLR3DECL(int)     VbglR3GuestPropEnumRaw(HGCMCLIENTID idClient, const char *paszPatterns, char *pcBuf, uint32_t cbBuf,
+                                           uint32_t *pcbBufActual);
+VBGLR3DECL(int)     VbglR3GuestPropEnum(HGCMCLIENTID idClient, char const * const *ppaszPatterns, uint32_t cPatterns,
+                                        PVBGLR3GUESTPROPENUM *ppHandle, char const **ppszName, char const **ppszValue,
+                                        uint64_t *pu64Timestamp, char const **ppszFlags);
+VBGLR3DECL(int)     VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle, char const **ppszName, char const **ppszValue,
+                                            uint64_t *pu64Timestamp, char const **ppszFlags);
 VBGLR3DECL(void)    VbglR3GuestPropEnumFree(PVBGLR3GUESTPROPENUM pHandle);
-VBGLR3DECL(int)     VbglR3GuestPropDelete(uint32_t u32ClientId, const char *pszName);
-VBGLR3DECL(int)     VbglR3GuestPropDelSet(uint32_t u32ClientId, char const * const *papszPatterns, uint32_t cPatterns);
-VBGLR3DECL(int)     VbglR3GuestPropWait(uint32_t u32ClientId, const char *pszPatterns, void *pvBuf, uint32_t cbBuf, uint64_t u64Timestamp, uint32_t cMillies, char ** ppszName, char **ppszValue, uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
+VBGLR3DECL(int)     VbglR3GuestPropDelete(HGCMCLIENTID idClient, const char *pszName);
+VBGLR3DECL(int)     VbglR3GuestPropDelSet(HGCMCLIENTID idClient, char const * const *papszPatterns, uint32_t cPatterns);
+VBGLR3DECL(int)     VbglR3GuestPropWait(HGCMCLIENTID idClient, const char *pszPatterns, void *pvBuf, uint32_t cbBuf,
+                                        uint64_t u64Timestamp, uint32_t cMillies, char ** ppszName, char **ppszValue,
+                                        uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
 /** @}  */
 
 /** @name Guest user handling / reporting.
  * @{ */
-VBGLR3DECL(int)     VbglR3GuestUserReportState(const char *pszUser, const char *pszDomain, VBoxGuestUserState enmState, uint8_t *puDetails, uint32_t cbDetails);
+VBGLR3DECL(int)     VbglR3GuestUserReportState(const char *pszUser, const char *pszDomain, VBoxGuestUserState enmState,
+                                               uint8_t *pbDetails, uint32_t cbDetails);
 /** @}  */
 
 /** @name Host version handling
  * @{ */
-VBGLR3DECL(int)     VbglR3HostVersionCheckForUpdate(uint32_t u32ClientId, bool *pfUpdate, char **ppszHostVersion, char **ppszGuestVersion);
-VBGLR3DECL(int)     VbglR3HostVersionLastCheckedLoad(uint32_t u32ClientId, char **ppszVer);
-VBGLR3DECL(int)     VbglR3HostVersionLastCheckedStore(uint32_t u32ClientId, const char *pszVer);
+VBGLR3DECL(int)     VbglR3HostVersionCheckForUpdate(HGCMCLIENTID idClient, bool *pfUpdate, char **ppszHostVersion,
+                                                    char **ppszGuestVersion);
+VBGLR3DECL(int)     VbglR3HostVersionLastCheckedLoad(HGCMCLIENTID idClient, char **ppszVer);
+VBGLR3DECL(int)     VbglR3HostVersionLastCheckedStore(HGCMCLIENTID idClient, const char *pszVer);
 /** @}  */
 # endif /* VBOX_WITH_GUEST_PROPS defined */
 
@@ -583,16 +592,18 @@ typedef struct VBGLR3SHAREDFOLDERMAPPING
     /** Root handle. */
     uint32_t u32Root;
 } VBGLR3SHAREDFOLDERMAPPING;
-/** Pointer to a shared folder mapping information struct. */
+/** Pointer to a shared folder mapping information structure. */
 typedef VBGLR3SHAREDFOLDERMAPPING *PVBGLR3SHAREDFOLDERMAPPING;
+/** Pointer to a const shared folder mapping information structure. */
+typedef VBGLR3SHAREDFOLDERMAPPING const *PCVBGLR3SHAREDFOLDERMAPPING;
 
-VBGLR3DECL(int)     VbglR3SharedFolderConnect(uint32_t *pu32ClientId);
-VBGLR3DECL(int)     VbglR3SharedFolderDisconnect(uint32_t u32ClientId);
-VBGLR3DECL(bool)    VbglR3SharedFolderExists(uint32_t u32ClientId, const char *pszShareName);
-VBGLR3DECL(int)     VbglR3SharedFolderGetMappings(uint32_t u32ClientId, bool fAutoMountOnly,
+VBGLR3DECL(int)     VbglR3SharedFolderConnect(uint32_t *pidClient);
+VBGLR3DECL(int)     VbglR3SharedFolderDisconnect(HGCMCLIENTID idClient);
+VBGLR3DECL(bool)    VbglR3SharedFolderExists(HGCMCLIENTID idClient, const char *pszShareName);
+VBGLR3DECL(int)     VbglR3SharedFolderGetMappings(HGCMCLIENTID idClient, bool fAutoMountOnly,
                                                   PVBGLR3SHAREDFOLDERMAPPING *ppaMappings, uint32_t *pcMappings);
 VBGLR3DECL(void)    VbglR3SharedFolderFreeMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings);
-VBGLR3DECL(int)     VbglR3SharedFolderGetName(uint32_t  u32ClientId,uint32_t u32Root, char **ppszName);
+VBGLR3DECL(int)     VbglR3SharedFolderGetName(HGCMCLIENTID  idClient,uint32_t u32Root, char **ppszName);
 VBGLR3DECL(int)     VbglR3SharedFolderGetMountPrefix(char **ppszPrefix);
 VBGLR3DECL(int)     VbglR3SharedFolderGetMountDir(char **ppszDir);
 /** @}  */
@@ -629,38 +640,54 @@ typedef struct VBGLR3GUESTCTRLCMDCTX
 } VBGLR3GUESTCTRLCMDCTX, *PVBGLR3GUESTCTRLCMDCTX;
 
 /* General message handling on the guest. */
-VBGLR3DECL(int) VbglR3GuestCtrlConnect(uint32_t *puClientId);
+VBGLR3DECL(int) VbglR3GuestCtrlConnect(uint32_t *pidClient);
 VBGLR3DECL(int) VbglR3GuestCtrlDisconnect(uint32_t uClientId);
 VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId, uint32_t uValue, uint32_t uMaskAdd, uint32_t uMaskRemove);
 VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterUnset(uint32_t uClientId);
 VBGLR3DECL(int) VbglR3GuestCtrlMsgReply(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc);
-VBGLR3DECL(int) VbglR3GuestCtrlMsgReplyEx(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc, uint32_t uType, void *pvPayload, uint32_t cbPayload);
+VBGLR3DECL(int) VbglR3GuestCtrlMsgReplyEx(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc, uint32_t uType,
+                                          void *pvPayload, uint32_t cbPayload);
 VBGLR3DECL(int) VbglR3GuestCtrlMsgSkip(uint32_t uClientId);
 VBGLR3DECL(int) VbglR3GuestCtrlMsgWaitFor(uint32_t uClientId, uint32_t *puMsg, uint32_t *puNumParms);
-VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(uint32_t u32ClientId);
+VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(HGCMCLIENTID idClient);
 /* Guest session handling. */
-VBGLR3DECL(int) VbglR3GuestCtrlSessionClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uFlags);
+VBGLR3DECL(int) VbglR3GuestCtrlSessionClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t fFlags);
 VBGLR3DECL(int) VbglR3GuestCtrlSessionNotify(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uType, uint32_t uResult);
-VBGLR3DECL(int) VbglR3GuestCtrlSessionGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puProtocol, char *pszUser, uint32_t  cbUser, char *pszPassword, uint32_t  cbPassword, char *pszDomain, uint32_t cbDomain, uint32_t *puFlags, uint32_t *puSessionID);
-VBGLR3DECL(int) VbglR3GuestCtrlSessionGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puFlags, uint32_t *puSessionID);
+VBGLR3DECL(int) VbglR3GuestCtrlSessionGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puProtocol, char *pszUser, uint32_t cbUser,
+                                              char *pszPassword, uint32_t  cbPassword, char *pszDomain, uint32_t cbDomain,
+                                              uint32_t *pfFlags, uint32_t *pidSession);
+VBGLR3DECL(int) VbglR3GuestCtrlSessionGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *pfFlags, uint32_t *pidSession);
 /* Guest path handling. */
-VBGLR3DECL(int) VbglR3GuestCtrlPathGetRename(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszSource, uint32_t cbSource, char *pszDest, uint32_t cbDest, uint32_t *puFlags);
+VBGLR3DECL(int) VbglR3GuestCtrlPathGetRename(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszSource, uint32_t cbSource, char *pszDest,
+                                             uint32_t cbDest, uint32_t *pfFlags);
 /* Guest process execution. */
-VBGLR3DECL(int) VbglR3GuestCtrlProcGetStart(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszCmd, uint32_t cbCmd, uint32_t *puFlags, char *pszArgs, uint32_t cbArgs, uint32_t *puNumArgs, char *pszEnv, uint32_t *pcbEnv, uint32_t *puNumEnvVars, char *pszUser, uint32_t cbUser, char *pszPassword, uint32_t cbPassword, uint32_t *puTimeoutMS, uint32_t *puPriority, uint64_t *puAffinity, uint32_t cbAffinity, uint32_t *pcAffinity);
+VBGLR3DECL(int) VbglR3GuestCtrlProcGetStart(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszCmd, uint32_t cbCmd, uint32_t *pfFlags,
+                                            char *pszArgs, uint32_t cbArgs, uint32_t *puNumArgs, char *pszEnv, uint32_t *pcbEnv,
+                                            uint32_t *puNumEnvVars, char *pszUser, uint32_t cbUser, char *pszPassword,
+                                            uint32_t cbPassword, uint32_t *puTimeoutMS, uint32_t *puPriority,
+                                            uint64_t *puAffinity, uint32_t cbAffinity, uint32_t *pcAffinity);
 VBGLR3DECL(int) VbglR3GuestCtrlProcGetTerminate(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID);
-VBGLR3DECL(int) VbglR3GuestCtrlProcGetInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puFlags, void *pvData, uint32_t cbData, uint32_t *pcbSize);
-VBGLR3DECL(int) VbglR3GuestCtrlProcGetOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puHandle, uint32_t *puFlags);
-VBGLR3DECL(int) VbglR3GuestCtrlProcGetWaitFor(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puWaitFlags, uint32_t *puTimeoutMS);
+VBGLR3DECL(int) VbglR3GuestCtrlProcGetInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *pfFlags, void *pvData,
+                                            uint32_t cbData, uint32_t *pcbSize);
+VBGLR3DECL(int) VbglR3GuestCtrlProcGetOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puHandle, uint32_t *pfFlags);
+VBGLR3DECL(int) VbglR3GuestCtrlProcGetWaitFor(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puWaitFlags,
+                                              uint32_t *puTimeoutMS);
 /* Guest native directory handling. */
-VBGLR3DECL(int) VbglR3GuestCtrlDirGetRemove(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath, uint32_t *puFlags);
+VBGLR3DECL(int) VbglR3GuestCtrlDirGetRemove(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath, uint32_t *pfFlags);
 /* Guest native file handling. */
-VBGLR3DECL(int) VbglR3GuestCtrlFileGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszFileName, uint32_t cbFileName, char *pszOpenMode, uint32_t cbOpenMode, char *pszDisposition, uint32_t cbDisposition, char *pszSharing, uint32_t cbSharing, uint32_t *puCreationMode, uint64_t *puOffset);
+VBGLR3DECL(int) VbglR3GuestCtrlFileGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszFileName, uint32_t cbFileName, char *pszOpenMode,
+                                           uint32_t cbOpenMode, char *pszDisposition, uint32_t cbDisposition, char *pszSharing,
+                                           uint32_t cbSharing, uint32_t *puCreationMode, uint64_t *puOffset);
 VBGLR3DECL(int) VbglR3GuestCtrlFileGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
 VBGLR3DECL(int) VbglR3GuestCtrlFileGetRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *puToRead);
-VBGLR3DECL(int) VbglR3GuestCtrlFileGetReadAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *puToRead, uint64_t *puOffset);
-VBGLR3DECL(int) VbglR3GuestCtrlFileGetWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, void *pvData, uint32_t cbData, uint32_t *pcbSize);
-VBGLR3DECL(int) VbglR3GuestCtrlFileGetWriteAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, void *pvData, uint32_t cbData, uint32_t *pcbSize, uint64_t *puOffset);
-VBGLR3DECL(int) VbglR3GuestCtrlFileGetSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *puSeekMethod, uint64_t *puOffset);
+VBGLR3DECL(int) VbglR3GuestCtrlFileGetReadAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
+                                             uint32_t *puToRead, uint64_t *poffRead);
+VBGLR3DECL(int) VbglR3GuestCtrlFileGetWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
+                                            void *pvData, uint32_t cbData, uint32_t *pcbActual);
+VBGLR3DECL(int) VbglR3GuestCtrlFileGetWriteAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, void *pvData, uint32_t cbData,
+                                              uint32_t *pcbActual, uint64_t *poffWrite);
+VBGLR3DECL(int) VbglR3GuestCtrlFileGetSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
+                                           uint32_t *puSeekMethod, uint64_t *poffSeek);
 VBGLR3DECL(int) VbglR3GuestCtrlFileGetTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
 /* Guest -> Host. */
 VBGLR3DECL(int) VbglR3GuestCtrlFileCbOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uFileHandle);
@@ -670,9 +697,12 @@ VBGLR3DECL(int) VbglR3GuestCtrlFileCbRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t
 VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uWritten);
 VBGLR3DECL(int) VbglR3GuestCtrlFileCbSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t uOffActual);
 VBGLR3DECL(int) VbglR3GuestCtrlFileCbTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t uOffActual);
-VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatus(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uStatus, uint32_t uFlags, void *pvData, uint32_t cbData);
-VBGLR3DECL(int) VbglR3GuestCtrlProcCbOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uHandle, uint32_t uFlags, void *pvData, uint32_t cbData);
-VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatusInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t u32PID, uint32_t uStatus, uint32_t uFlags, uint32_t cbWritten);
+VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatus(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uStatus, uint32_t fFlags,
+                                            void *pvData, uint32_t cbData);
+VBGLR3DECL(int) VbglR3GuestCtrlProcCbOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uHandle, uint32_t fFlags,
+                                            void *pvData, uint32_t cbData);
+VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatusInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t u32PID, uint32_t uStatus,
+                                                 uint32_t fFlags, uint32_t cbWritten);
 
 /** @}  */
 # endif /* VBOX_WITH_GUEST_CONTROL defined */
@@ -702,7 +732,8 @@ VBGLR3DECL(int)     VbglR3CpuHotPlugWaitForEvent(VMMDevCpuEventType *penmEventTy
 
 /** @name Page sharing
  * @{ */
-VBGLR3DECL(int)     VbglR3RegisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64  GCBaseAddr, uint32_t cbModule, unsigned cRegions, VMMDEVSHAREDREGIONDESC *pRegions);
+VBGLR3DECL(int)     VbglR3RegisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64  GCBaseAddr, uint32_t cbModule,
+                                               unsigned cRegions, VMMDEVSHAREDREGIONDESC *pRegions);
 VBGLR3DECL(int)     VbglR3UnregisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64  GCBaseAddr, uint32_t cbModule);
 VBGLR3DECL(int)     VbglR3CheckSharedModules(void);
 VBGLR3DECL(bool)    VbglR3PageSharingIsEnabled(void);
@@ -764,10 +795,11 @@ VBGLR3DECL(int)     VbglR3DnDDisconnect(PVBGLR3GUESTDNDCMDCTX pCtx);
 VBGLR3DECL(int)     VbglR3DnDProcessNextMessage(PVBGLR3GUESTDNDCMDCTX pCtx, CPVBGLR3DNDHGCMEVENT pEvent);
 
 VBGLR3DECL(int)     VbglR3DnDHGAcknowledgeOperation(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uAction);
-VBGLR3DECL(int)     VbglR3DnDHGRequestData(PVBGLR3GUESTDNDCMDCTX pCtx, const char* pcszFormat);
+VBGLR3DECL(int)     VbglR3DnDHGRequestData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat);
 VBGLR3DECL(int)     VbglR3DnDHGSetProgress(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uStatus, uint8_t uPercent, int rcErr);
 #  ifdef VBOX_WITH_DRAG_AND_DROP_GH
-VBGLR3DECL(int)     VbglR3DnDGHAcknowledgePending(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uDefAction, uint32_t uAllActions, const char* pcszFormats);
+VBGLR3DECL(int)     VbglR3DnDGHAcknowledgePending(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uDefAction,
+                                                  uint32_t uAllActions, const char *pszFormats);
 VBGLR3DECL(int)     VbglR3DnDGHSendData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat, void *pvData, uint32_t cbData);
 VBGLR3DECL(int)     VbglR3DnDGHSendError(PVBGLR3GUESTDNDCMDCTX pCtx, int rcOp);
 #  endif /* VBOX_WITH_DRAG_AND_DROP_GH */
diff --git a/ubuntu/vbox/include/VBox/VBoxGuestLibSharedFolders.h b/ubuntu/vbox/include/VBox/VBoxGuestLibSharedFolders.h
new file mode 100644 (file)
index 0000000..6e2001e
--- /dev/null
@@ -0,0 +1,120 @@
+/* $Id: VBoxGuestLibSharedFolders.h $ */
+/** @file
+ * VBoxGuestLib - Central calls header.
+ */
+
+/*
+ * Copyright (C) 2006-2015 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.
+ */
+
+#ifndef ___VBox_VBoxGuestLibSharedFolders_h_
+#define ___VBox_VBoxGuestLibSharedFolders_h_
+
+#include <VBox/VBoxGuestLib.h>
+#include <VBox/shflsvc.h>
+
+RT_C_DECLS_BEGIN
+
+
+/** @addtogroup grp_vboxguest_lib_r0
+ * @{
+ */
+
+typedef struct VBGLSFCLIENT
+{
+    HGCMCLIENTID idClient;
+    VBGLHGCMHANDLE handle;
+} VBGLSFCLIENT;
+typedef VBGLSFCLIENT *PVBGLSFCLIENT;
+
+typedef struct VBGLSFMAP
+{
+    SHFLROOT root;
+} VBGLSFMAP, *PVBGLSFMAP;
+
+DECLVBGL(int)  VbglR0SfInit(void);
+DECLVBGL(void) VbglR0SfTerm(void);
+DECLVBGL(int)  VbglR0SfConnect(PVBGLSFCLIENT pClient);
+DECLVBGL(void) VbglR0SfDisconnect(PVBGLSFCLIENT pClient);
+
+DECLVBGL(int)  VbglR0SfQueryMappings(PVBGLSFCLIENT pClient, SHFLMAPPING paMappings[], uint32_t *pcMappings);
+
+DECLVBGL(int)  VbglR0SfQueryMapName(PVBGLSFCLIENT pClient, SHFLROOT root, SHFLSTRING *pString, uint32_t size);
+
+/**
+ * Create a new file or folder or open an existing one in a shared folder.  Proxies
+ * to vbsfCreate in the host shared folder service.
+ *
+ * @returns IPRT status code, but see note below
+ * @param   pClient      Host-guest communication connection
+ * @param   pMap         The mapping for the shared folder in which the file
+ *                       or folder is to be created
+ * @param   pParsedPath  The path of the file or folder relative to the shared
+ *                       folder
+ * @param   pCreateParms Parameters for file/folder creation.  See the
+ *                       structure description in shflsvc.h
+ * @retval  pCreateParms See the structure description in shflsvc.h
+ *
+ * @note This function reports errors as follows.  The return value is always
+ *       VINF_SUCCESS unless an exceptional condition occurs - out of
+ *       memory, invalid arguments, etc.  If the file or folder could not be
+ *       opened or created, pCreateParms->Handle will be set to
+ *       SHFL_HANDLE_NIL on return.  In this case the value in
+ *       pCreateParms->Result provides information as to why (e.g.
+ *       SHFL_FILE_EXISTS).  pCreateParms->Result is also set on success
+ *       as additional information.
+ */
+DECLVBGL(int)  VbglR0SfCreate(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms);
+
+DECLVBGL(int)  VbglR0SfClose(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE Handle);
+DECLVBGL(int)  VbglR0SfRemove(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING pParsedPath, uint32_t flags);
+DECLVBGL(int)  VbglR0SfRename(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags);
+DECLVBGL(int)  VbglR0SfFlush(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile);
+
+DECLVBGL(int)  VbglR0SfRead(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
+DECLVBGL(int)  VbglR0SfReadPageList(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer,
+                                    uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages);
+DECLVBGL(int)  VbglR0SfWrite(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset,
+                             uint32_t *pcbBuffer,  uint8_t *pBuffer, bool fLocked);
+DECLVBGL(int)  VbglR0SfWritePhysCont(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset,
+                                     uint32_t *pcbBuffer, RTCCPHYS PhysBuffer);
+DECLVBGL(int)  VbglR0SfWritePageList(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer,
+                                     uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages);
+
+DECLVBGL(int)  VbglR0SfLock(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint64_t cbSize, uint32_t fLock);
+
+DECLVBGL(int)  VbglR0SfDirInfo(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile,PSHFLSTRING ParsedPath, uint32_t flags,
+                               uint32_t index, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer, uint32_t *pcFiles);
+DECLVBGL(int)  VbglR0SfFsInfo(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint32_t flags, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer);
+
+DECLVBGL(int)  VbglR0SfMapFolder(PVBGLSFCLIENT pClient, PSHFLSTRING szFolderName, PVBGLSFMAP pMap);
+DECLVBGL(int)  VbglR0SfUnmapFolder(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap);
+DECLVBGL(int)  VbglR0SfSetUtf8(PVBGLSFCLIENT pClient);
+
+DECLVBGL(int)  VbglR0SfReadLink(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING ParsedPath, uint32_t pcbBuffer, uint8_t *pBuffer);
+DECLVBGL(int)  VbglR0SfSymlink(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING pNewPath, PSHFLSTRING pOldPath, PSHFLFSOBJINFO pBuffer);
+DECLVBGL(int)  VbglR0SfSetSymlinks(PVBGLSFCLIENT pClient);
+
+/** @} */
+
+RT_C_DECLS_END
+
+#endif
+
index 70c9acaf646acebb41084bbb9a51b13c43d0c41d..e19c9abad0613277c81ad17f4010edf53af84a30 100644 (file)
@@ -41,7 +41,7 @@ RT_C_DECLS_BEGIN
 
 /** @defgroup grp_vmmdev    VMM Device
  *
- * Note! This interface cannot be changed, it can only be extended!
+ * @note This interface cannot be changed, it can only be extended!
  *
  * @{
  */
@@ -743,6 +743,11 @@ AssertCompileSize(VBoxGuestFacilityType, 4);
 /**
  * The current guest status of a facility.
  * This needs to be kept in sync with AdditionsFacilityStatus of the Main API!
+ *
+ * @remarks r=bird: Pretty please, for future types like this, simply do a
+ *          linear allocation without any gaps.  This stuff is impossible work
+ *          efficiently with, let alone validate.  Applies to the other facility
+ *          enums too.
  */
 typedef enum
 {
index fc1b06a847f766c807636f865abd699997061b2b..63cc7b9cfa6b6e912b8dddac377d3a85e1c70750 100644 (file)
 
 #include <iprt/assert.h>
 
+
+/** @addtogroup grp_vmmdev
+ * @{
+ */
+
+
 /**
  * Seamless mode.
  *
@@ -110,5 +116,7 @@ AssertCompileSize(HGCMServiceLocation, 128+4);
 struct VMMDevReqMousePointer;
 struct VMMDevMemory;
 
+/** @} */
+
 #endif
 
index db7006add05330579ea125ec20ee2fefd10f47ed..a85b6e7d042c43d15ffa52595d688f36b40180d1 100644 (file)
 #include <iprt/cdefs.h>
 
 
+/** @defgroup VBox Common Defintions and Macros
+ * @{
+ */
+
 /** @def VBOX_WITH_STATISTICS
  * When defined all statistics will be included in the build.
  * This is enabled by default in all debug builds.
 # define VBOXDDU_DECL(type) DECLIMPORT(type) VBOXCALL
 #endif
 
+/** @} */
+
+
+/** @defgroup grp_devdrv    Device Emulations and Drivers
+ * @{ */
+/** @} */
 
 #endif
 
index a30895f852eb2a4b9be7bac8c477d844843b49e7..7ca4a5c845e7697614cdecbd26680a174e0dca43 100644 (file)
@@ -30,7 +30,7 @@
 #include <iprt/err.h>
 
 
-/** @defgroup grp_err       Error Codes
+/** @defgroup grp_err       VBox Error Codes
  * @{
  */
 
 #define VERR_EM_CANNOT_EXEC_GUEST           (-1156)
 /** Reason for leaving RC: Inject a TRPM event. */
 #define VINF_EM_RAW_INJECT_TRPM_EVENT       1157
+/** Guest tried to trigger a CPU hang.  The guest is probably up to no good. */
+#define VERR_EM_GUEST_CPU_HANG              (-1158)
 /** @} */
 
 
 #define VINF_PGM_PHYS_TLB_CATCH_WRITE           1635
 /** Catch write access and route it thru PGM. */
 #define VERR_PGM_PHYS_TLB_CATCH_WRITE           (-1635)
-/** No CR3 root shadow page table.. */
+/** No CR3 root shadow page table. */
 #define VERR_PGM_NO_CR3_SHADOW_ROOT             (-1636)
 /** Trying to free a page with an invalid Page ID. */
 #define VERR_PGM_PHYS_INVALID_PAGE_ID           (-1637)
 #define VERR_VMM_RING3_CALL_DISABLED        (-2703)
 /** The VMMR0.r0 module version does not match VBoxVMM.dll/so/dylib.
  * If you just upgraded VirtualBox, please terminate all VMs and make sure
- * VBoxNetDHCP is not running.  Then try again.  If this error persists, try
- * re-installing VirtualBox. */
+ * that neither VBoxNetDHCP nor VBoxNetNAT is running.  Then try again.
+ * If this error persists, try re-installing VirtualBox. */
 #define VERR_VMM_R0_VERSION_MISMATCH        (-2704)
 /** The VMMRC.rc module version does not match VBoxVMM.dll/so/dylib.
  * Re-install if you are a user.  Developers should make sure the build is
 #define VERR_VMM_SWITCHER_STUB              (-2715)
 /** HM returned in the wrong state. */
 #define VERR_VMM_WRONG_HM_VMCPU_STATE       (-2716)
+/** SMAP enabled, but the AC flag was found to be clear - check the kernel
+ * log for details. */
+#define VERR_VMM_SMAP_BUT_AC_CLEAR          (-2717)
 /** @} */
 
 
 #define VERR_VD_DMG_XML_PARSE_ERROR                 (-3284)
 /** Unable to locate a usable DMG file within the XAR archive. */
 #define VERR_VD_DMG_NOT_FOUND_INSIDE_XAR            (-3285)
+/** The size of the raw image is not dividable by 512 */
+#define VERR_VD_RAW_SIZE_MODULO_512                 (-3286)
+/** The size of the raw image is not dividable by 2048 */
+#define VERR_VD_RAW_SIZE_MODULO_2048                (-3287)
+/** The size of the raw optical image is too small (<= 32K) */
+#define VERR_VD_RAW_SIZE_OPTICAL_TOO_SMALL          (-3288)
+/** The size of the raw floppy image is too big (>2.88MB) */
+#define VERR_VD_RAW_SIZE_FLOPPY_TOO_BIG             (-3289)
+
 /** @} */
 
 
 #define VWRN_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED     3746
 /** A TSC-delta measurement request is currently being serviced. */
 #define VERR_SUPDRV_TSC_DELTA_MEASUREMENT_BUSY      (-3747)
+/** The process trying to open VBoxDrv is not a budding VM process (1). */
+#define VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_1        (-3748)
+/** The process trying to open VBoxDrv is not a budding VM process (2). */
+#define VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_2        (-3749)
 /** @} */
 
 
 /** Internal VMX processing error no 5. */
 #define VERR_VMX_IPE_5                              (-4027)
 /** VT-x features for all modes (SMX and non-SMX) disabled by the BIOS. */
-#define VERR_VMX_MSR_ALL_VMXON_DISABLED             (-4028)
+#define VERR_VMX_MSR_ALL_VMX_DISABLED               (-4028)
 /** VT-x features disabled by the BIOS. */
-#define VERR_VMX_MSR_VMXON_DISABLED                 (-4029)
+#define VERR_VMX_MSR_VMX_DISABLED                   (-4029)
 /** VM-Entry Controls internal cache invalid. */
 #define VERR_VMX_ENTRY_CTLS_CACHE_INVALID           (-4030)
 /** VM-Exit Controls internal cache invalid. */
 /** VM-Execution Secondary Processor-based Controls internal
  *  cache invalid. */
 #define VERR_VMX_PROC_EXEC2_CTLS_CACHE_INVALID      (-4034)
+/** Failed to set VMXON enable bit while enabling VT-x through the MSR. */
+#define VERR_VMX_MSR_VMX_ENABLE_FAILED              (-4035)
+/** Failed to enable VMXON-in-SMX bit while enabling VT-x through the MSR. */
+#define VERR_VMX_MSR_SMX_VMX_ENABLE_FAILED          (-4036)
 /** @} */
 
 
 #define VINF_DBGC_BP_NO_COMMAND                     5406
 /** Generic debugger command failure. */
 #define VERR_DBGC_COMMAND_FAILED                    (-5407)
-/** Logic bug in the DBGC code.. */
+/** Logic bug in the DBGC code. */
 #define VERR_DBGC_IPE                               (-5408)
 
 /** The lowest parse status code.   */
 #define VERR_GIM_HYPERCALL_ACCESS_DENIED            (-6311)
 /** @} */
 
+
 /** @name Main API Status Codes
  * @{
  */
 #define VERR_MAIN_CONFIG_CONSTRUCTOR_IPE            (-6401)
 /** @} */
 
+
 /** @name VBox Drag and Drop Status Codes
  * @{
  */
 /** @} */
 
 
+/** @name Audio Status Codes
+ * @{
+ */
+/** Host backend couldn't be initialized.  Happen if the audio server is not
+ *  reachable, audio hardware is not available or similar.  We should use the
+ *  NULL audio driver. */
+#define VERR_AUDIO_BACKEND_INIT_FAILED              (-6600)
+/** @} */
+
+
 /* SED-END */
 
 /** @} */
index df3e6d036fa80080b3101f6fa3db2483d39bd4f3..b823292cd62af428daf6cb8d7f0b5579524bd7c0 100644 (file)
@@ -72,7 +72,7 @@ struct VBOXHGCMCALLHANDLE_TYPEDEF;
 typedef struct VBOXHGCMCALLHANDLE_TYPEDEF *VBOXHGCMCALLHANDLE;
 
 /** Service helpers pointers table. */
-typedef struct _VBOXHGCMSVCHELPERS
+typedef struct VBOXHGCMSVCHELPERS
 {
     /** The service has processed the Call request. */
     DECLR3CALLBACKMEMBER(void, pfnCallComplete, (VBOXHGCMCALLHANDLE callHandle, int32_t rc));
@@ -354,10 +354,11 @@ typedef FNHGCMSVCEXT *PFNHGCMSVCEXT;
  */
 
 /* The structure is used in separately compiled binaries so an explicit packing is required. */
-#pragma pack(1)
-typedef struct _VBOXHGCMSVCFNTABLE
+#pragma pack(1) /** @todo r=bird: The pragma pack(1) is not at all required!! */
+typedef struct VBOXHGCMSVCFNTABLE
 {
-    /** Filled by HGCM */
+    /** @name Filled by HGCM
+     * @{ */
 
     /** Size of the structure. */
     uint32_t                 cbSize;
@@ -366,8 +367,10 @@ typedef struct _VBOXHGCMSVCFNTABLE
     uint32_t                 u32Version;
 
     PVBOXHGCMSVCHELPERS      pHelpers;
+    /** @} */
 
-    /** Filled by the service. */
+    /** @name Filled in by the service.
+     * @{ */
 
     /** Size of client information the service want to have. */
     uint32_t                 cbClient;
@@ -407,6 +410,7 @@ typedef struct _VBOXHGCMSVCFNTABLE
     /** User/instance data pointer for the service. */
     void *pvService;
 
+    /** @} */
 } VBOXHGCMSVCFNTABLE;
 #pragma pack()
 
index 97ccc577018096503c92fdfcc8db40cca8a6b334..4c5b9c179f25439b7443aa411256301ecbdda148 100644 (file)
@@ -36,7 +36,7 @@
 #include <iprt/log.h>
 
 
-/** @defgroup grp_rt_vbox_log    VirtualBox Logging
+/** @defgroup grp_rt_vbox_log    VBox Logging
  * @ingroup grp_rt_vbox
  * @{
  */
@@ -740,7 +740,7 @@ typedef enum LOGGROUP
     /** USB webcam. */
     LOG_GROUP_USB_WEBCAM,
     /** VBox Guest Additions Driver (VBoxGuest). */
-    LOG_GROUP_VBGD,
+    LOG_GROUP_VGDRV,
     /** VBox Guest Additions Library. */
     LOG_GROUP_VBGL,
     /** Generic virtual disk layer. */
@@ -1138,7 +1138,7 @@ typedef enum LOGGROUP
     "USB_MSD",      \
     "USB_REMOTE",   \
     "USB_WEBCAM",   \
-    "VBGD",         \
+    "VGDRV",        \
     "VBGL",         \
     "VD",           \
     "VD_DMG",       \
index cc02678ec6a81fad83014a1201c33e4a53748b60..186b38addf98546c5ccb1b7d6c245443d693264f 100644 (file)
@@ -599,7 +599,7 @@ typedef enum _SHFLCREATERESULT
 /** Write access requested. */
 #define SHFL_CF_ACCESS_ATTR_WRITE       (0x00020000)
 /** Read/Write access requested. */
-#define SHFL_CF_ACCESS_ATTR_READWRITE   (SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_WRITE)
+#define SHFL_CF_ACCESS_ATTR_READWRITE   (SHFL_CF_ACCESS_ATTR_READ | SHFL_CF_ACCESS_ATTR_WRITE)
 
 /** The file is opened in append mode. Ignored if SHFL_CF_ACCESS_WRITE is not set. */
 #define SHFL_CF_ACCESS_APPEND           (0x00040000)
index 9778b444d97909c1f83786b36cc5e752c7775607..dd93665303b9b24d788bd968a076f077021f8fb0 100644 (file)
@@ -30,7 +30,7 @@
 #include <iprt/types.h>
 
 
-/** @defgroup grp_types     Basic VBox Types
+/** @defgroup grp_types     VBox Basic Types
  * @{
  */
 
index b3a5e126c9f9b022116ee79f360a43b584f93379..94587b04ddcdd25f2ea2f29193503c885fd7d634 100644 (file)
@@ -261,7 +261,7 @@ DECLINLINE(void) ASMGetGDTR(PRTGDTR pGdtr)
 
 /**
  * Sets the content of the GDTR CPU register.
- * @param   pIdtr   Where to load the GDTR contents from
+ * @param   pGdtr   Where to load the GDTR contents from
  */
 #if RT_INLINE_ASM_EXTERNAL
 DECLASM(void) ASMSetGDTR(const RTGDTR *pGdtr);
@@ -596,6 +596,184 @@ DECLINLINE(void) ASMSetFlags(RTCCUINTREG uFlags)
 #endif
 
 
+/**
+ * Modifies the [RE]FLAGS register.
+ * @returns Original value.
+ * @param   fAndEfl     Flags to keep (applied first).
+ * @param   fOrEfl      Flags to be set.
+ */
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15
+DECLASM(RTCCUINTREG) ASMChangeFlags(RTCCUINTREG fAndEfl, RTCCUINTREG fOrEfl);
+#else
+DECLINLINE(RTCCUINTREG) ASMChangeFlags(RTCCUINTREG fAndEfl, RTCCUINTREG fOrEfl)
+{
+    RTCCUINTREG fOldEfl;
+# if RT_INLINE_ASM_GNU_STYLE
+#  ifdef RT_ARCH_AMD64
+    __asm__ __volatile__("pushfq\n\t"
+                         "movq  (%%rsp), %0\n\t"
+                         "andq  %0, %1\n\t"
+                         "orq   %3, %1\n\t"
+                         "mov   %1, (%%rsp)\n\t"
+                         "popfq\n\t"
+                         : "=&r" (fOldEfl),
+                           "=r" (fAndEfl)
+                         : "1" (fAndEfl),
+                           "rn" (fOrEfl) );
+#  else
+    __asm__ __volatile__("pushfl\n\t"
+                         "movl  (%%esp), %0\n\t"
+                         "andl  %1, (%%esp)\n\t"
+                         "orl   %2, (%%esp)\n\t"
+                         "popfl\n\t"
+                         : "=&r" (fOldEfl)
+                         : "rn" (fAndEfl),
+                           "rn" (fOrEfl) );
+#  endif
+# elif RT_INLINE_ASM_USES_INTRIN >= 15
+    fOldEfl = __readeflags();
+    __writeeflags((fOldEfl & fAndEfl) | fOrEfl);
+# else
+    __asm
+    {
+#  ifdef RT_ARCH_AMD64
+        mov     rdx, [fAndEfl]
+        mov     rcx, [fOrEfl]
+        pushfq
+        mov     rax, [rsp]
+        and     rdx, rax
+        or      rdx, rcx
+        mov     [rsp], rdx
+        popfq
+        mov     [fOldEfl], rax
+#  else
+        mov     edx, [fAndEfl]
+        mov     ecx, [fOrEfl]
+        pushfd
+        mov     eax, [esp]
+        and     edx, eax
+        or      edx, ecx
+        mov     [esp], edx
+        popfd
+        mov     [fOldEfl], eax
+#  endif
+    }
+# endif
+    return fOldEfl;
+}
+#endif
+
+
+/**
+ * Modifies the [RE]FLAGS register by ORing in one or more flags.
+ * @returns Original value.
+ * @param   fOrEfl      The flags to be set (ORed in).
+ */
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15
+DECLASM(RTCCUINTREG) ASMAddFlags(RTCCUINTREG fOrEfl);
+#else
+DECLINLINE(RTCCUINTREG) ASMAddFlags(RTCCUINTREG fOrEfl)
+{
+    RTCCUINTREG fOldEfl;
+# if RT_INLINE_ASM_GNU_STYLE
+#  ifdef RT_ARCH_AMD64
+    __asm__ __volatile__("pushfq\n\t"
+                         "movq  (%%rsp), %0\n\t"
+                         "orq   %1, (%%rsp)\n\t"
+                         "popfq\n\t"
+                         : "=&r" (fOldEfl)
+                         : "rn" (fOrEfl) );
+#  else
+    __asm__ __volatile__("pushfl\n\t"
+                         "movl  (%%esp), %0\n\t"
+                         "orl   %1, (%%esp)\n\t"
+                         "popfl\n\t"
+                         : "=&r" (fOldEfl)
+                         : "rn" (fOrEfl) );
+#  endif
+# elif RT_INLINE_ASM_USES_INTRIN >= 15
+    fOldEfl = __readeflags();
+    __writeeflags(fOldEfl | fOrEfl);
+# else
+    __asm
+    {
+#  ifdef RT_ARCH_AMD64
+        mov     rcx, [fOrEfl]
+        pushfq
+        mov     rdx, [rsp]
+        or      [rsp], rcx
+        popfq
+        mov     [fOldEfl], rax
+#  else
+        mov     ecx, [fOrEfl]
+        pushfd
+        mov     edx, [esp]
+        or      [esp], ecx
+        popfd
+        mov     [fOldEfl], eax
+#  endif
+    }
+# endif
+    return fOldEfl;
+}
+#endif
+
+
+/**
+ * Modifies the [RE]FLAGS register by AND'ing out one or more flags.
+ * @returns Original value.
+ * @param   fAndEfl      The flags to keep.
+ */
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15
+DECLASM(RTCCUINTREG) ASMClearFlags(RTCCUINTREG fAndEfl);
+#else
+DECLINLINE(RTCCUINTREG) ASMClearFlags(RTCCUINTREG fAndEfl)
+{
+    RTCCUINTREG fOldEfl;
+# if RT_INLINE_ASM_GNU_STYLE
+#  ifdef RT_ARCH_AMD64
+    __asm__ __volatile__("pushfq\n\t"
+                         "movq  (%%rsp), %0\n\t"
+                         "andq  %1, (%%rsp)\n\t"
+                         "popfq\n\t"
+                         : "=&r" (fOldEfl)
+                         : "rn" (fAndEfl) );
+#  else
+    __asm__ __volatile__("pushfl\n\t"
+                         "movl  (%%esp), %0\n\t"
+                         "andl  %1, (%%esp)\n\t"
+                         "popfl\n\t"
+                         : "=&r" (fOldEfl)
+                         : "rn" (fAndEfl) );
+#  endif
+# elif RT_INLINE_ASM_USES_INTRIN >= 15
+    fOldEfl = __readeflags();
+    __writeeflags(fOldEfl & fAndEfl);
+# else
+    __asm
+    {
+#  ifdef RT_ARCH_AMD64
+        mov     rdx, [fAndEfl]
+        pushfq
+        mov     rdx, [rsp]
+        and     [rsp], rdx
+        popfq
+        mov     [fOldEfl], rax
+#  else
+        mov     edx, [fAndEfl]
+        pushfd
+        mov     edx, [esp]
+        and     [esp], edx
+        popfd
+        mov     [fOldEfl], eax
+#  endif
+    }
+# endif
+    return fOldEfl;
+}
+#endif
+
+
 /**
  * Gets the content of the CPU timestamp counter register.
  *
index cc7ea3e1a5c11e4d4b96c1c8e15a58eaec6c6eca..dafc70c0d5c4e0e35a2c144d914f5de544850a82 100644 (file)
 # define RT_INLINE_ASM_GCC_4_3_X_X86 0
 #endif
 
-/** @def RT_INLINE_DONT_USE_CMPXCHG8B
+/** @def RT_INLINE_DONT_MIX_CMPXCHG8B_AND_PIC
  * i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493) screws up
  * RTSemRWRequestWrite semsemrw-lockless-generic.cpp in release builds. PIC
  * mode, x86.
@@ -4321,13 +4321,13 @@ DECLINLINE(void) ASMBitClearRange(volatile void *pvBitmap, int32_t iBitStart, in
         int iStart = iBitStart & ~31;
         int iEnd   = iBitEnd & ~31;
         if (iStart == iEnd)
-            *pu32 &= ((1 << (iBitStart & 31)) - 1) | ~((1 << (iBitEnd & 31)) - 1);
+            *pu32 &= ((1U << (iBitStart & 31)) - 1) | ~((1U << (iBitEnd & 31)) - 1);
         else
         {
             /* bits in first dword. */
             if (iBitStart & 31)
             {
-                *pu32 &= (1 << (iBitStart & 31)) - 1;
+                *pu32 &= (1U << (iBitStart & 31)) - 1;
                 pu32++;
                 iBitStart = iStart + 32;
             }
@@ -4340,7 +4340,7 @@ DECLINLINE(void) ASMBitClearRange(volatile void *pvBitmap, int32_t iBitStart, in
             if (iBitEnd & 31)
             {
                 pu32 = (volatile uint32_t *)pvBitmap + (iBitEnd >> 5);
-                *pu32 &= ~((1 << (iBitEnd & 31)) - 1);
+                *pu32 &= ~((1U << (iBitEnd & 31)) - 1);
             }
         }
     }
@@ -4362,13 +4362,13 @@ DECLINLINE(void) ASMBitSetRange(volatile void *pvBitmap, int32_t iBitStart, int3
         int iStart = iBitStart & ~31;
         int iEnd   = iBitEnd & ~31;
         if (iStart == iEnd)
-            *pu32 |= ((1 << (iBitEnd - iBitStart)) - 1) << iBitStart;
+            *pu32 |= ((1U << (iBitEnd - iBitStart)) - 1) << (iBitStart & 31);
         else
         {
             /* bits in first dword. */
             if (iBitStart & 31)
             {
-                *pu32 |= ~((1 << (iBitStart & 31)) - 1);
+                *pu32 |= ~((1U << (iBitStart & 31)) - 1);
                 pu32++;
                 iBitStart = iStart + 32;
             }
@@ -4381,7 +4381,7 @@ DECLINLINE(void) ASMBitSetRange(volatile void *pvBitmap, int32_t iBitStart, int3
             if (iBitEnd & 31)
             {
                 pu32 = (volatile uint32_t *)pvBitmap + (iBitEnd >> 5);
-                *pu32 |= (1 << (iBitEnd & 31)) - 1;
+                *pu32 |= (1U << (iBitEnd & 31)) - 1;
             }
         }
     }
index 031a3271f5a594a1b5595404a859f96c804281e8..fb7b45d87e6ca966870d130220451dd4a09175a2 100644 (file)
@@ -98,7 +98,7 @@ RTDECL(void)    RTAssertMsg1Weak(const char *pszExpr, unsigned uLine, const char
  * @param   pszFormat   Printf like format string.
  * @param   ...         Arguments to that string.
  */
-RTDECL(void)    RTAssertMsg2(const char *pszFormat, ...);
+RTDECL(void)    RTAssertMsg2(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 /**
  * Weak version of RTAssertMsg2 that forwards to RTAssertMsg2WeakV.
  *
@@ -106,7 +106,7 @@ RTDECL(void)    RTAssertMsg2(const char *pszFormat, ...);
  *
  * @copydoc RTAssertMsg2
  */
-RTDECL(void)    RTAssertMsg2Weak(const char *pszFormat, ...);
+RTDECL(void)    RTAssertMsg2Weak(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 
 /**
  * The 2nd (optional) part of an assert message.
@@ -114,14 +114,14 @@ RTDECL(void)    RTAssertMsg2Weak(const char *pszFormat, ...);
  * @param   pszFormat   Printf like format string.
  * @param   va          Arguments to that string.
  */
-RTDECL(void)    RTAssertMsg2V(const char *pszFormat, va_list va);
+RTDECL(void)    RTAssertMsg2V(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);
 /**
  * Weak version of RTAssertMsg2V that can be overridden locally in a module to
  * modify, redirect or otherwise mess with the assertion output.
  *
  * @copydoc RTAssertMsg2V
  */
-RTDECL(void)    RTAssertMsg2WeakV(const char *pszFormat, va_list va);
+RTDECL(void)    RTAssertMsg2WeakV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);
 
 /**
  * Additional information which should be appended to the 2nd part of an
@@ -130,7 +130,7 @@ RTDECL(void)    RTAssertMsg2WeakV(const char *pszFormat, va_list va);
  * @param   pszFormat   Printf like format string.
  * @param   ...         Arguments to that string.
  */
-RTDECL(void)    RTAssertMsg2Add(const char *pszFormat, ...);
+RTDECL(void)    RTAssertMsg2Add(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 /**
  * Weak version of RTAssertMsg2Add that forwards to RTAssertMsg2AddWeakV.
  *
@@ -138,7 +138,7 @@ RTDECL(void)    RTAssertMsg2Add(const char *pszFormat, ...);
  *
  * @copydoc RTAssertMsg2Add
  */
-RTDECL(void)    RTAssertMsg2AddWeak(const char *pszFormat, ...);
+RTDECL(void)    RTAssertMsg2AddWeak(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 
 /**
  * Additional information which should be appended to the 2nd part of an
@@ -147,14 +147,14 @@ RTDECL(void)    RTAssertMsg2AddWeak(const char *pszFormat, ...);
  * @param   pszFormat   Printf like format string.
  * @param   va          Arguments to that string.
  */
-RTDECL(void)    RTAssertMsg2AddV(const char *pszFormat, va_list va);
+RTDECL(void)    RTAssertMsg2AddV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);
 /**
  * Weak version of RTAssertMsg2AddV that can be overridden locally in a module
  * to modify, redirect or otherwise mess with the assertion output.
  *
  * @copydoc RTAssertMsg2AddV
  */
-RTDECL(void)    RTAssertMsg2AddWeakV(const char *pszFormat, va_list va);
+RTDECL(void)    RTAssertMsg2AddWeakV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);
 
 #ifdef IN_RING0
 /**
@@ -1589,7 +1589,7 @@ RT_C_DECLS_END
         return (rc); \
     } while (0)
 
-/** @def AssertLogRelMsgFailedReturn
+/** @def AssertLogRelMsgFailedReturnStmt
  * An assertion failed, execute @a stmt and return @a rc.
  * Strict builds will hit a breakpoint, non-strict will only do LogRel.
  *
@@ -1621,7 +1621,7 @@ RT_C_DECLS_END
         return; \
     } while (0)
 
-/** @def AssertLogRelMsgFailedReturnVoid
+/** @def AssertLogRelMsgFailedReturnVoidStmt
  * An assertion failed, execute @a stmt and return void.
  * Strict builds will hit a breakpoint, non-strict will only do LogRel.
  *
@@ -2095,7 +2095,7 @@ RT_C_DECLS_END
  */
 #define AssertRCReturn(rc, rcRet)   AssertMsgRCReturn(rc, ("%Rra\n", (rc)), rcRet)
 
-/** @def AssertRCReturn
+/** @def AssertRCReturnStmt
  * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
  * @a stmt and returns @a rcRet if it isn't.
  *
@@ -2115,7 +2115,7 @@ RT_C_DECLS_END
  */
 #define AssertRCReturnVoid(rc)      AssertMsgRCReturnVoid(rc, ("%Rra\n", (rc)))
 
-/** @def AssertReturnVoidStmt
+/** @def AssertRCReturnVoidStmt
  * Asserts a iprt status code successful, bitch (RT_STRICT mode only), and
  * execute the given statement/return if it isn't.
  *
index e99d44f482ef3bf63fdce27a60be8c5e3c94f381..629df8a84b39240b6551287c3561868d068214f1 100644 (file)
@@ -58,6 +58,8 @@
 # define __X86__
 # define RT_ARCH_AMD64
 # define RT_ARCH_X86
+# define RT_ARCH_SPARC
+# define RT_ARCH_SPARC64
 # define IN_RING0
 # define IN_RING3
 # define IN_RC
@@ -72,7 +74,7 @@
 # define RT_LOCK_NO_STRICT
 # define RT_LOCK_STRICT_ORDER
 # define RT_LOCK_NO_STRICT_ORDER
-# define Breakpoint
+# define RT_BREAKPOINT
 # define RT_NO_DEPRECATED_MACROS
 # define RT_EXCEPTIONS_ENABLED
 # define RT_BIG_ENDIAN
@@ -80,6 +82,8 @@
 # define RT_COMPILER_GROKS_64BIT_BITFIELDS
 # define RT_COMPILER_WITH_80BIT_LONG_DOUBLE
 # define RT_NO_VISIBILITY_HIDDEN
+# define RT_GCC_SUPPORTS_VISIBILITY_HIDDEN
+# define RT_COMPILER_SUPPORTS_LAMBDA
 #endif /* DOXYGEN_RUNNING */
 
 /** @def RT_ARCH_X86
  * Replace: # elif defined(RT_OS_\1)\n#  define RT_OPSYS RT_OPSYS_\1
  */
 #ifndef RT_OPSYS
-# if defined(RT_OS_UNKNOWN)
+# if defined(RT_OS_UNKNOWN) || defined(DOXYGEN_RUNNING)
 #  define RT_OPSYS RT_OPSYS_UNKNOWN
 # elif defined(RT_OS_AGNOSTIC)
 #  define RT_OPSYS RT_OPSYS_AGNOSTIC
 # define RT_EXCEPTIONS_ENABLED
 #endif
 
-/** @def RT_NO_THROW
+/** @def RT_NO_THROW_PROTO
  * How to express that a function doesn't throw C++ exceptions
  * and the compiler can thus save itself the bother of trying
  * to catch any of them. Put this between the closing parenthesis
  * and the semicolon in function prototypes (and implementation if C++).
+ *
+ * @remarks May not work on C++ methods, mainly intented for C-style APIs.
+ *
+ * @remarks The use of the nothrow attribute with GCC is because old compilers
+ *          (4.1.1, 32-bit) leaking the nothrow into global space or something
+ *          when used with RTDECL or similar.  Using this forces use to have two
+ *          macros, as the nothrow attribute is not for the function definition.
  */
 #ifdef RT_EXCEPTIONS_ENABLED
-# define RT_NO_THROW            throw()
+# ifdef __GNUC__
+#  define RT_NO_THROW_PROTO     __attribute__((__nothrow__))
+# else
+#  define RT_NO_THROW_PROTO     throw()
+# endif
+#else
+# define RT_NO_THROW_PROTO
+#endif
+
+/** @def RT_NO_THROW_DEF
+ * The counter part to RT_NO_THROW_PROTO that is added to the function
+ * definition.
+ */
+#if defined(RT_EXCEPTIONS_ENABLED) && !defined(__GNUC__)
+# define RT_NO_THROW_DEF        RT_NO_THROW_PROTO
 #else
-# define RT_NO_THROW
+# define RT_NO_THROW_DEF
 #endif
 
 /** @def RT_THROW
 # define RT_THROW(type)
 #endif
 
+/** @def RT_IPRT_FORMAT_ATTR
+ * Identifies a function taking an IPRT format string.
+ * @param   a_iFmt  The index (1-based) of the format string argument.
+ * @param   a_iArgs The index (1-based) of the first format argument, use 0 for
+ *                  va_list.
+ */
+#if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)
+# define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs)   __attribute__((__iprt_format__(a_iFmt, a_iArgs)))
+#else
+# define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs)
+#endif
+
+/** @def RT_IPRT_FORMAT_ATTR_MAYBE_NULL
+ * Identifies a function taking an IPRT format string, NULL is allowed.
+ * @param   a_iFmt  The index (1-based) of the format string argument.
+ * @param   a_iArgs The index (1-based) of the first format argument, use 0 for
+ *                  va_list.
+ */
+#if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)
+# define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs)   __attribute__((__iprt_format_maybe_null__(a_iFmt, a_iArgs)))
+#else
+# define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs)
+#endif
+
+
 /** @def RT_GCC_SUPPORTS_VISIBILITY_HIDDEN
  * Indicates that the "hidden" visibility attribute can be used (GCC) */
 #if defined(__GNUC__)
 
 /** @def RTCALL
  * The standard calling convention for the Runtime interfaces.
+ *
+ * @remarks The regparm(0) in the X86/GNUC variant deals with -mregparm=x use in
+ *          the linux kernel and potentially elsewhere (3rd party).
  */
 #ifdef _MSC_VER
-# define RTCALL     __cdecl
+# define RTCALL                 __cdecl
 #elif defined(RT_OS_OS2)
-# define RTCALL     __cdecl
-#elif defined(__GNUC__) && defined(IN_RING0) && defined(RT_ARCH_X86) /** @todo consider dropping IN_RING0 here. */
-# define RTCALL     __attribute__((cdecl,regparm(0))) /* regparm(0) deals with -mregparm=x use in the linux kernel. */
+# define RTCALL                 __cdecl
+#elif defined(__GNUC__) && defined(RT_ARCH_X86)
+# define RTCALL                 __attribute__((cdecl,regparm(0)))
 #else
 # define RTCALL
 #endif
  * @param   type    The return type of the function declaration.
  */
 #ifdef __cplusplus
-# if defined(_MSC_VER) || defined(RT_OS_OS2)
-#  define DECLASM(type)          extern "C" type __cdecl
-# elif defined(__GNUC__) && defined(RT_ARCH_X86)
-#  define DECLASM(type)          extern "C" type __attribute__((cdecl,regparm(0)))
-# else
-#  define DECLASM(type)          extern "C" type
-# endif
+# define DECLASM(type)           extern "C" type RTCALL
 #else
-# if defined(_MSC_VER) || defined(RT_OS_OS2)
-#  define DECLASM(type)          type __cdecl
-# elif defined(__GNUC__) && defined(RT_ARCH_X86)
-#  define DECLASM(type)          type __attribute__((cdecl,regparm(0)))
-# else
-#  define DECLASM(type)          type
-# endif
+# define DECLASM(type)           type RTCALL
 #endif
 
 /** @def DECLASMTYPE
  * How to declare an internal assembly function type.
  * @param   type    The return type of the function.
  */
-# if defined(_MSC_VER) || defined(RT_OS_OS2)
-# define DECLASMTYPE(type)      type __cdecl
-#else
-# define DECLASMTYPE(type)      type
-#endif
+#define DECLASMTYPE(type)       type RTCALL
 
 /** @def DECLNORETURN
  * How to declare a function which does not return.
 #define RT_STR(str)             #str
 /** @def RT_XSTR
  * Returns the expanded argument as a string.
- * @param   str     Argument to expand and stringy. */
+ * @param   str     Argument to expand and stringify. */
 #define RT_XSTR(str)            RT_STR(str)
 
+/** @def RT_LSTR_2
+ * Helper for RT_WSTR that gets the expanded @a str.
+ * @param   str     String litteral to prefix with 'L'.  */
+#define RT_LSTR_2(str)          L##str
+/** @def RT_LSTR
+ * Returns the expanded argument with a L string prefix.
+ *
+ * Intended for converting ASCII string \#defines into wide char string
+ * litterals on Windows.
+ *
+ * @param   str     String litteral to . */
+#define RT_LSTR(str)            RT_LSTR_2(str)
+
 /** @def RT_CONCAT
  * Concatenate the expanded arguments without any extra spaces in between.
  *
 /** RT_CONCAT helper, don't use.  */
 #define RT_CONCAT_HLP(a,b)          a##b
 
-/** @def RT_CONCAT
+/** @def RT_CONCAT3
  * Concatenate the expanded arguments without any extra spaces in between.
  *
  * @param   a       The 1st part.
 /** RT_CONCAT3 helper, don't use.  */
 #define RT_CONCAT3_HLP(a,b,c)       a##b##c
 
-/** @def RT_CONCAT
+/** @def RT_CONCAT4
  * Concatenate the expanded arguments without any extra spaces in between.
  *
  * @param   a       The 1st part.
  * @param   b       The 2nd part.
  * @param   c       The 3rd part.
+ * @param   d       The 4th part.
  */
 #define RT_CONCAT4(a,b,c,d)         RT_CONCAT4_HLP(a,b,c,d)
 /** RT_CONCAT4 helper, don't use.  */
  * String constant tuple - string constant, strlen(string constant).
  *
  * @param   a_szConst   String constant.
+ * @sa      RTSTRTUPLE
  */
 #define RT_STR_TUPLE(a_szConst)  a_szConst, (sizeof(a_szConst) - 1)
 
index 9a0edf171b5637671f6870ef28a2e18ace239eaf..d566af4cc9722c74abc60330941f6283d877c870 100644 (file)
@@ -505,7 +505,7 @@ RTDECL(int)         RTErrInfoSet(PRTERRINFO pErrInfo, int rc, const char *pszMsg
  * @param   pszFormat           The format string.
  * @param   ...                 The format arguments.
  */
-RTDECL(int)         RTErrInfoSetF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...);
+RTDECL(int)         RTErrInfoSetF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
 
 /**
  * Fills in the error info details, with a vsprintf style message.
@@ -517,7 +517,7 @@ RTDECL(int)         RTErrInfoSetF(PRTERRINFO pErrInfo, int rc, const char *pszFo
  * @param   pszFormat           The format string.
  * @param   va                  The format arguments.
  */
-RTDECL(int)         RTErrInfoSetV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va);
+RTDECL(int)         RTErrInfoSetV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);
 
 /**
  * Adds more error info details.
@@ -540,7 +540,7 @@ RTDECL(int)         RTErrInfoAdd(PRTERRINFO pErrInfo, int rc, const char *pszMsg
  * @param   pszFormat           The format string to add.
  * @param   ...                 The format arguments.
  */
-RTDECL(int)         RTErrInfoAddF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...);
+RTDECL(int)         RTErrInfoAddF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
 
 /**
  * Adds more error info details, with a vsprintf style message.
@@ -552,7 +552,7 @@ RTDECL(int)         RTErrInfoAddF(PRTERRINFO pErrInfo, int rc, const char *pszFo
  * @param   pszFormat           The format string to add.
  * @param   va                  The format arguments.
  */
-RTDECL(int)         RTErrInfoAddV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va);
+RTDECL(int)         RTErrInfoAddV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);
 
 /**
  * Checks if the error info is set.
@@ -936,6 +936,20 @@ RT_C_DECLS_END
 #define VERR_MISMATCH                       (-22408)
 /** Wrong type. */
 #define VERR_WRONG_TYPE                     (-22409)
+/** This indicates that the process does not have sufficient privileges to
+ * perform the operation. */
+#define VERR_PRIVILEGE_NOT_HELD             (-22410)
+/** Process does not have the trusted code base (TCB) privilege needed for user
+ * authentication or/and process creation as a given user.  TCB is also called
+ * 'Act as part of the operating system'. */
+#define VERR_PROC_TCB_PRIV_NOT_HELD         (-22411)
+/** Process does not have the assign primary token (APT) privilege needed
+ * for creating process as a given user.  APT is also called 'Replace a process
+ * level token'. */
+#define VERR_PROC_APT_PRIV_NOT_HELD         (-22412)
+/** Process does not have the increase quota (IQ) privilege needed for
+ * creating a process as a given user. IQ is also called 'Increase quotas'. */
+#define VERR_PROC_IQ_PRIV_NOT_HELD          (-22413)
 /** @} */
 
 
@@ -1691,6 +1705,14 @@ RT_C_DECLS_END
 #define VERR_HTTP_ABORTED                       (-893)
 /** Request was redirected. */
 #define VERR_HTTP_REDIRECTED                    (-894)
+/** Proxy couldn't be resolved. */
+#define VERR_HTTP_PROXY_NOT_FOUND               (-895)
+/** The remote host couldn't be resolved. */
+#define VERR_HTTP_HOST_NOT_FOUND                (-896)
+/** Unexpected cURL error configure the proxy. */
+#define VERR_HTTP_CURL_PROXY_CONFIG             (-897)
+/** Generic CURL error. */
+#define VERR_HTTP_CURL_ERROR                    (-899)
 /** @} */
 
 /** @name RTManifest status codes
@@ -2475,12 +2497,50 @@ RT_C_DECLS_END
 
 /** @name RTCrDigest status codes.
  * @{ */
-/** OpenSSL failed to initialize the digest algorithm contextn. */
+/** OpenSSL failed to initialize the digest algorithm context. */
 #define VERR_CR_DIGEST_OSSL_DIGEST_INIT_ERROR       (-24200)
 /** OpenSSL failed to clone the digest algorithm context. */
 #define VERR_CR_DIGEST_OSSL_DIGEST_CTX_COPY_ERROR   (-24201)
 /** @} */
 
+/** @name RTPath  status codes.
+ * @{ */
+/** Unknown glob variable.  */
+#define VERR_PATH_MATCH_UNKNOWN_VARIABLE            (-24400)
+/** The specified glob variable must be first in the pattern. */
+#define VERR_PATH_MATCH_VARIABLE_MUST_BE_FIRST      (-24401)
+/** Hit unimplemented glob pattern matching feature.  */
+#define VERR_PATH_MATCH_FEATURE_NOT_IMPLEMENTED     (-24402)
+/** Unknown character class in glob pattern.   */
+#define VERR_PATH_GLOB_UNKNOWN_CHAR_CLASS           (-24403)
+/** @} */
+
+/** @name RTUri status codes.
+ * @{ */
+/** The URI is empty */
+#define VERR_URI_EMPTY                              (-24600)
+/** The URI is too short to be a valid URI. */
+#define VERR_URI_TOO_SHORT                          (-24601)
+/** Invalid scheme.  */
+#define VERR_URI_INVALID_SCHEME                     (-24602)
+/** Invalid port number.  */
+#define VERR_URI_INVALID_PORT_NUMBER                (-24603)
+/** Invalid escape sequence.  */
+#define VERR_URI_INVALID_ESCAPE_SEQ                 (-24604)
+/** Escape URI char decodes as zero (the C string terminator). */
+#define VERR_URI_ESCAPED_ZERO                       (-24605)
+/** Escaped URI characters does not decode to valid UTF-8. */
+#define VERR_URI_ESCAPED_CHARS_NOT_VALID_UTF8       (-24606)
+/** Escaped URI character is not a valid UTF-8 lead byte. */
+#define VERR_URI_INVALID_ESCAPED_UTF8_LEAD_BYTE     (-24607)
+/** Escaped URI character sequence with invalid UTF-8 continutation byte. */
+#define VERR_URI_INVALID_ESCAPED_UTF8_CONTINUATION_BYTE (-24608)
+/** Missing UTF-8 continutation in escaped URI character sequence. */
+#define VERR_URI_MISSING_UTF8_CONTINUATION_BYTE     (-24609)
+/** Expected URI using the 'file:' scheme. */
+#define VERR_URI_NOT_FILE_SCHEME                    (-24610)
+/** @} */
+
 /* SED-END */
 
 /** @} */
index 7b720be79af041f7650f8c93b4430da3a0d147a1..8220ce6edfa9dcfff4a9c23f1597de03072a8c4d 100644 (file)
@@ -116,6 +116,8 @@ RT_C_DECLS_BEGIN
 #define RTFS_TYPE_WHITEOUT          0160000U
 /** Type mask (S_IFMT). */
 #define RTFS_TYPE_MASK              0170000U
+/** The shift count to convert between RTFS_TYPE_MASK and DIRENTRYTYPE. */
+#define RTFS_TYPE_DIRENTRYTYPE_SHIFT    12
 
 /** Unix attribute mask. */
 #define RTFS_UNIX_MASK              0xffffU
@@ -592,6 +594,17 @@ typedef RTFSPROPERTIES const *PCRTFSPROPERTIES;
  */
 RTR3DECL(int) RTFsQueryProperties(const char *pszFsPath, PRTFSPROPERTIES pProperties);
 
+/**
+ * Checks if the given volume is case sensitive or not.
+ *
+ * This may be misleading in some cases as we lack the necessary APIs to query
+ * the information on some system (or choose not to use them) and are instead
+ * returning the general position on case sensitive file name of the system.
+ *
+ * @returns @c true if case sensitive, @c false if not.
+ * @param   pszFsPath       Path within the mounted file system.
+ */
+RTR3DECL(bool) RTFsIsCaseSensitive(const char *pszFsPath);
 
 /**
  * Mountpoint enumerator callback.
index a4ebcdcdb598f18b4038a7ffd73090382cf1a019..799c586823c3104be037dc87dc1ca612a3711f55 100644 (file)
@@ -180,7 +180,7 @@ RTDECL(size_t) RTHeapSimpleGetFreeSize(RTHEAPSIMPLE Heap);
  * @param   pszFormat   IPRT format string.
  * @param   ...         Format arguments.
  */
-typedef DECLCALLBACK(void) FNRTHEAPSIMPLEPRINTF(const char *pszFormat, ...);
+typedef DECLCALLBACK(void) FNRTHEAPSIMPLEPRINTF(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 /** Pointer to a FNRTHEAPSIMPLEPRINTF function. */
 typedef FNRTHEAPSIMPLEPRINTF *PFNRTHEAPSIMPLEPRINTF;
 
@@ -335,7 +335,7 @@ RTDECL(size_t) RTHeapOffsetGetFreeSize(RTHEAPOFFSET hHeap);
  * @param   pszFormat   IPRT format string.
  * @param   ...         Format arguments.
  */
-typedef DECLCALLBACK(void) FNRTHEAPOFFSETPRINTF(const char *pszFormat, ...);
+typedef DECLCALLBACK(void) FNRTHEAPOFFSETPRINTF(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 /** Pointer to a FNRTHEAPOFFSETPRINTF function. */
 typedef FNRTHEAPOFFSETPRINTF *PFNRTHEAPOFFSETPRINTF;
 
index e87e1f2da1c07b85a97a9a986b3269e383c288c9..f0129d5db2e5ac1f786511bde47b4b61253029b9 100644 (file)
@@ -35,7 +35,13 @@ RT_C_DECLS_BEGIN
  * @{
  */
 
-/** @defgroup grp_rt_initterm  Init / Term
+/** @defgroup grp_rt_initterm  RTInit/RTTerm - Initialization and Termination
+ *
+ * APIs for initializing and terminating the IPRT, optionally it can also
+ * convert input arguments to UTF-8 (in ring-3).
+ *
+ * @sa RTOnce, RTOnceEx.
+ *
  * @{
  */
 
@@ -50,6 +56,9 @@ RT_C_DECLS_BEGIN
 #define RTR3INIT_FLAGS_UNOBTRUSIVE  RT_BIT(2)
 /** The caller ensures that the argument bector is UTF-8. */
 #define RTR3INIT_FLAGS_UTF8_ARGV    RT_BIT(3)
+/** Indicates that this is a standalone application without any additional
+ * shared libraries in the application directory. Mainly windows loader mess. */
+#define RTR3INIT_FLAGS_STANDALONE_APP RT_BIT(4)
 /** @} */
 
 /** @name RTR3InitEx version
@@ -76,7 +85,7 @@ RTR3DECL(int) RTR3InitExeNoArguments(uint32_t fFlags);
  * @param   ppapszArgs      Pointer to the argument vector pointer.
  * @param   fFlags          Flags, see RTR3INIT_XXX.
  */
-RTR3DECL(int) RTR3InitExe(int cArgs, char ***papszArgs, uint32_t fFlags);
+RTR3DECL(int) RTR3InitExe(int cArgs, char ***ppapszArgs, uint32_t fFlags);
 
 /**
  * Initializes the runtime library.
@@ -100,7 +109,7 @@ RTR3DECL(int) RTR3InitDll(uint32_t fFlags);
  * @param   pszProgramPath  The program path.  Pass NULL if we're to figure it
  *                          out ourselves.
  */
-RTR3DECL(int) RTR3InitEx(uint32_t iVersion, uint32_t fFlags, int cArgs, char ***papszArgs, const char *pszProgramPath);
+RTR3DECL(int) RTR3InitEx(uint32_t iVersion, uint32_t fFlags, int cArgs, char ***ppapszArgs, const char *pszProgramPath);
 
 /**
  * Terminates the runtime library.
diff --git a/ubuntu/vbox/include/iprt/latin1.h b/ubuntu/vbox/include/iprt/latin1.h
new file mode 100644 (file)
index 0000000..d3ccfdf
--- /dev/null
@@ -0,0 +1,392 @@
+/** @file
+ * IPRT - String Manipulation, Latin-1 (ISO-8859-1) encoding.
+ */
+
+/*
+ * Copyright (C) 2006-2015 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.
+ */
+
+#ifndef ___iprt_latin1_h
+#define ___iprt_latin1_h
+
+#include <iprt/string.h>
+
+RT_C_DECLS_BEGIN
+
+
+/** @defgroup rt_str_latin1     Latin-1 (ISO-8859-1) String Manipulation
+ * @ingroup grp_rt_str
+ *
+ * Deals with Latin-1 encoded strings.
+ *
+ * @warning Make sure to name all variables dealing with Latin-1 strings
+ *          suchthat there is no way to mistake them for normal UTF-8 strings.
+ *          There may be severe security issues resulting from mistaking Latin-1
+ *          for UTF-8!
+ *
+ * @{
+ */
+
+/**
+ * Get the unicode code point at the given string position.
+ *
+ * @returns unicode code point.
+ * @returns RTUNICP_INVALID if the encoding is invalid.
+ * @param   pszLatin1   The Latin-1 string.
+ */
+DECLINLINE(RTUNICP) RTLatin1GetCp(const char *pszLatin1)
+{
+    return *(const unsigned char *)pszLatin1;
+}
+
+/**
+ * Get the unicode code point at the given string position.
+ *
+ * @returns iprt status code.
+ * @param   ppszLatin1  Pointer to the string pointer. This will be updated to
+ *                      point to the char following the current code point. This
+ *                      is advanced one character forward on failure.
+ * @param   pCp         Where to store the code point. RTUNICP_INVALID is stored
+ *                      here on failure.
+ */
+DECLINLINE(int) RTLatin1GetCpEx(const char **ppszLatin1, PRTUNICP pCp)
+{
+    const unsigned char uch = **(const unsigned char **)ppszLatin1;
+    (*ppszLatin1)++;
+    *pCp = uch;
+    return VINF_SUCCESS;
+}
+
+/**
+ * Get the unicode code point at the given string position for a string of a
+ * given maximum length.
+ *
+ * @returns iprt status code.
+ * @retval  VERR_END_OF_STRING if *pcch is 0. *pCp is set to RTUNICP_INVALID.
+ *
+ * @param   ppszLatin1  Pointer to the string pointer. This will be updated to
+ *                      point to the char following the current code point.
+ * @param   pcchLatin1  Pointer to the maximum string length.  This will be
+ *                      decremented by the size of the code point found.
+ * @param   pCp         Where to store the code point.
+ *                      RTUNICP_INVALID is stored here on failure.
+ */
+DECLINLINE(int) RTLatin1GetCpNEx(const char **ppszLatin1, size_t *pcchLatin1, PRTUNICP pCp)
+{
+    if (RT_LIKELY(*pcchLatin1 != 0))
+    {
+        const unsigned char uch = **(const unsigned char **)ppszLatin1;
+        (*ppszLatin1)++;
+        (*pcchLatin1)--;
+        *pCp = uch;
+        return VINF_SUCCESS;
+    }
+    *pCp = RTUNICP_INVALID;
+    return VERR_END_OF_STRING;
+}
+
+/**
+ * Get the Latin-1 size in characters of a given Unicode code point.
+ *
+ * The code point is expected to be a valid Unicode one, but not necessarily in
+ * the range supported by Latin-1.
+ *
+ * @returns the size in characters, or zero if there is no Latin-1 encoding
+ */
+DECLINLINE(size_t) RTLatin1CpSize(RTUNICP CodePoint)
+{
+    if (CodePoint < 0x100)
+        return 1;
+    return 0;
+}
+
+/**
+ * Put the unicode code point at the given string position
+ * and return the pointer to the char following it.
+ *
+ * This function will not consider anything at or following the
+ * buffer area pointed to by psz. It is therefore not suitable for
+ * inserting code points into a string, only appending/overwriting.
+ *
+ * @returns pointer to the char following the written code point.
+ * @param   pszLatin1   The string.
+ * @param   CodePoint   The code point to write.
+ *                      This should not be RTUNICP_INVALID or any other
+ *                      character out of the Latin-1 range.
+ */
+DECLINLINE(char *) RTLatin1PutCp(char *pszLatin1, RTUNICP CodePoint)
+{
+    AssertReturn(CodePoint < 0x100, NULL);
+    *pszLatin1++ = (unsigned char)CodePoint;
+    return pszLatin1;
+}
+
+/**
+ * Skips ahead, past the current code point.
+ *
+ * @returns Pointer to the char after the current code point.
+ * @param   pszLatin1   Pointer to the current code point.
+ * @remark  This will not move the next valid code point, only past the current one.
+ */
+DECLINLINE(char *) RTLatin1NextCp(const char *pszLatin1)
+{
+    pszLatin1++;
+    return (char *)pszLatin1;
+}
+
+/**
+ * Skips back to the previous code point.
+ *
+ * @returns Pointer to the char before the current code point.
+ * @returns pszLatin1Start on failure.
+ * @param   pszLatin1Start  Pointer to the start of the string.
+ * @param   pszLatin1       Pointer to the current code point.
+ */
+DECLINLINE(char *) RTLatin1PrevCp(const char *pszLatin1Start, const char *pszLatin1)
+{
+    if ((uintptr_t)pszLatin1 > (uintptr_t)pszLatin1Start)
+    {
+        pszLatin1--;
+        return (char *)pszLatin1;
+    }
+    return (char *)pszLatin1Start;
+}
+
+/**
+ * Translate a Latin1 string into a UTF-8 allocating the result buffer (default
+ * tag).
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1       Latin1 string to convert.
+ * @param   ppszString      Receives pointer of allocated UTF-8 string on
+ *                          success, and is always set to NULL on failure.
+ *                          The returned pointer must be freed using RTStrFree().
+ */
+#define RTLatin1ToUtf8(pszLatin1, ppszString)       RTLatin1ToUtf8Tag((pszLatin1), (ppszString), RTSTR_TAG)
+
+/**
+ * Translate a Latin-1 string into a UTF-8 allocating the result buffer.
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1       Latin-1 string to convert.
+ * @param   ppszString      Receives pointer of allocated UTF-8 string on
+ *                          success, and is always set to NULL on failure.
+ *                          The returned pointer must be freed using RTStrFree().
+ * @param   pszTag          Allocation tag used for statistics and such.
+ */
+RTDECL(int)  RTLatin1ToUtf8Tag(const char *pszLatin1, char **ppszString, const char *pszTag);
+
+/**
+ * Translates Latin-1 to UTF-8 using buffer provided by the caller or a fittingly
+ * sized buffer allocated by the function (default tag).
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1       The Latin-1 string to convert.
+ * @param   cchLatin1       The number of Latin-1 characters to translate from
+ *                          pszLatin1. The translation will stop when reaching
+ *                          cchLatin1 or the terminator ('\\0').  Use RTSTR_MAX
+ *                          to translate the entire string.
+ * @param   ppsz            If @a cch is non-zero, this must either be pointing
+ *                          to a pointer to a buffer of the specified size, or
+ *                          pointer to a NULL pointer.  If *ppsz is NULL or
+ *                          @a cch is zero a buffer of at least @a cch chars
+ *                          will be allocated to hold the translated string. If
+ *                          a buffer was requested it must be freed using
+ *                          RTStrFree().
+ * @param   cch             The buffer size in chars (the type). This includes the terminator.
+ * @param   pcch            Where to store the length of the translated string,
+ *                          excluding the terminator. (Optional)
+ *
+ *                          This may be set under some error conditions,
+ *                          however, only for VERR_BUFFER_OVERFLOW and
+ *                          VERR_NO_STR_MEMORY will it contain a valid string
+ *                          length that can be used to resize the buffer.
+ */
+#define RTLatin1ToUtf8Ex(pszLatin1, cchLatin1, ppsz, cch, pcch) \
+    RTLatin1ToUtf8ExTag((pszLatin1), (cchLatin1), (ppsz), (cch), (pcch), RTSTR_TAG)
+
+/**
+ * Translates Latin1 to UTF-8 using buffer provided by the caller or a fittingly
+ * sized buffer allocated by the function (custom tag).
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1       The Latin1 string to convert.
+ * @param   cchLatin1       The number of Latin1 characters to translate from
+ *                          pwszString.  The translation will stop when
+ *                          reaching cchLatin1 or the terminator ('\\0').  Use
+ *                          RTSTR_MAX to translate the entire string.
+ * @param   ppsz            If cch is non-zero, this must either be pointing to
+ *                          a pointer to a buffer of the specified size, or
+ *                          pointer to a NULL pointer.  If *ppsz is NULL or cch
+ *                          is zero a buffer of at least cch chars will be
+ *                          allocated to hold the translated string.  If a
+ *                          buffer was requested it must be freed using
+ *                          RTStrFree().
+ * @param   cch             The buffer size in chars (the type).  This includes
+ *                          the terminator.
+ * @param   pcch            Where to store the length of the translated string,
+ *                          excluding the terminator. (Optional)
+ *
+ *                          This may be set under some error conditions,
+ *                          however, only for VERR_BUFFER_OVERFLOW and
+ *                          VERR_NO_STR_MEMORY will it contain a valid string
+ *                          length that can be used to resize the buffer.
+ * @param   pszTag          Allocation tag used for statistics and such.
+ */
+RTDECL(int)  RTLatin1ToUtf8ExTag(const char *pszLatin1, size_t cchLatin1, char **ppsz, size_t cch, size_t *pcch,
+                                 const char *pszTag);
+
+/**
+ * Calculates the length of the Latin-1 string in UTF-8 chars (bytes).
+ *
+ * The primary purpose of this function is to help allocate buffers for
+ * RTLatin1ToUtf8() of the correct size. For most other purposes
+ * RTLatin1ToUtf8Ex() should be used.
+ *
+ * @returns Number of chars (bytes).
+ * @returns 0 if the string was incorrectly encoded.
+ * @param   pszLatin1     The Latin-1 string.
+ */
+RTDECL(size_t) RTLatin1CalcUtf8Len(const char *pszLatin1);
+
+/**
+ * Calculates the length of the Latin-1 string in UTF-8 chars (bytes).
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1   The Latin-1 string.
+ * @param   cchLatin1   The max string length. Use RTSTR_MAX to process the
+ *                      entire string.
+ * @param   pcch        Where to store the string length (in bytes).  Optional.
+ *                      This is undefined on failure.
+ */
+RTDECL(int) RTLatin1CalcUtf8LenEx(const char *pszLatin1, size_t cchLatin1, size_t *pcch);
+
+/**
+ * Calculates the length of the Latin-1 (ISO-8859-1) string in RTUTF16 items.
+ *
+ * @returns Number of RTUTF16 items.
+ * @param   pszLatin1       The Latin-1 string.
+ */
+RTDECL(size_t) RTLatin1CalcUtf16Len(const char *pszLatin1);
+
+/**
+ * Calculates the length of the Latin-1 (ISO-8859-1) string in RTUTF16 items.
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1       The Latin-1 string.
+ * @param   cchLatin1       The max string length. Use RTSTR_MAX to process the
+ *                          entire string.
+ * @param   pcwc            Where to store the string length. Optional.
+ *                          This is undefined on failure.
+ */
+RTDECL(int) RTLatin1CalcUtf16LenEx(const char *pszLatin1, size_t cchLatin1, size_t *pcwc);
+
+/**
+ * Translate a Latin-1 (ISO-8859-1) string into a UTF-16 allocating the result
+ * buffer (default tag).
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1       The Latin-1 string to convert.
+ * @param   ppwszString     Receives pointer to the allocated UTF-16 string. The
+ *                          returned string must be freed using RTUtf16Free().
+ */
+#define RTLatin1ToUtf16(pszLatin1, ppwszString)     RTLatin1ToUtf16Tag((pszLatin1), (ppwszString), RTSTR_TAG)
+
+/**
+ * Translate a Latin-1 (ISO-8859-1) string into a UTF-16 allocating the result
+ * buffer (custom tag).
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1       The Latin-1 string to convert.
+ * @param   ppwszString     Receives pointer to the allocated UTF-16 string. The
+ *                          returned string must be freed using RTUtf16Free().
+ * @param   pszTag          Allocation tag used for statistics and such.
+ */
+RTDECL(int) RTLatin1ToUtf16Tag(const char *pszLatin1, PRTUTF16 *ppwszString, const char *pszTag);
+
+/**
+ * Translates pszLatin1 from Latin-1 (ISO-8859-1) to UTF-16, allocating the
+ * result buffer if requested (default tag).
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1       The Latin-1 string to convert.
+ * @param   cchLatin1       The maximum size in chars (the type) to convert. The
+ *                          conversion stops when it reaches cchLatin1 or the
+ *                          string terminator ('\\0'). Use RTSTR_MAX to
+ *                          translate the entire string.
+ * @param   ppwsz           If cwc is non-zero, this must either be pointing
+ *                          to pointer to a buffer of the specified size, or
+ *                          pointer to a NULL pointer.
+ *                          If *ppwsz is NULL or cwc is zero a buffer of at
+ *                          least cwc items will be allocated to hold the
+ *                          translated string. If a buffer was requested it
+ *                          must be freed using RTUtf16Free().
+ * @param   cwc             The buffer size in RTUTF16s. This includes the
+ *                          terminator.
+ * @param   pcwc            Where to store the length of the translated string,
+ *                          excluding the terminator. (Optional)
+ *
+ *                          This may be set under some error conditions,
+ *                          however, only for VERR_BUFFER_OVERFLOW and
+ *                          VERR_NO_STR_MEMORY will it contain a valid string
+ *                          length that can be used to resize the buffer.
+ */
+#define RTLatin1ToUtf16Ex(pszLatin1, cchLatin1, ppwsz, cwc, pcwc) \
+    RTLatin1ToUtf16ExTag((pszLatin1), (cchLatin1), (ppwsz), (cwc), (pcwc), RTSTR_TAG)
+
+/**
+ * Translates pszLatin1 from Latin-1 (ISO-8859-1) to UTF-16, allocating the
+ * result buffer if requested.
+ *
+ * @returns iprt status code.
+ * @param   pszLatin1       The Latin-1 string to convert.
+ * @param   cchLatin1       The maximum size in chars (the type) to convert. The
+ *                          conversion stops when it reaches cchLatin1 or the
+ *                          string terminator ('\\0'). Use RTSTR_MAX to
+ *                          translate the entire string.
+ * @param   ppwsz           If cwc is non-zero, this must either be pointing
+ *                          to pointer to a buffer of the specified size, or
+ *                          pointer to a NULL pointer.
+ *                          If *ppwsz is NULL or cwc is zero a buffer of at
+ *                          least cwc items will be allocated to hold the
+ *                          translated string. If a buffer was requested it
+ *                          must be freed using RTUtf16Free().
+ * @param   cwc             The buffer size in RTUTF16s. This includes the
+ *                          terminator.
+ * @param   pcwc            Where to store the length of the translated string,
+ *                          excluding the terminator. (Optional)
+ *
+ *                          This may be set under some error conditions,
+ *                          however, only for VERR_BUFFER_OVERFLOW and
+ *                          VERR_NO_STR_MEMORY will it contain a valid string
+ *                          length that can be used to resize the buffer.
+ * @param   pszTag          Allocation tag used for statistics and such.
+ */
+RTDECL(int) RTLatin1ToUtf16ExTag(const char *pszLatin1, size_t cchLatin1,
+                                 PRTUTF16 *ppwsz, size_t cwc, size_t *pcwc, const char *pszTag);
+
+/** @} */
+
+RT_C_DECLS_END
+
+/** @} */
+
+#endif
+
index 283f7039fef4847118b2ae675651241c4e3d2f3f..a64d610ca1dff3b8b7dda491869dc10496c4f139 100644 (file)
@@ -69,6 +69,17 @@ typedef RTLISTANCHOR *PRTLISTANCHOR;
 /** Pointer to a const doubly linked list anchor. */
 typedef RTLISTANCHOR const *PCRTLISTANCHOR;
 
+/** Version of RTLISTNODE for holding a ring-3 only list in data which gets
+ * shared between multiple contexts */
+#if defined(IN_RING3)
+typedef RTLISTNODE RTLISTNODER3;
+#else
+typedef struct { RTR3PTR aOffLimits[2]; } RTLISTNODER3;
+#endif
+/** Version of RTLISTANCHOR for holding a ring-3 only list in data which gets
+ * shared between multiple contexts */
+typedef RTLISTNODER3 RTLISTANCHORR3;
+
 
 /**
  * Initialize a list.
@@ -152,8 +163,8 @@ DECLINLINE(void) RTListNodeRemove(PRTLISTNODE pNode)
 /**
  * Checks if a node is the last element in the list.
  *
- * @retval  @c true if the node is the last element in the list.
- * @retval  @c false otherwise
+ * @retval  true if the node is the last element in the list.
+ * @retval  false otherwise
  *
  * @param   pList               The list.
  * @param   pNode               The node to check.
@@ -163,8 +174,8 @@ DECLINLINE(void) RTListNodeRemove(PRTLISTNODE pNode)
 /**
  * Checks if a node is the first element in the list.
  *
- * @retval  @c true if the node is the first element in the list.
- * @retval  @c false otherwise.
+ * @retval  true if the node is the first element in the list.
+ * @retval  false otherwise.
  *
  * @param   pList               The list.
  * @param   pNode               The node to check.
@@ -174,11 +185,11 @@ DECLINLINE(void) RTListNodeRemove(PRTLISTNODE pNode)
 /**
  * Checks if a type converted node is actually the dummy element (@a pList).
  *
- * @retval  @c true if the node is the dummy element in the list.
- * @retval  @c false otherwise.
+ * @retval  true if the node is the dummy element in the list.
+ * @retval  false otherwise.
  *
  * @param   pList               The list.
- * @param   pNodeStruct         The node structure to check.  Typically
+ * @param   pNode               The node structure to check.  Typically
  *                              something obtained from RTListNodeGetNext() or
  *                              RTListNodeGetPrev().  This is NOT a PRTLISTNODE
  *                              but something that contains a RTLISTNODE member!
@@ -194,8 +205,8 @@ DECLINLINE(void) RTListNodeRemove(PRTLISTNODE pNode)
 /**
  * Checks if a list is empty.
  *
- * @retval  @c true if the list is empty.
- * @retval  @c false otherwise.
+ * @retval  true if the list is empty.
+ * @retval  false otherwise.
  *
  * @param   pList               The list to check.
  */
index 9bb784d75bc970344de74de9628a7a91f4651697..d2c88cb85e1a2f44b766153c6eb62548d0556f30 100644 (file)
@@ -264,8 +264,8 @@ RTDECL(int) RTLockValidatorRecMakeSiblings(PRTLOCKVALRECCORE pRec1, PRTLOCKVALRE
  *                              optional (NULL). Max length is 32 bytes.
  * @param   ...                 Format string arguments.
  */
-RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,
-                                        void *hLock, bool fEnabled, const char *pszNameFmt, ...);
+RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, void *hLock,
+                                        bool fEnabled, const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 7);
 /**
  * Initialize a lock validator record.
  *
@@ -285,8 +285,8 @@ RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS h
  *                              optional (NULL). Max length is 32 bytes.
  * @param   va                  Format string arguments.
  */
-RTDECL(void) RTLockValidatorRecExclInitV(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,
-                                         void *hLock, bool fEnabled, const char *pszNameFmt, va_list va);
+RTDECL(void) RTLockValidatorRecExclInitV(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, void *hLock,
+                                         bool fEnabled, const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 0);
 /**
  * Uninitialize a lock validator record previously initialized by
  * RTLockRecValidatorInit.
@@ -316,8 +316,8 @@ RTDECL(void) RTLockValidatorRecExclDelete(PRTLOCKVALRECEXCL pRec);
  *                              optional (NULL). Max length is 32 bytes.
  * @param   ...                 Format string arguments.
  */
-RTDECL(int)  RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,
-                                          void *hLock, bool fEnabled, const char *pszNameFmt, ...);
+RTDECL(int)  RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, void *hLock,
+                                          bool fEnabled, const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 7);
 
 /**
  * Create and initialize a lock validator record.
@@ -340,8 +340,8 @@ RTDECL(int)  RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLA
  *                              optional (NULL). Max length is 32 bytes.
  * @param   va                  Format string arguments.
  */
-RTDECL(int)  RTLockValidatorRecExclCreateV(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,
-                                           void *hLock, bool fEnabled, const char *pszNameFmt, va_list va);
+RTDECL(int)  RTLockValidatorRecExclCreateV(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, void *hLock,
+                                           bool fEnabled, const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 0);
 
 /**
  * Deinitialize and destroy a record created by RTLockValidatorRecExclCreate.
@@ -564,7 +564,8 @@ RTDECL(int) RTLockValidatorRecExclCheckOrderAndBlocking(PRTLOCKVALRECEXCL pRec,
  * @param   ...                 Format string arguments.
  */
 RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,
-                                          void *hLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, ...);
+                                          void *hLock, bool fSignaller, bool fEnabled,
+                                          const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(7, 8);
 
 /**
  * Initialize a lock validator record for a shared lock.
@@ -589,7 +590,8 @@ RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS
  * @param   va                  Format string arguments.
  */
 RTDECL(void) RTLockValidatorRecSharedInitV(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,
-                                           void *hLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, va_list va);
+                                           void *hLock, bool fSignaller, bool fEnabled,
+                                           const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(7, 0);
 
 /**
  * Uninitialize a lock validator record previously initialized by
@@ -624,7 +626,8 @@ RTDECL(void) RTLockValidatorRecSharedDelete(PRTLOCKVALRECSHRD pRec);
  * @param   ...                 Format string arguments.
  */
 RTDECL(int) RTLockValidatorRecSharedCreate(PRTLOCKVALRECSHRD *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,
-                                           void *pvLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, ...);
+                                           void *pvLock, bool fSignaller, bool fEnabled,
+                                           const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(7, 8);
 
 /**
  * Create and initialize a lock validator record for a shared lock.
@@ -651,7 +654,8 @@ RTDECL(int) RTLockValidatorRecSharedCreate(PRTLOCKVALRECSHRD *ppRec, RTLOCKVALCL
  * @param   va                  Format string arguments.
  */
 RTDECL(int) RTLockValidatorRecSharedCreateV(PRTLOCKVALRECSHRD *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,
-                                            void *pvLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, va_list va);
+                                            void *pvLock, bool fSignaller, bool fEnabled,
+                                            const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(7, 0);
 
 /**
  * Deinitialize and destroy a record created by RTLockValidatorRecSharedCreate.
@@ -689,6 +693,7 @@ RTDECL(uint32_t) RTLockValidatorRecSharedSetSubClass(PRTLOCKVALRECSHRD pRec, uin
  * @param   hThreadSelf         The handle of the calling thread.  If not known,
  *                              pass NIL_RTTHREAD and we'll figure it out.
  * @param   pSrcPos             The source position of the lock operation.
+ * @param   cMillies            Intended sleep time in milliseconds.
  */
 RTDECL(int)  RTLockValidatorRecSharedCheckOrder(PRTLOCKVALRECSHRD pRec, RTTHREAD hThreadSelf,
                                                 PCRTLOCKVALSRCPOS pSrcPos, RTMSINTERVAL cMillies);
@@ -711,6 +716,7 @@ RTDECL(int)  RTLockValidatorRecSharedCheckOrder(PRTLOCKVALRECSHRD pRec, RTTHREAD
  * @param   hThreadSelf         The current thread.  Shall not be NIL_RTTHREAD!
  * @param   pSrcPos             The source position of the lock operation.
  * @param   fRecursiveOk        Whether it's ok to recurse.
+ * @param   cMillies            Intended sleep time in milliseconds.
  * @param   enmSleepState       The sleep state to enter on successful return.
  * @param   fReallySleeping     Is it really going to sleep now or not.  Use
  *                              false before calls to other IPRT synchronization
@@ -729,6 +735,7 @@ RTDECL(int) RTLockValidatorRecSharedCheckBlocking(PRTLOCKVALRECSHRD pRec, RTTHRE
  * @param   hThreadSelf         The current thread.  Shall not be NIL_RTTHREAD!
  * @param   pSrcPos             The source position of the lock operation.
  * @param   fRecursiveOk        Whether it's ok to recurse.
+ * @param   cMillies            Intended sleep time in milliseconds.
  * @param   enmSleepState       The sleep state to enter on successful return.
  * @param   fReallySleeping     Is it really going to sleep now or not.  Use
  *                              false before calls to other IPRT synchronization
@@ -944,7 +951,7 @@ RTDECL(bool) RTLockValidatorHoldsLocksInSubClass(RTTHREAD hCurrentThread, RTLOCK
 RTDECL(int) RTLockValidatorClassCreateEx(PRTLOCKVALCLASS phClass, PCRTLOCKVALSRCPOS pSrcPos,
                                          bool fAutodidact, bool fRecursionOk, bool fStrictReleaseOrder,
                                          RTMSINTERVAL cMsMinDeadlock, RTMSINTERVAL cMsMinOrder,
-                                         const char *pszNameFmt, ...);
+                                         const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(8, 9);
 
 /**
  * Creates a new lock validator class, all properties specified.
@@ -973,7 +980,7 @@ RTDECL(int) RTLockValidatorClassCreateEx(PRTLOCKVALCLASS phClass, PCRTLOCKVALSRC
 RTDECL(int) RTLockValidatorClassCreateExV(PRTLOCKVALCLASS phClass, PCRTLOCKVALSRCPOS pSrcPos,
                                           bool fAutodidact, bool fRecursionOk, bool fStrictReleaseOrder,
                                           RTMSINTERVAL cMsMinDeadlock, RTMSINTERVAL cMsMinOrder,
-                                          const char *pszNameFmt, va_list va);
+                                          const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(8, 0);
 
 /**
  * Creates a new lock validator class.
@@ -983,14 +990,14 @@ RTDECL(int) RTLockValidatorClassCreateExV(PRTLOCKVALCLASS phClass, PCRTLOCKVALSR
  * @param   fAutodidact         Whether the class should be allowed to teach
  *                              itself new locking order rules (true), or if the
  *                              user will teach it all it needs to know (false).
- * @param   pszFile             The source position of the call, file.
- * @param   iLine               The source position of the call, line.
- * @param   pszFunction         The source position of the call, function.
+ * @param   SRC_POS             The source position where call is being made from.
+ *                              Use RT_SRC_POS when possible.  Optional.
  * @param   pszNameFmt          Class name format string, optional (NULL).  Max
  *                              length is 32 bytes.
  * @param   ...                 Format string arguments.
  */
-RTDECL(int) RTLockValidatorClassCreate(PRTLOCKVALCLASS phClass, bool fAutodidact, RT_SRC_POS_DECL, const char *pszNameFmt, ...);
+RTDECL(int) RTLockValidatorClassCreate(PRTLOCKVALCLASS phClass, bool fAutodidact, RT_SRC_POS_DECL,
+                                       const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 7);
 
 /**
  * Creates a new lock validator class with a reference that is consumed by the
@@ -1001,14 +1008,14 @@ RTDECL(int) RTLockValidatorClassCreate(PRTLOCKVALCLASS phClass, bool fAutodidact
  * @returns Class handle with a reference that is automatically consumed by the
  *          first retainer.  NIL_RTLOCKVALCLASS if we run into trouble.
  *
- * @param   pszFile             The source position of the call, file.
- * @param   iLine               The source position of the call, line.
- * @param   pszFunction         The source position of the call, function.
+ * @param   SRC_POS             The source position where call is being made from.
+ *                              Use RT_SRC_POS when possible.  Optional.
  * @param   pszNameFmt          Class name format string, optional (NULL).  Max
  *                              length is 32 bytes.
  * @param   ...                 Format string arguments.
  */
-RTDECL(RTLOCKVALCLASS) RTLockValidatorClassCreateUnique(RT_SRC_POS_DECL, const char *pszNameFmt, ...);
+RTDECL(RTLOCKVALCLASS) RTLockValidatorClassCreateUnique(RT_SRC_POS_DECL,
+                                                        const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);
 
 /**
  * Finds a class for the specified source position.
@@ -1022,14 +1029,14 @@ RTDECL(RTLOCKVALCLASS) RTLockValidatorClassFindForSrcPos(PRTLOCKVALSRCPOS pSrcPo
  * Finds or creates a class given the source position.
  *
  * @returns Class handle (not retained!) or NIL_RTLOCKVALCLASS.
- * @param   pszFile             The source file.
- * @param   iLine               The line in that source file.
- * @param   pszFunction         The function name.
+ * @param   SRC_POS             The source position where call is being made from.
+ *                              Use RT_SRC_POS when possible.  Optional.
  * @param   pszNameFmt          Class name format string, optional (NULL).  Max
  *                              length is 32 bytes.
  * @param   ...                 Format string arguments.
  */
-RTDECL(RTLOCKVALCLASS) RTLockValidatorClassForSrcPos(RT_SRC_POS_DECL, const char *pszNameFmt, ...);
+RTDECL(RTLOCKVALCLASS) RTLockValidatorClassForSrcPos(RT_SRC_POS_DECL,
+                                                     const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);
 
 /**
  * Retains a reference to a lock validator class.
@@ -1050,7 +1057,7 @@ RTDECL(uint32_t) RTLockValidatorClassRelease(RTLOCKVALCLASS hClass);
 
 /**
  * Teaches the class @a hClass that locks in the class @a hPriorClass can be
- * held when taking a lock of class @hClass
+ * held when taking a lock of class @hClass
  *
  * @returns IPRT status.
  * @param   hClass              Handle to the pupil class.
@@ -1065,7 +1072,7 @@ RTDECL(int) RTLockValidatorClassAddPriorClass(RTLOCKVALCLASS hClass, RTLOCKVALCL
  *
  * @returns IPRT status.
  * @param   hClass              Handle to the class to change.
- * @param   fEnable             Enable it (true) or disable it (false).
+ * @param   fEnabled            Enable it (true) or disable it (false).
  */
 RTDECL(int) RTLockValidatorClassEnforceStrictReleaseOrder(RTLOCKVALCLASS hClass, bool fEnabled);
 
index afa1bad9287819f789967a4d703edcc3c3c0139a..1e0c5cad98becc5f9812fca4b9f7129adade4669 100644 (file)
@@ -52,11 +52,13 @@ typedef enum RTLOGGROUP
 {
     /** Default logging group. */
     RTLOGGROUP_DEFAULT,
+    RTLOGGROUP_CRYPTO,
     RTLOGGROUP_DBG,
     RTLOGGROUP_DBG_DWARF,
     RTLOGGROUP_DIR,
     RTLOGGROUP_FILE,
     RTLOGGROUP_FS,
+    RTLOGGROUP_HTTP,
     RTLOGGROUP_LDR,
     RTLOGGROUP_PATH,
     RTLOGGROUP_PROCESS,
@@ -83,11 +85,13 @@ typedef enum RTLOGGROUP
  */
 #define RT_LOGGROUP_NAMES \
     "DEFAULT",      \
+    "RT_CRYPTO",    \
     "RT_DBG",       \
     "RT_DBG_DWARF", \
     "RT_DIR",       \
     "RT_FILE",      \
     "RT_FS",        \
+    "RT_HTTP", \
     "RT_LDR",       \
     "RT_PATH",      \
     "RT_PROCESS",   \
@@ -95,8 +99,6 @@ typedef enum RTLOGGROUP
     "RT_THREAD",    \
     "RT_TIME",      \
     "RT_TIMER",     \
-    "RT_13", \
-    "RT_14", \
     "RT_15", \
     "RT_16", \
     "RT_17", \
@@ -184,7 +186,7 @@ typedef enum RTLOGPHASE
  * @param   pszFormat   Format string.
  * @param   ...         Optional arguments as specified in the format string.
  */
-typedef DECLCALLBACK(void) FNRTLOGGER(const char *pszFormat, ...);
+typedef DECLCALLBACK(void) FNRTLOGGER(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 /** Pointer to logger function. */
 typedef FNRTLOGGER *PFNRTLOGGER;
 
@@ -213,7 +215,7 @@ typedef RCPTRTYPE(FNRTLOGFLUSHGC *) PFNRTLOGFLUSHGC;
  * @param   pszFormat   Format string.
  * @param   ...         Optional arguments specified in the format string.
  */
-typedef DECLCALLBACK(void) FNRTLOGPHASEMSG(PRTLOGGER pLogger, const char *pszFormat, ...);
+typedef DECLCALLBACK(void) FNRTLOGPHASEMSG(PRTLOGGER pLogger, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3);
 /** Pointer to header/footer message callback function. */
 typedef FNRTLOGPHASEMSG *PFNRTLOGPHASEMSG;
 
@@ -457,7 +459,8 @@ typedef enum RTLOGDEST
 } RTLOGDEST;
 
 
-RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);
+RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup,
+                           const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);
 
 
 #ifdef DOXYGEN_RUNNING
@@ -733,7 +736,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define LogFunc(a)   _LogIt(RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define LogFunc(a)   do { Log((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log(a); } while (0)
+# define LogFunc(a)   do { Log((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log(a); } while (0)
 #endif
 
 /** @def Log2Func
@@ -747,7 +750,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log2Func(a)  _LogIt(RTLOGGRPFLAGS_LEVEL_2, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log2Func(a)  do { Log2((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log2(a); } while (0)
+# define Log2Func(a)  do { Log2((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log2(a); } while (0)
 #endif
 
 /** @def Log3Func
@@ -761,7 +764,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log3Func(a)  _LogIt(RTLOGGRPFLAGS_LEVEL_3, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log3Func(a)  do { Log3((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log3(a); } while (0)
+# define Log3Func(a)  do { Log3((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log3(a); } while (0)
 #endif
 
 /** @def Log4Func
@@ -775,7 +778,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log4Func(a)  _LogIt(RTLOGGRPFLAGS_LEVEL_4, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log4Func(a)  do { Log4((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log4(a); } while (0)
+# define Log4Func(a)  do { Log4((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log4(a); } while (0)
 #endif
 
 /** @def Log5Func
@@ -789,7 +792,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log5Func(a)  _LogIt(RTLOGGRPFLAGS_LEVEL_5, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log5Func(a)  do { Log5((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log5(a); } while (0)
+# define Log5Func(a)  do { Log5((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log5(a); } while (0)
 #endif
 
 /** @def Log6Func
@@ -803,7 +806,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log6Func(a)  _LogIt(RTLOGGRPFLAGS_LEVEL_6, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log6Func(a)  do { Log6((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log6(a); } while (0)
+# define Log6Func(a)  do { Log6((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log6(a); } while (0)
 #endif
 
 /** @def Log7Func
@@ -817,7 +820,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log7Func(a)  _LogIt(RTLOGGRPFLAGS_LEVEL_7, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log7Func(a)  do { Log7((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log7(a); } while (0)
+# define Log7Func(a)  do { Log7((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log7(a); } while (0)
 #endif
 
 /** @def Log8Func
@@ -831,7 +834,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log8Func(a)  _LogIt(RTLOGGRPFLAGS_LEVEL_8, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log8Func(a)  do { Log8((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log8(a); } while (0)
+# define Log8Func(a)  do { Log8((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log8(a); } while (0)
 #endif
 
 /** @def Log9Func
@@ -845,7 +848,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log9Func(a)  _LogIt(RTLOGGRPFLAGS_LEVEL_9, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log9Func(a)  do { Log9((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log9(a); } while (0)
+# define Log9Func(a)  do { Log9((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log9(a); } while (0)
 #endif
 
 /** @def Log10Func
@@ -859,7 +862,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log10Func(a) _LogIt(RTLOGGRPFLAGS_LEVEL_10, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log10Func(a) do { Log10((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log10(a); } while (0)
+# define Log10Func(a) do { Log10((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log10(a); } while (0)
 #endif
 
 /** @def Log11Func
@@ -873,7 +876,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log11Func(a) _LogIt(RTLOGGRPFLAGS_LEVEL_11, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log11Func(a) do { Log11((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log11(a); } while (0)
+# define Log11Func(a) do { Log11((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log11(a); } while (0)
 #endif
 
 /** @def Log12Func
@@ -887,7 +890,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 #ifdef LOG_USE_C99
 # define Log12Func(a) _LogIt(RTLOGGRPFLAGS_LEVEL_12, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define Log12Func(a) do { Log12((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); Log12(a); } while (0)
+# define Log12Func(a) do { Log12((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); Log12(a); } while (0)
 #endif
 
 /** @def LogFlowFunc
@@ -903,7 +906,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
     _LogIt(RTLOGGRPFLAGS_FLOW, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
 # define LogFlowFunc(a) \
-    do { LogFlow((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); LogFlow(a); } while (0)
+    do { LogFlow((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); LogFlow(a); } while (0)
 #endif
 
 /** @def LogWarnFunc
@@ -1100,7 +1103,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 /** @name Misc Logging Macros
  * @{ */
 
-/** @def LogWarning1
+/** @def Log1Warning
  * The same as Log(), but prepents a <tt>"WARNING! "</tt> string to the message.
  *
  * @param   a   Custom log message in format <tt>("string\n" [, args])</tt>.
@@ -1111,7 +1114,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 # define Log1Warning(a)     do { Log(("WARNING! ")); Log(a); } while (0)
 #endif
 
-/** @def LogWarningFunc
+/** @def Log1WarningFunc
  * The same as LogWarning(), but prepents the log message with the function name.
  *
  * @param   a   Log message in format <tt>("string\n" [, args])</tt>.
@@ -1124,7 +1127,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
     do { Log((LOG_FN_FMT ": WARNING! ", __PRETTY_FUNCTION__)); Log(a); } while (0)
 #endif
 
-/** @def LogWarningThisFunc
+/** @def Log1WarningThisFunc
  * The same as LogWarningFunc() but for class functions (methods): the resulting
  * log line is additionally prepended with a hex value of |this| pointer.
  *
@@ -1580,7 +1583,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
 # define LogRelFunc(a) \
     _LogRelItLikely(RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
-# define LogRelFunc(a)      do { LogRel((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); LogRel(a); } while (0)
+# define LogRelFunc(a)      do { LogRel((LOG_FN_FMT ": ", RT_GCC_EXTENSION __PRETTY_FUNCTION__)); LogRel(a); } while (0)
 #endif
 
 /** @def LogRelFlowFunc
@@ -1702,7 +1705,8 @@ RTDECL(PRTLOGGER) RTLogRelGetDefaultInstanceEx(uint32_t fFlagsAndGroup);
  * @param   ...         Format arguments.
  * @remark  This is a worker function for LogRelIt.
  */
-RTDECL(void) RTLogRelLogger(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);
+RTDECL(void) RTLogRelLogger(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
+                            const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);
 
 /**
  * Write to a logger instance, defaulting to the release one.
@@ -1718,7 +1722,8 @@ RTDECL(void) RTLogRelLogger(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
  * @param   pszFormat   Format string.
  * @param   args        Format arguments.
  */
-RTDECL(void) RTLogRelLoggerV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, va_list args);
+RTDECL(void) RTLogRelLoggerV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
+                             const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(4, 0);
 
 /**
  * printf like function for writing to the default release log.
@@ -1728,7 +1733,7 @@ RTDECL(void) RTLogRelLoggerV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup
  *
  * @remark The API doesn't support formatting of floating point numbers at the moment.
  */
-RTDECL(void) RTLogRelPrintf(const char *pszFormat, ...);
+RTDECL(void) RTLogRelPrintf(const char *pszFormat, ...)  RT_IPRT_FORMAT_ATTR(1, 2);
 
 /**
  * vprintf like function for writing to the default release log.
@@ -1738,7 +1743,7 @@ RTDECL(void) RTLogRelPrintf(const char *pszFormat, ...);
  *
  * @remark The API doesn't support formatting of floating point numbers at the moment.
  */
-RTDECL(void) RTLogRelPrintfV(const char *pszFormat, va_list args);
+RTDECL(void) RTLogRelPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);
 
 /**
  * Changes the buffering setting of the default release logger.
@@ -1952,7 +1957,7 @@ RTDECL(PRTLOGGER) RTLogDefaultInit(void);
  */
 RTDECL(int) RTLogCreate(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,
                         const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,
-                        uint32_t fDestFlags, const char *pszFilenameFmt, ...);
+                        uint32_t fDestFlags, const char *pszFilenameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(8, 9);
 
 /**
  * Create a logger instance.
@@ -1988,8 +1993,8 @@ RTDECL(int) RTLogCreate(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGro
 RTDECL(int) RTLogCreateEx(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,
                           const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,
                           uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,
-                          uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot,
-                          char *pszErrorMsg, size_t cchErrorMsg, const char *pszFilenameFmt, ...);
+                          uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot, char *pszErrorMsg, size_t cchErrorMsg,
+                          const char *pszFilenameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(14, 15);
 
 /**
  * Create a logger instance.
@@ -2027,8 +2032,8 @@ RTDECL(int) RTLogCreateEx(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszG
 RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,
                            const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,
                            uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,
-                           uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot,
-                           char *pszErrorMsg, size_t cchErrorMsg, const char *pszFilenameFmt, va_list args);
+                           uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot, char *pszErrorMsg, size_t cchErrorMsg,
+                           const char *pszFilenameFmt, va_list args) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(14, 0);
 
 /**
  * Create a logger instance for singled threaded ring-0 usage.
@@ -2260,7 +2265,7 @@ RTDECL(void) RTLogFlush(PRTLOGGER pLogger);
  * @param   pszFormat   Format string.
  * @param   ...         Format arguments.
  */
-RTDECL(void) RTLogLogger(PRTLOGGER pLogger, void *pvCallerRet, const char *pszFormat, ...);
+RTDECL(void) RTLogLogger(PRTLOGGER pLogger, void *pvCallerRet, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
 
 /**
  * Write to a logger instance.
@@ -2269,7 +2274,7 @@ RTDECL(void) RTLogLogger(PRTLOGGER pLogger, void *pvCallerRet, const char *pszFo
  * @param   pszFormat   Format string.
  * @param   args        Format arguments.
  */
-RTDECL(void) RTLogLoggerV(PRTLOGGER pLogger, const char *pszFormat, va_list args);
+RTDECL(void) RTLogLoggerV(PRTLOGGER pLogger, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(3, 0);
 
 /**
  * Write to a logger instance.
@@ -2286,7 +2291,8 @@ RTDECL(void) RTLogLoggerV(PRTLOGGER pLogger, const char *pszFormat, va_list args
  * @param   ...         Format arguments.
  * @remark  This is a worker function of LogIt.
  */
-RTDECL(void) RTLogLoggerEx(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);
+RTDECL(void) RTLogLoggerEx(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
+                           const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);
 
 /**
  * Write to a logger instance.
@@ -2302,7 +2308,8 @@ RTDECL(void) RTLogLoggerEx(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
  * @param   pszFormat   Format string.
  * @param   args        Format arguments.
  */
-RTDECL(void) RTLogLoggerExV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, va_list args);
+RTDECL(void) RTLogLoggerExV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
+                            const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(4, 0);
 
 /**
  * printf like function for writing to the default log.
@@ -2312,17 +2319,17 @@ RTDECL(void) RTLogLoggerExV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
  *
  * @remark The API doesn't support formatting of floating point numbers at the moment.
  */
-RTDECL(void) RTLogPrintf(const char *pszFormat, ...);
+RTDECL(void) RTLogPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 
 /**
  * vprintf like function for writing to the default log.
  *
  * @param   pszFormat   Printf like format string.
- * @param   args        Optional arguments as specified in pszFormat.
+ * @param   va          Optional arguments as specified in pszFormat.
  *
  * @remark The API doesn't support formatting of floating point numbers at the moment.
  */
-RTDECL(void) RTLogPrintfV(const char *pszFormat, va_list args);
+RTDECL(void) RTLogPrintfV(const char *pszFormat, va_list va)  RT_IPRT_FORMAT_ATTR(1, 0);
 
 /**
  * Dumper vprintf-like function outputting to a logger.
@@ -2332,7 +2339,7 @@ RTDECL(void) RTLogPrintfV(const char *pszFormat, va_list args);
  * @param   pszFormat       Format string.
  * @param   va              Format arguments.
  */
-RTDECL(void) RTLogDumpPrintfV(void *pvUser, const char *pszFormat, va_list va);
+RTDECL(void) RTLogDumpPrintfV(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);
 
 
 #ifndef DECLARED_FNRTSTROUTPUT          /* duplicated in iprt/string.h */
@@ -2361,7 +2368,7 @@ typedef FNRTSTROUTPUT *PFNRTSTROUTPUT;
  * @param   pszFormat   Format string.
  * @param   args        Argument list.
  */
-RTDECL(size_t) RTLogFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArg, const char *pszFormat, va_list args);
+RTDECL(size_t) RTLogFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArg, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(3, 0);
 
 /**
  * Write log buffer to COM port.
@@ -2378,7 +2385,7 @@ RTDECL(void) RTLogWriteCom(const char *pach, size_t cb);
  * @param   pszFormat   Format string.
  * @param   ...         Optional arguments specified in the format string.
  */
-RTDECL(size_t) RTLogComPrintf(const char *pszFormat, ...);
+RTDECL(size_t) RTLogComPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 
 /**
  * Prints a formatted string to the serial port used for logging.
@@ -2387,7 +2394,7 @@ RTDECL(size_t) RTLogComPrintf(const char *pszFormat, ...);
  * @param   pszFormat   Format string.
  * @param   args        Optional arguments specified in the format string.
  */
-RTDECL(size_t)  RTLogComPrintfV(const char *pszFormat, va_list args);
+RTDECL(size_t)  RTLogComPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);
 
 
 #if 0 /* not implemented yet */
@@ -2497,7 +2504,7 @@ RTDECL(void) RTLogWriteStdErr(const char *pach, size_t cb);
  * @param   pszFormat   Format string.
  * @param   ...         Optional arguments specified in the format string.
  */
-RTDECL(size_t) RTLogBackdoorPrintf(const char *pszFormat, ...);
+RTDECL(size_t) RTLogBackdoorPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
 
 /**
  * Prints a formatted string to the backdoor port.
@@ -2506,7 +2513,7 @@ RTDECL(size_t) RTLogBackdoorPrintf(const char *pszFormat, ...);
  * @param   pszFormat   Format string.
  * @param   args        Optional arguments specified in the format string.
  */
-RTDECL(size_t)  RTLogBackdoorPrintfV(const char *pszFormat, va_list args);
+RTDECL(size_t)  RTLogBackdoorPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);
 
 #endif /* VBOX */
 
index a448709e8d0b7c49ad22089174b1fd17898d2b8b..37865ae0aa206ca222d0ab5c6098189b73bba216 100644 (file)
 # define RTDvmVolumeCreateVfsFile                       RT_MANGLER(RTDvmVolumeCreateVfsFile)
 # define RTEnvApplyChanges                              RT_MANGLER(RTEnvApplyChanges)
 # define RTEnvClone                                     RT_MANGLER(RTEnvClone)
+# define RTEnvCloneUtf16Block                           RT_MANGLER(RTEnvCloneUtf16Block)
 # define RTEnvCountEx                                   RT_MANGLER(RTEnvCountEx)
 # define RTEnvCreate                                    RT_MANGLER(RTEnvCreate)
 # define RTEnvCreateChangeRecord                        RT_MANGLER(RTEnvCreateChangeRecord)
 # define RTFileOpenBitBucket                            RT_MANGLER(RTFileOpenBitBucket)
 # define RTFileOpenF                                    RT_MANGLER(RTFileOpenF)
 # define RTFileOpenV                                    RT_MANGLER(RTFileOpenV)
+# define RTFileOpenTemp                                 RT_MANGLER(RTFileOpenTemp)
 # define RTFileQueryFsSizes                             RT_MANGLER(RTFileQueryFsSizes)
 # define RTFileQueryInfo                                RT_MANGLER(RTFileQueryInfo)
 # define RTFileQuerySize                                RT_MANGLER(RTFileQuerySize)
 # define RTFileWrite                                    RT_MANGLER(RTFileWrite)
 # define RTFileWriteAt                                  RT_MANGLER(RTFileWriteAt)
 # define RTFilesystemVfsFromFile                        RT_MANGLER(RTFilesystemVfsFromFile)
+# define RTFsIsCaseSensitive                            RT_MANGLER(RTFsIsCaseSensitive)
 # define RTFsQueryProperties                            RT_MANGLER(RTFsQueryProperties)
 # define RTFsQuerySerial                                RT_MANGLER(RTFsQuerySerial)
 # define RTFsQuerySizes                                 RT_MANGLER(RTFsQuerySizes)
 # define RTNetUDPChecksum                               RT_MANGLER(RTNetUDPChecksum)
 # define RTNetStrToMacAddr                              RT_MANGLER(RTNetStrToMacAddr)
 # define RTNetIsIPv4AddrStr                             RT_MANGLER(RTNetIsIPv4AddrStr)
+# define RTNetStrIsIPv4AddrAny                          RT_MANGLER(RTNetStrIsIPv4AddrAny)
 # define RTNetStrToIPv4AddrEx                           RT_MANGLER(RTNetStrToIPv4AddrEx)
 # define RTNetStrToIPv4Addr                             RT_MANGLER(RTNetStrToIPv4Addr)
 # define RTNetIsIPv6AddrStr                             RT_MANGLER(RTNetIsIPv6AddrStr)
+# define RTNetStrIsIPv6AddrAny                          RT_MANGLER(RTNetStrIsIPv6AddrAny)
 # define RTNetStrToIPv6AddrEx                           RT_MANGLER(RTNetStrToIPv6AddrEx)
 # define RTNetStrToIPv6Addr                             RT_MANGLER(RTNetStrToIPv6Addr)
 # define RTOnceSlow                                     RT_MANGLER(RTOnceSlow)
 # define RTPathCompare                                  RT_MANGLER(RTPathCompare)
 # define RTPathCopyComponents                           RT_MANGLER(RTPathCopyComponents)
 # define RTPathCountComponents                          RT_MANGLER(RTPathCountComponents)
+# define RTPathEnsureTrailingSeparator                  RT_MANGLER(RTPathEnsureTrailingSeparator)
 # define RTPathExecDir                                  RT_MANGLER(RTPathExecDir)
 # define RTPathExists                                   RT_MANGLER(RTPathExists)
 # define RTPathExistsEx                                 RT_MANGLER(RTPathExistsEx)
 # define RTPathGetCurrentDrive                          RT_MANGLER(RTPathGetCurrentDrive)
 # define RTPathGetCurrentOnDrive                        RT_MANGLER(RTPathGetCurrentOnDrive)
 # define RTPathGetMode                                  RT_MANGLER(RTPathGetMode)
+# define RTPathGlob                                     RT_MANGLER(RTPathGlob)
+# define RTPathGlobFree                                 RT_MANGLER(RTPathGlobFree)
 # define RTPathHasSuffix                                RT_MANGLER(RTPathHasSuffix)
 # define RTPathHasPath                                  RT_MANGLER(RTPathHasPath)
 # define RTPathIsSame                                   RT_MANGLER(RTPathIsSame)
 # define RTPipeCreate                                   RT_MANGLER(RTPipeCreate)
 # define RTPipeFlush                                    RT_MANGLER(RTPipeFlush)
 # define RTPipeFromNative                               RT_MANGLER(RTPipeFromNative)
+# define RTPipeQueryInfo                                RT_MANGLER(RTPipeQueryInfo)
 # define RTPipeQueryReadable                            RT_MANGLER(RTPipeQueryReadable)
 # define RTPipeRead                                     RT_MANGLER(RTPipeRead)
 # define RTPipeReadBlocking                             RT_MANGLER(RTPipeReadBlocking)
 # define RTR0AssertPanicSystem                          RT_MANGLER(RTR0AssertPanicSystem)      /* r0drv */
 # define RTR0DbgKrnlInfoOpen                            RT_MANGLER(RTR0DbgKrnlInfoOpen)        /* r0drv */
 # define RTR0DbgKrnlInfoQueryMember                     RT_MANGLER(RTR0DbgKrnlInfoQueryMember) /* r0drv */
+# define RTR0DbgKrnlInfoQuerySize                       RT_MANGLER(RTR0DbgKrnlInfoQuerySize)   /* r0drv */
 # define RTR0DbgKrnlInfoQuerySymbol                     RT_MANGLER(RTR0DbgKrnlInfoQuerySymbol) /* r0drv */
 # define RTR0DbgKrnlInfoRelease                         RT_MANGLER(RTR0DbgKrnlInfoRelease)     /* r0drv */
 # define RTR0DbgKrnlInfoRetain                          RT_MANGLER(RTR0DbgKrnlInfoRetain)      /* r0drv */
 # define RTSgBufSet                                     RT_MANGLER(RTSgBufSet)
 # define RTSgBufGetNextSegment                          RT_MANGLER(RTSgBufGetNextSegment)
 # define RTSha1                                         RT_MANGLER(RTSha1)
+# define RTSha1Check                                    RT_MANGLER(RTSha1Check)
 # define RTSha1Digest                                   RT_MANGLER(RTSha1Digest)
 # define RTSha1DigestFromFile                           RT_MANGLER(RTSha1DigestFromFile)
 # define RTSha1Final                                    RT_MANGLER(RTSha1Final)
 # define RTSha1ToString                                 RT_MANGLER(RTSha1ToString)
 # define RTSha1Update                                   RT_MANGLER(RTSha1Update)
 # define RTSha224                                       RT_MANGLER(RTSha224)
+# define RTSha224Check                                  RT_MANGLER(RTSha224Check)
 # define RTSha224Final                                  RT_MANGLER(RTSha224Final)
 # define RTSha224FromString                             RT_MANGLER(RTSha224FromString)
 # define RTSha224Init                                   RT_MANGLER(RTSha224Init)
 # define RTSha224Digest                                 RT_MANGLER(RTSha224Digest)
 # define RTSha224DigestFromFile                         RT_MANGLER(RTSha224DigestFromFile)
 # define RTSha256                                       RT_MANGLER(RTSha256)
+# define RTSha256Check                                  RT_MANGLER(RTSha256Check)
 # define RTSha256Final                                  RT_MANGLER(RTSha256Final)
 # define RTSha256FromString                             RT_MANGLER(RTSha256FromString)
 # define RTSha256Init                                   RT_MANGLER(RTSha256Init)
 # define RTSha256Digest                                 RT_MANGLER(RTSha256Digest)
 # define RTSha256DigestFromFile                         RT_MANGLER(RTSha256DigestFromFile)
 # define RTSha384                                       RT_MANGLER(RTSha384)
+# define RTSha384Check                                  RT_MANGLER(RTSha384Check)
 # define RTSha384Final                                  RT_MANGLER(RTSha384Final)
 # define RTSha384FromString                             RT_MANGLER(RTSha384FromString)
 # define RTSha384Init                                   RT_MANGLER(RTSha384Init)
 # define RTSha384ToString                               RT_MANGLER(RTSha384ToString)
 # define RTSha384Update                                 RT_MANGLER(RTSha384Update)
 # define RTSha512                                       RT_MANGLER(RTSha512)
+# define RTSha512Check                                  RT_MANGLER(RTSha512Check)
 # define RTSha512Final                                  RT_MANGLER(RTSha512Final)
 # define RTSha512FromString                             RT_MANGLER(RTSha512FromString)
 # define RTSha512Init                                   RT_MANGLER(RTSha512Init)
 # define RTSha512ToString                               RT_MANGLER(RTSha512ToString)
 # define RTSha512Update                                 RT_MANGLER(RTSha512Update)
 # define RTSha512t224                                   RT_MANGLER(RTSha512t224)
+# define RTSha512t224Check                              RT_MANGLER(RTSha512t224Check)
 # define RTSha512t224Final                              RT_MANGLER(RTSha512t224Final)
 # define RTSha512t224FromString                         RT_MANGLER(RTSha512t224FromString)
 # define RTSha512t224Init                               RT_MANGLER(RTSha512t224Init)
 # define RTSha512t224ToString                           RT_MANGLER(RTSha512t224ToString)
 # define RTSha512t224Update                             RT_MANGLER(RTSha512t224Update)
 # define RTSha512t256                                   RT_MANGLER(RTSha512t256)
+# define RTSha512t256Check                              RT_MANGLER(RTSha512t256Check)
 # define RTSha512t256Final                              RT_MANGLER(RTSha512t256Final)
 # define RTSha512t256FromString                         RT_MANGLER(RTSha512t256FromString)
 # define RTSha512t256Init                               RT_MANGLER(RTSha512t256Init)
 # define RTSymlinkIsDangling                            RT_MANGLER(RTSymlinkIsDangling)
 # define RTSymlinkRead                                  RT_MANGLER(RTSymlinkRead)
 # define RTSymlinkReadA                                 RT_MANGLER(RTSymlinkReadA)
+# define RTSystemIsInsideVM                             RT_MANGLER(RTSystemIsInsideVM)
 # define RTSystemQueryAvailableRam                      RT_MANGLER(RTSystemQueryAvailableRam)
 # define RTSystemQueryDmiString                         RT_MANGLER(RTSystemQueryDmiString)
 # define RTSystemQueryOSInfo                            RT_MANGLER(RTSystemQueryOSInfo)
 # define RTUdpServerShutdown                            RT_MANGLER(RTUdpServerShutdown)
 # define RTUdpWrite                                     RT_MANGLER(RTUdpWrite)
 # define RTUniFree                                      RT_MANGLER(RTUniFree)
-# define RTUriAuthority                                 RT_MANGLER(RTUriAuthority)
 # define RTUriCreate                                    RT_MANGLER(RTUriCreate)
 # define RTUriFileCreate                                RT_MANGLER(RTUriFileCreate)
-# define RTUriFileNPath                                 RT_MANGLER(RTUriFileNPath)
+# define RTUriFileCreateEx                              RT_MANGLER(RTUriFileCreateEx)
 # define RTUriFilePath                                  RT_MANGLER(RTUriFilePath)
-# define RTUriFragment                                  RT_MANGLER(RTUriFragment)
-# define RTUriHasScheme                                 RT_MANGLER(RTUriHasScheme)
-# define RTUriPath                                      RT_MANGLER(RTUriPath)
-# define RTUriQuery                                     RT_MANGLER(RTUriQuery)
-# define RTUriScheme                                    RT_MANGLER(RTUriScheme)
+# define RTUriFilePathEx                                RT_MANGLER(RTUriFilePathEx)
+# define RTUriParse                                     RT_MANGLER(RTUriParse)
+# define RTUriParsedAuthority                           RT_MANGLER(RTUriParsedAuthority)
+# define RTUriParsedAuthorityHost                       RT_MANGLER(RTUriParsedAuthorityHost)
+# define RTUriParsedAuthorityPassword                   RT_MANGLER(RTUriParsedAuthorityPassword)
+# define RTUriParsedAuthorityPort                       RT_MANGLER(RTUriParsedAuthorityPort)
+# define RTUriParsedAuthorityUsername                   RT_MANGLER(RTUriParsedAuthorityUsername)
+# define RTUriParsedFragment                            RT_MANGLER(RTUriParsedFragment)
+# define RTUriParsedPath                                RT_MANGLER(RTUriParsedPath)
+# define RTUriParsedScheme                              RT_MANGLER(RTUriParsedScheme)
+# define RTUriParsedQuery                               RT_MANGLER(RTUriParsedQuery)
+# define RTUriIsSchemeMatch                             RT_MANGLER(RTUriIsSchemeMatch)
 # define RTUtf16AllocTag                                RT_MANGLER(RTUtf16AllocTag)
 # define RTUtf16CalcLatin1Len                           RT_MANGLER(RTUtf16CalcLatin1Len)
 # define RTUtf16CalcLatin1LenEx                         RT_MANGLER(RTUtf16CalcLatin1LenEx)
 # define RTVfsIoStreamToPrivate                         RT_MANGLER(RTVfsIoStreamToPrivate)
 # define RTVfsIoStrmFlush                               RT_MANGLER(RTVfsIoStrmFlush)
 # define RTVfsIoStrmFromRTFile                          RT_MANGLER(RTVfsIoStrmFromRTFile)
+# define RTVfsIoStrmFromRTPipe                          RT_MANGLER(RTVfsIoStrmFromRTPipe)
 # define RTVfsIoStrmFromStdHandle                       RT_MANGLER(RTVfsIoStrmFromStdHandle)
 # define RTVfsIoStrmIsAtEnd                             RT_MANGLER(RTVfsIoStrmIsAtEnd)
 # define RTVfsIoStrmOpenNormal                          RT_MANGLER(RTVfsIoStrmOpenNormal)
 # define RTCrRsaPrivateKey_CheckSanity                  RT_MANGLER(RTCrRsaPrivateKey_CheckSanity)
 # define RTCrRsaPublicKey_CheckSanity                   RT_MANGLER(RTCrRsaPublicKey_CheckSanity)
 # define RTCrPemFreeSections                            RT_MANGLER(RTCrPemFreeSections)
+# define RTCrPemParseContent                            RT_MANGLER(RTCrPemParseContent)
 # define RTCrPemReadFile                                RT_MANGLER(RTCrPemReadFile)
 # define RTCrPkcs7Attribute_DecodeAsn1                  RT_MANGLER(RTCrPkcs7Attribute_DecodeAsn1)
 # define RTCrPkcs7Attributes_DecodeAsn1                 RT_MANGLER(RTCrPkcs7Attributes_DecodeAsn1)
 # define RTCrCertCtxRetain                              RT_MANGLER(RTCrCertCtxRetain)
 # define RTCrStoreCertAddEncoded                        RT_MANGLER(RTCrStoreCertAddEncoded)
 # define RTCrStoreCertByIssuerAndSerialNo               RT_MANGLER(RTCrStoreCertByIssuerAndSerialNo)
+# define RTCrStoreCertCount                             RT_MANGLER(RTCrStoreCertCount)
 # define RTCrStoreCertFindAll                           RT_MANGLER(RTCrStoreCertFindAll)
 # define RTCrStoreCertFindBySubjectOrAltSubjectByRfc5280 RT_MANGLER(RTCrStoreCertFindBySubjectOrAltSubjectByRfc5280)
 # define RTCrStoreCertSearchDestroy                     RT_MANGLER(RTCrStoreCertSearchDestroy)
 # define RTCrStoreRelease                               RT_MANGLER(RTCrStoreRelease)
 # define RTCrStoreRetain                                RT_MANGLER(RTCrStoreRetain)
 # define RTCrStoreCreateInMem                           RT_MANGLER(RTCrStoreCreateInMem)
+# define RTCrStoreCreateSnapshotById                    RT_MANGLER(RTCrStoreCreateSnapshotById)
+# define RTCrStoreCertAddFromDir                        RT_MANGLER(RTCrStoreCertAddFromDir)
 # define RTCrStoreCertAddFromFile                       RT_MANGLER(RTCrStoreCertAddFromFile)
+# define RTCrStoreCertAddFromJavaKeyStore               RT_MANGLER(RTCrStoreCertAddFromJavaKeyStore)
+# define RTCrStoreCertAddFromJavaKeyStoreInMem          RT_MANGLER(RTCrStoreCertAddFromJavaKeyStoreInMem)
+# define RTCrStoreCertAddFromStore                      RT_MANGLER(RTCrStoreCertAddFromStore)
+# define RTCrStoreCertAddWantedFromDir                  RT_MANGLER(RTCrStoreCertAddWantedFromDir)
+# define RTCrStoreCertAddWantedFromFile                 RT_MANGLER(RTCrStoreCertAddWantedFromFile)
+# define RTCrStoreCertAddWantedFromStore                RT_MANGLER(RTCrStoreCertAddWantedFromStore)
+# define RTCrStoreCertAddWantedFromFishingExpedition    RT_MANGLER(RTCrStoreCertAddWantedFromFishingExpedition)
+# define RTCrStoreCertCheckWanted                       RT_MANGLER(RTCrStoreCertCheckWanted)
+# define RTCrStoreCertExportAsPem                       RT_MANGLER(RTCrStoreCertExportAsPem)
 # define RTErrInfoAdd                                   RT_MANGLER(RTErrInfoAdd)
 # define RTErrInfoAddF                                  RT_MANGLER(RTErrInfoAddF)
 # define RTErrInfoAddV                                  RT_MANGLER(RTErrInfoAddV)
index c5fd037aad4985f135d55a92471d8535880c61e1..c8f89c58e8532b2bede8509e46307c217aee1009 100644 (file)
@@ -102,7 +102,7 @@ RT_C_DECLS_BEGIN
  * @param   cb      Size in bytes of the memory block to allocated.
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *)  RTMemTmpAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemTmpAllocTag(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Allocates zero'd temporary memory with default tag.
@@ -125,14 +125,14 @@ RTDECL(void *)  RTMemTmpAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
  * @param   cb      Size in bytes of the memory block to allocated.
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *)  RTMemTmpAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemTmpAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Free temporary memory.
  *
  * @param   pv      Pointer to memory block.
  */
-RTDECL(void)    RTMemTmpFree(void *pv) RT_NO_THROW;
+RTDECL(void)    RTMemTmpFree(void *pv) RT_NO_THROW_PROTO;
 
 /** @}  */
 
@@ -143,7 +143,6 @@ RTDECL(void)    RTMemTmpFree(void *pv) RT_NO_THROW;
  * @returns Pointer to the allocated memory.
  * @returns NULL on failure, assertion raised in strict builds.
  * @param   cb      Size in bytes of the memory block to allocated.
- * @param   pszTag  Allocation tag used for statistics and such.
  */
 #define RTMemAlloc(cb)                  RTMemAllocTag((cb), RTMEM_TAG)
 
@@ -155,7 +154,7 @@ RTDECL(void)    RTMemTmpFree(void *pv) RT_NO_THROW;
  * @param   cb      Size in bytes of the memory block to allocated.
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *)  RTMemAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemAllocTag(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Allocates zero'd memory with default tag.
@@ -182,7 +181,7 @@ RTDECL(void *)  RTMemAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
  * @param   cb      Size in bytes of the memory block to allocated.
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *)  RTMemAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Wrapper around RTMemAlloc for automatically aligning variable sized
@@ -201,7 +200,7 @@ RTDECL(void *)  RTMemAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW;
  * @param   cbUnaligned         The unaligned size.
  * @param   pszTag              Allocation tag used for statistics and such.
  */
-RTDECL(void *) RTMemAllocVarTag(size_t cbUnaligned, const char *pszTag) RT_NO_THROW;
+RTDECL(void *) RTMemAllocVarTag(size_t cbUnaligned, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Wrapper around RTMemAllocZ for automatically aligning variable sized
@@ -220,7 +219,7 @@ RTDECL(void *) RTMemAllocVarTag(size_t cbUnaligned, const char *pszTag) RT_NO_TH
  * @param   cbUnaligned         The unaligned size.
  * @param   pszTag              Allocation tag used for statistics and such.
  */
-RTDECL(void *) RTMemAllocZVarTag(size_t cbUnaligned, const char *pszTag) RT_NO_THROW;
+RTDECL(void *) RTMemAllocZVarTag(size_t cbUnaligned, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Duplicates a chunk of memory into a new heap block (default tag).
@@ -241,7 +240,7 @@ RTDECL(void *) RTMemAllocZVarTag(size_t cbUnaligned, const char *pszTag) RT_NO_T
  * @param   cb      The amount of memory to duplicate.
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *) RTMemDupTag(const void *pvSrc, size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *) RTMemDupTag(const void *pvSrc, size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Duplicates a chunk of memory into a new heap block with some additional
@@ -266,7 +265,7 @@ RTDECL(void *) RTMemDupTag(const void *pvSrc, size_t cb, const char *pszTag) RT_
  * @param   cbExtra The amount of extra memory to allocate and zero.
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *) RTMemDupExTag(const void *pvSrc, size_t cbSrc, size_t cbExtra, const char *pszTag) RT_NO_THROW;
+RTDECL(void *) RTMemDupExTag(const void *pvSrc, size_t cbSrc, size_t cbExtra, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Reallocates memory with default tag.
@@ -287,18 +286,18 @@ RTDECL(void *) RTMemDupExTag(const void *pvSrc, size_t cbSrc, size_t cbExtra, co
  * @param   cbNew   The new block size (in bytes).
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *)  RTMemReallocTag(void *pvOld, size_t cbNew, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemReallocTag(void *pvOld, size_t cbNew, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Frees memory.
  *
  * @param   pv      Pointer to memory block.
  */
-RTDECL(void)    RTMemFree(void *pv) RT_NO_THROW;
+RTDECL(void)    RTMemFree(void *pv) RT_NO_THROW_PROTO;
 
 
 
-/** @def RTR0MemAllocEx and RTR0MemAllocExTag flags.
+/** @name RTR0MemAllocEx and RTR0MemAllocExTag flags.
  * @{ */
 /** The returned memory should be zeroed. */
 #define RTMEMALLOCEX_FLAGS_ZEROED           RT_BIT(0)
@@ -361,20 +360,15 @@ RTDECL(void)    RTMemFree(void *pv) RT_NO_THROW;
  * @param   pszTag              The tag.
  * @param   ppv                 Where to return the memory.
  */
-RTDECL(int) RTMemAllocExTag(size_t cb, size_t cbAlignment, uint32_t fFlags, const char *pszTag, void **ppv) RT_NO_THROW;
+RTDECL(int) RTMemAllocExTag(size_t cb, size_t cbAlignment, uint32_t fFlags, const char *pszTag, void **ppv) RT_NO_THROW_PROTO;
 
 /**
  * For freeing memory allocated by RTMemAllocEx or RTMemAllocExTag.
  *
  * @param   pv                  What to free, NULL is fine.
  * @param   cb                  The amount of allocated memory.
- * @param   fFlags              The flags specified when allocating the memory.
- *                              Whether the exact flags are requires depends on
- *                              the implementation, but in general, ring-0
- *                              doesn't require anything while ring-3 requires
- *                              RTMEMALLOCEX_FLAGS_EXEC if used.
  */
-RTDECL(void) RTMemFreeEx(void *pv, size_t cb) RT_NO_THROW;
+RTDECL(void) RTMemFreeEx(void *pv, size_t cb) RT_NO_THROW_PROTO;
 
 
 
@@ -395,7 +389,7 @@ RTDECL(void) RTMemFreeEx(void *pv, size_t cb) RT_NO_THROW;
  * @param   cb      Size in bytes of the memory block to allocate.
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *)  RTMemExecAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemExecAllocTag(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Free executable/read/write memory allocated by RTMemExecAlloc().
@@ -403,7 +397,7 @@ RTDECL(void *)  RTMemExecAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
  * @param   pv      Pointer to memory block.
  * @param   cb      The allocation size.
  */
-RTDECL(void)    RTMemExecFree(void *pv, size_t cb) RT_NO_THROW;
+RTDECL(void)    RTMemExecFree(void *pv, size_t cb) RT_NO_THROW_PROTO;
 
 #if defined(IN_RING0) && defined(RT_ARCH_AMD64) && defined(RT_OS_LINUX)
 /**
@@ -421,7 +415,7 @@ RTDECL(void)    RTMemExecFree(void *pv, size_t cb) RT_NO_THROW;
  * @param   pvMemory    Pointer to the memory block.
  * @param   cb          The size of the memory block.
  */
-RTR0DECL(int) RTR0MemExecDonate(void *pvMemory, size_t cb) RT_NO_THROW;
+RTR0DECL(int) RTR0MemExecDonate(void *pvMemory, size_t cb) RT_NO_THROW_PROTO;
 #endif /* R0+AMD64+LINUX */
 
 /**
@@ -441,7 +435,7 @@ RTR0DECL(int) RTR0MemExecDonate(void *pvMemory, size_t cb) RT_NO_THROW;
  * @param   cb  Size of the memory block. Will be rounded up to page size.
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *) RTMemPageAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *) RTMemPageAllocTag(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Allocate zero'd page aligned memory with default tag.
@@ -460,7 +454,7 @@ RTDECL(void *) RTMemPageAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
  * @param   cb  Size of the memory block. Will be rounded up to page size.
  * @param   pszTag  Allocation tag used for statistics and such.
  */
-RTDECL(void *) RTMemPageAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *) RTMemPageAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Free a memory block allocated with RTMemPageAlloc() or RTMemPageAllocZ().
@@ -470,7 +464,7 @@ RTDECL(void *) RTMemPageAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW;
  * @param   cb      The allocation size.  Will be rounded up to page size.
  *                  Ignored if @a pv is NULL.
  */
-RTDECL(void) RTMemPageFree(void *pv, size_t cb) RT_NO_THROW;
+RTDECL(void) RTMemPageFree(void *pv, size_t cb) RT_NO_THROW_PROTO;
 
 /** Page level protection flags for RTMemProtect().
  * @{
@@ -493,7 +487,7 @@ RTDECL(void) RTMemPageFree(void *pv, size_t cb) RT_NO_THROW;
  * @param   cb          Size of the region. Will be rounded up to the nearest page boundary.
  * @param   fProtect    The new protection, a combination of the RTMEM_PROT_* defines.
  */
-RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW;
+RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW_PROTO;
 
 /**
  * Goes thru some pains to make sure the specified memory block is thoroughly
@@ -503,7 +497,7 @@ RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW;
  * @param   cb          The size of the memory block.
  * @param   cMinPasses  The minimum number of passes to make.
  */
-RTDECL(void) RTMemWipeThoroughly(void *pv, size_t cb, size_t cMinPasses) RT_NO_THROW;
+RTDECL(void) RTMemWipeThoroughly(void *pv, size_t cb, size_t cMinPasses) RT_NO_THROW_PROTO;
 
 #ifdef IN_RING0
 
@@ -516,7 +510,7 @@ RTDECL(void) RTMemWipeThoroughly(void *pv, size_t cb, size_t cMinPasses) RT_NO_T
  * @param   cb      The allocation size in bytes. This is always
  *                  rounded up to PAGE_SIZE.
  */
-RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb) RT_NO_THROW;
+RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb) RT_NO_THROW_PROTO;
 
 /**
  * Frees memory allocated ysing RTMemContAlloc().
@@ -524,7 +518,7 @@ RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb) RT_NO_THROW;
  * @param   pv      Pointer to return from RTMemContAlloc().
  * @param   cb      The cb parameter passed to RTMemContAlloc().
  */
-RTR0DECL(void) RTMemContFree(void *pv, size_t cb) RT_NO_THROW;
+RTR0DECL(void) RTMemContFree(void *pv, size_t cb) RT_NO_THROW_PROTO;
 
 /**
  * Copy memory from an user mode buffer into a kernel buffer.
@@ -635,8 +629,10 @@ RTR0DECL(int) RTR0MemKernelCopyTo(void *pvDst, void const *pvSrc, size_t cb);
  * @returns NULL on failure.
  * @param   cb      Size in bytes of the memory block to allocate.
  * @param   pszTag  Allocation tag used for statistics and such.
+ * @param   SRC_POS The source position where call is being made from.
+ *                  Use RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void *)  RTMemEfTmpAlloc(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void *)  RTMemEfTmpAlloc(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Same as RTMemTmpAllocZTag() except that it's fenced.
@@ -645,15 +641,19 @@ RTDECL(void *)  RTMemEfTmpAlloc(size_t cb, const char *pszTag, RT_SRC_POS_DECL)
  * @returns NULL on failure.
  * @param   cb      Size in bytes of the memory block to allocate.
  * @param   pszTag  Allocation tag used for statistics and such.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void *)  RTMemEfTmpAllocZ(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void *)  RTMemEfTmpAllocZ(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Same as RTMemTmpFree() except that it's for fenced memory.
  *
  * @param   pv      Pointer to memory block.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void)    RTMemEfTmpFree(void *pv, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void)    RTMemEfTmpFree(void *pv, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Same as RTMemAllocTag() except that it's fenced.
@@ -662,8 +662,10 @@ RTDECL(void)    RTMemEfTmpFree(void *pv, RT_SRC_POS_DECL) RT_NO_THROW;
  * @returns NULL on failure.
  * @param   cb      Size in bytes of the memory block to allocate.
  * @param   pszTag  Allocation tag used for statistics and such.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void *)  RTMemEfAlloc(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void *)  RTMemEfAlloc(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Same as RTMemAllocZTag() except that it's fenced.
@@ -672,8 +674,10 @@ RTDECL(void *)  RTMemEfAlloc(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_
  * @returns NULL on failure.
  * @param   cb      Size in bytes of the memory block to allocate.
  * @param   pszTag  Allocation tag used for statistics and such.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void *)  RTMemEfAllocZ(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void *)  RTMemEfAllocZ(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Same as RTMemAllocVarTag() except that it's fenced.
@@ -682,8 +686,10 @@ RTDECL(void *)  RTMemEfAllocZ(size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT
  * @returns NULL on failure.
  * @param   cbUnaligned Size in bytes of the memory block to allocate.
  * @param   pszTag  Allocation tag used for statistics and such.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void *)  RTMemEfAllocVar(size_t cbUnaligned, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void *)  RTMemEfAllocVar(size_t cbUnaligned, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Same as RTMemAllocZVarTag() except that it's fenced.
@@ -692,8 +698,10 @@ RTDECL(void *)  RTMemEfAllocVar(size_t cbUnaligned, const char *pszTag, RT_SRC_P
  * @returns NULL on failure.
  * @param   cbUnaligned Size in bytes of the memory block to allocate.
  * @param   pszTag  Allocation tag used for statistics and such.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void *)  RTMemEfAllocZVar(size_t cbUnaligned, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void *)  RTMemEfAllocZVar(size_t cbUnaligned, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Same as RTMemReallocTag() except that it's fenced.
@@ -703,15 +711,19 @@ RTDECL(void *)  RTMemEfAllocZVar(size_t cbUnaligned, const char *pszTag, RT_SRC_
  * @param   pvOld   The memory block to reallocate.
  * @param   cbNew   The new block size (in bytes).
  * @param   pszTag  Allocation tag used for statistics and such.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void *)  RTMemEfRealloc(void *pvOld, size_t cbNew, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void *)  RTMemEfRealloc(void *pvOld, size_t cbNew, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Free memory allocated by any of the RTMemEf* allocators.
  *
  * @param   pv      Pointer to memory block.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void)    RTMemEfFree(void *pv, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void)    RTMemEfFree(void *pv, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Same as RTMemDupTag() except that it's fenced.
@@ -721,8 +733,10 @@ RTDECL(void)    RTMemEfFree(void *pv, RT_SRC_POS_DECL) RT_NO_THROW;
  * @param   pvSrc   The memory to duplicate.
  * @param   cb      The amount of memory to duplicate.
  * @param   pszTag  Allocation tag used for statistics and such.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void *) RTMemEfDup(const void *pvSrc, size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void *) RTMemEfDup(const void *pvSrc, size_t cb, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /**
  * Same as RTMemEfDupExTag except that it's fenced.
@@ -733,8 +747,10 @@ RTDECL(void *) RTMemEfDup(const void *pvSrc, size_t cb, const char *pszTag, RT_S
  * @param   cbSrc   The amount of memory to duplicate.
  * @param   cbExtra The amount of extra memory to allocate and zero.
  * @param   pszTag  Allocation tag used for statistics and such.
+ * @param   SRC_POS The source position where call is being made from.  Use
+ *                  RT_SRC_POS when possible.  Optional.
  */
-RTDECL(void *) RTMemEfDupEx(const void *pvSrc, size_t cbSrc, size_t cbExtra, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW;
+RTDECL(void *) RTMemEfDupEx(const void *pvSrc, size_t cbSrc, size_t cbExtra, const char *pszTag, RT_SRC_POS_DECL) RT_NO_THROW_PROTO;
 
 /** @def RTMEM_WRAP_SOME_NEW_AND_DELETE_TO_EF
  * Define RTMEM_WRAP_SOME_NEW_AND_DELETE_TO_EF to enable electric fence new and
@@ -755,7 +771,7 @@ RTDECL(void *) RTMemEfDupEx(const void *pvSrc, size_t cbSrc, size_t cbExtra, con
                 return pv; \
             throw std::bad_alloc(); \
         } \
-        void *operator new(size_t cb, const std::nothrow_t &nothrow_constant) RT_NO_THROW \
+        void *operator new(size_t cb, const std::nothrow_t &nothrow_constant) RT_NO_THROW_DEF \
         { \
             NOREF(nothrow_constant); \
             return RTMemEfAlloc(cb, RTMEM_TAG, RT_SRC_POS); \
@@ -767,26 +783,26 @@ RTDECL(void *) RTMemEfDupEx(const void *pvSrc, size_t cbSrc, size_t cbExtra, con
                 return pv; \
             throw std::bad_alloc(); \
         } \
-        void *operator new[](size_t cb, const std::nothrow_t &nothrow_constant) RT_NO_THROW \
+        void *operator new[](size_t cb, const std::nothrow_t &nothrow_constant) RT_NO_THROW_DEF \
         { \
             NOREF(nothrow_constant); \
             return RTMemEfAlloc(cb, RTMEM_TAG, RT_SRC_POS); \
         } \
         \
-        void operator delete(void *pv) RT_NO_THROW \
+        void operator delete(void *pv) RT_NO_THROW_DEF \
         { \
             RTMemEfFree(pv, RT_SRC_POS); \
         } \
-        void operator delete(void *pv, const std::nothrow_t &nothrow_constant) RT_NO_THROW \
+        void operator delete(void *pv, const std::nothrow_t &nothrow_constant) RT_NO_THROW_DEF \
         { \
             NOREF(nothrow_constant); \
             RTMemEfFree(pv, RT_SRC_POS); \
         } \
-        void operator delete[](void *pv) RT_NO_THROW \
+        void operator delete[](void *pv) RT_NO_THROW_DEF \
         { \
             RTMemEfFree(pv, RT_SRC_POS); \
         } \
-        void operator delete[](void *pv, const std::nothrow_t &nothrow_constant) RT_NO_THROW \
+        void operator delete[](void *pv, const std::nothrow_t &nothrow_constant) RT_NO_THROW_DEF \
         { \
             NOREF(nothrow_constant); \
             RTMemEfFree(pv, RT_SRC_POS); \
@@ -867,67 +883,67 @@ RTDECL(void *) RTMemEfDupEx(const void *pvSrc, size_t cbSrc, size_t cbExtra, con
  * Fenced drop-in replacement for RTMemTmpAllocTag.
  * @copydoc RTMemTmpAllocTag
  */
-RTDECL(void *)  RTMemEfTmpAllocNP(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemEfTmpAllocNP(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemTmpAllocZTag.
  * @copydoc RTMemTmpAllocZTag
  */
-RTDECL(void *)  RTMemEfTmpAllocZNP(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemEfTmpAllocZNP(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemTmpFreeTag.
- * @copydoc RTMemTmpFreeTag
+ * @copydoc RTMemTmpFree
  */
-RTDECL(void)    RTMemEfTmpFreeNP(void *pv) RT_NO_THROW;
+RTDECL(void)    RTMemEfTmpFreeNP(void *pv) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemAllocTag.
  * @copydoc RTMemAllocTag
  */
-RTDECL(void *)  RTMemEfAllocNP(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemEfAllocNP(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemAllocZTag.
  * @copydoc RTMemAllocZTag
  */
-RTDECL(void *)  RTMemEfAllocZNP(size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemEfAllocZNP(size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemAllocVarTag
  * @copydoc RTMemAllocVarTag
  */
-RTDECL(void *)  RTMemEfAllocVarNP(size_t cbUnaligned, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemEfAllocVarNP(size_t cbUnaligned, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemAllocZVarTag.
  * @copydoc RTMemAllocZVarTag
  */
-RTDECL(void *)  RTMemEfAllocZVarNP(size_t cbUnaligned, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemEfAllocZVarNP(size_t cbUnaligned, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemReallocTag.
  * @copydoc RTMemReallocTag
  */
-RTDECL(void *)  RTMemEfReallocNP(void *pvOld, size_t cbNew, const char *pszTag) RT_NO_THROW;
+RTDECL(void *)  RTMemEfReallocNP(void *pvOld, size_t cbNew, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemFree.
  * @copydoc RTMemFree
  */
-RTDECL(void)    RTMemEfFreeNP(void *pv) RT_NO_THROW;
+RTDECL(void)    RTMemEfFreeNP(void *pv) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemDupExTag.
- * @copydoc RTMemDupExTag
+ * @copydoc RTMemDupTag
  */
-RTDECL(void *) RTMemEfDupNP(const void *pvSrc, size_t cb, const char *pszTag) RT_NO_THROW;
+RTDECL(void *) RTMemEfDupNP(const void *pvSrc, size_t cb, const char *pszTag) RT_NO_THROW_PROTO;
 
 /**
  * Fenced drop-in replacement for RTMemDupExTag.
  * @copydoc RTMemDupExTag
  */
-RTDECL(void *) RTMemEfDupExNP(const void *pvSrc, size_t cbSrc, size_t cbExtra, const char *pszTag) RT_NO_THROW;
+RTDECL(void *) RTMemEfDupExNP(const void *pvSrc, size_t cbSrc, size_t cbExtra, const char *pszTag) RT_NO_THROW_PROTO;
 
 /** @} */
 
index 676a19af7fb16a592d3cecfeeb65e55f78a90351..c35f65ad4633b382f93f76dcbd3fcf142dd7f259 100644 (file)
@@ -46,8 +46,8 @@ RT_C_DECLS_BEGIN
  * @returns VINF_SUCCESS on success, VERR_GETOPT_INVALID_ARGUMENT_FORMAT on
  *          failure.
  *
- * @param   pszValue        The value to convert.
- * @param   pAddr           Where to store the result.
+ * @param   pszAddr         The address string to convert.
+ * @param   pMacAddr        Where to store the result.
  */
 RTDECL(int) RTNetStrToMacAddr(const char *pszAddr, PRTMAC pMacAddr);
 
@@ -69,6 +69,14 @@ typedef RTNETADDRIPV4 const *PCRTNETADDRIPV4;
  */
 RTDECL(bool) RTNetIsIPv4AddrStr(const char *pcszAddr);
 
+/**
+ * Tests if the given string is a wildcard IPv4 address.
+ *
+ * @returns boolean.
+ * @param   pcszAddr        String which may be an IPv4 address.
+ */
+RTDECL(bool) RTNetStrIsIPv4AddrAny(const char *pcszAddr);
+
 /**
  * Parses dotted-decimal IPv4 address into RTNETADDRIPV4 representation.
  *
@@ -112,6 +120,14 @@ typedef RTNETADDRIPV6 const *PCRTNETADDRIPV6;
  */
 RTDECL(bool) RTNetIsIPv6AddrStr(const char *pszAddress);
 
+/**
+ * Tests if the given string is a wildcard IPv6 address.
+ *
+ * @returns @c true if it is, @c false if not.
+ * @param   pszAddress          String which may be an IPv6 address.
+ */
+RTDECL(bool) RTNetStrIsIPv6AddrAny(const char *pszAddress);
+
 /**
  * Parses IPv6 address into RTNETADDRIPV6 representation.
  *
index b27ec5a7f9992cc4566e7ff21755e7224a86dddb..420728f50f67064aecc7932f1dd47f96dedf62a2 100644 (file)
@@ -357,6 +357,21 @@ RTDECL(void) RTPathStripSuffix(char *pszPath);
  */
 RTDECL(size_t) RTPathStripTrailingSlash(char *pszPath);
 
+/**
+ * Ensures that the path has a trailing path separator such that file names can
+ * be appended without further work.
+ *
+ * This can be helpful when preparing for efficiently combining a directory path
+ * with the filenames returned by RTDirRead.  The return value gives you the
+ * position at which you copy the RTDIRENTRY::szName to construct a valid path
+ * to it.
+ *
+ * @returns The length of the path, 0 on buffer overflow.
+ * @param   pszPath     The path.
+ * @param   cbPath      The length of the path buffer @a pszPath points to.
+ */
+RTDECL(size_t) RTPathEnsureTrailingSeparator(char *pszPath, size_t cbPath);
+
 /**
  * Changes all the slashes in the specified path to DOS style.
  *
@@ -585,7 +600,7 @@ RTDECL(int) RTPathCopyComponents(char *pszDst, size_t cbDst, const char *pszSrc,
  *
  * The first component is the root, volume or UNC specifier, if present.  Use
  * RTPATH_PROP_HAS_ROOT_SPEC() on RTPATHPARSED::fProps to determine its
- * precense.
+ * presence.
  *
  * Other than the root component, no component will include directory separators
  * (slashes).
@@ -791,7 +806,7 @@ RTDECL(void) RTPathSplitFree(PRTPATHSPLIT pSplit);
  * @retval  VERR_BUFFER_OVERFLOW if @a cbDstPath is less than or equal to
  *          RTPATHSPLIT::cchPath.
  *
- * @param   pParsed             The parser output for @a pszSrcPath.
+ * @param   pSplit              A split path (see RTPathSplit, RTPathSplitA).
  * @param   fFlags              Combination of RTPATH_STR_F_STYLE_XXX.
  *                              Most users will pass 0.
  * @param   pszDstPath          Pointer to the buffer where the path is to be
@@ -1156,6 +1171,72 @@ RTDECL(int) RTPathAppDocs(char *pszPath, size_t cchPath);
  */
 RTDECL(int) RTPathTemp(char *pszPath, size_t cchPath);
 
+
+/**
+ * RTPathGlobl result entry.
+ */
+typedef struct RTPATHGLOBENTRY
+{
+    /** List entry. */
+    struct RTPATHGLOBENTRY *pNext;
+    /** RTDIRENTRYTYPE value. */
+    uint8_t                 uType;
+    /** Unused explicit padding. */
+    uint8_t                 bUnused;
+    /** The length of the path. */
+    uint16_t                cchPath;
+    /** The path to the file (variable length). */
+    char                    szPath[1];
+} RTPATHGLOBENTRY;
+/** Pointer to a GLOB result entry. */
+typedef RTPATHGLOBENTRY *PRTPATHGLOBENTRY;
+/** Pointer to a const GLOB result entry. */
+typedef RTPATHGLOBENTRY const *PCRTPATHGLOBENTRY;
+/** Pointer to a GLOB result entry pointer. */
+typedef PCRTPATHGLOBENTRY *PPCRTPATHGLOBENTRY;
+
+/**
+ * Performs wildcard expansion on a path pattern.
+ *
+ * @returns IPRT status code.
+ *
+ * @param   pszPattern      The pattern to expand.
+ * @param   fFlags          RTPATHGLOB_F_XXX.
+ * @param   ppHead          Where to return the head of the result list.  This
+ *                          is always set to NULL on failure.
+ * @param   pcResults       Where to return the number of the result. Optional.
+ */
+RTDECL(int) RTPathGlob(const char *pszPattern, uint32_t fFlags, PPCRTPATHGLOBENTRY ppHead, uint32_t *pcResults);
+
+/** @name RTPATHGLOB_F_XXX - RTPathGlob flags
+ *  @{ */
+/** Case insensitive. */
+#define RTPATHGLOB_F_IGNORE_CASE        RT_BIT_32(0)
+/** Do not expand \${EnvOrSpecialVariable} in the pattern. */
+#define RTPATHGLOB_F_NO_VARIABLES       RT_BIT_32(1)
+/** Do not interpret a leading tilde as a home directory reference. */
+#define RTPATHGLOB_F_NO_TILDE           RT_BIT_32(2)
+/** Only return the first match. */
+#define RTPATHGLOB_F_FIRST_ONLY         RT_BIT_32(3)
+/** Only match directories (implied if pattern ends with slash). */
+#define RTPATHGLOB_F_ONLY_DIRS          RT_BIT_32(4)
+/** Do not match directories.  (Can't be used with RTPATHGLOB_F_ONLY_DIRS or
+ * patterns containing a trailing slash.) */
+#define RTPATHGLOB_F_NO_DIRS            RT_BIT_32(5)
+/** Disables the '**' wildcard pattern for matching zero or more subdirs. */
+#define RTPATHGLOB_F_NO_STARSTAR        RT_BIT_32(6)
+/** Mask of valid flags. */
+#define RTPATHGLOB_F_MASK               UINT32_C(0x0000007f)
+/** @} */
+
+/**
+ * Frees the results produced by RTPathGlob.
+ *
+ * @param   pHead           What RTPathGlob returned.  NULL ignored.
+ */
+RTDECL(void) RTPathGlobFree(PCRTPATHGLOBENTRY pHead);
+
+
 /**
  * Query information about a file system object.
  *
index b02d702d7f5a5e49e13c30efa293ca3d0d4601b1..fe096fe7cf8f21eec90dbcaf10058270db0f20a6 100644 (file)
@@ -159,7 +159,7 @@ RTR3DECL(int)   RTProcCreate(const char *pszExec, const char * const *papszArgs,
  *                      guest.
  * @param   pszAsUser   User to run the process as.  Pass NULL to use the same
  *                      user as the current process.
- *                      Windows: Use user@domain format to specify a domain.
+ *                      Windows: Use user\@domain format to specify a domain.
  * @param   pszPassword Password to use to authenticate @a pszAsUser.  Must be
  *                      NULL wif pszAsUser is NULL.  Whether this is actually
  *                      used or not depends on the platform.
@@ -186,7 +186,7 @@ RTR3DECL(int)   RTProcCreateEx(const char *pszExec, const char * const *papszArg
  * be possible to wait for it, i.e. @a phProcess shall be NULL. */
 #define RTPROC_FLAGS_DETACHED               RT_BIT(0)
 /** Don't show the started process.
- * This is a window (and maybe OS/2) concept, do not use on other platforms. */
+ * This is a Windows (and maybe OS/2) concept, do not use on other platforms. */
 #define RTPROC_FLAGS_HIDDEN                 RT_BIT(1)
 /** Use special code path for starting child processes from a service (daemon).
  * This is a windows concept for dealing with the so called "Session 0"
@@ -197,9 +197,13 @@ RTR3DECL(int)   RTProcCreateEx(const char *pszExec, const char * const *papszArg
  * on Solaris.  Without this flag the contract id is always changed, as that's
  * the more frequently used case. */
 #define RTPROC_FLAGS_SAME_CONTRACT          RT_BIT(3)
-/** Do not load user profile data when executing a process.
- * This bit at the moment only is valid on Windows. */
-#define RTPROC_FLAGS_NO_PROFILE             RT_BIT(4)
+/** Load user profile data when executing a process.
+ * This redefines the meaning of RTENV_DEFAULT to the profile environment.
+ * @remarks On non-windows platforms, the resulting environment maybe very
+ *          different from what you see in your shell.  Among other reasons,
+ *          we cannot run shell profile scripts which typically sets up the
+ *          environment. */
+#define RTPROC_FLAGS_PROFILE                RT_BIT(4)
 /** Create process without a console window.
  * This is a Windows (and OS/2) concept, do not use on other platforms. */
 #define RTPROC_FLAGS_NO_WINDOW              RT_BIT(5)
@@ -210,8 +214,11 @@ RTR3DECL(int)   RTProcCreateEx(const char *pszExec, const char * const *papszArg
  * just join up argv with a space between each.  Ignored on platforms
  * passing argument the vector. */
 #define RTPROC_FLAGS_UNQUOTED_ARGS          RT_BIT(7)
+/** Consider hEnv an environment change record to be applied to RTENV_DEFAULT.
+ * If hEnv is RTENV_DEFAULT, the flag has no effect. */
+#define RTPROC_FLAGS_ENV_CHANGE_RECORD      RT_BIT(8)
 /** Valid flag mask. */
-#define RTPROC_FLAGS_VALID_MASK             UINT32_C(0xff)
+#define RTPROC_FLAGS_VALID_MASK             UINT32_C(0x1ff)
 /** @}  */
 
 
@@ -333,9 +340,9 @@ RTR3DECL(char *) RTProcGetExecutablePath(char *pszExecPath, size_t cbExecPath);
  * @returns IPRT status code.  On success it is normal for the caller to exit
  *          the process by returning from main().
  *
- * @param   papszArgs       The argument vector of the calling process.
- * @param   pszDaemonized   The daemonized option.  This is appended to the end
- *                          of the parameter list of the daemonized process.
+ * @param   papszArgs           The argument vector of the calling process.
+ * @param   pszDaemonizedOpt    The daemonized option.  This is appended to the
+ *                              end of the parameter list of the daemonized process.
  */
 RTR3DECL(int)   RTProcDaemonize(const char * const *papszArgs, const char *pszDaemonizedOpt);
 
@@ -384,14 +391,14 @@ RTR3DECL(int) RTProcQueryParent(RTPROCESS hProcess, PRTPROCESS phParent);
  * @returns IPRT status code.
  * @retval VERR_BUFFER_OVERFLOW if the given buffer size is to small for the username.
  * @param   hProcess     The process handle to query the username for.
+ *                       NIL_PROCESS is an alias for the current process.
  * @param   pszUser      Where to store the user name on success.
  * @param   cbUser       The size of the user name buffer.
  * @param   pcbUser      Where to store the username length on success
  *                       or the required buffer size if VERR_BUFFER_OVERFLOW
  *                       is returned.
  */
-RTR3DECL(int)   RTProcQueryUsername(RTPROCESS hProcess, char *pszUser, size_t cbUser,
-                                    size_t *pcbUser);
+RTR3DECL(int)   RTProcQueryUsername(RTPROCESS hProcess, char *pszUser, size_t cbUser, size_t *pcbUser);
 
 /**
  * Query the username of the given process allocating the string for the username.
index 85dbb99e122f98397718812127003082141a539e..90383a1ef984ec57c9433b4d03e43447d99623e4 100644 (file)
@@ -130,7 +130,8 @@ RTDECL(int)  RTSemEventCreate(PRTSEMEVENT phEventSem);
  *                              optional (NULL).  Max length is 32 bytes.
  * @param   ...                 Format string arguments.
  */
-RTDECL(int)  RTSemEventCreateEx(PRTSEMEVENT phEventSem, uint32_t fFlags, RTLOCKVALCLASS hClass, const char *pszNameFmt, ...);
+RTDECL(int)  RTSemEventCreateEx(PRTSEMEVENT phEventSem, uint32_t fFlags, RTLOCKVALCLASS hClass,
+                                const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);
 
 /** @name RTSemMutexCreateEx flags
  * @{ */
@@ -213,11 +214,8 @@ RTDECL(int)  RTSemEventWaitEx(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uT
  * @param   uTimeout            See RTSemEventWaitEx.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)  RTSemEventWaitExDebug(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout,
                                    RTHCUINTPTR uId, RT_SRC_POS_DECL);
@@ -300,7 +298,7 @@ RTDECL(int)  RTSemEventMultiCreate(PRTSEMEVENTMULTI phEventMultiSem);
  * @param   ...                 Format string arguments.
  */
 RTDECL(int)  RTSemEventMultiCreateEx(PRTSEMEVENTMULTI phEventMultiSem, uint32_t fFlags, RTLOCKVALCLASS hClass,
-                                     const char *pszNameFmt, ...);
+                                     const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);
 
 /** @name RTSemMutexCreateEx flags
  * @{ */
@@ -388,11 +386,8 @@ RTDECL(int)  RTSemEventMultiWaitEx(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFla
  * @param   uTimeout            See RTSemEventMultiWaitEx.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)  RTSemEventMultiWaitExDebug(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout,
                                         RTHCUINTPTR uId, RT_SRC_POS_DECL);
@@ -466,8 +461,8 @@ RTDECL(int)  RTSemMutexCreate(PRTSEMMUTEX phMutexSem);
  * Creates a read/write semaphore.
  *
  * @returns iprt status code.
- * @param   phRWSem             Where to store the handle to the newly created
- *                              RW semaphore.
+ * @param   phMutexSem          Where to store the handle to the newly created
+ *                              mutex semaphore.
  * @param   fFlags              Flags, any combination of the
  *                              RTSEMMUTEX_FLAGS_XXX \#defines.
  * @param   hClass              The class (no reference consumed).  If NIL, no
@@ -480,8 +475,8 @@ RTDECL(int)  RTSemMutexCreate(PRTSEMMUTEX phMutexSem);
  *                              optional (NULL).  Max length is 32 bytes.
  * @param   ...                 Format string arguments.
  */
-RTDECL(int) RTSemMutexCreateEx(PRTSEMMUTEX phMutexSem, uint32_t fFlags,
-                               RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszNameFmt, ...);
+RTDECL(int) RTSemMutexCreateEx(PRTSEMMUTEX phMutexSem, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass,
+                               const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(5, 6);
 
 /** @name RTSemMutexCreateEx flags
  * @{ */
@@ -554,11 +549,8 @@ RTDECL(int)  RTSemMutexRequestNoResume(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMilli
  * @param   cMillies            The number of milliseconds to wait.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)  RTSemMutexRequestDebug(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
 
@@ -570,11 +562,8 @@ RTDECL(int)  RTSemMutexRequestDebug(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies,
  * @param   cMillies            The number of milliseconds to wait.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)  RTSemMutexRequestNoResumeDebug(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
 
@@ -606,11 +595,8 @@ RTDECL(int)  RTSemMutexRequestEx(RTSEMMUTEX hMutexSem, uint32_t fFlags, uint64_t
  * @param   uTimeout            See RTSemMutexRequestEx.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)  RTSemMutexRequestExDebug(RTSEMMUTEX hMutexSem, uint32_t fFlags, uint64_t uTimeout,
                                       RTHCUINTPTR uId, RT_SRC_POS_DECL);
@@ -844,8 +830,8 @@ RTDECL(int)   RTSemRWCreate(PRTSEMRW phRWSem);
  *                              optional (NULL).  Max length is 32 bytes.
  * @param   ...                 Format string arguments.
  */
-RTDECL(int)   RTSemRWCreateEx(PRTSEMRW phRWSem, uint32_t fFlags,
-                              RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszNameFmt, ...);
+RTDECL(int)   RTSemRWCreateEx(PRTSEMRW phRWSem, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass,
+                              const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(5, 6);
 
 /** @name RTSemRWCreateEx flags
  * @{ */
@@ -914,11 +900,8 @@ RTDECL(int)   RTSemRWRequestReadNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies);
  * @param   cMillies            The number of milliseconds to wait.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)   RTSemRWRequestReadDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
 
@@ -934,11 +917,8 @@ RTDECL(int)   RTSemRWRequestReadDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTH
  * @param   cMillies            The number of milliseconds to wait.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)   RTSemRWRequestReadNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
 
@@ -977,11 +957,8 @@ RTDECL(int)   RTSemRWRequestReadEx(RTSEMRW hRWSem, uint32_t fFlags, uint64_t uTi
  * @param   uTimeout            See RTSemRWRequestReadEx.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)   RTSemRWRequestReadExDebug(RTSEMRW hRWSem, uint32_t fFlags, uint64_t uTimeout,
                                         RTHCUINTPTR uId, RT_SRC_POS_DECL);
@@ -1031,11 +1008,8 @@ RTDECL(int)   RTSemRWRequestWriteNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
  * @param   cMillies            The number of milliseconds to wait.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)  RTSemRWRequestWriteDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
 
@@ -1047,11 +1021,8 @@ RTDECL(int)  RTSemRWRequestWriteDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTH
  * @param   cMillies            The number of milliseconds to wait.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)  RTSemRWRequestWriteNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
 
@@ -1086,11 +1057,8 @@ RTDECL(int)   RTSemRWRequestWriteEx(RTSEMRW hRWSem, uint32_t fFlags, uint64_t uT
  * @param   uTimeout            See RTSemRWRequestWriteEx.
  * @param   uId                 Some kind of locking location ID.  Typically a
  *                              return address up the stack.  Optional (0).
- * @param   pszFile             The file where the lock is being acquired from.
- *                              Optional.
- * @param   iLine               The line number in that file.  Optional (0).
- * @param   pszFunction         The function where the lock is being acquired
- *                              from.  Optional.
+ * @param   SRC_POS             The source position where call is being made
+ *                              from.  Use RT_SRC_POS when possible.  Optional.
  */
 RTDECL(int)  RTSemRWRequestWriteExDebug(RTSEMRW hRWSem, uint32_t fFlags, uint64_t uTimeout,
                                         RTHCUINTPTR uId, RT_SRC_POS_DECL);
index d1ebbb0292eea54a387b8ae3f156f61cc58fb27a..ce5f4c1df2f10f26137acc6ddf9eb1b2625cabf7 100644 (file)
@@ -33,7 +33,9 @@
 #include <iprt/err.h> /* for VINF_SUCCESS */
 #if defined(RT_OS_LINUX) && defined(__KERNEL__)
   RT_C_DECLS_BEGIN
+# define new newhack /* string.h: strreplace */
 # include <linux/string.h>
+# undef new
   RT_C_DECLS_END
 
 #elif defined(IN_XF86_MODULE) && !defined(NO_ANSIC)
 # include <string.h>
 #endif
 
+/* For the time being: */
+#include <iprt/utf16.h>
+#include <iprt/latin1.h>
+
 /*
  * Supply prototypes for standard string functions provided by
  * IPRT instead of the operating environment.
@@ -107,6 +113,13 @@ char *strpbrk(const char *pszStr, const char *pszChars);
 RT_C_DECLS_END
 #endif
 
+#if !defined(RT_OS_LINUX) || !defined(_GNU_SOURCE)
+RT_C_DECLS_BEGIN
+void *memrchr(const char *pv, int ch, size_t cb);
+RT_C_DECLS_END
+#endif
+
+
 /** @def RT_USE_RTC_3629
  * When defined the UTF-8 range will stop at  0x10ffff.  If not defined, the
  * range stops at 0x7fffffff.
@@ -173,7 +186,7 @@ RT_C_DECLS_BEGIN
  * the pointer to the current file name.  The string API will make of use of
  * this as pointer to a volatile but read-only string.
  */
-#ifndef RTSTR_TAG
+#if !defined(RTSTR_TAG) || defined(DOXYGEN_RUNNING)
 # define RTSTR_TAG      (__FILE__)
 #endif
 
@@ -672,6 +685,7 @@ RTDECL(int) RTStrReallocTag(char **ppsz, size_t cbNew, const char *pszTag);
 RTDECL(int) RTStrValidateEncoding(const char *psz);
 
 /** @name Flags for RTStrValidateEncodingEx and RTUtf16ValidateEncodingEx
+ * @{
  */
 /** Check that the string is zero terminated within the given size.
  * VERR_BUFFER_OVERFLOW will be returned if the check fails. */
@@ -719,7 +733,7 @@ RTDECL(size_t) RTStrPurgeEncoding(char *psz);
  *          string is not correctly encoded.  In this last case the string
  *          may be partially processed.
  * @param   psz            The string to sanitise.
- * @param   puszValidSets  A zero-terminated array of pairs of Unicode points.
+ * @param   puszValidSet   A zero-terminated array of pairs of Unicode points.
  *                         Each pair is the start and end point of a range,
  *                         and the union of these ranges forms the white list.
  * @param   chReplacement  The ASCII replacement character.
@@ -919,7 +933,7 @@ RTDECL(size_t) RTStrCalcLatin1Len(const char *psz);
  * @param   pcch        Where to store the string length. Optional.
  *                      This is undefined on failure.
  */
-RTDECL(int) RTStrCalcLatin1LenEx(const char *psz, size_t cch, size_t *pcwc);
+RTDECL(int) RTStrCalcLatin1LenEx(const char *psz, size_t cch, size_t *pcch);
 
 /**
  * Translate a UTF-8 string into a Latin-1 allocating the result buffer (default
@@ -1003,114 +1017,6 @@ RTDECL(int) RTStrToLatin1Tag(const char *pszString, char **ppszString, const cha
  */
 RTDECL(int)  RTStrToLatin1ExTag(const char *pszString, size_t cchString, char **ppsz, size_t cch, size_t *pcch, const char *pszTag);
 
-
-/**
- * Translate a Latin1 string into a UTF-8 allocating the result buffer (default
- * tag).
- *
- * @returns iprt status code.
- * @param   pszString       Latin1 string to convert.
- * @param   ppszString      Receives pointer of allocated UTF-8 string on
- *                          success, and is always set to NULL on failure.
- *                          The returned pointer must be freed using RTStrFree().
- */
-#define RTLatin1ToUtf8(pszString, ppszString)       RTLatin1ToUtf8Tag((pszString), (ppszString), RTSTR_TAG)
-
-/**
- * Translate a Latin-1 string into a UTF-8 allocating the result buffer.
- *
- * @returns iprt status code.
- * @param   pszString       Latin-1 string to convert.
- * @param   ppszString      Receives pointer of allocated UTF-8 string on
- *                          success, and is always set to NULL on failure.
- *                          The returned pointer must be freed using RTStrFree().
- * @param   pszTag          Allocation tag used for statistics and such.
- */
-RTDECL(int)  RTLatin1ToUtf8Tag(const char *pszString, char **ppszString, const char *pszTag);
-
-/**
- * Translates Latin-1 to UTF-8 using buffer provided by the caller or a fittingly
- * sized buffer allocated by the function (default tag).
- *
- * @returns iprt status code.
- * @param   pszString       The Latin-1 string to convert.
- * @param   cchString       The number of Latin-1 characters to translate from
- *                          pszString. The translation will stop when reaching
- *                          cchString or the terminator ('\\0').  Use RTSTR_MAX
- *                          to translate the entire string.
- * @param   ppsz            If cch is non-zero, this must either be pointing to
- *                          a pointer to a buffer of the specified size, or
- *                          pointer to a NULL pointer.  If *ppsz is NULL or cch
- *                          is zero a buffer of at least cch chars will be
- *                          allocated to hold the translated string. If a
- *                          buffer was requested it must be freed using
- *                          RTStrFree().
- * @param   cch             The buffer size in chars (the type). This includes the terminator.
- * @param   pcch            Where to store the length of the translated string,
- *                          excluding the terminator. (Optional)
- *
- *                          This may be set under some error conditions,
- *                          however, only for VERR_BUFFER_OVERFLOW and
- *                          VERR_NO_STR_MEMORY will it contain a valid string
- *                          length that can be used to resize the buffer.
- */
-#define RTLatin1ToUtf8Ex(pszString, cchString, ppsz, cch, pcch) \
-    RTLatin1ToUtf8ExTag((pszString), (cchString), (ppsz), (cch), (pcch), RTSTR_TAG)
-
-/**
- * Translates Latin1 to UTF-8 using buffer provided by the caller or a fittingly
- * sized buffer allocated by the function (custom tag).
- *
- * @returns iprt status code.
- * @param   pszString       The Latin1 string to convert.
- * @param   cchString       The number of Latin1 characters to translate from
- *                          pwszString.  The translation will stop when
- *                          reaching cchString or the terminator ('\\0').  Use
- *                          RTSTR_MAX to translate the entire string.
- * @param   ppsz            If cch is non-zero, this must either be pointing to
- *                          a pointer to a buffer of the specified size, or
- *                          pointer to a NULL pointer.  If *ppsz is NULL or cch
- *                          is zero a buffer of at least cch chars will be
- *                          allocated to hold the translated string.  If a
- *                          buffer was requested it must be freed using
- *                          RTStrFree().
- * @param   cch             The buffer size in chars (the type).  This includes
- *                          the terminator.
- * @param   pcch            Where to store the length of the translated string,
- *                          excluding the terminator. (Optional)
- *
- *                          This may be set under some error conditions,
- *                          however, only for VERR_BUFFER_OVERFLOW and
- *                          VERR_NO_STR_MEMORY will it contain a valid string
- *                          length that can be used to resize the buffer.
- * @param   pszTag          Allocation tag used for statistics and such.
- */
-RTDECL(int)  RTLatin1ToUtf8ExTag(const char *pszString, size_t cchString, char **ppsz, size_t cch, size_t *pcch, const char *pszTag);
-
-/**
- * Calculates the length of the Latin-1 string in UTF-8 chars (bytes).
- *
- * The primary purpose of this function is to help allocate buffers for
- * RTLatin1ToUtf8() of the correct size. For most other purposes
- * RTLatin1ToUtf8Ex() should be used.
- *
- * @returns Number of chars (bytes).
- * @returns 0 if the string was incorrectly encoded.
- * @param   psz        The Latin-1 string.
- */
-RTDECL(size_t) RTLatin1CalcUtf8Len(const char *psz);
-
-/**
- * Calculates the length of the Latin-1 string in UTF-8 chars (bytes).
- *
- * @returns iprt status code.
- * @param   psz         The string.
- * @param   cch         The max string length. Use RTSTR_MAX to process the entire string.
- * @param   pcch        Where to store the string length (in bytes).  Optional.
- *                      This is undefined on failure.
- */
-RTDECL(int) RTLatin1CalcUtf8LenEx(const char *psz, size_t cch, size_t *pcch);
-
 /**
  * Get the unicode code point at the given string position.
  *
@@ -1331,131 +1237,6 @@ DECLINLINE(char *) RTStrNextCp(const char *psz)
  */
 RTDECL(char *) RTStrPrevCp(const char *pszStart, const char *psz);
 
-/**
- * Get the unicode code point at the given string position.
- *
- * @returns unicode code point.
- * @returns RTUNICP_INVALID if the encoding is invalid.
- * @param   psz         The string.
- */
-DECLINLINE(RTUNICP) RTLatin1GetCp(const char *psz)
-{
-    return *(const unsigned char *)psz;
-}
-
-/**
- * Get the unicode code point at the given string position.
- *
- * @returns iprt status code.
- * @param   ppsz        Pointer to the string pointer. This will be updated to
- *                      point to the char following the current code point.
- *                      This is advanced one character forward on failure.
- * @param   pCp         Where to store the code point.
- *                      RTUNICP_INVALID is stored here on failure.
- *
- * @remark  We optimize this operation by using an inline function for
- *          the most frequent and simplest sequence, the rest is
- *          handled by RTStrGetCpExInternal().
- */
-DECLINLINE(int) RTLatin1GetCpEx(const char **ppsz, PRTUNICP pCp)
-{
-    const unsigned char uch = **(const unsigned char **)ppsz;
-    (*ppsz)++;
-    *pCp = uch;
-    return VINF_SUCCESS;
-}
-
-/**
- * Get the unicode code point at the given string position for a string of a
- * given maximum length.
- *
- * @returns iprt status code.
- * @retval  VERR_END_OF_STRING if *pcch is 0. *pCp is set to RTUNICP_INVALID.
- *
- * @param   ppsz        Pointer to the string pointer. This will be updated to
- *                      point to the char following the current code point.
- * @param   pcch        Pointer to the maximum string length.  This will be
- *                      decremented by the size of the code point found.
- * @param   pCp         Where to store the code point.
- *                      RTUNICP_INVALID is stored here on failure.
- */
-DECLINLINE(int) RTLatin1GetCpNEx(const char **ppsz, size_t *pcch, PRTUNICP pCp)
-{
-    if (RT_LIKELY(*pcch != 0))
-    {
-        const unsigned char uch = **(const unsigned char **)ppsz;
-        (*ppsz)++;
-        (*pcch)--;
-        *pCp = uch;
-        return VINF_SUCCESS;
-    }
-    *pCp = RTUNICP_INVALID;
-    return VERR_END_OF_STRING;
-}
-
-/**
- * Get the Latin-1 size in characters of a given Unicode code point.
- *
- * The code point is expected to be a valid Unicode one, but not necessarily in
- * the range supported by Latin-1.
- *
- * @returns the size in characters, or zero if there is no Latin-1 encoding
- */
-DECLINLINE(size_t) RTLatin1CpSize(RTUNICP CodePoint)
-{
-    if (CodePoint < 0x100)
-        return 1;
-    return 0;
-}
-
-/**
- * Put the unicode code point at the given string position
- * and return the pointer to the char following it.
- *
- * This function will not consider anything at or following the
- * buffer area pointed to by psz. It is therefore not suitable for
- * inserting code points into a string, only appending/overwriting.
- *
- * @returns pointer to the char following the written code point.
- * @param   psz         The string.
- * @param   CodePoint   The code point to write.
- *                      This should not be RTUNICP_INVALID or any other
- *                      character out of the Latin-1 range.
- */
-DECLINLINE(char *) RTLatin1PutCp(char *psz, RTUNICP CodePoint)
-{
-    AssertReturn(CodePoint < 0x100, NULL);
-    *psz++ = (unsigned char)CodePoint;
-    return psz;
-}
-
-/**
- * Skips ahead, past the current code point.
- *
- * @returns Pointer to the char after the current code point.
- * @param   psz     Pointer to the current code point.
- * @remark  This will not move the next valid code point, only past the current one.
- */
-DECLINLINE(char *) RTLatin1NextCp(const char *psz)
-{
-    psz++;
-    return (char *)psz;
-}
-
-/**
- * Skips back to the previous code point.
- *
- * @returns Pointer to the char before the current code point.
- * @returns pszStart on failure.
- * @param   pszStart    Pointer to the start of the string.
- * @param   psz         Pointer to the current code point.
- */
-DECLINLINE(char *) RTLatin1PrevCp(const char *psz)
-{
-    psz--;
-    return (char *)psz;
-}
-
 
 /** @page pg_rt_str_format  The IPRT Format Strings
  *
@@ -1654,7 +1435,7 @@ typedef DECLCALLBACK(size_t) FNRTSTROUTPUT(void *pvArg, const char *pachChars, s
 typedef FNRTSTROUTPUT *PFNRTSTROUTPUT;
 #endif
 
-/** Format flag.
+/** @name Format flag.
  * These are used by RTStrFormat extensions and RTStrFormatNumber, mind
  * that not all flags makes sense to both of the functions.
  * @{ */
@@ -1726,7 +1507,8 @@ typedef FNSTRFORMAT *PFNSTRFORMAT;
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   InArgs      Argument list.
  */
-RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat, const char *pszFormat, va_list InArgs);
+RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat,
+                            const char *pszFormat, va_list InArgs) RT_IPRT_FORMAT_ATTR(5, 0);
 
 /**
  * Partial implementation of a printf like formatter.
@@ -1743,7 +1525,8 @@ RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRF
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   ...         Argument list.
  */
-RTDECL(size_t) RTStrFormat(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat, const char *pszFormat, ...);
+RTDECL(size_t) RTStrFormat(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat,
+                           const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(5, 6);
 
 /**
  * Formats an integer number according to the parameters.
@@ -1756,7 +1539,8 @@ RTDECL(size_t) RTStrFormat(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFO
  * @param   cchPrecision    Precision.
  * @param   fFlags          Flags, RTSTR_F_XXX.
  */
-RTDECL(int) RTStrFormatNumber(char *psz, uint64_t u64Value, unsigned int uiBase, signed int cchWidth, signed int cchPrecision, unsigned int fFlags);
+RTDECL(int) RTStrFormatNumber(char *psz, uint64_t u64Value, unsigned int uiBase, signed int cchWidth, signed int cchPrecision,
+                              unsigned int fFlags);
 
 /**
  * Formats an unsigned 8-bit number.
@@ -1949,7 +1733,7 @@ RTDECL(int) RTStrFormatTypeSetUser(const char *pszType, void *pvUser);
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   args        The format argument.
  */
-RTDECL(size_t) RTStrPrintfV(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args);
+RTDECL(size_t) RTStrPrintfV(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(3, 0);
 
 /**
  * String printf.
@@ -1961,7 +1745,7 @@ RTDECL(size_t) RTStrPrintfV(char *pszBuffer, size_t cchBuffer, const char *pszFo
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   ...         The format argument.
  */
-RTDECL(size_t) RTStrPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...);
+RTDECL(size_t) RTStrPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
 
 
 /**
@@ -1976,7 +1760,8 @@ RTDECL(size_t) RTStrPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFor
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   args        The format argument.
  */
-RTDECL(size_t) RTStrPrintfExV(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args);
+RTDECL(size_t) RTStrPrintfExV(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer,
+                              const char *pszFormat, va_list args)  RT_IPRT_FORMAT_ATTR(5, 0);
 
 /**
  * String printf with custom formatting.
@@ -1990,7 +1775,8 @@ RTDECL(size_t) RTStrPrintfExV(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuff
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   ...         The format argument.
  */
-RTDECL(size_t) RTStrPrintfEx(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...);
+RTDECL(size_t) RTStrPrintfEx(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer,
+                             const char *pszFormat, ...)  RT_IPRT_FORMAT_ATTR(5, 6);
 
 
 /**
@@ -2020,7 +1806,7 @@ RTDECL(size_t) RTStrPrintfEx(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffe
  * @param   args        The format argument.
  * @param   pszTag      Allocation tag used for statistics and such.
  */
-RTDECL(int) RTStrAPrintfVTag(char **ppszBuffer, const char *pszFormat, va_list args, const char *pszTag);
+RTDECL(int) RTStrAPrintfVTag(char **ppszBuffer, const char *pszFormat, va_list args, const char *pszTag) RT_IPRT_FORMAT_ATTR(2, 0);
 
 /**
  * Allocating string printf.
@@ -2034,7 +1820,7 @@ RTDECL(int) RTStrAPrintfVTag(char **ppszBuffer, const char *pszFormat, va_list a
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   ...         The format argument.
  */
-DECLINLINE(int) RTStrAPrintf(char **ppszBuffer, const char *pszFormat, ...)
+DECLINLINE(int) RT_IPRT_FORMAT_ATTR(2, 3) RTStrAPrintf(char **ppszBuffer, const char *pszFormat, ...)
 {
     int     cbRet;
     va_list va;
@@ -2057,7 +1843,7 @@ DECLINLINE(int) RTStrAPrintf(char **ppszBuffer, const char *pszFormat, ...)
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   ...         The format argument.
  */
-DECLINLINE(int) RTStrAPrintfTag(char **ppszBuffer, const char *pszTag, const char *pszFormat, ...)
+DECLINLINE(int) RT_IPRT_FORMAT_ATTR(3, 4) RTStrAPrintfTag(char **ppszBuffer, const char *pszTag, const char *pszFormat, ...)
 {
     int     cbRet;
     va_list va;
@@ -2086,7 +1872,7 @@ DECLINLINE(int) RTStrAPrintfTag(char **ppszBuffer, const char *pszTag, const cha
  * @param   args        The format argument.
  * @param   pszTag      Allocation tag used for statistics and such.
  */
-RTDECL(char *) RTStrAPrintf2VTag(const char *pszFormat, va_list args, const char *pszTag);
+RTDECL(char *) RTStrAPrintf2VTag(const char *pszFormat, va_list args, const char *pszTag) RT_IPRT_FORMAT_ATTR(1, 0);
 
 /**
  * Allocating string printf, version 2 (default tag).
@@ -2096,7 +1882,7 @@ RTDECL(char *) RTStrAPrintf2VTag(const char *pszFormat, va_list args, const char
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   ...         The format argument.
  */
-DECLINLINE(char *) RTStrAPrintf2(const char *pszFormat, ...)
+DECLINLINE(char *) RT_IPRT_FORMAT_ATTR(1, 2) RTStrAPrintf2(const char *pszFormat, ...)
 {
     char   *pszRet;
     va_list va;
@@ -2115,7 +1901,7 @@ DECLINLINE(char *) RTStrAPrintf2(const char *pszFormat, ...)
  * @param   pszFormat   Pointer to the format string, @see pg_rt_str_format.
  * @param   ...         The format argument.
  */
-DECLINLINE(char *) RTStrAPrintf2Tag(const char *pszTag, const char *pszFormat, ...)
+DECLINLINE(char *) RT_IPRT_FORMAT_ATTR(2, 3) RTStrAPrintf2Tag(const char *pszTag, const char *pszFormat, ...)
 {
     char   *pszRet;
     va_list va;
@@ -2525,6 +2311,24 @@ DECLINLINE(char *) RTStrEnd(const char *pszString, size_t cchMax)
 
 RT_C_DECLS_BEGIN
 
+/**
+ * Finds the offset at which a simple character first occurs in a string.
+ *
+ * @returns The offset of the first occurence or the terminator offset.
+ * @param   pszHaystack The string to search.
+ * @param   chNeedle    The character to search for.
+ */
+DECLINLINE(size_t) RTStrOffCharOrTerm(const char *pszHaystack, char chNeedle)
+{
+    const char *psz = pszHaystack;
+    char ch;
+    while (   (ch = *psz) != chNeedle
+           && ch != '\0')
+        psz++;
+    return psz - pszHaystack;
+}
+
+
 /**
  * Matches a simple string pattern.
  *
@@ -3209,972 +3013,9 @@ RTDECL(uint32_t)    RTStrHash1ExNV(size_t cPairs, va_list va);
 
 /** @}  */
 
-
-/** @defgroup rt_str_utf16      UTF-16 String Manipulation
- * @{
- */
-
-/**
- * Allocates memory for UTF-16 string storage (default tag).
- *
- * You should normally not use this function, except if there is some very
- * custom string handling you need doing that isn't covered by any of the other
- * APIs.
- *
- * @returns Pointer to the allocated UTF-16 string.  The first wide char is
- *          always set to the string terminator char, the contents of the
- *          remainder of the memory is undefined.  The string must be freed by
- *          calling RTUtf16Free.
- *
- *          NULL is returned if the allocation failed.  Please translate this to
- *          VERR_NO_UTF16_MEMORY and not VERR_NO_MEMORY.  Also consider
- *          RTUtf16AllocEx if an IPRT status code is required.
- *
- * @param   cb                  How many bytes to allocate, will be rounded up
- *                              to a multiple of two. If this is zero, we will
- *                              allocate a terminator wide char anyway.
- */
-#define RTUtf16Alloc(cb)                    RTUtf16AllocTag((cb), RTSTR_TAG)
-
-/**
- * Allocates memory for UTF-16 string storage (custom tag).
- *
- * You should normally not use this function, except if there is some very
- * custom string handling you need doing that isn't covered by any of the other
- * APIs.
- *
- * @returns Pointer to the allocated UTF-16 string.  The first wide char is
- *          always set to the string terminator char, the contents of the
- *          remainder of the memory is undefined.  The string must be freed by
- *          calling RTUtf16Free.
- *
- *          NULL is returned if the allocation failed.  Please translate this to
- *          VERR_NO_UTF16_MEMORY and not VERR_NO_MEMORY.  Also consider
- *          RTUtf16AllocExTag if an IPRT status code is required.
- *
- * @param   cb                  How many bytes to allocate, will be rounded up
- *                              to a multiple of two. If this is zero, we will
- *                              allocate a terminator wide char anyway.
- * @param   pszTag              Allocation tag used for statistics and such.
- */
-RTDECL(PRTUTF16) RTUtf16AllocTag(size_t cb, const char *pszTag);
-
-
-/**
- * Free a UTF-16 string allocated by RTStrToUtf16(), RTStrToUtf16Ex(),
- * RTLatin1ToUtf16(), RTLatin1ToUtf16Ex(), RTUtf16Dup() or RTUtf16DupEx().
- *
- * @returns iprt status code.
- * @param   pwszString      The UTF-16 string to free. NULL is accepted.
- */
-RTDECL(void)  RTUtf16Free(PRTUTF16 pwszString);
-
-/**
- * Allocates a new copy of the specified UTF-16 string (default tag).
- *
- * @returns Pointer to the allocated string copy. Use RTUtf16Free() to free it.
- * @returns NULL when out of memory.
- * @param   pwszString      UTF-16 string to duplicate.
- * @remark  This function will not make any attempt to validate the encoding.
- */
-#define RTUtf16Dup(pwszString)          RTUtf16DupTag((pwszString), RTSTR_TAG)
-
-/**
- * Allocates a new copy of the specified UTF-16 string (custom tag).
- *
- * @returns Pointer to the allocated string copy. Use RTUtf16Free() to free it.
- * @returns NULL when out of memory.
- * @param   pwszString      UTF-16 string to duplicate.
- * @param   pszTag          Allocation tag used for statistics and such.
- * @remark  This function will not make any attempt to validate the encoding.
- */
-RTDECL(PRTUTF16) RTUtf16DupTag(PCRTUTF16 pwszString, const char *pszTag);
-
-/**
- * Allocates a new copy of the specified UTF-16 string (default tag).
- *
- * @returns iprt status code.
- * @param   ppwszString     Receives pointer of the allocated UTF-16 string.
- *                          The returned pointer must be freed using RTUtf16Free().
- * @param   pwszString      UTF-16 string to duplicate.
- * @param   cwcExtra        Number of extra RTUTF16 items to allocate.
- * @remark  This function will not make any attempt to validate the encoding.
- */
-#define RTUtf16DupEx(ppwszString, pwszString, cwcExtra) \
-    RTUtf16DupExTag((ppwszString), (pwszString), (cwcExtra), RTSTR_TAG)
-
-/**
- * Allocates a new copy of the specified UTF-16 string (custom tag).
- *
- * @returns iprt status code.
- * @param   ppwszString     Receives pointer of the allocated UTF-16 string.
- *                          The returned pointer must be freed using RTUtf16Free().
- * @param   pwszString      UTF-16 string to duplicate.
- * @param   cwcExtra        Number of extra RTUTF16 items to allocate.
- * @param   pszTag          Allocation tag used for statistics and such.
- * @remark  This function will not make any attempt to validate the encoding.
- */
-RTDECL(int) RTUtf16DupExTag(PRTUTF16 *ppwszString, PCRTUTF16 pwszString, size_t cwcExtra, const char *pszTag);
-
-/**
- * Returns the length of a UTF-16 string in UTF-16 characters
- * without trailing '\\0'.
- *
- * Surrogate pairs counts as two UTF-16 characters here. Use RTUtf16CpCnt()
- * to get the exact number of code points in the string.
- *
- * @returns The number of RTUTF16 items in the string.
- * @param   pwszString  Pointer the UTF-16 string.
- * @remark  This function will not make any attempt to validate the encoding.
- */
-RTDECL(size_t) RTUtf16Len(PCRTUTF16 pwszString);
-
-/**
- * Find the length of a zero-terminated byte string, given a max string length.
- *
- * @returns The string length or cbMax. The returned length does not include
- *          the zero terminator if it was found.
- *
- * @param   pwszString  The string.
- * @param   cwcMax      The max string length in RTUTF16s.
- * @sa      RTUtf16NLenEx, RTStrNLen.
- */
-RTDECL(size_t) RTUtf16NLen(PCRTUTF16 pwszString, size_t cwcMax);
-
-/**
- * Find the length of a zero-terminated byte string, given
- * a max string length.
- *
- * @returns IPRT status code.
- * @retval  VINF_SUCCESS if the string has a length less than cchMax.
- * @retval  VERR_BUFFER_OVERFLOW if the end of the string wasn't found
- *          before cwcMax was reached.
- *
- * @param   pwszString  The string.
- * @param   cwcMax      The max string length in RTUTF16s.
- * @param   pcwc        Where to store the string length excluding the
- *                      terminator.  This is set to cwcMax if the terminator
- *                      isn't found.
- * @sa      RTUtf16NLen, RTStrNLenEx.
- */
-RTDECL(int) RTUtf16NLenEx(PCRTUTF16 pwszString, size_t cwcMax, size_t *pcwc);
-
-/**
- * Find the zero terminator in a string with a limited length.
- *
- * @returns Pointer to the zero terminator.
- * @returns NULL if the zero terminator was not found.
- *
- * @param   pwszString  The string.
- * @param   cwcMax      The max string length.  RTSTR_MAX is fine.
- */
-RTDECL(PCRTUTF16) RTUtf16End(PCRTUTF16 pwszString, size_t cwcMax);
-
-/**
- * Strips blankspaces from both ends of the string.
- *
- * @returns Pointer to first non-blank char in the string.
- * @param   pwsz    The string to strip.
- */
-RTDECL(PRTUTF16) RTUtf16Strip(PRTUTF16 pwsz);
-
-/**
- * Strips blankspaces from the start of the string.
- *
- * @returns Pointer to first non-blank char in the string.
- * @param   pwsz    The string to strip.
- */
-RTDECL(PRTUTF16) RTUtf16StripL(PCRTUTF16 pwsz);
-
-/**
- * Strips blankspaces from the end of the string.
- *
- * @returns pwsz.
- * @param   pwsz    The string to strip.
- */
-RTDECL(PRTUTF16) RTUtf16StripR(PRTUTF16 pwsz);
-
-/**
- * String copy with overflow handling.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
- *          buffer will contain as much of the string as it can hold, fully
- *          terminated.
- *
- * @param   pwszDst             The destination buffer.
- * @param   cwcDst              The size of the destination buffer in RTUTF16s.
- * @param   pwszSrc             The source string.  NULL is not OK.
- */
-RTDECL(int) RTUtf16Copy(PRTUTF16 pwszDst, size_t cwcDst, PCRTUTF16 pwszSrc);
-
-/**
- * String copy with overflow handling, ASCII source.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
- *          buffer will contain as much of the string as it can hold, fully
- *          terminated.
- *
- * @param   pwszDst             The destination buffer.
- * @param   cwcDst              The size of the destination buffer in RTUTF16s.
- * @param   pszSrc              The source string, pure ASCII.  NULL is not OK.
- */
-RTDECL(int) RTUtf16CopyAscii(PRTUTF16 pwszDst, size_t cwcDst, const char *pszSrc);
-
-/**
- * String copy with overflow handling.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
- *          buffer will contain as much of the string as it can hold, fully
- *          terminated.
- *
- * @param   pwszDst             The destination buffer.
- * @param   cwcDst              The size of the destination buffer in RTUTF16s.
- * @param   pwszSrc             The source string.  NULL is not OK.
- * @param   cwcSrcMax           The maximum number of chars (not code points) to
- *                              copy from the source string, not counting the
- *                              terminator as usual.
- */
-RTDECL(int) RTUtf16CopyEx(PRTUTF16 pwszDst, size_t cwcDst, PCRTUTF16 pwszSrc, size_t cwcSrcMax);
-
-/**
- * String concatenation with overflow handling.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
- *          buffer will contain as much of the string as it can hold, fully
- *          terminated.
- *
- * @param   pszDst              The destination buffer.
- * @param   cwcDst              The size of the destination buffer in RTUTF16s.
- * @param   pwszSrc             The source string.  NULL is not OK.
- */
-RTDECL(int) RTUtf16Cat(PRTUTF16 pwszDst, size_t cwcDst, PCRTUTF16 pwszSrc);
-
-/**
- * String concatenation with overflow handling, ASCII source.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
- *          buffer will contain as much of the string as it can hold, fully
- *          terminated.
- *
- * @param   pszDst              The destination buffer.
- * @param   cwcDst              The size of the destination buffer in RTUTF16s.
- * @param   pszSrc              The source string, pure ASCII.  NULL is not OK.
- */
-RTDECL(int) RTUtf16CatAscii(PRTUTF16 pwszDst, size_t cwcDst, const char *pwszSrc);
-
-/**
- * String concatenation with overflow handling.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
- *          buffer will contain as much of the string as it can hold, fully
- *          terminated.
- *
- * @param   pwszDst             The destination buffer.
- * @param   cwcDst              The size of the destination buffer in RTUTF16s.
- * @param   pwszSrc             The source string.  NULL is not OK.
- * @param   cwcSrcMax           The maximum number of UTF-16 chars (not code
- *                              points) to copy from the source string, not
- *                              counting the terminator as usual.
- */
-RTDECL(int) RTUtf16CatEx(PRTUTF16 pwszDst, size_t cwcDst, PCRTUTF16 pwszSrc, size_t cwcSrcMax);
-
-/**
- * Performs a case sensitive string compare between two UTF-16 strings.
- *
- * @returns < 0 if the first string less than the second string.s
- * @returns 0 if the first string identical to the second string.
- * @returns > 0 if the first string greater than the second string.
- * @param   pwsz1       First UTF-16 string. Null is allowed.
- * @param   pwsz2       Second UTF-16 string. Null is allowed.
- * @remark  This function will not make any attempt to validate the encoding.
- */
-RTDECL(int) RTUtf16Cmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
-
-/**
- * Performs a case sensitive string compare between an UTF-16 string and a pure
- * ASCII string.
- *
- * @returns < 0 if the first string less than the second string.s
- * @returns 0 if the first string identical to the second string.
- * @returns > 0 if the first string greater than the second string.
- * @param   pwsz1       First UTF-16 string. Null is allowed.
- * @param   psz2        Second string, pure ASCII. Null is allowed.
- * @remark  This function will not make any attempt to validate the encoding.
- */
-RTDECL(int) RTUtf16CmpAscii(PCRTUTF16 pwsz1, const char *psz2);
-
-/**
- * Performs a case insensitive string compare between two UTF-16 strings.
- *
- * This is a simplified compare, as only the simplified lower/upper case folding
- * specified by the unicode specs are used. It does not consider character pairs
- * as they are used in some languages, just simple upper & lower case compares.
- *
- * @returns < 0 if the first string less than the second string.
- * @returns 0 if the first string identical to the second string.
- * @returns > 0 if the first string greater than the second string.
- * @param   pwsz1       First UTF-16 string. Null is allowed.
- * @param   pwsz2       Second UTF-16 string. Null is allowed.
- */
-RTDECL(int) RTUtf16ICmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
-
-/**
- * Performs a case insensitive string compare between an UTF-16 string and an
- * pure ASCII string.
- *
- * Since this compare only takes cares about the first 128 codepoints in
- * unicode, no tables are needed and there aren't any real complications.
- *
- * @returns < 0 if the first string less than the second string.
- * @returns 0 if the first string identical to the second string.
- * @returns > 0 if the first string greater than the second string.
- * @param   pwsz1       First UTF-16 string. Null is allowed.
- * @param   psz2        Second string, pure ASCII. Null is allowed.
- */
-RTDECL(int) RTUtf16ICmpAscii(PCRTUTF16 pwsz1, const char *psz2);
-
-/**
- * Performs a case insensitive string compare between two UTF-16 strings
- * using the current locale of the process (if applicable).
- *
- * This differs from RTUtf16ICmp() in that it will try, if a locale with the
- * required data is available, to do a correct case-insensitive compare. It
- * follows that it is more complex and thereby likely to be more expensive.
- *
- * @returns < 0 if the first string less than the second string.
- * @returns 0 if the first string identical to the second string.
- * @returns > 0 if the first string greater than the second string.
- * @param   pwsz1       First UTF-16 string. Null is allowed.
- * @param   pwsz2       Second UTF-16 string. Null is allowed.
- */
-RTDECL(int) RTUtf16LocaleICmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
-
-/**
- * Folds a UTF-16 string to lowercase.
- *
- * This is a very simple folding; is uses the simple lowercase
- * code point, it is not related to any locale just the most common
- * lowercase codepoint setup by the unicode specs, and it will not
- * create new surrogate pairs or remove existing ones.
- *
- * @returns Pointer to the passed in string.
- * @param   pwsz        The string to fold.
- */
-RTDECL(PRTUTF16) RTUtf16ToLower(PRTUTF16 pwsz);
-
-/**
- * Folds a UTF-16 string to uppercase.
- *
- * This is a very simple folding; is uses the simple uppercase
- * code point, it is not related to any locale just the most common
- * uppercase codepoint setup by the unicode specs, and it will not
- * create new surrogate pairs or remove existing ones.
- *
- * @returns Pointer to the passed in string.
- * @param   pwsz        The string to fold.
- */
-RTDECL(PRTUTF16) RTUtf16ToUpper(PRTUTF16 pwsz);
-
-/**
- * Validates the UTF-16 encoding of the string.
- *
- * @returns iprt status code.
- * @param   pwsz        The string.
- */
-RTDECL(int) RTUtf16ValidateEncoding(PCRTUTF16 pwsz);
-
-/**
- * Validates the UTF-16 encoding of the string.
- *
- * @returns iprt status code.
- * @param   pwsz        The string.
- * @param   cwc         The max string length (/ size) in UTF-16 units. Use
- *                      RTSTR_MAX to process the entire string.
- * @param   fFlags      Combination of RTSTR_VALIDATE_ENCODING_XXX flags.
- */
-RTDECL(int) RTUtf16ValidateEncodingEx(PCRTUTF16 pwsz, size_t cwc, uint32_t fFlags);
-
-/**
- * Checks if the UTF-16 encoding is valid.
- *
- * @returns true / false.
- * @param   pwsz        The string.
- */
-RTDECL(bool) RTUtf16IsValidEncoding(PCRTUTF16 pwsz);
-
-/**
- * Sanitise a (valid) UTF-16 string by replacing all characters outside a white
- * list in-place by an ASCII replacement character.  Multi-byte characters will
- * be replaced byte by byte.
- *
- * @returns The number of code points replaced, or a negative value if the
- *          string is not correctly encoded.  In this last case the string
- *          may be partially processed.
- * @param   pwsz           The string to sanitise.
- * @param   puszValidSets  A zero-terminated array of pairs of Unicode points.
- *                         Each pair is the start and end point of a range,
- *                         and the union of these ranges forms the white list.
- * @param   chReplacement  The ASCII replacement character.
- */
-RTDECL(ssize_t) RTUtf16PurgeComplementSet(PRTUTF16 pwsz, PCRTUNICP puszValidSet, char chReplacement);
-
-/**
- * Translate a UTF-16 string into a UTF-8 allocating the result buffer (default
- * tag).
- *
- * @returns iprt status code.
- * @param   pwszString      UTF-16 string to convert.
- * @param   ppszString      Receives pointer of allocated UTF-8 string on
- *                          success, and is always set to NULL on failure.
- *                          The returned pointer must be freed using RTStrFree().
- */
-#define RTUtf16ToUtf8(pwszString, ppszString)       RTUtf16ToUtf8Tag((pwszString), (ppszString), RTSTR_TAG)
-
-/**
- * Translate a UTF-16 string into a UTF-8 allocating the result buffer.
- *
- * @returns iprt status code.
- * @param   pwszString      UTF-16 string to convert.
- * @param   ppszString      Receives pointer of allocated UTF-8 string on
- *                          success, and is always set to NULL on failure.
- *                          The returned pointer must be freed using RTStrFree().
- * @param   pszTag          Allocation tag used for statistics and such.
- */
-RTDECL(int)  RTUtf16ToUtf8Tag(PCRTUTF16 pwszString, char **ppszString, const char *pszTag);
-
-/**
- * Translates UTF-16 to UTF-8 using buffer provided by the caller or a fittingly
- * sized buffer allocated by the function (default tag).
- *
- * @returns iprt status code.
- * @param   pwszString      The UTF-16 string to convert.
- * @param   cwcString       The number of RTUTF16 items to translate from pwszString.
- *                          The translation will stop when reaching cwcString or the terminator ('\\0').
- *                          Use RTSTR_MAX to translate the entire string.
- * @param   ppsz            If cch is non-zero, this must either be pointing to a pointer to
- *                          a buffer of the specified size, or pointer to a NULL pointer.
- *                          If *ppsz is NULL or cch is zero a buffer of at least cch chars
- *                          will be allocated to hold the translated string.
- *                          If a buffer was requested it must be freed using RTStrFree().
- * @param   cch             The buffer size in chars (the type). This includes the terminator.
- * @param   pcch            Where to store the length of the translated string,
- *                          excluding the terminator. (Optional)
- *
- *                          This may be set under some error conditions,
- *                          however, only for VERR_BUFFER_OVERFLOW and
- *                          VERR_NO_STR_MEMORY will it contain a valid string
- *                          length that can be used to resize the buffer.
- */
-#define RTUtf16ToUtf8Ex(pwszString, cwcString, ppsz, cch, pcch) \
-    RTUtf16ToUtf8ExTag((pwszString), (cwcString), (ppsz), (cch), (pcch), RTSTR_TAG)
-
-/**
- * Translates UTF-16 to UTF-8 using buffer provided by the caller or a fittingly
- * sized buffer allocated by the function (custom tag).
- *
- * @returns iprt status code.
- * @param   pwszString      The UTF-16 string to convert.
- * @param   cwcString       The number of RTUTF16 items to translate from pwszString.
- *                          The translation will stop when reaching cwcString or the terminator ('\\0').
- *                          Use RTSTR_MAX to translate the entire string.
- * @param   ppsz            If cch is non-zero, this must either be pointing to a pointer to
- *                          a buffer of the specified size, or pointer to a NULL pointer.
- *                          If *ppsz is NULL or cch is zero a buffer of at least cch chars
- *                          will be allocated to hold the translated string.
- *                          If a buffer was requested it must be freed using RTStrFree().
- * @param   cch             The buffer size in chars (the type). This includes the terminator.
- * @param   pcch            Where to store the length of the translated string,
- *                          excluding the terminator. (Optional)
- *
- *                          This may be set under some error conditions,
- *                          however, only for VERR_BUFFER_OVERFLOW and
- *                          VERR_NO_STR_MEMORY will it contain a valid string
- *                          length that can be used to resize the buffer.
- * @param   pszTag          Allocation tag used for statistics and such.
- */
-RTDECL(int)  RTUtf16ToUtf8ExTag(PCRTUTF16 pwszString, size_t cwcString, char **ppsz, size_t cch, size_t *pcch, const char *pszTag);
-
-/**
- * Calculates the length of the UTF-16 string in UTF-8 chars (bytes).
- *
- * This function will validate the string, and incorrectly encoded UTF-16
- * strings will be rejected. The primary purpose of this function is to
- * help allocate buffers for RTUtf16ToUtf8() of the correct size. For most
- * other purposes RTUtf16ToUtf8Ex() should be used.
- *
- * @returns Number of char (bytes).
- * @returns 0 if the string was incorrectly encoded.
- * @param   pwsz        The UTF-16 string.
- */
-RTDECL(size_t) RTUtf16CalcUtf8Len(PCRTUTF16 pwsz);
-
-/**
- * Calculates the length of the UTF-16 string in UTF-8 chars (bytes).
- *
- * This function will validate the string, and incorrectly encoded UTF-16
- * strings will be rejected.
- *
- * @returns iprt status code.
- * @param   pwsz        The string.
- * @param   cwc         The max string length. Use RTSTR_MAX to process the entire string.
- * @param   pcch        Where to store the string length (in bytes). Optional.
- *                      This is undefined on failure.
- */
-RTDECL(int) RTUtf16CalcUtf8LenEx(PCRTUTF16 pwsz, size_t cwc, size_t *pcch);
-
-/**
- * Translate a UTF-16 string into a Latin-1 (ISO-8859-1) allocating the result
- * buffer (default tag).
- *
- * @returns iprt status code.
- * @param   pwszString      UTF-16 string to convert.
- * @param   ppszString      Receives pointer of allocated Latin1 string on
- *                          success, and is always set to NULL on failure.
- *                          The returned pointer must be freed using RTStrFree().
- */
-#define RTUtf16ToLatin1(pwszString, ppszString)     RTUtf16ToLatin1Tag((pwszString), (ppszString), RTSTR_TAG)
-
-/**
- * Translate a UTF-16 string into a Latin-1 (ISO-8859-1) allocating the result
- * buffer (custom tag).
- *
- * @returns iprt status code.
- * @param   pwszString      UTF-16 string to convert.
- * @param   ppszString      Receives pointer of allocated Latin1 string on
- *                          success, and is always set to NULL on failure.
- *                          The returned pointer must be freed using RTStrFree().
- * @param   pszTag          Allocation tag used for statistics and such.
- */
-RTDECL(int)  RTUtf16ToLatin1Tag(PCRTUTF16 pwszString, char **ppszString, const char *pszTag);
-
-/**
- * Translates UTF-16 to Latin-1 (ISO-8859-1) using buffer provided by the caller
- * or a fittingly sized buffer allocated by the function (default tag).
- *
- * @returns iprt status code.
- * @param   pwszString      The UTF-16 string to convert.
- * @param   cwcString       The number of RTUTF16 items to translate from
- *                          pwszString. The translation will stop when reaching
- *                          cwcString or the terminator ('\\0'). Use RTSTR_MAX
- *                          to translate the entire string.
- * @param   ppsz            Pointer to the pointer to the Latin-1 string. The
- *                          buffer can optionally be preallocated by the caller.
- *
- *                          If cch is zero, *ppsz is undefined.
- *
- *                          If cch is non-zero and *ppsz is not NULL, then this
- *                          will be used as the output buffer.
- *                          VERR_BUFFER_OVERFLOW will be returned if this is
- *                          insufficient.
- *
- *                          If cch is zero or *ppsz is NULL, then a buffer of
- *                          sufficient size is allocated. cch can be used to
- *                          specify a minimum size of this buffer. Use
- *                          RTUtf16Free() to free the result.
- *
- * @param   cch             The buffer size in chars (the type). This includes
- *                          the terminator.
- * @param   pcch            Where to store the length of the translated string,
- *                          excluding the terminator. (Optional)
- *
- *                          This may be set under some error conditions,
- *                          however, only for VERR_BUFFER_OVERFLOW and
- *                          VERR_NO_STR_MEMORY will it contain a valid string
- *                          length that can be used to resize the buffer.
- */
-#define RTUtf16ToLatin1Ex(pwszString, cwcString, ppsz, cch, pcch) \
-    RTUtf16ToLatin1ExTag((pwszString), (cwcString), (ppsz), (cch), (pcch), RTSTR_TAG)
-
-/**
- * Translates UTF-16 to Latin-1 (ISO-8859-1) using buffer provided by the caller
- * or a fittingly sized buffer allocated by the function (custom tag).
- *
- * @returns iprt status code.
- * @param   pwszString      The UTF-16 string to convert.
- * @param   cwcString       The number of RTUTF16 items to translate from
- *                          pwszString. The translation will stop when reaching
- *                          cwcString or the terminator ('\\0'). Use RTSTR_MAX
- *                          to translate the entire string.
- * @param   ppsz            Pointer to the pointer to the Latin-1 string. The
- *                          buffer can optionally be preallocated by the caller.
- *
- *                          If cch is zero, *ppsz is undefined.
- *
- *                          If cch is non-zero and *ppsz is not NULL, then this
- *                          will be used as the output buffer.
- *                          VERR_BUFFER_OVERFLOW will be returned if this is
- *                          insufficient.
- *
- *                          If cch is zero or *ppsz is NULL, then a buffer of
- *                          sufficient size is allocated. cch can be used to
- *                          specify a minimum size of this buffer. Use
- *                          RTUtf16Free() to free the result.
- *
- * @param   cch             The buffer size in chars (the type). This includes
- *                          the terminator.
- * @param   pcch            Where to store the length of the translated string,
- *                          excluding the terminator. (Optional)
- *
- *                          This may be set under some error conditions,
- *                          however, only for VERR_BUFFER_OVERFLOW and
- *                          VERR_NO_STR_MEMORY will it contain a valid string
- *                          length that can be used to resize the buffer.
- * @param   pszTag          Allocation tag used for statistics and such.
- */
-RTDECL(int)  RTUtf16ToLatin1ExTag(PCRTUTF16 pwszString, size_t cwcString, char **ppsz, size_t cch, size_t *pcch, const char *pszTag);
-
-/**
- * Calculates the length of the UTF-16 string in Latin-1 (ISO-8859-1) chars.
- *
- * This function will validate the string, and incorrectly encoded UTF-16
- * strings will be rejected. The primary purpose of this function is to
- * help allocate buffers for RTUtf16ToLatin1() of the correct size. For most
- * other purposes RTUtf16ToLatin1Ex() should be used.
- *
- * @returns Number of char (bytes).
- * @returns 0 if the string was incorrectly encoded.
- * @param   pwsz        The UTF-16 string.
- */
-RTDECL(size_t) RTUtf16CalcLatin1Len(PCRTUTF16 pwsz);
-
-/**
- * Calculates the length of the UTF-16 string in Latin-1 (ISO-8859-1) chars.
- *
- * This function will validate the string, and incorrectly encoded UTF-16
- * strings will be rejected.
- *
- * @returns iprt status code.
- * @param   pwsz        The string.
- * @param   cwc         The max string length. Use RTSTR_MAX to process the
- *                      entire string.
- * @param   pcch        Where to store the string length (in bytes). Optional.
- *                      This is undefined on failure.
- */
-RTDECL(int) RTUtf16CalcLatin1LenEx(PCRTUTF16 pwsz, size_t cwc, size_t *pcch);
-
-/**
- * Get the unicode code point at the given string position.
- *
- * @returns unicode code point.
- * @returns RTUNICP_INVALID if the encoding is invalid.
- * @param   pwsz        The string.
- *
- * @remark  This is an internal worker for RTUtf16GetCp().
- */
-RTDECL(RTUNICP) RTUtf16GetCpInternal(PCRTUTF16 pwsz);
-
-/**
- * Get the unicode code point at the given string position.
- *
- * @returns iprt status code.
- * @param   ppwsz       Pointer to the string pointer. This will be updated to
- *                      point to the char following the current code point.
- * @param   pCp         Where to store the code point.
- *                      RTUNICP_INVALID is stored here on failure.
- *
- * @remark  This is an internal worker for RTUtf16GetCpEx().
- */
-RTDECL(int) RTUtf16GetCpExInternal(PCRTUTF16 *ppwsz, PRTUNICP pCp);
-
-/**
- * Put the unicode code point at the given string position
- * and return the pointer to the char following it.
- *
- * This function will not consider anything at or following the
- * buffer area pointed to by pwsz. It is therefore not suitable for
- * inserting code points into a string, only appending/overwriting.
- *
- * @returns pointer to the char following the written code point.
- * @param   pwsz        The string.
- * @param   CodePoint   The code point to write.
- *                      This should not be RTUNICP_INVALID or any other
- *                      character out of the UTF-16 range.
- *
- * @remark  This is an internal worker for RTUtf16GetCpEx().
- */
-RTDECL(PRTUTF16) RTUtf16PutCpInternal(PRTUTF16 pwsz, RTUNICP CodePoint);
-
-/**
- * Get the unicode code point at the given string position.
- *
- * @returns unicode code point.
- * @returns RTUNICP_INVALID if the encoding is invalid.
- * @param   pwsz        The string.
- *
- * @remark  We optimize this operation by using an inline function for
- *          everything which isn't a surrogate pair or an endian indicator.
- */
-DECLINLINE(RTUNICP) RTUtf16GetCp(PCRTUTF16 pwsz)
-{
-    const RTUTF16 wc = *pwsz;
-    if (wc < 0xd800 || (wc > 0xdfff && wc < 0xfffe))
-        return wc;
-    return RTUtf16GetCpInternal(pwsz);
-}
-
-/**
- * Get the unicode code point at the given string position.
- *
- * @returns iprt status code.
- * @param   ppwsz       Pointer to the string pointer. This will be updated to
- *                      point to the char following the current code point.
- * @param   pCp         Where to store the code point.
- *                      RTUNICP_INVALID is stored here on failure.
- *
- * @remark  We optimize this operation by using an inline function for
- *          everything which isn't a surrogate pair or and endian indicator.
- */
-DECLINLINE(int) RTUtf16GetCpEx(PCRTUTF16 *ppwsz, PRTUNICP pCp)
-{
-    const RTUTF16 wc = **ppwsz;
-    if (wc < 0xd800 || (wc > 0xdfff && wc < 0xfffe))
-    {
-        (*ppwsz)++;
-        *pCp = wc;
-        return VINF_SUCCESS;
-    }
-    return RTUtf16GetCpExInternal(ppwsz, pCp);
-}
-
-/**
- * Put the unicode code point at the given string position
- * and return the pointer to the char following it.
- *
- * This function will not consider anything at or following the
- * buffer area pointed to by pwsz. It is therefore not suitable for
- * inserting code points into a string, only appending/overwriting.
- *
- * @returns pointer to the char following the written code point.
- * @param   pwsz        The string.
- * @param   CodePoint   The code point to write.
- *                      This should not be RTUNICP_INVALID or any other
- *                      character out of the UTF-16 range.
- *
- * @remark  We optimize this operation by using an inline function for
- *          everything which isn't a surrogate pair or and endian indicator.
- */
-DECLINLINE(PRTUTF16) RTUtf16PutCp(PRTUTF16 pwsz, RTUNICP CodePoint)
-{
-    if (CodePoint < 0xd800 || (CodePoint > 0xd800 && CodePoint < 0xfffe))
-    {
-        *pwsz++ = (RTUTF16)CodePoint;
-        return pwsz;
-    }
-    return RTUtf16PutCpInternal(pwsz, CodePoint);
-}
-
-/**
- * Skips ahead, past the current code point.
- *
- * @returns Pointer to the char after the current code point.
- * @param   pwsz    Pointer to the current code point.
- * @remark  This will not move the next valid code point, only past the current one.
- */
-DECLINLINE(PRTUTF16) RTUtf16NextCp(PCRTUTF16 pwsz)
-{
-    RTUNICP Cp;
-    RTUtf16GetCpEx(&pwsz, &Cp);
-    return (PRTUTF16)pwsz;
-}
-
-/**
- * Skips backwards, to the previous code point.
- *
- * @returns Pointer to the char after the current code point.
- * @param   pwszStart   Pointer to the start of the string.
- * @param   pwsz        Pointer to the current code point.
- */
-RTDECL(PRTUTF16) RTUtf16PrevCp(PCRTUTF16 pwszStart, PCRTUTF16 pwsz);
-
-
-/**
- * Checks if the UTF-16 char is the high surrogate char (i.e.
- * the 1st char in the pair).
- *
- * @returns true if it is.
- * @returns false if it isn't.
- * @param   wc      The character to investigate.
- */
-DECLINLINE(bool) RTUtf16IsHighSurrogate(RTUTF16 wc)
-{
-    return wc >= 0xd800 && wc <= 0xdbff;
-}
-
-/**
- * Checks if the UTF-16 char is the low surrogate char (i.e.
- * the 2nd char in the pair).
- *
- * @returns true if it is.
- * @returns false if it isn't.
- * @param   wc      The character to investigate.
- */
-DECLINLINE(bool) RTUtf16IsLowSurrogate(RTUTF16 wc)
-{
-    return wc >= 0xdc00 && wc <= 0xdfff;
-}
-
-
-/**
- * Checks if the two UTF-16 chars form a valid surrogate pair.
- *
- * @returns true if they do.
- * @returns false if they doesn't.
- * @param   wcHigh      The high (1st) character.
- * @param   wcLow       The low (2nd) character.
- */
-DECLINLINE(bool) RTUtf16IsSurrogatePair(RTUTF16 wcHigh, RTUTF16 wcLow)
-{
-    return RTUtf16IsHighSurrogate(wcHigh)
-        && RTUtf16IsLowSurrogate(wcLow);
-}
-
-/**
- * Formats a buffer stream as hex bytes.
- *
- * The default is no separating spaces or line breaks or anything.
- *
- * @returns IPRT status code.
- * @retval  VERR_INVALID_POINTER if any of the pointers are wrong.
- * @retval  VERR_BUFFER_OVERFLOW if the buffer is insufficent to hold the bytes.
- *
- * @param   pwszBuf     Output string buffer.
- * @param   cwcBuf      The size of the output buffer in RTUTF16 units.
- * @param   pv          Pointer to the bytes to stringify.
- * @param   cb          The number of bytes to stringify.
- * @param   fFlags      Combination of RTSTRPRINTHEXBYTES_F_XXX values.
- * @sa      RTStrPrintHexBytes.
- */
-RTDECL(int) RTUtf16PrintHexBytes(PRTUTF16 pwszBuf, size_t cwcBuf, void const *pv, size_t cb, uint32_t fFlags);
-
-/** @} */
-
-
-/** @defgroup rt_str_latin1     Latin-1 (ISO-8859-1) String Manipulation
- * @{
- */
-
-/**
- * Calculates the length of the Latin-1 (ISO-8859-1) string in RTUTF16 items.
- *
- * @returns Number of RTUTF16 items.
- * @param   psz             The Latin-1 string.
- */
-RTDECL(size_t) RTLatin1CalcUtf16Len(const char *psz);
-
-/**
- * Calculates the length of the Latin-1 (ISO-8859-1) string in RTUTF16 items.
- *
- * @returns iprt status code.
- * @param   psz             The Latin-1 string.
- * @param   cch             The max string length. Use RTSTR_MAX to process the
- *                          entire string.
- * @param   pcwc            Where to store the string length. Optional.
- *                          This is undefined on failure.
- */
-RTDECL(int) RTLatin1CalcUtf16LenEx(const char *psz, size_t cch, size_t *pcwc);
-
-/**
- * Translate a Latin-1 (ISO-8859-1) string into a UTF-16 allocating the result
- * buffer (default tag).
- *
- * @returns iprt status code.
- * @param   pszString       The Latin-1 string to convert.
- * @param   ppwszString     Receives pointer to the allocated UTF-16 string. The
- *                          returned string must be freed using RTUtf16Free().
- */
-#define RTLatin1ToUtf16(pszString, ppwszString)     RTLatin1ToUtf16Tag((pszString), (ppwszString), RTSTR_TAG)
-
-/**
- * Translate a Latin-1 (ISO-8859-1) string into a UTF-16 allocating the result
- * buffer (custom tag).
- *
- * @returns iprt status code.
- * @param   pszString       The Latin-1 string to convert.
- * @param   ppwszString     Receives pointer to the allocated UTF-16 string. The
- *                          returned string must be freed using RTUtf16Free().
- * @param   pszTag          Allocation tag used for statistics and such.
- */
-RTDECL(int) RTLatin1ToUtf16Tag(const char *pszString, PRTUTF16 *ppwszString, const char *pszTag);
-
-/**
- * Translates pszString from Latin-1 (ISO-8859-1) to UTF-16, allocating the
- * result buffer if requested (default tag).
- *
- * @returns iprt status code.
- * @param   pszString       The Latin-1 string to convert.
- * @param   cchString       The maximum size in chars (the type) to convert.
- *                          The conversion stops when it reaches cchString or
- *                          the string terminator ('\\0').
- *                          Use RTSTR_MAX to translate the entire string.
- * @param   ppwsz           If cwc is non-zero, this must either be pointing
- *                          to pointer to a buffer of the specified size, or
- *                          pointer to a NULL pointer.
- *                          If *ppwsz is NULL or cwc is zero a buffer of at
- *                          least cwc items will be allocated to hold the
- *                          translated string. If a buffer was requested it
- *                          must be freed using RTUtf16Free().
- * @param   cwc             The buffer size in RTUTF16s. This includes the
- *                          terminator.
- * @param   pcwc            Where to store the length of the translated string,
- *                          excluding the terminator. (Optional)
- *
- *                          This may be set under some error conditions,
- *                          however, only for VERR_BUFFER_OVERFLOW and
- *                          VERR_NO_STR_MEMORY will it contain a valid string
- *                          length that can be used to resize the buffer.
- */
-#define RTLatin1ToUtf16Ex(pszString, cchString, ppwsz, cwc, pcwc) \
-    RTLatin1ToUtf16ExTag((pszString), (cchString), (ppwsz), (cwc), (pcwc), RTSTR_TAG)
-
-/**
- * Translates pszString from Latin-1 (ISO-8859-1) to UTF-16, allocating the
- * result buffer if requested.
- *
- * @returns iprt status code.
- * @param   pszString       The Latin-1 string to convert.
- * @param   cchString       The maximum size in chars (the type) to convert.
- *                          The conversion stops when it reaches cchString or
- *                          the string terminator ('\\0').
- *                          Use RTSTR_MAX to translate the entire string.
- * @param   ppwsz           If cwc is non-zero, this must either be pointing
- *                          to pointer to a buffer of the specified size, or
- *                          pointer to a NULL pointer.
- *                          If *ppwsz is NULL or cwc is zero a buffer of at
- *                          least cwc items will be allocated to hold the
- *                          translated string. If a buffer was requested it
- *                          must be freed using RTUtf16Free().
- * @param   cwc             The buffer size in RTUTF16s. This includes the
- *                          terminator.
- * @param   pcwc            Where to store the length of the translated string,
- *                          excluding the terminator. (Optional)
- *
- *                          This may be set under some error conditions,
- *                          however, only for VERR_BUFFER_OVERFLOW and
- *                          VERR_NO_STR_MEMORY will it contain a valid string
- *                          length that can be used to resize the buffer.
- * @param   pszTag          Allocation tag used for statistics and such.
- */
-RTDECL(int) RTLatin1ToUtf16ExTag(const char *pszString, size_t cchString,
-                                 PRTUTF16 *ppwsz, size_t cwc, size_t *pcwc, const char *pszTag);
-
-/** @} */
-
-#ifndef ___iprt_nocrt_string_h
-# if defined(RT_OS_WINDOWS)
-RTDECL(void *) mempcpy(void *pvDst, const void *pvSrc, size_t cb);
-# endif
-#endif
-
+/** @} */
 
 RT_C_DECLS_END
 
-/** @} */
-
 #endif
 
index 9bb1e6122bb5ca2a05a63ec030e95b3084661670..2bfba459c3ad582084af22b5eec1bdf407bcd9ae 100644 (file)
@@ -298,7 +298,7 @@ typedef DECLCALLBACKPTR(int, PFNRTTHREADCREATE)(PRTTHREAD pThread, PFNRTTHREAD p
  * @param   va          Format arguments.
  */
 RTDECL(int) RTThreadCreateV(PRTTHREAD pThread, PFNRTTHREAD pfnThread, void *pvUser, size_t cbStack,
-                            RTTHREADTYPE enmType, uint32_t fFlags, const char *pszNameFmt, va_list va);
+                            RTTHREADTYPE enmType, uint32_t fFlags, const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR(7, 0);
 
 /**
  * Create a new thread.
@@ -316,7 +316,7 @@ RTDECL(int) RTThreadCreateV(PRTTHREAD pThread, PFNRTTHREAD pfnThread, void *pvUs
  * @param   ...         Format arguments.
  */
 RTDECL(int) RTThreadCreateF(PRTTHREAD pThread, PFNRTTHREAD pfnThread, void *pvUser, size_t cbStack,
-                            RTTHREADTYPE enmType, uint32_t fFlags, const char *pszNameFmt, ...);
+                            RTTHREADTYPE enmType, uint32_t fFlags, const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR(7, 8);
 
 /**
  * Gets the native thread id of a IPRT thread.
index e8ee359a85f4d3c818952b129952b9bc48976a64..c95e0db99aaaab4e29f566fc7d27699fef4f0fb1 100644 (file)
@@ -70,7 +70,7 @@ RT_C_DECLS_END
 #  endif
 #  include <sys/types.h>
 #  ifndef offsetof
-#   error "offsetof is not defined..."
+#   error "offsetof is not defined!"
 #  endif
 
 # elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86)
@@ -2174,6 +2174,21 @@ typedef RTUTF16        *PRTUTF16;
 typedef const RTUTF16  *PCRTUTF16;
 
 
+/**
+ * String tuple to go with the RT_STR_TUPLE macro.
+ */
+typedef struct RTSTRTUPLE
+{
+    /** The string. */
+    const char *psz;
+    /** The string length. */
+    size_t      cch;
+} RTSTRTUPLE;
+/** Pointer to a string tuple. */
+typedef RTSTRTUPLE *PRTSTRTUPLE;
+/** Pointer to a const string tuple. */
+typedef RTSTRTUPLE const *PCRTSTRTUPLE;
+
 /**
  * Wait for ever if we have to.
  */
@@ -2198,7 +2213,7 @@ typedef FNRTPROGRESS *PFNRTPROGRESS;
  * @param   pszFormat       The format string.
  * @param   va              Arguments for the format string.
  */
-typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser, const char *pszFormat, va_list va);
+typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);
 /** Pointer to a generic printf-like function for dumping. */
 typedef FNRTDUMPPRINTFV *PFNRTDUMPPRINTFV;
 
@@ -2415,7 +2430,7 @@ typedef const RTRANGE *PCRTRANGE;
  */
 typedef union RTPTRUNION
 {
-    /** Pointer into the void... */
+    /** Pointer into the void. */
     void                   *pv;
     /** As a signed integer. */
     intptr_t                i;
@@ -2454,7 +2469,7 @@ typedef RTPTRUNION *PRTPTRUNION;
  */
 typedef union RTCPTRUNION
 {
-    /** Pointer into the void... */
+    /** Pointer into the void. */
     void const             *pv;
     /** As a signed integer. */
     intptr_t                i;
@@ -2493,7 +2508,7 @@ typedef RTCPTRUNION *PRTCPTRUNION;
  */
 typedef union RTVPTRUNION
 {
-    /** Pointer into the void... */
+    /** Pointer into the void. */
     void volatile          *pv;
     /** As a signed integer. */
     intptr_t                i;
@@ -2532,7 +2547,7 @@ typedef RTVPTRUNION *PRTVPTRUNION;
  */
 typedef union RTCVPTRUNION
 {
-    /** Pointer into the void... */
+    /** Pointer into the void. */
     void const volatile            *pv;
     /** As a signed integer. */
     intptr_t                        i;
diff --git a/ubuntu/vbox/include/iprt/utf16.h b/ubuntu/vbox/include/iprt/utf16.h
new file mode 100644 (file)
index 0000000..54ff99b
--- /dev/null
@@ -0,0 +1,885 @@
+/** @file
+ * IPRT - String Manipulation, UTF-16 encoding.
+ */
+
+/*
+ * Copyright (C) 2006-2015 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.
+ */
+
+#ifndef ___iprt_utf16_h
+#define ___iprt_utf16_h
+
+#include <iprt/string.h>
+
+RT_C_DECLS_BEGIN
+
+
+/** @defgroup rt_str_utf16      UTF-16 String Manipulation
+ * @ingroup grp_rt_str
+ * @{
+ */
+
+/**
+ * Allocates memory for UTF-16 string storage (default tag).
+ *
+ * You should normally not use this function, except if there is some very
+ * custom string handling you need doing that isn't covered by any of the other
+ * APIs.
+ *
+ * @returns Pointer to the allocated UTF-16 string.  The first wide char is
+ *          always set to the string terminator char, the contents of the
+ *          remainder of the memory is undefined.  The string must be freed by
+ *          calling RTUtf16Free.
+ *
+ *          NULL is returned if the allocation failed.  Please translate this to
+ *          VERR_NO_UTF16_MEMORY and not VERR_NO_MEMORY.  Also consider
+ *          RTUtf16AllocEx if an IPRT status code is required.
+ *
+ * @param   cb                  How many bytes to allocate, will be rounded up
+ *                              to a multiple of two. If this is zero, we will
+ *                              allocate a terminator wide char anyway.
+ */
+#define RTUtf16Alloc(cb)                    RTUtf16AllocTag((cb), RTSTR_TAG)
+
+/**
+ * Allocates memory for UTF-16 string storage (custom tag).
+ *
+ * You should normally not use this function, except if there is some very
+ * custom string handling you need doing that isn't covered by any of the other
+ * APIs.
+ *
+ * @returns Pointer to the allocated UTF-16 string.  The first wide char is
+ *          always set to the string terminator char, the contents of the
+ *          remainder of the memory is undefined.  The string must be freed by
+ *          calling RTUtf16Free.
+ *
+ *          NULL is returned if the allocation failed.  Please translate this to
+ *          VERR_NO_UTF16_MEMORY and not VERR_NO_MEMORY.  Also consider
+ *          RTUtf16AllocExTag if an IPRT status code is required.
+ *
+ * @param   cb                  How many bytes to allocate, will be rounded up
+ *                              to a multiple of two. If this is zero, we will
+ *                              allocate a terminator wide char anyway.
+ * @param   pszTag              Allocation tag used for statistics and such.
+ */
+RTDECL(PRTUTF16) RTUtf16AllocTag(size_t cb, const char *pszTag);
+
+
+/**
+ * Free a UTF-16 string allocated by RTStrToUtf16(), RTStrToUtf16Ex(),
+ * RTLatin1ToUtf16(), RTLatin1ToUtf16Ex(), RTUtf16Dup() or RTUtf16DupEx().
+ *
+ * @returns iprt status code.
+ * @param   pwszString      The UTF-16 string to free. NULL is accepted.
+ */
+RTDECL(void)  RTUtf16Free(PRTUTF16 pwszString);
+
+/**
+ * Allocates a new copy of the specified UTF-16 string (default tag).
+ *
+ * @returns Pointer to the allocated string copy. Use RTUtf16Free() to free it.
+ * @returns NULL when out of memory.
+ * @param   pwszString      UTF-16 string to duplicate.
+ * @remark  This function will not make any attempt to validate the encoding.
+ */
+#define RTUtf16Dup(pwszString)          RTUtf16DupTag((pwszString), RTSTR_TAG)
+
+/**
+ * Allocates a new copy of the specified UTF-16 string (custom tag).
+ *
+ * @returns Pointer to the allocated string copy. Use RTUtf16Free() to free it.
+ * @returns NULL when out of memory.
+ * @param   pwszString      UTF-16 string to duplicate.
+ * @param   pszTag          Allocation tag used for statistics and such.
+ * @remark  This function will not make any attempt to validate the encoding.
+ */
+RTDECL(PRTUTF16) RTUtf16DupTag(PCRTUTF16 pwszString, const char *pszTag);
+
+/**
+ * Allocates a new copy of the specified UTF-16 string (default tag).
+ *
+ * @returns iprt status code.
+ * @param   ppwszString     Receives pointer of the allocated UTF-16 string.
+ *                          The returned pointer must be freed using RTUtf16Free().
+ * @param   pwszString      UTF-16 string to duplicate.
+ * @param   cwcExtra        Number of extra RTUTF16 items to allocate.
+ * @remark  This function will not make any attempt to validate the encoding.
+ */
+#define RTUtf16DupEx(ppwszString, pwszString, cwcExtra) \
+    RTUtf16DupExTag((ppwszString), (pwszString), (cwcExtra), RTSTR_TAG)
+
+/**
+ * Allocates a new copy of the specified UTF-16 string (custom tag).
+ *
+ * @returns iprt status code.
+ * @param   ppwszString     Receives pointer of the allocated UTF-16 string.
+ *                          The returned pointer must be freed using RTUtf16Free().
+ * @param   pwszString      UTF-16 string to duplicate.
+ * @param   cwcExtra        Number of extra RTUTF16 items to allocate.
+ * @param   pszTag          Allocation tag used for statistics and such.
+ * @remark  This function will not make any attempt to validate the encoding.
+ */
+RTDECL(int) RTUtf16DupExTag(PRTUTF16 *ppwszString, PCRTUTF16 pwszString, size_t cwcExtra, const char *pszTag);
+
+/**
+ * Returns the length of a UTF-16 string in UTF-16 characters
+ * without trailing '\\0'.
+ *
+ * Surrogate pairs counts as two UTF-16 characters here. Use RTUtf16CpCnt()
+ * to get the exact number of code points in the string.
+ *
+ * @returns The number of RTUTF16 items in the string.
+ * @param   pwszString  Pointer the UTF-16 string.
+ * @remark  This function will not make any attempt to validate the encoding.
+ */
+RTDECL(size_t) RTUtf16Len(PCRTUTF16 pwszString);
+
+/**
+ * Find the length of a zero-terminated byte string, given a max string length.
+ *
+ * @returns The string length or cbMax. The returned length does not include
+ *          the zero terminator if it was found.
+ *
+ * @param   pwszString  The string.
+ * @param   cwcMax      The max string length in RTUTF16s.
+ * @sa      RTUtf16NLenEx, RTStrNLen.
+ */
+RTDECL(size_t) RTUtf16NLen(PCRTUTF16 pwszString, size_t cwcMax);
+
+/**
+ * Find the length of a zero-terminated byte string, given
+ * a max string length.
+ *
+ * @returns IPRT status code.
+ * @retval  VINF_SUCCESS if the string has a length less than cchMax.
+ * @retval  VERR_BUFFER_OVERFLOW if the end of the string wasn't found
+ *          before cwcMax was reached.
+ *
+ * @param   pwszString  The string.
+ * @param   cwcMax      The max string length in RTUTF16s.
+ * @param   pcwc        Where to store the string length excluding the
+ *                      terminator.  This is set to cwcMax if the terminator
+ *                      isn't found.
+ * @sa      RTUtf16NLen, RTStrNLenEx.
+ */
+RTDECL(int) RTUtf16NLenEx(PCRTUTF16 pwszString, size_t cwcMax, size_t *pcwc);
+
+/**
+ * Find the zero terminator in a string with a limited length.
+ *
+ * @returns Pointer to the zero terminator.
+ * @returns NULL if the zero terminator was not found.
+ *
+ * @param   pwszString  The string.
+ * @param   cwcMax      The max string length.  RTSTR_MAX is fine.
+ */
+RTDECL(PCRTUTF16) RTUtf16End(PCRTUTF16 pwszString, size_t cwcMax);
+
+/**
+ * Strips blankspaces from both ends of the string.
+ *
+ * @returns Pointer to first non-blank char in the string.
+ * @param   pwsz    The string to strip.
+ */
+RTDECL(PRTUTF16) RTUtf16Strip(PRTUTF16 pwsz);
+
+/**
+ * Strips blankspaces from the start of the string.
+ *
+ * @returns Pointer to first non-blank char in the string.
+ * @param   pwsz    The string to strip.
+ */
+RTDECL(PRTUTF16) RTUtf16StripL(PCRTUTF16 pwsz);
+
+/**
+ * Strips blankspaces from the end of the string.
+ *
+ * @returns pwsz.
+ * @param   pwsz    The string to strip.
+ */
+RTDECL(PRTUTF16) RTUtf16StripR(PRTUTF16 pwsz);
+
+/**
+ * String copy with overflow handling.
+ *
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
+ *          buffer will contain as much of the string as it can hold, fully
+ *          terminated.
+ *
+ * @param   pwszDst             The destination buffer.
+ * @param   cwcDst              The size of the destination buffer in RTUTF16s.
+ * @param   pwszSrc             The source string.  NULL is not OK.
+ */
+RTDECL(int) RTUtf16Copy(PRTUTF16 pwszDst, size_t cwcDst, PCRTUTF16 pwszSrc);
+
+/**
+ * String copy with overflow handling, ASCII source.
+ *
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
+ *          buffer will contain as much of the string as it can hold, fully
+ *          terminated.
+ *
+ * @param   pwszDst             The destination buffer.
+ * @param   cwcDst              The size of the destination buffer in RTUTF16s.
+ * @param   pszSrc              The source string, pure ASCII.  NULL is not OK.
+ */
+RTDECL(int) RTUtf16CopyAscii(PRTUTF16 pwszDst, size_t cwcDst, const char *pszSrc);
+
+/**
+ * String copy with overflow handling.
+ *
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
+ *          buffer will contain as much of the string as it can hold, fully
+ *          terminated.
+ *
+ * @param   pwszDst             The destination buffer.
+ * @param   cwcDst              The size of the destination buffer in RTUTF16s.
+ * @param   pwszSrc             The source string.  NULL is not OK.
+ * @param   cwcSrcMax           The maximum number of chars (not code points) to
+ *                              copy from the source string, not counting the
+ *                              terminator as usual.
+ */
+RTDECL(int) RTUtf16CopyEx(PRTUTF16 pwszDst, size_t cwcDst, PCRTUTF16 pwszSrc, size_t cwcSrcMax);
+
+/**
+ * String concatenation with overflow handling.
+ *
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
+ *          buffer will contain as much of the string as it can hold, fully
+ *          terminated.
+ *
+ * @param   pwszDst             The destination buffer.
+ * @param   cwcDst              The size of the destination buffer in RTUTF16s.
+ * @param   pwszSrc             The source string.  NULL is not OK.
+ */
+RTDECL(int) RTUtf16Cat(PRTUTF16 pwszDst, size_t cwcDst, PCRTUTF16 pwszSrc);
+
+/**
+ * String concatenation with overflow handling, ASCII source.
+ *
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
+ *          buffer will contain as much of the string as it can hold, fully
+ *          terminated.
+ *
+ * @param   pwszDst             The destination buffer.
+ * @param   cwcDst              The size of the destination buffer in RTUTF16s.
+ * @param   pszSrc              The source string, pure ASCII.  NULL is not OK.
+ */
+RTDECL(int) RTUtf16CatAscii(PRTUTF16 pwszDst, size_t cwcDst, const char *pszSrc);
+
+/**
+ * String concatenation with overflow handling.
+ *
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
+ *          buffer will contain as much of the string as it can hold, fully
+ *          terminated.
+ *
+ * @param   pwszDst             The destination buffer.
+ * @param   cwcDst              The size of the destination buffer in RTUTF16s.
+ * @param   pwszSrc             The source string.  NULL is not OK.
+ * @param   cwcSrcMax           The maximum number of UTF-16 chars (not code
+ *                              points) to copy from the source string, not
+ *                              counting the terminator as usual.
+ */
+RTDECL(int) RTUtf16CatEx(PRTUTF16 pwszDst, size_t cwcDst, PCRTUTF16 pwszSrc, size_t cwcSrcMax);
+
+/**
+ * Performs a case sensitive string compare between two UTF-16 strings.
+ *
+ * @returns < 0 if the first string less than the second string.s
+ * @returns 0 if the first string identical to the second string.
+ * @returns > 0 if the first string greater than the second string.
+ * @param   pwsz1       First UTF-16 string. Null is allowed.
+ * @param   pwsz2       Second UTF-16 string. Null is allowed.
+ * @remark  This function will not make any attempt to validate the encoding.
+ */
+RTDECL(int) RTUtf16Cmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
+
+/**
+ * Performs a case sensitive string compare between an UTF-16 string and a pure
+ * ASCII string.
+ *
+ * @returns < 0 if the first string less than the second string.s
+ * @returns 0 if the first string identical to the second string.
+ * @returns > 0 if the first string greater than the second string.
+ * @param   pwsz1       First UTF-16 string. Null is allowed.
+ * @param   psz2        Second string, pure ASCII. Null is allowed.
+ * @remark  This function will not make any attempt to validate the encoding.
+ */
+RTDECL(int) RTUtf16CmpAscii(PCRTUTF16 pwsz1, const char *psz2);
+
+/**
+ * Performs a case insensitive string compare between two UTF-16 strings.
+ *
+ * This is a simplified compare, as only the simplified lower/upper case folding
+ * specified by the unicode specs are used. It does not consider character pairs
+ * as they are used in some languages, just simple upper & lower case compares.
+ *
+ * @returns < 0 if the first string less than the second string.
+ * @returns 0 if the first string identical to the second string.
+ * @returns > 0 if the first string greater than the second string.
+ * @param   pwsz1       First UTF-16 string. Null is allowed.
+ * @param   pwsz2       Second UTF-16 string. Null is allowed.
+ */
+RTDECL(int) RTUtf16ICmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
+
+/**
+ * Performs a case insensitive string compare between an UTF-16 string and an
+ * pure ASCII string.
+ *
+ * Since this compare only takes cares about the first 128 codepoints in
+ * unicode, no tables are needed and there aren't any real complications.
+ *
+ * @returns < 0 if the first string less than the second string.
+ * @returns 0 if the first string identical to the second string.
+ * @returns > 0 if the first string greater than the second string.
+ * @param   pwsz1       First UTF-16 string. Null is allowed.
+ * @param   psz2        Second string, pure ASCII. Null is allowed.
+ */
+RTDECL(int) RTUtf16ICmpAscii(PCRTUTF16 pwsz1, const char *psz2);
+
+/**
+ * Performs a case insensitive string compare between two UTF-16 strings
+ * using the current locale of the process (if applicable).
+ *
+ * This differs from RTUtf16ICmp() in that it will try, if a locale with the
+ * required data is available, to do a correct case-insensitive compare. It
+ * follows that it is more complex and thereby likely to be more expensive.
+ *
+ * @returns < 0 if the first string less than the second string.
+ * @returns 0 if the first string identical to the second string.
+ * @returns > 0 if the first string greater than the second string.
+ * @param   pwsz1       First UTF-16 string. Null is allowed.
+ * @param   pwsz2       Second UTF-16 string. Null is allowed.
+ */
+RTDECL(int) RTUtf16LocaleICmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
+
+/**
+ * Folds a UTF-16 string to lowercase.
+ *
+ * This is a very simple folding; is uses the simple lowercase
+ * code point, it is not related to any locale just the most common
+ * lowercase codepoint setup by the unicode specs, and it will not
+ * create new surrogate pairs or remove existing ones.
+ *
+ * @returns Pointer to the passed in string.
+ * @param   pwsz        The string to fold.
+ */
+RTDECL(PRTUTF16) RTUtf16ToLower(PRTUTF16 pwsz);
+
+/**
+ * Folds a UTF-16 string to uppercase.
+ *
+ * This is a very simple folding; is uses the simple uppercase
+ * code point, it is not related to any locale just the most common
+ * uppercase codepoint setup by the unicode specs, and it will not
+ * create new surrogate pairs or remove existing ones.
+ *
+ * @returns Pointer to the passed in string.
+ * @param   pwsz        The string to fold.
+ */
+RTDECL(PRTUTF16) RTUtf16ToUpper(PRTUTF16 pwsz);
+
+/**
+ * Validates the UTF-16 encoding of the string.
+ *
+ * @returns iprt status code.
+ * @param   pwsz        The string.
+ */
+RTDECL(int) RTUtf16ValidateEncoding(PCRTUTF16 pwsz);
+
+/**
+ * Validates the UTF-16 encoding of the string.
+ *
+ * @returns iprt status code.
+ * @param   pwsz        The string.
+ * @param   cwc         The max string length (/ size) in UTF-16 units. Use
+ *                      RTSTR_MAX to process the entire string.
+ * @param   fFlags      Combination of RTSTR_VALIDATE_ENCODING_XXX flags.
+ */
+RTDECL(int) RTUtf16ValidateEncodingEx(PCRTUTF16 pwsz, size_t cwc, uint32_t fFlags);
+
+/**
+ * Checks if the UTF-16 encoding is valid.
+ *
+ * @returns true / false.
+ * @param   pwsz        The string.
+ */
+RTDECL(bool) RTUtf16IsValidEncoding(PCRTUTF16 pwsz);
+
+/**
+ * Sanitise a (valid) UTF-16 string by replacing all characters outside a white
+ * list in-place by an ASCII replacement character.  Multi-byte characters will
+ * be replaced byte by byte.
+ *
+ * @returns The number of code points replaced, or a negative value if the
+ *          string is not correctly encoded.  In this last case the string
+ *          may be partially processed.
+ * @param   pwsz           The string to sanitise.
+ * @param   puszValidSet   A zero-terminated array of pairs of Unicode points.
+ *                         Each pair is the start and end point of a range,
+ *                         and the union of these ranges forms the white list.
+ * @param   chReplacement  The ASCII replacement character.
+ */
+RTDECL(ssize_t) RTUtf16PurgeComplementSet(PRTUTF16 pwsz, PCRTUNICP puszValidSet, char chReplacement);
+
+/**
+ * Translate a UTF-16 string into a UTF-8 allocating the result buffer (default
+ * tag).
+ *
+ * @returns iprt status code.
+ * @param   pwszString      UTF-16 string to convert.
+ * @param   ppszString      Receives pointer of allocated UTF-8 string on
+ *                          success, and is always set to NULL on failure.
+ *                          The returned pointer must be freed using RTStrFree().
+ */
+#define RTUtf16ToUtf8(pwszString, ppszString)       RTUtf16ToUtf8Tag((pwszString), (ppszString), RTSTR_TAG)
+
+/**
+ * Translate a UTF-16 string into a UTF-8 allocating the result buffer.
+ *
+ * @returns iprt status code.
+ * @param   pwszString      UTF-16 string to convert.
+ * @param   ppszString      Receives pointer of allocated UTF-8 string on
+ *                          success, and is always set to NULL on failure.
+ *                          The returned pointer must be freed using RTStrFree().
+ * @param   pszTag          Allocation tag used for statistics and such.
+ */
+RTDECL(int)  RTUtf16ToUtf8Tag(PCRTUTF16 pwszString, char **ppszString, const char *pszTag);
+
+/**
+ * Translates UTF-16 to UTF-8 using buffer provided by the caller or a fittingly
+ * sized buffer allocated by the function (default tag).
+ *
+ * @returns iprt status code.
+ * @param   pwszString      The UTF-16 string to convert.
+ * @param   cwcString       The number of RTUTF16 items to translate from pwszString.
+ *                          The translation will stop when reaching cwcString or the terminator ('\\0').
+ *                          Use RTSTR_MAX to translate the entire string.
+ * @param   ppsz            If cch is non-zero, this must either be pointing to a pointer to
+ *                          a buffer of the specified size, or pointer to a NULL pointer.
+ *                          If *ppsz is NULL or cch is zero a buffer of at least cch chars
+ *                          will be allocated to hold the translated string.
+ *                          If a buffer was requested it must be freed using RTStrFree().
+ * @param   cch             The buffer size in chars (the type). This includes the terminator.
+ * @param   pcch            Where to store the length of the translated string,
+ *                          excluding the terminator. (Optional)
+ *
+ *                          This may be set under some error conditions,
+ *                          however, only for VERR_BUFFER_OVERFLOW and
+ *                          VERR_NO_STR_MEMORY will it contain a valid string
+ *                          length that can be used to resize the buffer.
+ */
+#define RTUtf16ToUtf8Ex(pwszString, cwcString, ppsz, cch, pcch) \
+    RTUtf16ToUtf8ExTag((pwszString), (cwcString), (ppsz), (cch), (pcch), RTSTR_TAG)
+
+/**
+ * Translates UTF-16 to UTF-8 using buffer provided by the caller or a fittingly
+ * sized buffer allocated by the function (custom tag).
+ *
+ * @returns iprt status code.
+ * @param   pwszString      The UTF-16 string to convert.
+ * @param   cwcString       The number of RTUTF16 items to translate from pwszString.
+ *                          The translation will stop when reaching cwcString or the terminator ('\\0').
+ *                          Use RTSTR_MAX to translate the entire string.
+ * @param   ppsz            If cch is non-zero, this must either be pointing to a pointer to
+ *                          a buffer of the specified size, or pointer to a NULL pointer.
+ *                          If *ppsz is NULL or cch is zero a buffer of at least cch chars
+ *                          will be allocated to hold the translated string.
+ *                          If a buffer was requested it must be freed using RTStrFree().
+ * @param   cch             The buffer size in chars (the type). This includes the terminator.
+ * @param   pcch            Where to store the length of the translated string,
+ *                          excluding the terminator. (Optional)
+ *
+ *                          This may be set under some error conditions,
+ *                          however, only for VERR_BUFFER_OVERFLOW and
+ *                          VERR_NO_STR_MEMORY will it contain a valid string
+ *                          length that can be used to resize the buffer.
+ * @param   pszTag          Allocation tag used for statistics and such.
+ */
+RTDECL(int)  RTUtf16ToUtf8ExTag(PCRTUTF16 pwszString, size_t cwcString, char **ppsz, size_t cch, size_t *pcch, const char *pszTag);
+
+/**
+ * Calculates the length of the UTF-16 string in UTF-8 chars (bytes).
+ *
+ * This function will validate the string, and incorrectly encoded UTF-16
+ * strings will be rejected. The primary purpose of this function is to
+ * help allocate buffers for RTUtf16ToUtf8() of the correct size. For most
+ * other purposes RTUtf16ToUtf8Ex() should be used.
+ *
+ * @returns Number of char (bytes).
+ * @returns 0 if the string was incorrectly encoded.
+ * @param   pwsz        The UTF-16 string.
+ */
+RTDECL(size_t) RTUtf16CalcUtf8Len(PCRTUTF16 pwsz);
+
+/**
+ * Calculates the length of the UTF-16 string in UTF-8 chars (bytes).
+ *
+ * This function will validate the string, and incorrectly encoded UTF-16
+ * strings will be rejected.
+ *
+ * @returns iprt status code.
+ * @param   pwsz        The string.
+ * @param   cwc         The max string length. Use RTSTR_MAX to process the entire string.
+ * @param   pcch        Where to store the string length (in bytes). Optional.
+ *                      This is undefined on failure.
+ */
+RTDECL(int) RTUtf16CalcUtf8LenEx(PCRTUTF16 pwsz, size_t cwc, size_t *pcch);
+
+/**
+ * Translate a UTF-16 string into a Latin-1 (ISO-8859-1) allocating the result
+ * buffer (default tag).
+ *
+ * @returns iprt status code.
+ * @param   pwszString      UTF-16 string to convert.
+ * @param   ppszString      Receives pointer of allocated Latin1 string on
+ *                          success, and is always set to NULL on failure.
+ *                          The returned pointer must be freed using RTStrFree().
+ */
+#define RTUtf16ToLatin1(pwszString, ppszString)     RTUtf16ToLatin1Tag((pwszString), (ppszString), RTSTR_TAG)
+
+/**
+ * Translate a UTF-16 string into a Latin-1 (ISO-8859-1) allocating the result
+ * buffer (custom tag).
+ *
+ * @returns iprt status code.
+ * @param   pwszString      UTF-16 string to convert.
+ * @param   ppszString      Receives pointer of allocated Latin1 string on
+ *                          success, and is always set to NULL on failure.
+ *                          The returned pointer must be freed using RTStrFree().
+ * @param   pszTag          Allocation tag used for statistics and such.
+ */
+RTDECL(int)  RTUtf16ToLatin1Tag(PCRTUTF16 pwszString, char **ppszString, const char *pszTag);
+
+/**
+ * Translates UTF-16 to Latin-1 (ISO-8859-1) using buffer provided by the caller
+ * or a fittingly sized buffer allocated by the function (default tag).
+ *
+ * @returns iprt status code.
+ * @param   pwszString      The UTF-16 string to convert.
+ * @param   cwcString       The number of RTUTF16 items to translate from
+ *                          pwszString. The translation will stop when reaching
+ *                          cwcString or the terminator ('\\0'). Use RTSTR_MAX
+ *                          to translate the entire string.
+ * @param   ppsz            Pointer to the pointer to the Latin-1 string. The
+ *                          buffer can optionally be preallocated by the caller.
+ *
+ *                          If cch is zero, *ppsz is undefined.
+ *
+ *                          If cch is non-zero and *ppsz is not NULL, then this
+ *                          will be used as the output buffer.
+ *                          VERR_BUFFER_OVERFLOW will be returned if this is
+ *                          insufficient.
+ *
+ *                          If cch is zero or *ppsz is NULL, then a buffer of
+ *                          sufficient size is allocated. cch can be used to
+ *                          specify a minimum size of this buffer. Use
+ *                          RTUtf16Free() to free the result.
+ *
+ * @param   cch             The buffer size in chars (the type). This includes
+ *                          the terminator.
+ * @param   pcch            Where to store the length of the translated string,
+ *                          excluding the terminator. (Optional)
+ *
+ *                          This may be set under some error conditions,
+ *                          however, only for VERR_BUFFER_OVERFLOW and
+ *                          VERR_NO_STR_MEMORY will it contain a valid string
+ *                          length that can be used to resize the buffer.
+ */
+#define RTUtf16ToLatin1Ex(pwszString, cwcString, ppsz, cch, pcch) \
+    RTUtf16ToLatin1ExTag((pwszString), (cwcString), (ppsz), (cch), (pcch), RTSTR_TAG)
+
+/**
+ * Translates UTF-16 to Latin-1 (ISO-8859-1) using buffer provided by the caller
+ * or a fittingly sized buffer allocated by the function (custom tag).
+ *
+ * @returns iprt status code.
+ * @param   pwszString      The UTF-16 string to convert.
+ * @param   cwcString       The number of RTUTF16 items to translate from
+ *                          pwszString. The translation will stop when reaching
+ *                          cwcString or the terminator ('\\0'). Use RTSTR_MAX
+ *                          to translate the entire string.
+ * @param   ppsz            Pointer to the pointer to the Latin-1 string. The
+ *                          buffer can optionally be preallocated by the caller.
+ *
+ *                          If cch is zero, *ppsz is undefined.
+ *
+ *                          If cch is non-zero and *ppsz is not NULL, then this
+ *                          will be used as the output buffer.
+ *                          VERR_BUFFER_OVERFLOW will be returned if this is
+ *                          insufficient.
+ *
+ *                          If cch is zero or *ppsz is NULL, then a buffer of
+ *                          sufficient size is allocated. cch can be used to
+ *                          specify a minimum size of this buffer. Use
+ *                          RTUtf16Free() to free the result.
+ *
+ * @param   cch             The buffer size in chars (the type). This includes
+ *                          the terminator.
+ * @param   pcch            Where to store the length of the translated string,
+ *                          excluding the terminator. (Optional)
+ *
+ *                          This may be set under some error conditions,
+ *                          however, only for VERR_BUFFER_OVERFLOW and
+ *                          VERR_NO_STR_MEMORY will it contain a valid string
+ *                          length that can be used to resize the buffer.
+ * @param   pszTag          Allocation tag used for statistics and such.
+ */
+RTDECL(int)  RTUtf16ToLatin1ExTag(PCRTUTF16 pwszString, size_t cwcString, char **ppsz, size_t cch, size_t *pcch, const char *pszTag);
+
+/**
+ * Calculates the length of the UTF-16 string in Latin-1 (ISO-8859-1) chars.
+ *
+ * This function will validate the string, and incorrectly encoded UTF-16
+ * strings will be rejected. The primary purpose of this function is to
+ * help allocate buffers for RTUtf16ToLatin1() of the correct size. For most
+ * other purposes RTUtf16ToLatin1Ex() should be used.
+ *
+ * @returns Number of char (bytes).
+ * @returns 0 if the string was incorrectly encoded.
+ * @param   pwsz        The UTF-16 string.
+ */
+RTDECL(size_t) RTUtf16CalcLatin1Len(PCRTUTF16 pwsz);
+
+/**
+ * Calculates the length of the UTF-16 string in Latin-1 (ISO-8859-1) chars.
+ *
+ * This function will validate the string, and incorrectly encoded UTF-16
+ * strings will be rejected.
+ *
+ * @returns iprt status code.
+ * @param   pwsz        The string.
+ * @param   cwc         The max string length. Use RTSTR_MAX to process the
+ *                      entire string.
+ * @param   pcch        Where to store the string length (in bytes). Optional.
+ *                      This is undefined on failure.
+ */
+RTDECL(int) RTUtf16CalcLatin1LenEx(PCRTUTF16 pwsz, size_t cwc, size_t *pcch);
+
+/**
+ * Get the unicode code point at the given string position.
+ *
+ * @returns unicode code point.
+ * @returns RTUNICP_INVALID if the encoding is invalid.
+ * @param   pwsz        The string.
+ *
+ * @remark  This is an internal worker for RTUtf16GetCp().
+ */
+RTDECL(RTUNICP) RTUtf16GetCpInternal(PCRTUTF16 pwsz);
+
+/**
+ * Get the unicode code point at the given string position.
+ *
+ * @returns iprt status code.
+ * @param   ppwsz       Pointer to the string pointer. This will be updated to
+ *                      point to the char following the current code point.
+ * @param   pCp         Where to store the code point.
+ *                      RTUNICP_INVALID is stored here on failure.
+ *
+ * @remark  This is an internal worker for RTUtf16GetCpEx().
+ */
+RTDECL(int) RTUtf16GetCpExInternal(PCRTUTF16 *ppwsz, PRTUNICP pCp);
+
+/**
+ * Put the unicode code point at the given string position
+ * and return the pointer to the char following it.
+ *
+ * This function will not consider anything at or following the
+ * buffer area pointed to by pwsz. It is therefore not suitable for
+ * inserting code points into a string, only appending/overwriting.
+ *
+ * @returns pointer to the char following the written code point.
+ * @param   pwsz        The string.
+ * @param   CodePoint   The code point to write.
+ *                      This should not be RTUNICP_INVALID or any other
+ *                      character out of the UTF-16 range.
+ *
+ * @remark  This is an internal worker for RTUtf16GetCpEx().
+ */
+RTDECL(PRTUTF16) RTUtf16PutCpInternal(PRTUTF16 pwsz, RTUNICP CodePoint);
+
+/**
+ * Get the unicode code point at the given string position.
+ *
+ * @returns unicode code point.
+ * @returns RTUNICP_INVALID if the encoding is invalid.
+ * @param   pwsz        The string.
+ *
+ * @remark  We optimize this operation by using an inline function for
+ *          everything which isn't a surrogate pair or an endian indicator.
+ */
+DECLINLINE(RTUNICP) RTUtf16GetCp(PCRTUTF16 pwsz)
+{
+    const RTUTF16 wc = *pwsz;
+    if (wc < 0xd800 || (wc > 0xdfff && wc < 0xfffe))
+        return wc;
+    return RTUtf16GetCpInternal(pwsz);
+}
+
+/**
+ * Get the unicode code point at the given string position.
+ *
+ * @returns iprt status code.
+ * @param   ppwsz       Pointer to the string pointer. This will be updated to
+ *                      point to the char following the current code point.
+ * @param   pCp         Where to store the code point.
+ *                      RTUNICP_INVALID is stored here on failure.
+ *
+ * @remark  We optimize this operation by using an inline function for
+ *          everything which isn't a surrogate pair or and endian indicator.
+ */
+DECLINLINE(int) RTUtf16GetCpEx(PCRTUTF16 *ppwsz, PRTUNICP pCp)
+{
+    const RTUTF16 wc = **ppwsz;
+    if (wc < 0xd800 || (wc > 0xdfff && wc < 0xfffe))
+    {
+        (*ppwsz)++;
+        *pCp = wc;
+        return VINF_SUCCESS;
+    }
+    return RTUtf16GetCpExInternal(ppwsz, pCp);
+}
+
+/**
+ * Put the unicode code point at the given string position
+ * and return the pointer to the char following it.
+ *
+ * This function will not consider anything at or following the
+ * buffer area pointed to by pwsz. It is therefore not suitable for
+ * inserting code points into a string, only appending/overwriting.
+ *
+ * @returns pointer to the char following the written code point.
+ * @param   pwsz        The string.
+ * @param   CodePoint   The code point to write.
+ *                      This should not be RTUNICP_INVALID or any other
+ *                      character out of the UTF-16 range.
+ *
+ * @remark  We optimize this operation by using an inline function for
+ *          everything which isn't a surrogate pair or and endian indicator.
+ */
+DECLINLINE(PRTUTF16) RTUtf16PutCp(PRTUTF16 pwsz, RTUNICP CodePoint)
+{
+    if (CodePoint < 0xd800 || (CodePoint > 0xd800 && CodePoint < 0xfffe))
+    {
+        *pwsz++ = (RTUTF16)CodePoint;
+        return pwsz;
+    }
+    return RTUtf16PutCpInternal(pwsz, CodePoint);
+}
+
+/**
+ * Skips ahead, past the current code point.
+ *
+ * @returns Pointer to the char after the current code point.
+ * @param   pwsz    Pointer to the current code point.
+ * @remark  This will not move the next valid code point, only past the current one.
+ */
+DECLINLINE(PRTUTF16) RTUtf16NextCp(PCRTUTF16 pwsz)
+{
+    RTUNICP Cp;
+    RTUtf16GetCpEx(&pwsz, &Cp);
+    return (PRTUTF16)pwsz;
+}
+
+/**
+ * Skips backwards, to the previous code point.
+ *
+ * @returns Pointer to the char after the current code point.
+ * @param   pwszStart   Pointer to the start of the string.
+ * @param   pwsz        Pointer to the current code point.
+ */
+RTDECL(PRTUTF16) RTUtf16PrevCp(PCRTUTF16 pwszStart, PCRTUTF16 pwsz);
+
+
+/**
+ * Checks if the UTF-16 char is the high surrogate char (i.e.
+ * the 1st char in the pair).
+ *
+ * @returns true if it is.
+ * @returns false if it isn't.
+ * @param   wc      The character to investigate.
+ */
+DECLINLINE(bool) RTUtf16IsHighSurrogate(RTUTF16 wc)
+{
+    return wc >= 0xd800 && wc <= 0xdbff;
+}
+
+/**
+ * Checks if the UTF-16 char is the low surrogate char (i.e.
+ * the 2nd char in the pair).
+ *
+ * @returns true if it is.
+ * @returns false if it isn't.
+ * @param   wc      The character to investigate.
+ */
+DECLINLINE(bool) RTUtf16IsLowSurrogate(RTUTF16 wc)
+{
+    return wc >= 0xdc00 && wc <= 0xdfff;
+}
+
+
+/**
+ * Checks if the two UTF-16 chars form a valid surrogate pair.
+ *
+ * @returns true if they do.
+ * @returns false if they doesn't.
+ * @param   wcHigh      The high (1st) character.
+ * @param   wcLow       The low (2nd) character.
+ */
+DECLINLINE(bool) RTUtf16IsSurrogatePair(RTUTF16 wcHigh, RTUTF16 wcLow)
+{
+    return RTUtf16IsHighSurrogate(wcHigh)
+        && RTUtf16IsLowSurrogate(wcLow);
+}
+
+/**
+ * Formats a buffer stream as hex bytes.
+ *
+ * The default is no separating spaces or line breaks or anything.
+ *
+ * @returns IPRT status code.
+ * @retval  VERR_INVALID_POINTER if any of the pointers are wrong.
+ * @retval  VERR_BUFFER_OVERFLOW if the buffer is insufficent to hold the bytes.
+ *
+ * @param   pwszBuf     Output string buffer.
+ * @param   cwcBuf      The size of the output buffer in RTUTF16 units.
+ * @param   pv          Pointer to the bytes to stringify.
+ * @param   cb          The number of bytes to stringify.
+ * @param   fFlags      Combination of RTSTRPRINTHEXBYTES_F_XXX values.
+ * @sa      RTStrPrintHexBytes.
+ */
+RTDECL(int) RTUtf16PrintHexBytes(PRTUTF16 pwszBuf, size_t cwcBuf, void const *pv, size_t cb, uint32_t fFlags);
+
+/** @} */
+
+
+RT_C_DECLS_END
+
+/** @} */
+
+#endif
+
index 9de4a72d0abae26cefbccd43f27359f5b7f524c9..f82847326029a3647991286f9c88be0738be4160 100644 (file)
@@ -1069,6 +1069,9 @@ AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00040000)) == 0);
 /** BIOS update signature (microcode). */
 #define MSR_IA32_BIOS_SIGN_ID               0x8B
 
+/** SMM monitor control. */
+#define MSR_IA32_SMM_MONITOR_CTL            0x9B
+
 /** General performance counter no. 0. */
 #define MSR_IA32_PMC0                       0xC1
 /** General performance counter no. 1. */
index 0955256e3747b0743739e472df6b3ecc7da812f7..d6b9cf2c14eb96036f096bd7020947eedf947d33 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define RTMEM_NO_WRAP_TO_EF_APIS
 #include <iprt/mem.h>
 #include "internal/iprt.h"
@@ -45,9 +45,9 @@
 #include "r0drv/alloc-r0drv.h"
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 #ifdef RT_STRICT
 # define RTR0MEM_STRICT
 #endif
@@ -59,9 +59,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 #ifdef RTR0MEM_STRICT
 /** Fence data. */
 static uint8_t const g_abFence[RTR0MEM_FENCE_EXTRA] =
@@ -89,21 +89,21 @@ DECLINLINE(PRTMEMHDR) rtR0MemAlloc(size_t cb, uint32_t fFlags)
 }
 
 
-RTDECL(void *)  RTMemTmpAllocTag(size_t cb, const char *pszTag) RT_NO_THROW
+RTDECL(void *)  RTMemTmpAllocTag(size_t cb, const char *pszTag) RT_NO_THROW_DEF
 {
     return RTMemAllocTag(cb, pszTag);
 }
 RT_EXPORT_SYMBOL(RTMemTmpAllocTag);
 
 
-RTDECL(void *)  RTMemTmpAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW
+RTDECL(void *)  RTMemTmpAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW_DEF
 {
     return RTMemAllocZTag(cb, pszTag);
 }
 RT_EXPORT_SYMBOL(RTMemTmpAllocZTag);
 
 
-RTDECL(void)    RTMemTmpFree(void *pv) RT_NO_THROW
+RTDECL(void)    RTMemTmpFree(void *pv) RT_NO_THROW_DEF
 {
     return RTMemFree(pv);
 }
@@ -113,7 +113,7 @@ RT_EXPORT_SYMBOL(RTMemTmpFree);
 
 
 
-RTDECL(void *)  RTMemAllocTag(size_t cb, const char *pszTag) RT_NO_THROW
+RTDECL(void *)  RTMemAllocTag(size_t cb, const char *pszTag) RT_NO_THROW_DEF
 {
     PRTMEMHDR pHdr;
     RT_ASSERT_INTS_ON();
@@ -132,7 +132,7 @@ RTDECL(void *)  RTMemAllocTag(size_t cb, const char *pszTag) RT_NO_THROW
 RT_EXPORT_SYMBOL(RTMemAllocTag);
 
 
-RTDECL(void *)  RTMemAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW
+RTDECL(void *)  RTMemAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW_DEF
 {
     PRTMEMHDR pHdr;
     RT_ASSERT_INTS_ON();
@@ -177,7 +177,7 @@ RTDECL(void *) RTMemAllocZVarTag(size_t cbUnaligned, const char *pszTag)
 RT_EXPORT_SYMBOL(RTMemAllocZVarTag);
 
 
-RTDECL(void *) RTMemReallocTag(void *pvOld, size_t cbNew, const char *pszTag) RT_NO_THROW
+RTDECL(void *) RTMemReallocTag(void *pvOld, size_t cbNew, const char *pszTag) RT_NO_THROW_DEF
 {
     PRTMEMHDR pHdrOld;
 
@@ -243,7 +243,7 @@ RTDECL(void *) RTMemReallocTag(void *pvOld, size_t cbNew, const char *pszTag) RT
 RT_EXPORT_SYMBOL(RTMemReallocTag);
 
 
-RTDECL(void) RTMemFree(void *pv) RT_NO_THROW
+RTDECL(void) RTMemFree(void *pv) RT_NO_THROW_DEF
 {
     PRTMEMHDR pHdr;
     RT_ASSERT_INTS_ON();
@@ -276,7 +276,7 @@ RT_EXPORT_SYMBOL(RTMemFree);
 
 
 
-RTDECL(void *)    RTMemExecAllocTag(size_t cb, const char *pszTag) RT_NO_THROW
+RTDECL(void *)    RTMemExecAllocTag(size_t cb, const char *pszTag) RT_NO_THROW_DEF
 {
     PRTMEMHDR pHdr;
 #ifdef RT_OS_SOLARIS /** @todo figure out why */
@@ -299,7 +299,7 @@ RTDECL(void *)    RTMemExecAllocTag(size_t cb, const char *pszTag) RT_NO_THROW
 RT_EXPORT_SYMBOL(RTMemExecAllocTag);
 
 
-RTDECL(void)      RTMemExecFree(void *pv, size_t cb) RT_NO_THROW
+RTDECL(void)      RTMemExecFree(void *pv, size_t cb) RT_NO_THROW_DEF
 {
     PRTMEMHDR pHdr;
     RT_ASSERT_INTS_ON();
@@ -329,7 +329,7 @@ RT_EXPORT_SYMBOL(RTMemExecFree);
 
 
 
-RTDECL(int) RTMemAllocExTag(size_t cb, size_t cbAlignment, uint32_t fFlags, const char *pszTag, void **ppv) RT_NO_THROW
+RTDECL(int) RTMemAllocExTag(size_t cb, size_t cbAlignment, uint32_t fFlags, const char *pszTag, void **ppv) RT_NO_THROW_DEF
 {
     uint32_t    fHdrFlags = RTMEMHDR_FLAG_ALLOC_EX;
     PRTMEMHDR   pHdr;
@@ -393,7 +393,7 @@ RTDECL(int) RTMemAllocExTag(size_t cb, size_t cbAlignment, uint32_t fFlags, cons
 RT_EXPORT_SYMBOL(RTMemAllocExTag);
 
 
-RTDECL(void) RTMemFreeEx(void *pv, size_t cb) RT_NO_THROW
+RTDECL(void) RTMemFreeEx(void *pv, size_t cb) RT_NO_THROW_DEF
 {
     PRTMEMHDR pHdr;
 
index f97a192987959b8b348bb77015a1d39067952036..395fdcda57fff45481a8f081cd4e01eb4328d158 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #ifdef RT_OS_WINDOWS
 # include "../nt/the-nt-kernel.h"
 #endif
@@ -43,9 +43,9 @@
 #include "internal/magics.h"
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Saved state information.
  */
@@ -85,9 +85,9 @@ typedef struct RTSEMSPINMUTEXINTERNAL
 } RTSEMSPINMUTEXINTERNAL;
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /*#define RTSEMSPINMUTEX_INT_FLAGS_MUST*/
 
 /** Validates the handle, returning if invalid. */
index 8fd1102919631e081c53cecb3887894b4b49a4c7..f01d980e67934d5d8edebb966bf142f2fc998c8a 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/initterm.h>
 #include "internal/iprt.h"
 
@@ -45,9 +45,9 @@
 #include "internal/thread.h"
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** Count of current IPRT users.
  * In ring-0 several drivers / kmods / kexts / wossnames may share the
  * same runtime code. So, we need to keep count in order not to terminate
index 537d19bc3bcd0f5aea64c5e1bce1d8f10c63d93c..79aa6abd629078397b0e49f2b04fe1005053e9ed 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 #include <iprt/log.h>
@@ -35,7 +35,9 @@
 
 RTDECL(void) RTLogWriteDebugger(const char *pch, size_t cb)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     printk("%.*s", (int)cb, pch);
+    IPRT_LINUX_RESTORE_EFL_AC();
 }
 RT_EXPORT_SYMBOL(RTLogWriteDebugger);
 
index 1506615f5a5a7bbbff1f816125ba4abb5bf55ea4..0451e7b9367c7fcbef2860165b97c1d230f3385a 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 #include <iprt/mem.h>
@@ -63,9 +63,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 #ifdef RTMEMALLOC_EXEC_VM_AREA
 /**
  * Extended header used for headers marked with RTMEMHDR_FLAG_EXEC_VM_AREA.
@@ -87,9 +87,9 @@ typedef RTMEMLNXHDREX *PRTMEMLNXHDREX;
 #endif
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 #ifdef RTMEMALLOC_EXEC_HEAP
 /** The heap. */
 static RTHEAPSIMPLE g_HeapExec = NIL_RTHEAPSIMPLE;
@@ -234,6 +234,7 @@ static PRTMEMHDR rtR0MemAllocExecVmArea(size_t cb)
 DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
 {
     PRTMEMHDR pHdr;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * Allocate.
@@ -297,7 +298,10 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
             pHdr = vmalloc(cb + sizeof(*pHdr));
     }
     if (RT_UNLIKELY(!pHdr))
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VERR_NO_MEMORY;
+    }
 
     /*
      * Initialize.
@@ -308,6 +312,7 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
     pHdr->cbReq     = cb;
 
     *ppHdr = pHdr;
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 
@@ -317,6 +322,8 @@ DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
  */
 DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
     pHdr->u32Magic += 1;
     if (pHdr->fFlags & RTMEMHDR_FLAG_KMALLOC)
         kfree(pHdr);
@@ -345,6 +352,8 @@ DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
 #endif
     else
         vfree(pHdr);
+
+    IPRT_LINUX_RESTORE_EFL_AC();
 }
 
 
@@ -383,6 +392,8 @@ RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb)
     int             cOrder;
     unsigned        cPages;
     struct page    *paPages;
+    void           *pvRet;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * validate input.
@@ -434,10 +445,13 @@ RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb)
 #endif
         }
         *pPhys = page_to_phys(paPages);
-        return phys_to_virt(page_to_phys(paPages));
+        pvRet = phys_to_virt(page_to_phys(paPages));
     }
+    else
+        pvRet = NULL;
 
-    return NULL;
+    IPRT_LINUX_RESTORE_EFL_AC();
+    return pvRet;
 }
 RT_EXPORT_SYMBOL(RTMemContAlloc);
 
@@ -456,6 +470,7 @@ RTR0DECL(void) RTMemContFree(void *pv, size_t cb)
         unsigned        cPages;
         unsigned        iPage;
         struct page    *paPages;
+        IPRT_LINUX_SAVE_EFL_AC();
 
         /* validate */
         AssertMsg(!((uintptr_t)pv & PAGE_OFFSET_MASK), ("pv=%p\n", pv));
@@ -478,6 +493,7 @@ RTR0DECL(void) RTMemContFree(void *pv, size_t cb)
 #endif
         }
         __free_pages(paPages, cOrder);
+        IPRT_LINUX_RESTORE_EFL_AC();
     }
 }
 RT_EXPORT_SYMBOL(RTMemContFree);
index c127e28096afd2ec4dd280611c12c2dd6ff49d79..84be7e514b86253518117b2e4cdd5ea553c58a0b 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 
 
 DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     printk(KERN_EMERG
            "\r\n!!Assertion Failed!!\r\n"
            "Expression: %s\r\n"
            "Location  : %s(%d) %s\r\n",
            pszExpr, pszFile, uLine, pszFunction);
+    IPRT_LINUX_RESTORE_EFL_AC();
 }
 
 
 DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
 {
     char szMsg[256];
+    IPRT_LINUX_SAVE_EFL_AC();
 
     RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);
     szMsg[sizeof(szMsg) - 1] = '\0';
     printk(KERN_EMERG "%s", szMsg);
 
     NOREF(fInitial);
+    IPRT_LINUX_RESTORE_EFL_AC();
 }
 
 
index e1bc5a385b76e4319ddb718487cc848a1cb1575e..ef3627b95ddb2efda3a212a155ff6f779ac68464 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 #include <iprt/err.h>
@@ -35,9 +35,9 @@
 #include "internal/initterm.h"
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The IPRT work queue. */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)
 static struct workqueue_struct *g_prtR0LnxWorkQueue;
@@ -46,9 +46,9 @@ static DECLARE_TASK_QUEUE(g_rtR0LnxWorkQueue);
 #endif
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 /* in alloc-r0drv0-linux.c */
 DECLHIDDEN(void) rtR0MemExecCleanup(void);
 
@@ -62,6 +62,8 @@ DECLHIDDEN(void) rtR0MemExecCleanup(void);
  */
 DECLHIDDEN(void) rtR0LnxWorkqueuePush(RTR0LNXWORKQUEUEITEM *pWork, void (*pfnWorker)(RTR0LNXWORKQUEUEITEM *))
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)
 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
     INIT_WORK(pWork, pfnWorker);
@@ -73,6 +75,8 @@ DECLHIDDEN(void) rtR0LnxWorkqueuePush(RTR0LNXWORKQUEUEITEM *pWork, void (*pfnWor
     INIT_TQUEUE(pWork, (void (*)(void *))pfnWorker, pWork);
     queue_task(pWork, &g_rtR0LnxWorkQueue);
 #endif
+
+    IPRT_LINUX_RESTORE_EFL_AC();
 }
 
 
@@ -84,16 +88,23 @@ DECLHIDDEN(void) rtR0LnxWorkqueuePush(RTR0LNXWORKQUEUEITEM *pWork, void (*pfnWor
  */
 DECLHIDDEN(void) rtR0LnxWorkqueueFlush(void)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)
     flush_workqueue(g_prtR0LnxWorkQueue);
 #else
     run_task_queue(&g_rtR0LnxWorkQueue);
 #endif
+
+    IPRT_LINUX_RESTORE_EFL_AC();
 }
 
 
 DECLHIDDEN(int) rtR0InitNative(void)
 {
+    int rc = VINF_SUCCESS;
+    IPRT_LINUX_SAVE_EFL_AC();
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
     g_prtR0LnxWorkQueue = create_workqueue("iprt-VBoxWQueue");
@@ -101,15 +112,18 @@ DECLHIDDEN(int) rtR0InitNative(void)
     g_prtR0LnxWorkQueue = create_workqueue("iprt-VBoxQ");
  #endif
     if (!g_prtR0LnxWorkQueue)
-        return VERR_NO_MEMORY;
+        rc = VERR_NO_MEMORY;
 #endif
 
-    return VINF_SUCCESS;
+    IPRT_LINUX_RESTORE_EFL_AC();
+    return rc;
 }
 
 
 DECLHIDDEN(void) rtR0TermNative(void)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
     rtR0LnxWorkqueueFlush();
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)
     destroy_workqueue(g_prtR0LnxWorkQueue);
@@ -117,5 +131,7 @@ DECLHIDDEN(void) rtR0TermNative(void)
 #endif
 
     rtR0MemExecCleanup();
+
+    IPRT_LINUX_RESTORE_EFL_AC();
 }
 
index f1ae2a5936f601e94f474ef2e35e9e184d06f1e7..60896e91e63d20efdc51006d07037c0f30b4548c 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 
 #include <iprt/memobj.h>
@@ -39,9 +39,9 @@
 #include "internal/memobj.h"
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /* early 2.6 kernels */
 #ifndef PAGE_SHARED_EXEC
 # define PAGE_SHARED_EXEC PAGE_SHARED
@@ -66,9 +66,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * The Darwin version of the memory object structure.
  */
@@ -547,6 +547,7 @@ static void rtR0MemObjLinuxVUnmap(PRTR0MEMOBJLNX pMemLnx)
 
 DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem;
 
     /*
@@ -625,12 +626,14 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
             AssertMsgFailed(("enmType=%d\n", pMemLnx->Core.enmType));
             return VERR_INTERNAL_ERROR;
     }
+    IPRT_LINUX_RESTORE_EFL_ONLY_AC();
     return VINF_SUCCESS;
 }
 
 
 DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     PRTR0MEMOBJLNX pMemLnx;
     int rc;
 
@@ -647,6 +650,7 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb,
         if (RT_SUCCESS(rc))
         {
             *ppMem = &pMemLnx->Core;
+            IPRT_LINUX_RESTORE_EFL_AC();
             return rc;
         }
 
@@ -654,12 +658,14 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb,
         rtR0MemObjDelete(&pMemLnx->Core);
     }
 
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 
 
 DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     PRTR0MEMOBJLNX pMemLnx;
     int rc;
 
@@ -687,6 +693,7 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb,
         if (RT_SUCCESS(rc))
         {
             *ppMem = &pMemLnx->Core;
+            IPRT_LINUX_RESTORE_EFL_AC();
             return rc;
         }
 
@@ -694,12 +701,14 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb,
         rtR0MemObjDelete(&pMemLnx->Core);
     }
 
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 
 
 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     PRTR0MEMOBJLNX pMemLnx;
     int rc;
 
@@ -730,6 +739,7 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb,
 #endif
             pMemLnx->Core.u.Cont.Phys = page_to_phys(pMemLnx->apPages[0]);
             *ppMem = &pMemLnx->Core;
+            IPRT_LINUX_RESTORE_EFL_AC();
             return rc;
         }
 
@@ -737,6 +747,7 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb,
         rtR0MemObjDelete(&pMemLnx->Core);
     }
 
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 
@@ -744,7 +755,7 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb,
 /**
  * Worker for rtR0MemObjLinuxAllocPhysSub that tries one allocation strategy.
  *
- * @returns IPRT status.
+ * @returns IPRT status code.
  * @param   ppMemLnx    Where to
  * @param   enmType     The object type.
  * @param   cb          The size of the allocation.
@@ -796,7 +807,7 @@ static int rtR0MemObjLinuxAllocPhysSub2(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTY
 /**
  * Worker for rtR0MemObjNativeAllocPhys and rtR0MemObjNativeAllocPhysNC.
  *
- * @returns IPRT status.
+ * @returns IPRT status code.
  * @param   ppMem       Where to store the memory object pointer on success.
  * @param   enmType     The object type.
  * @param   cb          The size of the allocation.
@@ -808,6 +819,7 @@ static int rtR0MemObjLinuxAllocPhysSub(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYP
                                        size_t cb, size_t uAlignment, RTHCPHYS PhysHighest)
 {
     int rc;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * There are two clear cases and that's the <=16MB and anything-goes ones.
@@ -843,6 +855,7 @@ static int rtR0MemObjLinuxAllocPhysSub(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYP
             /* ZONE_DMA: 0-16MB */
             rc = rtR0MemObjLinuxAllocPhysSub2(ppMem, enmType, cb, uAlignment, PhysHighest, GFP_DMA);
     }
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 
@@ -953,6 +966,8 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t c
 
 DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
     /*
      * All we need to do here is to validate that we can use
      * ioremap on the specified address (32/64-bit dma_addr_t).
@@ -963,19 +978,24 @@ DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS P
 
     pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_PHYS, NULL, cb);
     if (!pMemLnx)
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VERR_NO_MEMORY;
+    }
 
     pMemLnx->Core.u.Phys.PhysBase = PhysAddr;
     pMemLnx->Core.u.Phys.fAllocated = false;
     pMemLnx->Core.u.Phys.uCachePolicy = uCachePolicy;
     Assert(!pMemLnx->cPages);
     *ppMem = &pMemLnx->Core;
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 
 
 DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     const int cPages = cb >> PAGE_SHIFT;
     struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process);
     struct vm_area_struct **papVMAs;
@@ -996,7 +1016,10 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3P
      */
     pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJLNX, apPages[cPages]), RTR0MEMOBJTYPE_LOCK, (void *)R3Ptr, cb);
     if (!pMemLnx)
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VERR_NO_MEMORY;
+    }
 
     papVMAs = (struct vm_area_struct **)RTMemAlloc(sizeof(*papVMAs) * cPages);
     if (papVMAs)
@@ -1047,6 +1070,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3P
             Assert(!pMemLnx->fMappedToRing0);
             *ppMem = &pMemLnx->Core;
 
+            IPRT_LINUX_RESTORE_EFL_AC();
             return VINF_SUCCESS;
         }
 
@@ -1067,12 +1091,14 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3P
     }
 
     rtR0MemObjDelete(&pMemLnx->Core);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 
 
 DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     void           *pvLast = (uint8_t *)pv + cb - 1;
     size_t const    cPages = cb >> PAGE_SHIFT;
     PRTR0MEMOBJLNX  pMemLnx;
@@ -1105,7 +1131,10 @@ DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv,
      */
     pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJLNX, apPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);
     if (!pMemLnx)
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VERR_NO_MEMORY;
+    }
 
     /*
      * Gather the pages.
@@ -1146,10 +1175,12 @@ DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv,
         Assert(!pMemLnx->fMappedToRing0);
         *ppMem = &pMemLnx->Core;
 
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VINF_SUCCESS;
     }
 
     rtR0MemObjDelete(&pMemLnx->Core);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 
@@ -1157,6 +1188,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv,
 DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
+    IPRT_LINUX_SAVE_EFL_AC();
     const size_t cPages = cb >> PAGE_SHIFT;
     struct page *pDummyPage;
     struct page **papPages;
@@ -1171,36 +1203,39 @@ DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *
      * the dummy page is mapped all over the reserved area.
      */
     pDummyPage = alloc_page(GFP_HIGHUSER | __GFP_NOWARN);
-    if (!pDummyPage)
-        return VERR_NO_MEMORY;
-    papPages = RTMemAlloc(sizeof(*papPages) * cPages);
-    if (papPages)
+    if (pDummyPage)
     {
-        void *pv;
-        size_t iPage = cPages;
-        while (iPage-- > 0)
-            papPages[iPage] = pDummyPage;
+        papPages = RTMemAlloc(sizeof(*papPages) * cPages);
+        if (papPages)
+        {
+            void *pv;
+            size_t iPage = cPages;
+            while (iPage-- > 0)
+                papPages[iPage] = pDummyPage;
 # ifdef VM_MAP
-        pv = vmap(papPages, cPages, VM_MAP, PAGE_KERNEL_RO);
+            pv = vmap(papPages, cPages, VM_MAP, PAGE_KERNEL_RO);
 # else
-        pv = vmap(papPages, cPages, VM_ALLOC, PAGE_KERNEL_RO);
+            pv = vmap(papPages, cPages, VM_ALLOC, PAGE_KERNEL_RO);
 # endif
-        RTMemFree(papPages);
-        if (pv)
-        {
-            PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb);
-            if (pMemLnx)
+            RTMemFree(papPages);
+            if (pv)
             {
-                pMemLnx->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS;
-                pMemLnx->cPages = 1;
-                pMemLnx->apPages[0] = pDummyPage;
-                *ppMem = &pMemLnx->Core;
-                return VINF_SUCCESS;
+                PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb);
+                if (pMemLnx)
+                {
+                    pMemLnx->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS;
+                    pMemLnx->cPages = 1;
+                    pMemLnx->apPages[0] = pDummyPage;
+                    *ppMem = &pMemLnx->Core;
+                    IPRT_LINUX_RESTORE_EFL_AC();
+                    return VINF_SUCCESS;
+                }
+                vunmap(pv);
             }
-            vunmap(pv);
         }
+        __free_page(pDummyPage);
     }
-    __free_page(pDummyPage);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VERR_NO_MEMORY;
 
 #else   /* < 2.4.22 */
@@ -1215,6 +1250,7 @@ DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *
 
 DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     PRTR0MEMOBJLNX      pMemLnx;
     void               *pv;
     struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process);
@@ -1232,17 +1268,22 @@ DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR
      */
     pv = rtR0MemObjLinuxDoMmap(R3PtrFixed, cb, uAlignment, pTask, RTMEM_PROT_NONE);
     if (pv == (void *)-1)
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VERR_NO_MEMORY;
+    }
 
     pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb);
     if (!pMemLnx)
     {
         rtR0MemObjLinuxDoMunmap(pv, cb, pTask);
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VERR_NO_MEMORY;
     }
 
     pMemLnx->Core.u.ResVirt.R0Process = R0Process;
     *ppMem = &pMemLnx->Core;
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 
@@ -1254,6 +1295,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ
     int rc = VERR_NO_MEMORY;
     PRTR0MEMOBJLNX pMemLnxToMap = (PRTR0MEMOBJLNX)pMemToMap;
     PRTR0MEMOBJLNX pMemLnx;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /* Fail if requested to do something we can't. */
     AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
@@ -1325,11 +1367,13 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ
         {
             pMemLnx->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;
             *ppMem = &pMemLnx->Core;
+            IPRT_LINUX_RESTORE_EFL_AC();
             return VINF_SUCCESS;
         }
         rtR0MemObjDelete(&pMemLnx->Core);
     }
 
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 
@@ -1394,6 +1438,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ p
     struct page        *pDummyPage;
     RTHCPHYS            DummyPhys;
 #endif
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * Check for restrictions.
@@ -1409,7 +1454,10 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ p
      */
     pDummyPage = alloc_page(GFP_USER | __GFP_NOWARN);
     if (!pDummyPage)
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VERR_NO_MEMORY;
+    }
     SetPageReserved(pDummyPage);
     DummyPhys = page_to_phys(pDummyPage);
 #endif
@@ -1563,6 +1611,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ p
                 pMemLnx->Core.pv = pv;
                 pMemLnx->Core.u.Mapping.R0Process = R0Process;
                 *ppMem = &pMemLnx->Core;
+                IPRT_LINUX_RESTORE_EFL_AC();
                 return VINF_SUCCESS;
             }
 
@@ -1577,6 +1626,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ p
     __free_page(pDummyPage);
 #endif
 
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 
index e60f3287df9b1fa11eaa855911e3bde24fbbcfa5..3532724c79591550f29498cb64e55cb851748265 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 
 
 RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     if (RT_LIKELY(copy_from_user(pvDst, (void *)R3PtrSrc, cb) == 0))
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VINF_SUCCESS;
+    }
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VERR_ACCESS_DENIED;
 }
 RT_EXPORT_SYMBOL(RTR0MemUserCopyFrom);
@@ -46,8 +51,13 @@ RT_EXPORT_SYMBOL(RTR0MemUserCopyFrom);
 
 RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     if (RT_LIKELY(copy_to_user((void *)R3PtrDst, pvSrc, cb) == 0))
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VINF_SUCCESS;
+    }
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VERR_ACCESS_DENIED;
 }
 RT_EXPORT_SYMBOL(RTR0MemUserCopyTo);
@@ -55,7 +65,10 @@ RT_EXPORT_SYMBOL(RTR0MemUserCopyTo);
 
 RTR0DECL(bool) RTR0MemUserIsValidAddr(RTR3PTR R3Ptr)
 {
-    return access_ok(VERIFY_READ, (void *)R3Ptr, 1);
+    IPRT_LINUX_SAVE_EFL_AC();
+    bool fRc = access_ok(VERIFY_READ, (void *)R3Ptr, 1);
+    IPRT_LINUX_RESTORE_EFL_AC();
+    return fRc;
 }
 RT_EXPORT_SYMBOL(RTR0MemUserIsValidAddr);
 
@@ -113,6 +126,7 @@ static int rtR0MemKernelCopyLnxWorker(void *pvDst, void const *pvSrc, size_t cb)
 #  endif
 # endif /* !_ASM_EXTABLE */
     int rc;
+    IPRT_LINUX_SAVE_EFL_AC(); /* paranoia */
     if (!cb)
         return VINF_SUCCESS;
 
@@ -135,6 +149,7 @@ static int rtR0MemKernelCopyLnxWorker(void *pvDst, void const *pvSrc, size_t cb)
                             "2" (pvSrc),
                             "3" (cb)
                           : "memory");
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 #else
     return VERR_NOT_SUPPORTED;
index dd5b3107ecdff330807feb38dbf9a4c339be227b..8bd8b1a79302940cf2b58dbab2fe722fdb5c23a2 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 
@@ -248,6 +248,7 @@ static void rtmpLinuxAllWrapper(void *pvInfo)
 
 RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     int rc;
     RTMPARGS Args;
     RTCPUSET OnlineSet;
@@ -300,6 +301,7 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
     }
 
     RTThreadPreemptRestore(&PreemptState);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTMpOnAll);
@@ -307,6 +309,7 @@ RT_EXPORT_SYMBOL(RTMpOnAll);
 
 RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     int rc;
     RTMPARGS Args;
 
@@ -326,6 +329,7 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
     RTThreadPreemptRestore(&PreemptState);
 
     Assert(rc == 0); NOREF(rc);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTMpOnOthers);
@@ -355,6 +359,7 @@ static void rtMpLinuxOnPairWrapper(void *pvInfo)
 
 RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     int rc;
     RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
 
@@ -442,6 +447,7 @@ RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPW
     else
         rc = VERR_CPU_NOT_FOUND;
     RTThreadPreemptRestore(&PreemptState);;
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 RT_EXPORT_SYMBOL(RTMpOnPair);
@@ -477,6 +483,7 @@ static void rtmpOnSpecificLinuxWrapper(void *pvInfo)
 
 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     int rc;
     RTMPARGS Args;
 
@@ -516,6 +523,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
     RTThreadPreemptRestore(&PreemptState);;
 
     NOREF(rc);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 RT_EXPORT_SYMBOL(RTMpOnSpecific);
@@ -538,6 +546,7 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
     int rc;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     if (!RTMpIsCpuPossible(idCpu))
         return VERR_CPU_NOT_FOUND;
@@ -553,6 +562,7 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
 # endif /* older kernels */
     NOREF(rc);
     Assert(rc == 0);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 
 #else  /* older kernels */
index 1c7cad45ce98b8bbb80b7262f9135fc2a96ddeec..4b2eb211e9b73639cdff36bb9db8719b411b5bb1 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 71) && defined(CONFIG_SMP)
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, unsigned long ulNativeEvent, void *pvCpu);
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /**
  * The notifier block we use for registering the callback.
  */
@@ -173,12 +174,14 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock,
 DECLHIDDEN(int) rtR0MpNotificationNativeInit(void)
 {
     int rc;
+    IPRT_LINUX_SAVE_EFL_AC();
 
 # ifdef CPU_DOWN_FAILED
     RTCpuSetEmpty(&g_MpPendingOfflineSet);
 # endif
 
     rc = register_cpu_notifier(&g_NotifierBlock);
+    IPRT_LINUX_RESTORE_EFL_AC();
     AssertMsgReturn(!rc, ("%d\n", rc), RTErrConvertFromErrno(rc));
     return VINF_SUCCESS;
 }
@@ -186,7 +189,9 @@ DECLHIDDEN(int) rtR0MpNotificationNativeInit(void)
 
 DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     unregister_cpu_notifier(&g_NotifierBlock);
+    IPRT_LINUX_RESTORE_EFL_AC();
 }
 
 #else   /* Not supported / Not needed */
index 44d3d7f33543753b373779a71544c52a2ff586b4..b04ac1aafe45379bfdc754b0a444551d475a8501 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 
index c7b46ef06fb56486ebdd079b9fa052439375592d..ab27087bbc9f5a6f60bbc184421693fbed1dc685 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define RTSEMEVENT_WITHOUT_REMAPPING
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
@@ -43,9 +43,9 @@
 #include "internal/magics.h"
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Linux event semaphore.
  */
@@ -72,6 +72,7 @@ RTDECL(int)  RTSemEventCreate(PRTSEMEVENT phEventSem)
 RTDECL(int)  RTSemEventCreateEx(PRTSEMEVENT phEventSem, uint32_t fFlags, RTLOCKVALCLASS hClass, const char *pszNameFmt, ...)
 {
     PRTSEMEVENTINTERNAL pThis;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     AssertReturn(!(fFlags & ~(RTSEMEVENT_FLAGS_NO_LOCK_VAL | RTSEMEVENT_FLAGS_BOOTSTRAP_HACK)), VERR_INVALID_PARAMETER);
     Assert(!(fFlags & RTSEMEVENT_FLAGS_BOOTSTRAP_HACK) || (fFlags & RTSEMEVENT_FLAGS_NO_LOCK_VAL));
@@ -86,6 +87,7 @@ RTDECL(int)  RTSemEventCreateEx(PRTSEMEVENT phEventSem, uint32_t fFlags, RTLOCKV
     init_waitqueue_head(&pThis->Head);
 
     *phEventSem = pThis;
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSemEventCreate);
@@ -117,6 +119,8 @@ DECLINLINE(void) rtR0SemEventLnxRelease(PRTSEMEVENTINTERNAL pThis)
 
 RTDECL(int)  RTSemEventDestroy(RTSEMEVENT hEventSem)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
     /*
      * Validate input.
      */
@@ -134,6 +138,8 @@ RTDECL(int)  RTSemEventDestroy(RTSEMEVENT hEventSem)
     Assert(!waitqueue_active(&pThis->Head));
     wake_up_all(&pThis->Head);
     rtR0SemEventLnxRelease(pThis);
+
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSemEventDestroy);
@@ -141,6 +147,8 @@ RT_EXPORT_SYMBOL(RTSemEventDestroy);
 
 RTDECL(int)  RTSemEventSignal(RTSEMEVENT hEventSem)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
     /*
      * Validate input.
      */
@@ -156,6 +164,7 @@ RTDECL(int)  RTSemEventSignal(RTSEMEVENT hEventSem)
     wake_up(&pThis->Head);
 
     rtR0SemEventLnxRelease(pThis);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSemEventSignal);
@@ -194,6 +203,7 @@ static int rtR0SemEventLnxWait(PRTSEMEVENTINTERNAL pThis, uint32_t fFlags, uint6
         /*
          * We have to wait.
          */
+        IPRT_LINUX_SAVE_EFL_AC();
         RTR0SEMLNXWAIT Wait;
         rc = rtR0SemLnxWaitInit(&Wait, fFlags, uTimeout, &pThis->Head);
         if (RT_SUCCESS(rc))
@@ -230,6 +240,7 @@ static int rtR0SemEventLnxWait(PRTSEMEVENTINTERNAL pThis, uint32_t fFlags, uint6
             rtR0SemLnxWaitDelete(&Wait);
             IPRT_DEBUG_SEMS_STATE_RC(pThis, 'E', rc);
         }
+        IPRT_LINUX_RESTORE_EFL_AC();
     }
 
     rtR0SemEventLnxRelease(pThis);
index 1ae8e51439148a26266918f29fe344e4fd5a9709..d46ded06a0119b316a7e8e6e70ccf449d20cf47b 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define RTSEMEVENTMULTI_WITHOUT_REMAPPING
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
@@ -43,9 +43,9 @@
 #include "internal/magics.h"
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /** @name fStateAndGen values
  * @{ */
 /** The state bit number. */
@@ -61,9 +61,9 @@
 /** @}  */
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Linux event semaphore.
  */
@@ -95,6 +95,7 @@ RTDECL(int)  RTSemEventMultiCreateEx(PRTSEMEVENTMULTI phEventMultiSem, uint32_t
                                      const char *pszNameFmt, ...)
 {
     PRTSEMEVENTMULTIINTERNAL pThis;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     AssertReturn(!(fFlags & ~RTSEMEVENTMULTI_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER);
     pThis = (PRTSEMEVENTMULTIINTERNAL)RTMemAlloc(sizeof(*pThis));
@@ -106,8 +107,10 @@ RTDECL(int)  RTSemEventMultiCreateEx(PRTSEMEVENTMULTI phEventMultiSem, uint32_t
         init_waitqueue_head(&pThis->Head);
 
         *phEventMultiSem = pThis;
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VINF_SUCCESS;
     }
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VERR_NO_MEMORY;
 }
 RT_EXPORT_SYMBOL(RTSemEventMultiCreate);
@@ -143,6 +146,8 @@ DECLINLINE(void) rtR0SemEventMultiLnxRelease(PRTSEMEVENTMULTIINTERNAL pThis)
 
 RTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI hEventMultiSem)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
     /*
      * Validate input.
      */
@@ -161,6 +166,8 @@ RTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI hEventMultiSem)
     Assert(!waitqueue_active(&pThis->Head));
     wake_up_all(&pThis->Head);
     rtR0SemEventMultiLnxRelease(pThis);
+
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSemEventMultiDestroy);
@@ -168,6 +175,7 @@ RT_EXPORT_SYMBOL(RTSemEventMultiDestroy);
 
 RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEventMultiSem)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     uint32_t fNew;
     uint32_t fOld;
 
@@ -197,6 +205,7 @@ RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEventMultiSem)
     wake_up_all(&pThis->Head);
 
     rtR0SemEventMultiLnxRelease(pThis);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSemEventMultiSignal);
@@ -260,6 +269,7 @@ static int rtR0SemEventMultiLnxWait(PRTSEMEVENTMULTIINTERNAL pThis, uint32_t fFl
          * We have to wait.
          */
         RTR0SEMLNXWAIT Wait;
+        IPRT_LINUX_SAVE_EFL_AC();
         rc = rtR0SemLnxWaitInit(&Wait, fFlags, uTimeout, &pThis->Head);
         if (RT_SUCCESS(rc))
         {
@@ -295,6 +305,7 @@ static int rtR0SemEventMultiLnxWait(PRTSEMEVENTMULTIINTERNAL pThis, uint32_t fFl
             rtR0SemLnxWaitDelete(&Wait);
             IPRT_DEBUG_SEMS_STATE_RC(pThis, 'E', rc);
         }
+        IPRT_LINUX_RESTORE_EFL_AC();
     }
 
     rtR0SemEventMultiLnxRelease(pThis);
index 814540081401a438b5637f174ae9a67335f45fc0..b437151657674f6afde3d8fa4685201af41a6cf9 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 #include <iprt/semaphore.h>
@@ -42,9 +42,9 @@
 #include "internal/magics.h"
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Wrapper for the linux semaphore structure.
  */
@@ -63,6 +63,8 @@ typedef struct RTSEMFASTMUTEXINTERNAL
 
 RTDECL(int)  RTSemFastMutexCreate(PRTSEMFASTMUTEX phFastMtx)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
     /*
      * Allocate.
      */
@@ -81,6 +83,7 @@ RTDECL(int)  RTSemFastMutexCreate(PRTSEMFASTMUTEX phFastMtx)
 #endif
 
     *phFastMtx = pThis;
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSemFastMutexCreate);
@@ -106,6 +109,8 @@ RT_EXPORT_SYMBOL(RTSemFastMutexDestroy);
 
 RTDECL(int)  RTSemFastMutexRequest(RTSEMFASTMUTEX hFastMtx)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
     /*
      * Validate.
      */
@@ -120,6 +125,8 @@ RTDECL(int)  RTSemFastMutexRequest(RTSEMFASTMUTEX hFastMtx)
     AssertRelease(pThis->Owner == NIL_RTNATIVETHREAD);
     ASMAtomicUoWriteSize(&pThis->Owner, RTThreadNativeSelf());
 #endif
+
+    IPRT_LINUX_RESTORE_EFL_ONLY_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSemFastMutexRequest);
@@ -127,6 +134,8 @@ RT_EXPORT_SYMBOL(RTSemFastMutexRequest);
 
 RTDECL(int)  RTSemFastMutexRelease(RTSEMFASTMUTEX hFastMtx)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
+
     /*
      * Validate.
      */
@@ -140,6 +149,8 @@ RTDECL(int)  RTSemFastMutexRelease(RTSEMFASTMUTEX hFastMtx)
 #endif
     up(&pThis->Semaphore);
     IPRT_DEBUG_SEMS_STATE(pThis, 'u');
+
+    IPRT_LINUX_RESTORE_EFL_ONLY_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSemFastMutexRelease);
index 543f09c7df92d3da8a1ffed853d70ee2a170a28a..135f45ced98de1898e50b46a7bb2be3387f7d17d 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define RTSEMMUTEX_WITHOUT_REMAPPING
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
@@ -42,9 +42,9 @@
 #include "internal/magics.h"
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 typedef struct RTSEMMUTEXLNXWAITER
 {
     /** The list entry. */
@@ -86,26 +86,33 @@ typedef struct RTSEMMUTEXINTERNAL
 
 RTDECL(int) RTSemMutexCreate(PRTSEMMUTEX phMtx)
 {
+    int rc = VINF_SUCCESS;
+    IPRT_LINUX_SAVE_EFL_AC();
+
     /*
      * Allocate.
      */
     PRTSEMMUTEXINTERNAL pThis;
     pThis = (PRTSEMMUTEXINTERNAL)RTMemAlloc(sizeof(*pThis));
-    if (!pThis)
-        return VERR_NO_MEMORY;
+    if (pThis)
+    {
+        /*
+         * Initialize.
+         */
+        pThis->u32Magic     = RTSEMMUTEX_MAGIC;
+        pThis->cRecursions  = 0;
+        pThis->pOwnerTask   = NULL;
+        pThis->cRefs        = 1;
+        RTListInit(&pThis->WaiterList);
+        spin_lock_init(&pThis->Spinlock);
+
+        *phMtx = pThis;
+    }
+    else
+        rc = VERR_NO_MEMORY;
 
-    /*
-     * Initialize.
-     */
-    pThis->u32Magic     = RTSEMMUTEX_MAGIC;
-    pThis->cRecursions  = 0;
-    pThis->pOwnerTask   = NULL;
-    pThis->cRefs        = 1;
-    RTListInit(&pThis->WaiterList);
-    spin_lock_init(&pThis->Spinlock);
-
-    *phMtx = pThis;
-    return VINF_SUCCESS;
+    IPRT_LINUX_RESTORE_EFL_AC();
+    return rc;
 }
 RT_EXPORT_SYMBOL(RTSemMutexCreate);
 
@@ -129,6 +136,8 @@ RTDECL(int) RTSemMutexDestroy(RTSEMMUTEX hMtx)
      */
     AssertReturn(ASMAtomicCmpXchgU32(&pThis->u32Magic, RTSEMMUTEX_MAGIC_DEAD, RTSEMMUTEX_MAGIC), VERR_INVALID_HANDLE);
 
+    IPRT_LINUX_SAVE_EFL_AC();
+
     spin_lock_irqsave(&pThis->Spinlock, fSavedIrq);
     RTListForEach(&pThis->WaiterList, pCur, RTSEMMUTEXLNXWAITER, ListEntry)
     {
@@ -144,6 +153,8 @@ RTDECL(int) RTSemMutexDestroy(RTSEMMUTEX hMtx)
         RTMemFree(pThis);
     }
 
+    IPRT_LINUX_RESTORE_EFL_AC();
+
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSemMutexDestroy);
@@ -250,6 +261,7 @@ DECLINLINE(int) rtSemMutexLinuxRequest(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMilli
     struct task_struct *pSelf = current;
     unsigned long       fSavedIrq;
     int                 rc;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * Validate.
@@ -289,10 +301,15 @@ DECLINLINE(int) rtSemMutexLinuxRequest(RTSEMMUTEX hMutexSem, RTMSINTERVAL cMilli
      * No, so go to sleep.
      */
     else
-        return rtSemMutexLinuxRequestSleep(pThis, cMillies, fInterruptible, fSavedIrq);
+    {
+        rc = rtSemMutexLinuxRequestSleep(pThis, cMillies, fInterruptible, fSavedIrq);
+        IPRT_LINUX_RESTORE_EFL_ONLY_AC();
+        return rc;
+    }
 
     IPRT_DEBUG_SEMS_STATE_RC(pThis, 'M', rc);
     spin_unlock_irqrestore(&pThis->Spinlock, fSavedIrq);
+    IPRT_LINUX_RESTORE_EFL_ONLY_AC();
     return rc;
 }
 
@@ -331,6 +348,7 @@ RTDECL(int) RTSemMutexRelease(RTSEMMUTEX hMtx)
     struct task_struct *pSelf = current;
     unsigned long       fSavedIrq;
     int                 rc;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * Validate.
@@ -366,6 +384,7 @@ RTDECL(int) RTSemMutexRelease(RTSEMMUTEX hMtx)
     spin_unlock_irqrestore(&pThis->Spinlock, fSavedIrq);
 
     AssertRC(rc);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return rc;
 }
 RT_EXPORT_SYMBOL(RTSemMutexRelease);
@@ -376,6 +395,7 @@ RTDECL(bool) RTSemMutexIsOwned(RTSEMMUTEX hMutexSem)
     PRTSEMMUTEXINTERNAL pThis = hMutexSem;
     unsigned long       fSavedIrq;
     bool                fOwned;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * Validate.
@@ -391,6 +411,7 @@ RTDECL(bool) RTSemMutexIsOwned(RTSEMMUTEX hMutexSem)
     fOwned = pThis->pOwnerTask != NULL;
     spin_unlock_irqrestore(&pThis->Spinlock, fSavedIrq);
 
+    IPRT_LINUX_RESTORE_EFL_AC();
     return fOwned;
 
 }
index dc366567b0b432756157f02165a52f59132b1872..b6ae5d4b14eed321836e5e2f89f1902522370a8e 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 #include <iprt/spinlock.h>
@@ -44,9 +44,9 @@
 #include "internal/magics.h"
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Wrapper for the spinlock_t structure.
  */
@@ -73,6 +73,7 @@ typedef struct RTSPINLOCKINTERNAL
 
 RTDECL(int)  RTSpinlockCreate(PRTSPINLOCK pSpinlock, uint32_t fFlags, const char *pszName)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     PRTSPINLOCKINTERNAL pThis;
     AssertReturn(fFlags == RTSPINLOCK_FLAGS_INTERRUPT_SAFE || fFlags == RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, VERR_INVALID_PARAMETER);
 
@@ -97,6 +98,7 @@ RTDECL(int)  RTSpinlockCreate(PRTSPINLOCK pSpinlock, uint32_t fFlags, const char
     spin_lock_init(&pThis->Spinlock);
 
     *pSpinlock = pThis;
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTSpinlockCreate);
@@ -126,6 +128,7 @@ RT_EXPORT_SYMBOL(RTSpinlockDestroy);
 RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock)
 {
     PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)Spinlock;
+    IPRT_LINUX_SAVE_EFL_AC();
     RT_ASSERT_PREEMPT_CPUID_VAR();
     AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_MAGIC,
               ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
@@ -145,6 +148,7 @@ RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock)
     lockdep_on();
 #endif
 
+    IPRT_LINUX_RESTORE_EFL_ONLY_AC();
     RT_ASSERT_PREEMPT_CPUID_SPIN_ACQUIRED(pThis);
 }
 RT_EXPORT_SYMBOL(RTSpinlockAcquire);
@@ -153,6 +157,7 @@ RT_EXPORT_SYMBOL(RTSpinlockAcquire);
 RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
 {
     PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)Spinlock;
+    IPRT_LINUX_SAVE_EFL_AC();           /* spin_unlock* may preempt and trash eflags.ac. */
     RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE_VARS();
     AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_MAGIC,
               ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
@@ -173,6 +178,7 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
     lockdep_on();
 #endif
 
+    IPRT_LINUX_RESTORE_EFL_ONLY_AC();
     RT_ASSERT_PREEMPT_CPUID();
 }
 RT_EXPORT_SYMBOL(RTSpinlockRelease);
index 7b99e3aefa8ae91839465b31f9a0c342951601c6..65ce3cb3c020c0196fe7eda261483084976b75fb 100644 (file)
@@ -382,12 +382,12 @@ DECLINLINE(unsigned long) msecs_to_jiffies(unsigned int cMillies)
  * The AMD 64 switch_to in macro in arch/x86/include/asm/switch_to.h stopped
  * restoring flags.
  * @{ */
-#ifdef CONFIG_X86_SMAP
+#if defined(CONFIG_X86_SMAP) || defined(RT_STRICT) || defined(IPRT_WITH_EFLAGS_AC_PRESERVING)
 # include <iprt/asm-amd64-x86.h>
 # define IPRT_X86_EFL_AC                    RT_BIT(18)
-# define IPRT_LINUX_SAVE_EFL_AC()           RTCCUINTREG fSavedEfl = ASMGetFlags();
+# define IPRT_LINUX_SAVE_EFL_AC()           RTCCUINTREG fSavedEfl = ASMGetFlags()
 # define IPRT_LINUX_RESTORE_EFL_AC()        ASMSetFlags(fSavedEfl)
-# define IPRT_LINUX_RESTORE_EFL_ONLY_AC()   ASMSetFlags((ASMGetFlags() & ~IPRT_X86_EFL_AC) | (fSavedEfl & IPRT_X86_EFL_AC))
+# define IPRT_LINUX_RESTORE_EFL_ONLY_AC()   ASMChangeFlags(~IPRT_X86_EFL_AC, fSavedEfl & IPRT_X86_EFL_AC)
 #else
 # define IPRT_LINUX_SAVE_EFL_AC()           do { } while (0)
 # define IPRT_LINUX_RESTORE_EFL_AC()        do { } while (0)
index 679164c4f205b2a97ad336b28b53b1fb0d318fcc..b55541dc29d074ca47dbd03ed9cc11ed509279a0 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 #include <iprt/thread.h>
@@ -41,9 +41,9 @@
 #include <iprt/mp.h>
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 #ifndef CONFIG_PREEMPT
 /** Per-cpu preemption counters. */
 static int32_t volatile g_acPreemptDisabled[NR_CPUS];
@@ -59,9 +59,11 @@ RT_EXPORT_SYMBOL(RTThreadNativeSelf);
 
 static int rtR0ThreadLnxSleepCommon(RTMSINTERVAL cMillies)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
     long cJiffies = msecs_to_jiffies(cMillies);
     set_current_state(TASK_INTERRUPTIBLE);
     cJiffies = schedule_timeout(cJiffies);
+    IPRT_LINUX_RESTORE_EFL_AC();
     if (!cJiffies)
         return VINF_SUCCESS;
     return VERR_INTERRUPTED;
@@ -84,6 +86,7 @@ RT_EXPORT_SYMBOL(RTThreadSleepNoLog);
 
 RTDECL(bool) RTThreadYield(void)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 20)
     yield();
 #else
@@ -92,6 +95,7 @@ RTDECL(bool) RTThreadYield(void)
     sys_sched_yield();
     schedule();
 #endif
+    IPRT_LINUX_RESTORE_EFL_AC();
     return true;
 }
 RT_EXPORT_SYMBOL(RTThreadYield);
index 2a7f2f634a26e5b6ef358c2332c585351176af8b..ed5dfa635c35c0cbae0469300d53cf0e394161f8 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 
@@ -137,16 +137,20 @@ DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pN
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 4)
     struct task_struct *NativeThread;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     RT_ASSERT_PREEMPTIBLE();
 
     NativeThread = kthread_run(rtThreadNativeMain, pThreadInt, "iprt-%s", pThreadInt->szName);
 
-    if (IS_ERR(NativeThread))
-        return VERR_GENERAL_FAILURE;
-
-    *pNativeThread = (RTNATIVETHREAD)NativeThread;
-    return VINF_SUCCESS;
+    if (!IS_ERR(NativeThread))
+    {
+        *pNativeThread = (RTNATIVETHREAD)NativeThread;
+        IPRT_LINUX_RESTORE_EFL_AC();
+        return VINF_SUCCESS;
+    }
+    IPRT_LINUX_RESTORE_EFL_AC();
+    return VERR_GENERAL_FAILURE;
 #else
     return VERR_NOT_IMPLEMENTED;
 #endif
index ab212ac4aadb7cc0e5036741c76b0132ffda6bce..18b5a3d83272584441c76e50f819b2962e0e788c 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_TIME
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
@@ -169,14 +169,17 @@ RT_EXPORT_SYMBOL(RTTimeSystemMilliTS);
 
 RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
 {
+    IPRT_LINUX_SAVE_EFL_AC();
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
     struct timespec Ts;
     ktime_get_real_ts(&Ts);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return RTTimeSpecSetTimespec(pTime, &Ts);
 
 #else   /* < 2.6.16 */
     struct timeval Tv;
     do_gettimeofday(&Tv);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return RTTimeSpecSetTimeval(pTime, &Tv);
 #endif
 }
index 74d2390967455f215050da374ccb1caf11f2a522..a26d1468ea90bc6f2d4450dad68cef3c8ccfc42e 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 
@@ -56,9 +56,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Timer state machine.
  *
@@ -198,9 +198,9 @@ typedef struct RTTIMERLINUXSTARTONCPUARGS
 typedef RTTIMERLINUXSTARTONCPUARGS *PRTTIMERLINUXSTARTONCPUARGS;
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 #ifdef CONFIG_SMP
 static DECLCALLBACK(void) rtTimerLinuxMpEvent(RTMPEVENT enmEvent, RTCPUID idCpu, void *pvUser);
 #endif
@@ -1185,6 +1185,7 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
 {
     RTTIMERLINUXSTARTONCPUARGS Args;
     int rc2;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * Validate.
@@ -1202,7 +1203,11 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
      * Omni timer?
      */
     if (pTimer->fAllCpus)
-        return rtTimerLnxOmniStart(pTimer, &Args);
+    {
+        rc2 = rtTimerLnxOmniStart(pTimer, &Args);
+        IPRT_LINUX_RESTORE_EFL_AC();
+        return rc2;
+    }
 #endif
 
     /*
@@ -1233,6 +1238,7 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
                             return rc2;
                         }
                     }
+                    IPRT_LINUX_RESTORE_EFL_AC();
                     return VINF_SUCCESS;
                 }
                 break;
@@ -1242,12 +1248,14 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
                 if (rtTimerLnxCmpXchgState(&pTimer->aSubTimers[0].enmState, RTTIMERLNXSTATE_CB_RESTARTING, enmState))
                 {
                     ASMAtomicWriteBool(&pTimer->fSuspended, false);
+                    IPRT_LINUX_RESTORE_EFL_AC();
                     return VINF_SUCCESS;
                 }
                 break;
 
             default:
                 AssertMsgFailed(("%d\n", enmState));
+                IPRT_LINUX_RESTORE_EFL_AC();
                 return VERR_INTERNAL_ERROR_4;
         }
         ASMNopPause();
@@ -1328,6 +1336,7 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer)
     /*
      * Validate.
      */
+    IPRT_LINUX_SAVE_EFL_AC();
     AssertPtrReturn(pTimer, VERR_INVALID_HANDLE);
     AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);
     RTTIMERLNX_LOG(("stop %p\n", pTimer));
@@ -1336,6 +1345,8 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer)
         return VERR_TIMER_SUSPENDED;
 
     rtTimerLnxStop(pTimer, false /*fForDestroy*/);
+
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTTimerStop);
@@ -1345,6 +1356,7 @@ RTDECL(int) RTTimerChangeInterval(PRTTIMER pTimer, uint64_t u64NanoInterval)
 {
     unsigned long cJiffies;
     unsigned long flFlags;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * Validate.
@@ -1364,6 +1376,7 @@ RTDECL(int) RTTimerChangeInterval(PRTTIMER pTimer, uint64_t u64NanoInterval)
     if (pTimer->fHighRes)
     {
         ASMAtomicWriteU64(&pTimer->u64NanoInterval, u64NanoInterval);
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VINF_SUCCESS;
     }
 #endif
@@ -1384,6 +1397,7 @@ RTDECL(int) RTTimerChangeInterval(PRTTIMER pTimer, uint64_t u64NanoInterval)
     pTimer->cJiffies = cJiffies;
     ASMAtomicWriteU64(&pTimer->u64NanoInterval, u64NanoInterval);
     spin_unlock_irqrestore(&pTimer->ChgIntLock, flFlags);
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTTimerChangeInterval);
@@ -1392,6 +1406,7 @@ RT_EXPORT_SYMBOL(RTTimerChangeInterval);
 RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
 {
     bool fCanDestroy;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     /*
      * Validate. It's ok to pass NULL pointer.
@@ -1459,6 +1474,7 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
             rtTimerLnxDestroyIt(pTimer);
     }
 
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTTimerDestroy);
@@ -1470,6 +1486,7 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
     RTCPUID     iCpu;
     unsigned    cCpus;
     int         rc;
+    IPRT_LINUX_SAVE_EFL_AC();
 
     rtR0LnxWorkqueueFlush();                /* for 2.4 */
     *ppTimer = NULL;
@@ -1478,11 +1495,17 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
      * Validate flags.
      */
     if (!RTTIMER_FLAGS_ARE_VALID(fFlags))
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VERR_INVALID_PARAMETER;
+    }
     if (    (fFlags & RTTIMER_FLAGS_CPU_SPECIFIC)
         &&  (fFlags & RTTIMER_FLAGS_CPU_ALL) != RTTIMER_FLAGS_CPU_ALL
         &&  !RTMpIsCpuPossible(RTMpCpuIdFromSetIndex(fFlags & RTTIMER_FLAGS_CPU_MASK)))
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return VERR_CPU_NOT_FOUND;
+    }
 
     /*
      * Allocate the timer handler.
@@ -1493,14 +1516,17 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
     {
         cCpus = RTMpGetMaxCpuId() + 1;
         Assert(cCpus <= RTCPUSET_MAX_CPUS); /* On linux we have a 1:1 relationship between cpuid and set index. */
-        AssertReturn(u64NanoInterval, VERR_NOT_IMPLEMENTED); /* We don't implement single shot on all cpus, sorry. */
+        AssertReturnStmt(u64NanoInterval, IPRT_LINUX_RESTORE_EFL_AC(), VERR_NOT_IMPLEMENTED); /* We don't implement single shot on all cpus, sorry. */
     }
 #endif
 
     rc = RTMemAllocEx(RT_OFFSETOF(RTTIMER, aSubTimers[cCpus]), 0,
                       RTMEMALLOCEX_FLAGS_ZEROED | RTMEMALLOCEX_FLAGS_ANY_CTX_FREE, (void **)&pTimer);
     if (RT_FAILURE(rc))
+    {
+        IPRT_LINUX_RESTORE_EFL_AC();
         return rc;
+    }
 
     /*
      * Initialize it.
@@ -1567,6 +1593,7 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
         if (RT_FAILURE(rc))
         {
             RTTimerDestroy(pTimer);
+            IPRT_LINUX_RESTORE_EFL_AC();
             return rc;
         }
     }
@@ -1574,6 +1601,7 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
 
     RTTIMERLNX_LOG(("create %p hires=%d fFlags=%#x cCpus=%u\n", pTimer, pTimer->fHighRes, fFlags, cCpus));
     *ppTimer = pTimer;
+    IPRT_LINUX_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTTimerCreateEx);
@@ -1584,7 +1612,10 @@ RTDECL(uint32_t) RTTimerGetSystemGranularity(void)
 #if 0 /** @todo Not sure if this is what we want or not... Add new API for
        *        querying the resolution of the high res timers? */
     struct timespec Ts;
-    int rc = hrtimer_get_res(CLOCK_MONOTONIC, &Ts);
+    int rc;
+    IPRT_LINUX_SAVE_EFL_AC();
+    rc = hrtimer_get_res(CLOCK_MONOTONIC, &Ts);
+    IPRT_LINUX_RESTORE_EFL_AC();
     if (!rc)
     {
         Assert(!Ts.tv_sec);
index 49669dc9ecd1a579142440d47716e1143c79cbc0..687ac2c0e8be497688de2ba71858bb8b1db65576 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_DEFAULT ///@todo RTLOGGROUP_MEM
 #include <iprt/memobj.h>
 #include "internal/iprt.h"
index 9cf523a6f30e8816c30522d52a5d804f252e0f6f..023397d30f5780be4ecc9429dd3ec19192ee45f1 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/mp.h>
 #include "internal/iprt.h"
 
@@ -44,9 +44,9 @@
 #include "r0drv/mp-r0drv.h"
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Notification registration record tracking
  * RTMpRegisterNotification() calls.
@@ -66,9 +66,9 @@ typedef struct RTMPNOTIFYREG
 typedef RTMPNOTIFYREG *PRTMPNOTIFYREG;
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The spinlock protecting the list. */
 static RTSPINLOCK volatile g_hRTMpNotifySpinLock = NIL_RTSPINLOCK;
 /** List of callbacks, in registration order. */
index 02333ef9bb4538c519bb34ebe9e60e71306e8775..1afec3da10dd197006021282b3173852bcc7f92d 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/power.h>
 #include "internal/iprt.h"
 
@@ -45,9 +45,9 @@
 #include "r0drv/power-r0drv.h"
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Notification registration record tracking
  * RTPowerRegisterNotification() calls.
@@ -67,9 +67,9 @@ typedef struct RTPOWERNOTIFYREG
 typedef RTPOWERNOTIFYREG *PRTPOWERNOTIFYREG;
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The spinlock protecting the list. */
 static RTSPINLOCK volatile g_hRTPowerNotifySpinLock = NIL_RTSPINLOCK;
 /** List of callbacks, in registration order. */
index cc9b3bbaaa0fab62ce6274322f9dd4a5a6a25efe..72359ed552a63e3c647b2ff0d007115c2ab8ac83 100644 (file)
 #include <iprt/assert.h>
 #include <iprt/string.h>
 
-DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
+
+DECLVBGL(int) VbglGRVerify(const VMMDevRequestHeader *pReq, size_t cbReq)
 {
     size_t cbReqExpected;
 
-    if (!pReq || cbReq < sizeof (VMMDevRequestHeader))
+    if (RT_UNLIKELY(!pReq || cbReq < sizeof(VMMDevRequestHeader)))
     {
         dprintf(("VbglGRVerify: Invalid parameter: pReq = %p, cbReq = %zu\n", pReq, cbReq));
         return VERR_INVALID_PARAMETER;
     }
 
-    if (pReq->size > cbReq)
+    if (RT_UNLIKELY(pReq->size > cbReq))
     {
         dprintf(("VbglGRVerify: request size %u > buffer size %zu\n", pReq->size, cbReq));
         return VERR_INVALID_PARAMETER;
@@ -48,8 +49,7 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
 
     /* The request size must correspond to the request type. */
     cbReqExpected = vmmdevGetRequestSize(pReq->requestType);
-
-    if (cbReq < cbReqExpected)
+    if (RT_UNLIKELY(cbReq < cbReqExpected))
     {
         dprintf(("VbglGRVerify: buffer size %zu < expected size %zu\n", cbReq, cbReqExpected));
         return VERR_INVALID_PARAMETER;
@@ -57,10 +57,11 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
 
     if (cbReqExpected == cbReq)
     {
-        /* This is most likely a fixed size request, and in this case the request size
-         * must be also equal to the expected size.
+        /*
+         * This is most likely a fixed size request, and in this case the
+         * request size must be also equal to the expected size.
          */
-        if (pReq->size != cbReqExpected)
+        if (RT_UNLIKELY(pReq->size != cbReqExpected))
         {
             dprintf(("VbglGRVerify: request size %u != expected size %zu\n", pReq->size, cbReqExpected));
             return VERR_INVALID_PARAMETER;
@@ -81,99 +82,89 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
         || pReq->requestType == VMMDevReq_HGCMCall64
 #else
         || pReq->requestType == VMMDevReq_HGCMCall
-#endif /* VBOX_WITH_64_BITS_GUESTS */
+#endif
         || pReq->requestType == VMMDevReq_RegisterSharedModule
         || pReq->requestType == VMMDevReq_ReportGuestUserState
         || pReq->requestType == VMMDevReq_LogString
         || pReq->requestType == VMMDevReq_SetPointerShape
         || pReq->requestType == VMMDevReq_VideoSetVisibleRegion)
     {
-        if (cbReq > VMMDEV_MAX_VMMDEVREQ_SIZE)
+        if (RT_UNLIKELY(cbReq > VMMDEV_MAX_VMMDEVREQ_SIZE))
         {
             dprintf(("VbglGRVerify: VMMDevReq_LogString: buffer size %zu too big\n", cbReq));
-            return VERR_BUFFER_OVERFLOW; /* @todo is this error code ok? */
+            return VERR_BUFFER_OVERFLOW; /** @todo is this error code ok? */
         }
     }
     else
     {
         dprintf(("VbglGRVerify: request size %u > buffer size %zu\n", pReq->size, cbReq));
-        return VERR_IO_BAD_LENGTH; /* @todo is this error code ok? */
+        return VERR_IO_BAD_LENGTH; /** @todo is this error code ok? */
     }
 
     return VINF_SUCCESS;
 }
 
-DECLVBGL(int) VbglGRAlloc (VMMDevRequestHeader **ppReq, uint32_t cbSize, VMMDevRequestType reqType)
+DECLVBGL(int) VbglGRAlloc(VMMDevRequestHeader **ppReq, size_t cbReq, VMMDevRequestType enmReqType)
 {
-    VMMDevRequestHeader *pReq;
-    int rc = vbglR0Enter ();
-
-    if (RT_FAILURE(rc))
-        return rc;
-
-    if (!ppReq || cbSize < sizeof (VMMDevRequestHeader))
-    {
-        dprintf(("VbglGRAlloc: Invalid parameter: ppReq = %p, cbSize = %u\n", ppReq, cbSize));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    pReq = (VMMDevRequestHeader *)VbglPhysHeapAlloc (cbSize);
-    if (!pReq)
+    int rc = vbglR0Enter();
+    if (RT_SUCCESS(rc))
     {
-        AssertMsgFailed(("VbglGRAlloc: no memory\n"));
-        rc = VERR_NO_MEMORY;
-    }
-    else
-    {
-        memset(pReq, 0xAA, cbSize);
-
-        pReq->size        = cbSize;
-        pReq->version     = VMMDEV_REQUEST_HEADER_VERSION;
-        pReq->requestType = reqType;
-        pReq->rc          = VERR_GENERAL_FAILURE;
-        pReq->reserved1   = 0;
-        pReq->reserved2   = 0;
-
-        *ppReq = pReq;
+        if (   ppReq
+            && cbReq >= sizeof(VMMDevRequestHeader)
+            && cbReq == (uint32_t)cbReq)
+        {
+            VMMDevRequestHeader *pReq = (VMMDevRequestHeader *)VbglPhysHeapAlloc((uint32_t)cbReq);
+            AssertMsgReturn(pReq, ("VbglGRAlloc: no memory (cbReq=%u)\n", cbReq), VERR_NO_MEMORY);
+            memset(pReq, 0xAA, cbReq);
+
+            pReq->size        = (uint32_t)cbReq;
+            pReq->version     = VMMDEV_REQUEST_HEADER_VERSION;
+            pReq->requestType = enmReqType;
+            pReq->rc          = VERR_GENERAL_FAILURE;
+            pReq->reserved1   = 0;
+            pReq->reserved2   = 0;
+
+            *ppReq = pReq;
+            rc = VINF_SUCCESS;
+        }
+        else
+        {
+            dprintf(("VbglGRAlloc: Invalid parameter: ppReq=%p cbReq=%u\n", ppReq, cbReq));
+            rc = VERR_INVALID_PARAMETER;
+        }
     }
-
     return rc;
 }
 
-DECLVBGL(int) VbglGRPerform (VMMDevRequestHeader *pReq)
+DECLVBGL(int) VbglGRPerform(VMMDevRequestHeader *pReq)
 {
-    RTCCPHYS physaddr;
-    int rc = vbglR0Enter ();
-
-    if (RT_FAILURE(rc))
-        return rc;
-
-    if (!pReq)
-        return VERR_INVALID_PARAMETER;
-
-    physaddr = VbglPhysHeapGetPhysAddr (pReq);
-    if (  !physaddr
-       || (physaddr >> 32) != 0) /* Port IO is 32 bit. */
+    int rc = vbglR0Enter();
+    if (RT_SUCCESS(rc))
     {
-        rc = VERR_VBGL_INVALID_ADDR;
-    }
-    else
-    {
-        ASMOutU32(g_vbgldata.portVMMDev + VMMDEV_PORT_OFF_REQUEST, (uint32_t)physaddr);
-        /* Make the compiler aware that the host has changed memory. */
-        ASMCompilerBarrier();
-        rc = pReq->rc;
+        if (pReq)
+        {
+            RTCCPHYS PhysAddr = VbglPhysHeapGetPhysAddr(pReq);
+            if (   PhysAddr != 0
+                && PhysAddr < _4G) /* Port IO is 32 bit. */
+            {
+                ASMOutU32(g_vbgldata.portVMMDev + VMMDEV_PORT_OFF_REQUEST, (uint32_t)PhysAddr);
+                /* Make the compiler aware that the host has changed memory. */
+                ASMCompilerBarrier();
+                rc = pReq->rc;
+            }
+            else
+                rc = VERR_VBGL_INVALID_ADDR;
+        }
+        else
+            rc = VERR_INVALID_PARAMETER;
     }
     return rc;
 }
 
-DECLVBGL(void) VbglGRFree (VMMDevRequestHeader *pReq)
+DECLVBGL(void) VbglGRFree(VMMDevRequestHeader *pReq)
 {
-    int rc = vbglR0Enter ();
-
-    if (RT_FAILURE(rc))
-        return;
-
-    VbglPhysHeapFree (pReq);
+    int rc = vbglR0Enter();
+    if (RT_SUCCESS(rc))
+        VbglPhysHeapFree(pReq);
 }
 
index 61893ac4031cc3e4ae0106bde9d7000bf4be081d..e6fd7839a438882fd22360eab42a481a117eecca 100644 (file)
 /* Entire file is ifdef'ed with VBGL_VBOXGUEST */
 #ifdef VBGL_VBOXGUEST
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP LOG_GROUP_HGCM
 
 #include "VBGLInternal.h"
 #include <iprt/thread.h>
 #include <iprt/time.h>
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /** The max parameter buffer size for a user request. */
 #define VBGLR0_MAX_HGCM_USER_PARM       (24*_1M)
 /** The max parameter buffer size for a kernel request. */
@@ -57,9 +59,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Lock info structure used by VbglR0HGCMInternalCall and its helpers.
  */
@@ -484,7 +486,7 @@ static void vbglR0HGCMInternalInitCall(VMMDevHGCMCall *pHGCMCall, VBoxGuestHGCMC
     HGCMFunctionParameter const *pSrcParm = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo);
     HGCMFunctionParameter       *pDstParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall);
     uint32_t    cParms   = pCallInfo->cParms;
-    uint32_t    offExtra = (uintptr_t)(pDstParm + cParms) - (uintptr_t)pHGCMCall;
+    uint32_t    offExtra = (uint32_t)((uintptr_t)(pDstParm + cParms) - (uintptr_t)pHGCMCall);
     uint32_t    iLockBuf = 0;
     uint32_t    iParm;
 
@@ -572,7 +574,7 @@ static void vbglR0HGCMInternalInitCall(VMMDevHGCMCall *pHGCMCall, VBoxGuestHGCMC
                         else
 #endif
                             pDstPgLst->offFirstPage = pSrcParm->u.Pointer.u.linearAddr & PAGE_OFFSET_MASK;
-                        pDstPgLst->cPages           = cPages; Assert(pDstPgLst->cPages == cPages);
+                        pDstPgLst->cPages           = (uint32_t)cPages; Assert(pDstPgLst->cPages == cPages);
                         for (iPage = 0; iPage < cPages; iPage++)
                         {
                             pDstPgLst->aPages[iPage] = RTR0MemObjGetPagePhysAddr(hObj, iPage);
index ec899dab2c07065883e83b90120f8af297e28370..f7ffb3f8e8406f9213097a67326de6df9988fab4 100644 (file)
  * terms and conditions of either the GPL or the CDDL or both.
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define VBGL_DECL_DATA
 #include "VBGLInternal.h"
 
 #include <iprt/assert.h>
 #include <iprt/semaphore.h>
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The global VBGL instance data.  */
 VBGLDATA g_vbgldata;
 
@@ -110,7 +112,7 @@ static void vbglQueryDriverInfo (void)
         {
             dprintf (("port = 0x%04X, mem = %p\n", port.portAddress, port.pVMMDevMemory));
 
-            g_vbgldata.portVMMDev = port.portAddress;
+            g_vbgldata.portVMMDev = (RTIOPORT)port.portAddress;
             g_vbgldata.pVMMDevMemory = port.pVMMDevMemory;
 
             g_vbgldata.status = VbglStatusReady;
@@ -184,14 +186,14 @@ DECLVBGL(void) vbglTerminateCommon (void)
 
 #ifdef VBGL_VBOXGUEST
 
-DECLVBGL(int) VbglInit (VBGLIOPORT portVMMDev, VMMDevMemory *pVMMDevMemory)
+DECLVBGL(int) VbglInitPrimary(RTIOPORT portVMMDev, VMMDevMemory *pVMMDevMemory)
 {
     int rc = VINF_SUCCESS;
 
 # ifdef RT_OS_WINDOWS /** @todo r=bird: this doesn't make sense. Is there something special going on on windows? */
     dprintf(("vbglInit: starts g_vbgldata.status %d\n", g_vbgldata.status));
 
-    if (g_vbgldata.status == VbglStatusInitializing
+    if (   g_vbgldata.status == VbglStatusInitializing
         || g_vbgldata.status == VbglStatusReady)
     {
         /* Initialization is already in process. */
@@ -230,11 +232,11 @@ DECLVBGL(void) VbglTerminate (void)
 
 #else /* !VBGL_VBOXGUEST */
 
-DECLVBGL(int) VbglInit (void)
+DECLVBGL(int) VbglInitClient(void)
 {
     int rc = VINF_SUCCESS;
 
-    if (g_vbgldata.status == VbglStatusInitializing
+    if (   g_vbgldata.status == VbglStatusInitializing
         || g_vbgldata.status == VbglStatusReady)
     {
         /* Initialization is already in process. */
index 62617919ad6bbbcf6684b6f5eef30de2e254f685..fc5e99e9354c07f630275c7978222ccedea55cf7 100644 (file)
@@ -512,7 +512,7 @@ DECLVBGL(uint32_t) VbglPhysHeapGetPhysAddr (void *p)
     return physAddr;
 }
 
-DECLVBGL(void) VbglPhysHeapFree (void *p)
+DECLVBGL(void) VbglPhysHeapFree(void *p)
 {
     VBGLPHYSHEAPBLOCK *pBlock;
     VBGLPHYSHEAPBLOCK *pNeighbour;
index 6e5e20a85870a1f8ebdcbc539cdd69695719a992..000477382ea85b6e95d287b2d76ba3be8fc7e72f 100644 (file)
@@ -50,7 +50,7 @@
  * @param   fWriteAccess    Lock for read-write (true) or readonly (false).
  * @param   fFlags          HGCM call flags, VBGLR0_HGCM_F_XXX.
  */
-int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess, uint32_t fFlags)
+int vbglLockLinear(void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess, uint32_t fFlags)
 {
     int         rc      = VINF_SUCCESS;
 #ifndef RT_OS_WINDOWS
@@ -73,7 +73,7 @@ int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess
     /** @todo just use IPRT here. the extra allocation shouldn't matter much...
      *        Then we can move all this up one level even. */
 #ifdef RT_OS_WINDOWS
-    PMDL pMdl = IoAllocateMdl (pv, u32Size, FALSE, FALSE, NULL);
+    PMDL pMdl = IoAllocateMdl(pv, u32Size, FALSE, FALSE, NULL);
 
     if (pMdl == NULL)
     {
@@ -84,16 +84,16 @@ int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess
     {
         __try {
             /* Calls to MmProbeAndLockPages must be enclosed in a try/except block. */
-            MmProbeAndLockPages (pMdl,
-                                 /** @todo (fFlags & VBGLR0_HGCMCALL_F_MODE_MASK) == VBGLR0_HGCMCALL_F_USER? UserMode: KernelMode */
-                                 KernelMode,
-                                 (fWriteAccess) ? IoModifyAccess : IoReadAccess);
+            MmProbeAndLockPages(pMdl,
+                                /** @todo (fFlags & VBGLR0_HGCMCALL_F_MODE_MASK) == VBGLR0_HGCMCALL_F_USER? UserMode: KernelMode */
+                                KernelMode,
+                                (fWriteAccess) ? IoModifyAccess : IoReadAccess);
 
             *ppvCtx = pMdl;
 
         } __except(EXCEPTION_EXECUTE_HANDLER) {
 
-            IoFreeMdl (pMdl);
+            IoFreeMdl(pMdl);
             /** @todo  */
             rc = VERR_INVALID_PARAMETER;
             AssertMsgFailed(("MmProbeAndLockPages %p %x failed!!\n", pv, u32Size));
@@ -123,7 +123,7 @@ int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess
     return rc;
 }
 
-void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size)
+void vbglUnlockLinear(void *pvCtx, void *pv, uint32_t u32Size)
 {
 #ifdef RT_OS_WINDOWS
     PMDL pMdl = (PMDL)pvCtx;
@@ -131,8 +131,8 @@ void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size)
     Assert(pMdl);
     if (pMdl != NULL)
     {
-        MmUnlockPages (pMdl);
-        IoFreeMdl (pMdl);
+        MmUnlockPages(pMdl);
+        IoFreeMdl(pMdl);
     }
 
 #else
@@ -163,13 +163,13 @@ RT_C_DECLS_END
 # if !defined(RT_OS_OS2) \
   && !defined(RT_OS_WINDOWS)
 RT_C_DECLS_BEGIN
-extern DECLVBGL(void *) VBoxGuestIDCOpen (uint32_t *pu32Version);
-extern DECLVBGL(void)   VBoxGuestIDCClose (void *pvOpaque);
-extern DECLVBGL(int)    VBoxGuestIDCCall (void *pvOpaque, unsigned int iCmd, void *pvData, size_t cbSize, size_t *pcbReturn);
+extern DECLVBGL(void *) VBoxGuestIDCOpen(uint32_t *pu32Version);
+extern DECLVBGL(void)   VBoxGuestIDCClose(void *pvOpaque);
+extern DECLVBGL(int)    VBoxGuestIDCCall(void *pvOpaque, unsigned int iCmd, void *pvData, size_t cbSize, size_t *pcbReturn);
 RT_C_DECLS_END
 # endif
 
-bool vbglDriverIsOpened (VBGLDRIVER *pDriver)
+bool vbglDriverIsOpened(VBGLDRIVER *pDriver)
 {
 # ifdef RT_OS_WINDOWS
     return pDriver->pFileObject != NULL;
@@ -180,19 +180,17 @@ bool vbglDriverIsOpened (VBGLDRIVER *pDriver)
 # endif
 }
 
-int vbglDriverOpen (VBGLDRIVER *pDriver)
+int vbglDriverOpen(VBGLDRIVER *pDriver)
 {
 # ifdef RT_OS_WINDOWS
     UNICODE_STRING uszDeviceName;
-    RtlInitUnicodeString (&uszDeviceName, L"\\Device\\VBoxGuest");
+    RtlInitUnicodeString(&uszDeviceName, L"\\Device\\VBoxGuest");
 
     PDEVICE_OBJECT pDeviceObject = NULL;
     PFILE_OBJECT pFileObject = NULL;
 
-    NTSTATUS rc = IoGetDeviceObjectPointer (&uszDeviceName, FILE_ALL_ACCESS,
-                                            &pFileObject, &pDeviceObject);
-
-    if (NT_SUCCESS (rc))
+    NTSTATUS rc = IoGetDeviceObjectPointer(&uszDeviceName, FILE_ALL_ACCESS, &pFileObject, &pDeviceObject);
+    if (NT_SUCCESS(rc))
     {
         Log(("vbglDriverOpen VBoxGuest successful pDeviceObject=%x\n", pDeviceObject));
         pDriver->pDeviceObject = pDeviceObject;
@@ -207,9 +205,9 @@ int vbglDriverOpen (VBGLDRIVER *pDriver)
     /*
      * Just check whether the connection was made or not.
      */
-    if (    g_VBoxGuestIDC.u32Version == VMMDEV_VERSION
-        &&  VALID_PTR(g_VBoxGuestIDC.u32Session)
-        &&  VALID_PTR(g_VBoxGuestIDC.pfnServiceEP))
+    if (   g_VBoxGuestIDC.u32Version == VMMDEV_VERSION
+        && RT_VALID_PTR(g_VBoxGuestIDC.u32Session)
+        && RT_VALID_PTR(g_VBoxGuestIDC.pfnServiceEP))
     {
         pDriver->u32Session = g_VBoxGuestIDC.u32Session;
         return VINF_SUCCESS;
@@ -220,9 +218,9 @@ int vbglDriverOpen (VBGLDRIVER *pDriver)
 
 # else
     uint32_t u32VMMDevVersion;
-    pDriver->pvOpaque = VBoxGuestIDCOpen (&u32VMMDevVersion);
-    if (    pDriver->pvOpaque
-        &&  u32VMMDevVersion == VMMDEV_VERSION)
+    pDriver->pvOpaque = VBoxGuestIDCOpen(&u32VMMDevVersion);
+    if (   pDriver->pvOpaque
+        && u32VMMDevVersion == VMMDEV_VERSION)
         return VINF_SUCCESS;
 
     Log(("vbglDriverOpen: failed\n"));
@@ -231,34 +229,32 @@ int vbglDriverOpen (VBGLDRIVER *pDriver)
 }
 
 # ifdef RT_OS_WINDOWS
-static NTSTATUS vbglDriverIOCtlCompletion (IN PDEVICE_OBJECT DeviceObject,
-                                           IN PIRP Irp,
-                                           IN PVOID Context)
+static NTSTATUS vbglDriverIOCtlCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
 {
     Log(("VBGL completion %x\n", Irp));
 
     KEVENT *pEvent = (KEVENT *)Context;
-    KeSetEvent (pEvent, IO_NO_INCREMENT, FALSE);
+    KeSetEvent(pEvent, IO_NO_INCREMENT, FALSE);
 
     return STATUS_MORE_PROCESSING_REQUIRED;
 }
 # endif
 
-int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData)
+int vbglDriverIOCtl(VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData)
 {
     Log(("vbglDriverIOCtl: pDriver: %p, Func: %x, pvData: %p, cbData: %d\n", pDriver, u32Function, pvData, cbData));
 
 # ifdef RT_OS_WINDOWS
     KEVENT Event;
 
-    KeInitializeEvent (&Event, NotificationEvent, FALSE);
+    KeInitializeEvent(&Event, NotificationEvent, FALSE);
 
     /* Have to use the IoAllocateIRP method because this code is generic and
      * must work in any thread context.
      * The IoBuildDeviceIoControlRequest, which was used here, does not work
      * when APCs are disabled, for example.
      */
-    PIRP irp = IoAllocateIrp (pDriver->pDeviceObject->StackSize, FALSE);
+    PIRP irp = IoAllocateIrp(pDriver->pDeviceObject->StackSize, FALSE);
 
     Log(("vbglDriverIOCtl: irp %p, IRQL = %d\n", irp, KeGetCurrentIrql()));
 
@@ -272,7 +268,7 @@ int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, ui
      * Setup the IRP_MJ_DEVICE_CONTROL IRP.
      */
 
-    PIO_STACK_LOCATION nextStack = IoGetNextIrpStackLocation (irp);
+    PIO_STACK_LOCATION nextStack = IoGetNextIrpStackLocation(irp);
 
     nextStack->MajorFunction = IRP_MJ_DEVICE_CONTROL;
     nextStack->MinorFunction = 0;
@@ -286,25 +282,21 @@ int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, ui
     irp->MdlAddress = NULL;
 
     /* A completion routine is required to signal the Event. */
-    IoSetCompletionRoutine (irp, vbglDriverIOCtlCompletion, &Event, TRUE, TRUE, TRUE);
+    IoSetCompletionRoutine(irp, vbglDriverIOCtlCompletion, &Event, TRUE, TRUE, TRUE);
 
-    NTSTATUS rc = IoCallDriver (pDriver->pDeviceObject, irp);
+    NTSTATUS rc = IoCallDriver(pDriver->pDeviceObject, irp);
 
     if (NT_SUCCESS (rc))
     {
         /* Wait the event to be signalled by the completion routine. */
-        KeWaitForSingleObject (&Event,
-                               Executive,
-                               KernelMode,
-                               FALSE,
-                               NULL);
+        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
 
         rc = irp->IoStatus.Status;
 
         Log(("vbglDriverIOCtl: wait completed IRQL = %d\n", KeGetCurrentIrql()));
     }
 
-    IoFreeIrp (irp);
+    IoFreeIrp(irp);
 
     if (rc != STATUS_SUCCESS)
         Log(("vbglDriverIOCtl: ntstatus=%x\n", rc));
@@ -330,11 +322,11 @@ int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, ui
 # endif
 }
 
-void vbglDriverClose (VBGLDRIVER *pDriver)
+void vbglDriverClose(VBGLDRIVER *pDriver)
 {
 # ifdef RT_OS_WINDOWS
     Log(("vbglDriverClose pDeviceObject=%x\n", pDriver->pDeviceObject));
-    ObDereferenceObject (pDriver->pFileObject);
+    ObDereferenceObject(pDriver->pFileObject);
     pDriver->pFileObject = NULL;
     pDriver->pDeviceObject = NULL;
 
@@ -342,7 +334,7 @@ void vbglDriverClose (VBGLDRIVER *pDriver)
     pDriver->u32Session = 0;
 
 # else
-    VBoxGuestIDCClose (pDriver->pvOpaque);
+    VBoxGuestIDCClose(pDriver->pvOpaque);
     pDriver->pvOpaque = NULL;
 # endif
 }
index fede8b0babdc8695049077ad6b852280f0811f1d..ee554ff55a0e3584b309379d86441975e096cf0b 100644 (file)
@@ -24,8 +24,8 @@
  * terms and conditions of either the GPL or the CDDL or both.
  */
 
-#ifndef __VBoxGuestLib_SysHlp_h
-#define __VBoxGuestLib_SysHlp_h
+#ifndef ___VBoxGuestLib_SysHlp_h
+#define ___VBoxGuestLib_SysHlp_h
 
 #include <iprt/types.h>
 
@@ -55,8 +55,8 @@ RT_C_DECLS_END
 /* XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist on NT4, so...
  * The same for ExAllocatePool.
  */
-#undef ExAllocatePool
-#undef ExFreePool
+# undef ExAllocatePool
+# undef ExFreePool
 #endif
 
 typedef struct _VBGLDRIVER
@@ -71,8 +71,8 @@ typedef struct _VBGLDRIVER
 #endif
 } VBGLDRIVER;
 
-int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess, uint32_t fFlags);
-void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size);
+int  vbglLockLinear(void **ppvCtx, void *pv, uint32_t cb, bool fWriteAccess, uint32_t fFlags);
+void vbglUnlockLinear(void *pvCtx, void *pv, uint32_t cb);
 
 
 #ifndef VBGL_VBOXGUEST
@@ -82,9 +82,9 @@ void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size);
  *
  * @param pDriver      Pointer to the driver structure.
  *
- * @return VBox error code
+ * @return VBox status code
  */
-int vbglDriverOpen (VBGLDRIVER *pDriver);
+int vbglDriverOpen(VBGLDRIVER *pDriver);
 
 /**
  * Answers whether the VBoxGuest driver is opened
@@ -93,7 +93,7 @@ int vbglDriverOpen (VBGLDRIVER *pDriver);
  *
  * @return true - if opened, false - otherwise
  */
-bool vbglDriverIsOpened (VBGLDRIVER *pDriver);
+bool vbglDriverIsOpened(VBGLDRIVER *pDriver);
 
 /**
  * Call VBoxGuest driver.
@@ -103,20 +103,20 @@ bool vbglDriverIsOpened (VBGLDRIVER *pDriver);
  * @param pvData       Pointer to supplied in/out data buffer.
  * @param cbData       Size of data buffer.
  *
- * @return VBox error code
+ * @returns VBox status code
  */
-int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
+int vbglDriverIOCtl(VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
 
 /**
  * Close VBoxGuest driver.
  *
  * @param pDriver      Pointer to the driver structure.
  *
- * @return VBox error code
+ * @returns VBox status code
  */
-void vbglDriverClose (VBGLDRIVER *pDriver);
+void vbglDriverClose(VBGLDRIVER *pDriver);
 
 #endif
 
-#endif /* !__VBoxGuestLib_SysHlp_h */
+#endif
 
index fe9b01a93eaf4b2e79c7f77e5a40a1a0371f91ac..e4233fbb8447ee1b4f85edc5d57e07a65e978a20 100644 (file)
@@ -72,11 +72,11 @@ enum VbglLibStatus
  * Global VBGL ring-0 data.
  * Lives in VbglR0Init.cpp.
  */
-typedef struct _VBGLDATA
+typedef struct VBGLDATA
 {
     enum VbglLibStatus status;
 
-    VBGLIOPORT portVMMDev;
+    RTIOPORT portVMMDev;
 
     VMMDevMemory *pVMMDevMemory;
 
@@ -154,9 +154,11 @@ int vbglR0Enter (void);
 
 #ifdef VBOX_WITH_HGCM
 # ifndef VBGL_VBOXGUEST
-int vbglR0HGCMInit (void);
-int vbglR0HGCMTerminate (void);
+int                         vbglR0HGCMInit(void);
+int                         vbglR0HGCMTerminate(void);
 # endif
+struct VBGLHGCMHANDLEDATA  *vbglHGCMHandleAlloc(void);
+void                        vbglHGCMHandleFree(struct VBGLHGCMHANDLEDATA *pHandle);
 #endif /* VBOX_WITH_HGCM */
 
 #ifndef VBGL_VBOXGUEST
index daf961fb6c47d28be5f1729719be158e12afc929..ae32f5845cebadf00924ad82619ee0c27b1ed41f 100644 (file)
@@ -72,7 +72,7 @@
  *
  *
  *
- * @section sec_logging_destination     The Group Specifier.
+ * @section sec_logging_group           The Group Specifier.
  *
  * The {logger-env-base} environment variable can be used to specify which
  * logger groups to enable and which to disable. By default all groups are
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #ifdef IN_RING3
 # if defined(RT_OS_WINDOWS)
 #  include <Windows.h>
 #endif
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The default logger. */
 static PRTLOGGER                    g_pLogger = NULL;
 /** The default logger groups.
index 46d617a3255740a3136d19d9ff503c689679ea85..143cc34b1d8957f4376081b2f1a5cb08156c8033 100644 (file)
  * terms and conditions of either the GPL or the CDDL or both.
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <VBox/log.h>
 #include "internal/iprt.h"
 #include <iprt/asm-amd64-x86.h>
@@ -36,9 +37,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 static DECLCALLBACK(size_t) rtLogBackdoorOutput(void *pv, const char *pachChars, size_t cbChars);
 
 
index 0383d06f136bc346cf0489e9536fe19301676661..abc038dec279a4e5def2d746444c121974d4bf3a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Rev: 100489 $ */
+/* $Rev: 103598 $ */
 /** @file
  * VBoxGuest - Linux specifics.
  *
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
   */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP LOG_GROUP_SUP_DRV
 
 #include "the-linux-kernel.h"
 #include <VBox/log.h>
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /** The device name. */
 #define DEVICE_NAME             "vboxguest"
-/** The device name for the device node open to everyone.. */
+/** The device name for the device node open to everyone. */
 #define DEVICE_NAME_USER        "vboxuser"
 /** The name of the PCI driver */
 #define DRIVER_NAME             DEVICE_NAME
 #endif
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
-static void vboxguestLinuxTermPci(struct pci_dev *pPciDev);
-static int  vboxguestLinuxModInit(void);
-static void vboxguestLinuxModExit(void);
-static int  vboxguestLinuxOpen(struct inode *pInode, struct file *pFilp);
-static int  vboxguestLinuxRelease(struct inode *pInode, struct file *pFilp);
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
+static void vgdrvLinuxTermPci(struct pci_dev *pPciDev);
+static int  vgdrvLinuxProbePci(struct pci_dev *pPciDev, const struct pci_device_id *id);
+static int  vgdrvLinuxModInit(void);
+static void vgdrvLinuxModExit(void);
+static int  vgdrvLinuxOpen(struct inode *pInode, struct file *pFilp);
+static int  vgdrvLinuxRelease(struct inode *pInode, struct file *pFilp);
 #ifdef HAVE_UNLOCKED_IOCTL
-static long vboxguestLinuxIOCtl(struct file *pFilp, unsigned int uCmd, unsigned long ulArg);
+static long vgdrvLinuxIOCtl(struct file *pFilp, unsigned int uCmd, unsigned long ulArg);
 #else
-static int  vboxguestLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigned int uCmd, unsigned long ulArg);
+static int  vgdrvLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigned int uCmd, unsigned long ulArg);
 #endif
-static int  vboxguestFAsync(int fd, struct file *pFile, int fOn);
-static unsigned int vboxguestPoll(struct file *pFile, poll_table *pPt);
-static ssize_t vboxguestRead(struct file *pFile, char *pbBuf, size_t cbRead, loff_t *poff);
+static int  vgdrvLinuxFAsync(int fd, struct file *pFile, int fOn);
+static unsigned int vgdrvLinuxPoll(struct file *pFile, poll_table *pPt);
+static ssize_t vgdrvLinuxRead(struct file *pFile, char *pbBuf, size_t cbRead, loff_t *poff);
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /**
  * Device extention & session data association structure.
  */
@@ -139,16 +141,16 @@ static struct input_dev        *g_pInputDevice = NULL;
 static struct file_operations   g_FileOps =
 {
     owner:          THIS_MODULE,
-    open:           vboxguestLinuxOpen,
-    release:        vboxguestLinuxRelease,
+    open:           vgdrvLinuxOpen,
+    release:        vgdrvLinuxRelease,
 #ifdef HAVE_UNLOCKED_IOCTL
-    unlocked_ioctl: vboxguestLinuxIOCtl,
+    unlocked_ioctl: vgdrvLinuxIOCtl,
 #else
-    ioctl:          vboxguestLinuxIOCtl,
+    ioctl:          vgdrvLinuxIOCtl,
 #endif
-    fasync:         vboxguestFAsync,
-    read:           vboxguestRead,
-    poll:           vboxguestPoll,
+    fasync:         vgdrvLinuxFAsync,
+    read:           vgdrvLinuxRead,
+    poll:           vgdrvLinuxPoll,
     llseek:         no_llseek,
 };
 
@@ -166,12 +168,12 @@ static struct miscdevice        g_MiscDevice =
 static struct file_operations   g_FileOpsUser =
 {
     owner:          THIS_MODULE,
-    open:           vboxguestLinuxOpen,
-    release:        vboxguestLinuxRelease,
+    open:           vgdrvLinuxOpen,
+    release:        vgdrvLinuxRelease,
 #ifdef HAVE_UNLOCKED_IOCTL
-    unlocked_ioctl: vboxguestLinuxIOCtl,
+    unlocked_ioctl: vgdrvLinuxIOCtl,
 #else
-    ioctl:          vboxguestLinuxIOCtl,
+    ioctl:          vgdrvLinuxIOCtl,
 #endif
 };
 
@@ -199,17 +201,29 @@ g_VBoxGuestPciId[] =
         /* empty entry */
     }
 };
+
 MODULE_DEVICE_TABLE(pci, g_VBoxGuestPciId);
 
+/** Structure for registering the PCI driver. */
+static struct pci_driver  g_PciDriver =
+{
+    name:           DRIVER_NAME,
+    id_table:       g_VBoxGuestPciId,
+    probe:          vgdrvLinuxProbePci,
+    remove:         vgdrvLinuxTermPci
+};
+
 static PVBOXGUESTSESSION        g_pKernelSession = NULL;
 
+
+
 /**
  * Converts a VBox status code to a linux error code.
  *
  * @returns corresponding negative linux error code.
  * @param   rc  supdrv error code (SUPDRV_ERR_* defines).
  */
-static int vboxguestLinuxConvertToNegErrno(int rc)
+static int vgdrvLinuxConvertToNegErrno(int rc)
 {
     if (   rc > -1000
         && rc < 1000)
@@ -232,16 +246,14 @@ static int vboxguestLinuxConvertToNegErrno(int rc)
 }
 
 
-
 /**
  * Does the PCI detection and init of the device.
  *
  * @returns 0 on success, negated errno on failure.
  */
-static int vboxguestLinuxProbePci(struct pci_dev *pPciDev,
-                                  const struct pci_device_id *id)
+static int vgdrvLinuxProbePci(struct pci_dev *pPciDev, const struct pci_device_id *id)
 {
-    int             rc;
+    int rc;
 
     NOREF(id);
     AssertReturn(!g_pPciDev, -EINVAL);
@@ -297,7 +309,7 @@ static int vboxguestLinuxProbePci(struct pci_dev *pPciDev,
 /**
  * Clean up the usage of the PCI device.
  */
-static void vboxguestLinuxTermPci(struct pci_dev *pPciDev)
+static void vgdrvLinuxTermPci(struct pci_dev *pPciDev)
 {
     g_pPciDev = NULL;
     if (pPciDev)
@@ -314,16 +326,6 @@ static void vboxguestLinuxTermPci(struct pci_dev *pPciDev)
 }
 
 
-/** Structure for registering the PCI driver. */
-static struct pci_driver  g_PciDriver =
-{
-    name:           DRIVER_NAME,
-    id_table:       g_VBoxGuestPciId,
-    probe:          vboxguestLinuxProbePci,
-    remove:         vboxguestLinuxTermPci
-};
-
-
 /**
  * Interrupt service routine.
  *
@@ -332,15 +334,15 @@ static struct pci_driver  g_PciDriver =
  *
  * @param   iIrq            The IRQ number.
  * @param   pvDevId         The device ID, a pointer to g_DevExt.
- * @param   pvRegs          Register set. Removed in 2.6.19.
+ * @param   pRegs           Register set. Removed in 2.6.19.
  */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
-static irqreturn_t vboxguestLinuxISR(int iIrrq, void *pvDevId)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) && !defined(DOXYGEN_RUNNING)
+static irqreturn_t vgdrvLinuxISR(int iIrq, void *pvDevId)
 #else
-static irqreturn_t vboxguestLinuxISR(int iIrrq, void *pvDevId, struct pt_regs *pRegs)
+static irqreturn_t vgdrvLinuxISR(int iIrq, void *pvDevId, struct pt_regs *pRegs)
 #endif
 {
-    bool fTaken = VbgdCommonISR(&g_DevExt);
+    bool fTaken = VGDrvCommonISR(&g_DevExt);
     return IRQ_RETVAL(fTaken);
 }
 
@@ -348,13 +350,13 @@ static irqreturn_t vboxguestLinuxISR(int iIrrq, void *pvDevId, struct pt_regs *p
 /**
  * Registers the ISR and initializes the poll wait queue.
  */
-static int __init vboxguestLinuxInitISR(void)
+static int __init vgdrvLinuxInitISR(void)
 {
     int rc;
 
     init_waitqueue_head(&g_PollEventQueue);
     rc = request_irq(g_pPciDev->irq,
-                     vboxguestLinuxISR,
+                     vgdrvLinuxISR,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
                      IRQF_SHARED,
 #else
@@ -374,110 +376,120 @@ static int __init vboxguestLinuxInitISR(void)
 /**
  * Deregisters the ISR.
  */
-static void vboxguestLinuxTermISR(void)
+static void vgdrvLinuxTermISR(void)
 {
     free_irq(g_pPciDev->irq, &g_DevExt);
 }
 
 
 #ifdef VBOXGUEST_WITH_INPUT_DRIVER
-/** Calls the kernel IOCtl to report mouse status to the host on behalf of
- * our kernel session. */
-static int vboxguestLinuxSetMouseStatus(uint32_t fStatus)
+
+/**
+ * Reports the mouse integration status to the host.
+ *
+ * Calls the kernel IOCtl to report mouse status to the host on behalf of
+ * our kernel session.
+ *
+ * @param   fStatus     The mouse status to report.
+ */
+static int vgdrvLinuxSetMouseStatus(uint32_t fStatus)
 {
-    return VbgdCommonIoCtl(VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &g_DevExt,
-                           g_pKernelSession, &fStatus, sizeof(fStatus),
-                           NULL);
+    return VGDrvCommonIoCtl(VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &g_DevExt, g_pKernelSession, &fStatus, sizeof(fStatus), NULL);
 }
 
 
-/** Called when the input device is first opened.  Sets up absolute reporting.
+/**
+ * Called when the input device is first opened.
+ *
+ * Sets up absolute mouse reporting.
  */
 static int vboxguestOpenInputDevice(struct input_dev *pDev)
 {
-    NOREF(pDev);
-    if (RT_FAILURE(vboxguestLinuxSetMouseStatus
-                                   (  VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE
-                                    | VMMDEV_MOUSE_NEW_PROTOCOL)))
+    int rc = vgdrvLinuxSetMouseStatus(VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE | VMMDEV_MOUSE_NEW_PROTOCOL);
+    if (RT_FAILURE(rc))
         return ENODEV;
+    NOREF(pDev);
     return 0;
 }
 
 
-/** Called if all open handles to the device are closed, disables absolute
- * reporting. */
+/**
+ * Called if all open handles to the input device are closed.
+ *
+ * Disables absolute reporting.
+ */
 static void vboxguestCloseInputDevice(struct input_dev *pDev)
 {
     NOREF(pDev);
-    vboxguestLinuxSetMouseStatus(0);
+    vgdrvLinuxSetMouseStatus(0);
 }
 
 
 /**
  * Creates the kernel input device.
  */
-static int __init vboxguestLinuxCreateInputDevice(void)
+static int __init vgdrvLinuxCreateInputDevice(void)
 {
-    int rc;
-
-    rc = VbglGRAlloc((VMMDevRequestHeader **)&g_pMouseStatusReq,
-                     sizeof(*g_pMouseStatusReq),
-                     VMMDevReq_GetMouseStatus);
-    if (RT_FAILURE(rc))
-        return -ENOMEM;
-    g_pInputDevice = input_allocate_device();
-    if (!g_pInputDevice)
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&g_pMouseStatusReq, sizeof(*g_pMouseStatusReq), VMMDevReq_GetMouseStatus);
+    if (RT_SUCCESS(rc))
     {
-        VbglGRFree(&g_pMouseStatusReq->header);
-        return -ENOMEM;
-    }
-    g_pInputDevice->id.bustype = BUS_PCI;
-    g_pInputDevice->id.vendor  = VMMDEV_VENDORID;
-    g_pInputDevice->id.product = VMMDEV_DEVICEID;
-    g_pInputDevice->id.version = VBOX_SHORT_VERSION;
-    g_pInputDevice->open       = vboxguestOpenInputDevice;
-    g_pInputDevice->close      = vboxguestCloseInputDevice;
+        g_pInputDevice = input_allocate_device();
+        if (g_pInputDevice)
+        {
+            g_pInputDevice->id.bustype = BUS_PCI;
+            g_pInputDevice->id.vendor  = VMMDEV_VENDORID;
+            g_pInputDevice->id.product = VMMDEV_DEVICEID;
+            g_pInputDevice->id.version = VBOX_SHORT_VERSION;
+            g_pInputDevice->open       = vboxguestOpenInputDevice;
+            g_pInputDevice->close      = vboxguestCloseInputDevice;
 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
-    g_pInputDevice->cdev.dev   = &g_pPciDev->dev;
+            g_pInputDevice->cdev.dev   = &g_pPciDev->dev;
 # else
-    g_pInputDevice->dev.parent = &g_pPciDev->dev;
+            g_pInputDevice->dev.parent = &g_pPciDev->dev;
 # endif
-    {
-        int rc = input_register_device(g_pInputDevice);
-        if (rc)
-        {
-            VbglGRFree(&g_pMouseStatusReq->header);
+            rc = input_register_device(g_pInputDevice);
+            if (rc == 0)
+            {
+                /* Do what one of our competitors apparently does as that works. */
+                ASMBitSet(g_pInputDevice->evbit, EV_ABS);
+                ASMBitSet(g_pInputDevice->evbit, EV_KEY);
+# ifdef EV_SYN
+                ASMBitSet(g_pInputDevice->evbit, EV_SYN);
+# endif
+                input_set_abs_params(g_pInputDevice, ABS_X, VMMDEV_MOUSE_RANGE_MIN, VMMDEV_MOUSE_RANGE_MAX, 0, 0);
+                input_set_abs_params(g_pInputDevice, ABS_Y, VMMDEV_MOUSE_RANGE_MIN, VMMDEV_MOUSE_RANGE_MAX, 0, 0);
+                ASMBitSet(g_pInputDevice->keybit, BTN_MOUSE);
+                /** @todo this string should be in a header file somewhere. */
+                g_pInputDevice->name = "VirtualBox mouse integration";
+                return 0;
+            }
+
             input_free_device(g_pInputDevice);
-            return rc;
         }
+        else
+            rc = -ENOMEM;
+        VbglGRFree(&g_pMouseStatusReq->header);
+        g_pMouseStatusReq = NULL;
     }
-    /* Do what one of our competitors apparently does as that works. */
-    ASMBitSet(g_pInputDevice->evbit, EV_ABS);
-    ASMBitSet(g_pInputDevice->evbit, EV_KEY);
-# ifdef EV_SYN
-    ASMBitSet(g_pInputDevice->evbit, EV_SYN);
-# endif
-    input_set_abs_params(g_pInputDevice, ABS_X, VMMDEV_MOUSE_RANGE_MIN,
-                         VMMDEV_MOUSE_RANGE_MAX, 0, 0);
-    input_set_abs_params(g_pInputDevice, ABS_Y, VMMDEV_MOUSE_RANGE_MIN,
-                         VMMDEV_MOUSE_RANGE_MAX, 0, 0);
-    ASMBitSet(g_pInputDevice->keybit, BTN_MOUSE);
-    /** @todo this string should be in a header file somewhere. */
-    g_pInputDevice->name = "VirtualBox mouse integration";
-    return 0;
+    else
+        rc = -ENOMEM;
+    return rc;
 }
 
 
 /**
  * Terminates the kernel input device.
  */
-static void vboxguestLinuxTermInputDevice(void)
+static void vgdrvLinuxTermInputDevice(void)
 {
     VbglGRFree(&g_pMouseStatusReq->header);
+    g_pMouseStatusReq = NULL;
+
     /* See documentation of input_register_device(): input_free_device()
      * should not be called after a device has been registered. */
     input_unregister_device(g_pInputDevice);
 }
+
 #endif /* VBOXGUEST_WITH_INPUT_DRIVER */
 
 
@@ -486,39 +498,33 @@ static void vboxguestLinuxTermInputDevice(void)
  *
  * @returns 0 on success, negated errno on failure.
  */
-static int __init vboxguestLinuxInitDeviceNodes(void)
+static int __init vgdrvLinuxInitDeviceNodes(void)
 {
-    int rc;
-
     /*
      * The full feature device node.
      */
-    rc = misc_register(&g_MiscDevice);
-    if (rc)
-    {
-        LogRel((DEVICE_NAME ": misc_register failed for %s (rc=%d)\n", DEVICE_NAME, rc));
-        return rc;
-    }
-
-    /*
-     * The device node intended to be accessible by all users.
-     */
-    rc = misc_register(&g_MiscDeviceUser);
-    if (rc)
+    int rc = misc_register(&g_MiscDevice);
+    if (!rc)
     {
+        /*
+         * The device node intended to be accessible by all users.
+         */
+        rc = misc_register(&g_MiscDeviceUser);
+        if (!rc)
+            return 0;
         LogRel((DEVICE_NAME ": misc_register failed for %s (rc=%d)\n", DEVICE_NAME_USER, rc));
         misc_deregister(&g_MiscDevice);
-        return rc;
     }
-
-    return 0;
+    else
+        LogRel((DEVICE_NAME ": misc_register failed for %s (rc=%d)\n", DEVICE_NAME, rc));
+    return rc;
 }
 
 
 /**
  * Deregisters the device nodes.
  */
-static void vboxguestLinuxTermDeviceNodes(void)
+static void vgdrvLinuxTermDeviceNodes(void)
 {
     misc_deregister(&g_MiscDevice);
     misc_deregister(&g_MiscDeviceUser);
@@ -530,7 +536,7 @@ static void vboxguestLinuxTermDeviceNodes(void)
  *
  * @returns appropriate status code.
  */
-static int __init vboxguestLinuxModInit(void)
+static int __init vgdrvLinuxModInit(void)
 {
     static const char * const   s_apszGroups[] = VBOX_LOGGROUP_NAMES;
     PRTLOGGER                   pRelLogger;
@@ -576,7 +582,7 @@ static int __init vboxguestLinuxModInit(void)
         /*
          * Register the interrupt service routine for it.
          */
-        rc = vboxguestLinuxInitISR();
+        rc = vgdrvLinuxInitISR();
         if (rc >= 0)
         {
             /*
@@ -594,33 +600,32 @@ static int __init vboxguestLinuxModInit(void)
 # warning "huh? which arch + version is this?"
             VBOXOSTYPE enmOsType = VBOXOSTYPE_Linux;
 #endif
-            rc = VbgdCommonInitDevExt(&g_DevExt,
-                                      g_IOPortBase,
-                                      g_pvMMIOBase,
-                                      g_cbMMIO,
-                                      enmOSType,
-                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
+            rc = VGDrvCommonInitDevExt(&g_DevExt,
+                                       g_IOPortBase,
+                                       g_pvMMIOBase,
+                                       g_cbMMIO,
+                                       enmOSType,
+                                       VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
             if (RT_SUCCESS(rc))
             {
                 /*
                  * Create the kernel session for this driver.
                  */
-                rc = VbgdCommonCreateKernelSession(&g_DevExt,
-                                                  &g_pKernelSession);
+                rc = VGDrvCommonCreateKernelSession(&g_DevExt, &g_pKernelSession);
                 if (RT_SUCCESS(rc))
                 {
                     /*
                      * Create the kernel input device.
                      */
 #ifdef VBOXGUEST_WITH_INPUT_DRIVER
-                    rc = vboxguestLinuxCreateInputDevice();
+                    rc = vgdrvLinuxCreateInputDevice();
                     if (rc >= 0)
                     {
 #endif
                         /*
                          * Finally, create the device nodes.
                          */
-                        rc = vboxguestLinuxInitDeviceNodes();
+                        rc = vgdrvLinuxInitDeviceNodes();
                         if (rc >= 0)
                         {
                             /* some useful information for the user but don't show this on the console */
@@ -633,7 +638,7 @@ static int __init vboxguestLinuxModInit(void)
 
                         /* bail out */
 #ifdef VBOXGUEST_WITH_INPUT_DRIVER
-                        vboxguestLinuxTermInputDevice();
+                        vgdrvLinuxTermInputDevice();
                     }
                     else
                     {
@@ -641,16 +646,16 @@ static int __init vboxguestLinuxModInit(void)
                         rc = RTErrConvertFromErrno(rc);
                     }
 #endif
-                    VbgdCommonCloseSession(&g_DevExt, g_pKernelSession);
+                    VGDrvCommonCloseSession(&g_DevExt, g_pKernelSession);
                 }
-                VbgdCommonDeleteDevExt(&g_DevExt);
+                VGDrvCommonDeleteDevExt(&g_DevExt);
             }
             else
             {
-                LogRel((DEVICE_NAME ": VbgdCommonInitDevExt failed with rc=%Rrc\n", rc));
+                LogRel((DEVICE_NAME ": VGDrvCommonInitDevExt failed with rc=%Rrc\n", rc));
                 rc = RTErrConvertFromErrno(rc);
             }
-            vboxguestLinuxTermISR();
+            vgdrvLinuxTermISR();
         }
     }
     else
@@ -669,18 +674,18 @@ static int __init vboxguestLinuxModInit(void)
 /**
  * Unload the module.
  */
-static void __exit vboxguestLinuxModExit(void)
+static void __exit vgdrvLinuxModExit(void)
 {
     /*
      * Inverse order of init.
      */
-    vboxguestLinuxTermDeviceNodes();
+    vgdrvLinuxTermDeviceNodes();
 #ifdef VBOXGUEST_WITH_INPUT_DRIVER
-    vboxguestLinuxTermInputDevice();
+    vgdrvLinuxTermInputDevice();
 #endif
-    VbgdCommonCloseSession(&g_DevExt, g_pKernelSession);
-    VbgdCommonDeleteDevExt(&g_DevExt);
-    vboxguestLinuxTermISR();
+    VGDrvCommonCloseSession(&g_DevExt, g_pKernelSession);
+    VGDrvCommonDeleteDevExt(&g_DevExt);
+    vgdrvLinuxTermISR();
     pci_unregister_driver(&g_PciDriver);
     RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
     RTLogDestroy(RTLogSetDefaultInstance(NULL));
@@ -694,7 +699,7 @@ static void __exit vboxguestLinuxModExit(void)
  * @param   pInode      Pointer to inode info structure.
  * @param   pFilp       Associated file pointer.
  */
-static int vboxguestLinuxOpen(struct inode *pInode, struct file *pFilp)
+static int vgdrvLinuxOpen(struct inode *pInode, struct file *pFilp)
 {
     int                 rc;
     PVBOXGUESTSESSION   pSession;
@@ -704,7 +709,7 @@ static int vboxguestLinuxOpen(struct inode *pInode, struct file *pFilp)
      * Call common code to create the user session. Associate it with
      * the file so we can access it in the other methods.
      */
-    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
+    rc = VGDrvCommonCreateUserSession(&g_DevExt, &pSession);
     if (RT_SUCCESS(rc))
     {
         pFilp->private_data = pSession;
@@ -712,10 +717,9 @@ static int vboxguestLinuxOpen(struct inode *pInode, struct file *pFilp)
             pSession->fUserSession = true;
     }
 
-    Log(("vboxguestLinuxOpen: g_DevExt=%p pSession=%p rc=%d/%d (pid=%d/%d %s)\n",
-         &g_DevExt, pSession, rc, vboxguestLinuxConvertToNegErrno(rc),
-         RTProcSelf(), current->pid, current->comm));
-    return vboxguestLinuxConvertToNegErrno(rc);
+    Log(("vgdrvLinuxOpen: g_DevExt=%p pSession=%p rc=%d/%d (pid=%d/%d %s)\n",
+         &g_DevExt, pSession, rc, vgdrvLinuxConvertToNegErrno(rc), RTProcSelf(), current->pid, current->comm));
+    return vgdrvLinuxConvertToNegErrno(rc);
 }
 
 
@@ -725,17 +729,17 @@ static int vboxguestLinuxOpen(struct inode *pInode, struct file *pFilp)
  * @param   pInode      Pointer to inode info structure.
  * @param   pFilp       Associated file pointer.
  */
-static int vboxguestLinuxRelease(struct inode *pInode, struct file *pFilp)
+static int vgdrvLinuxRelease(struct inode *pInode, struct file *pFilp)
 {
-    Log(("vboxguestLinuxRelease: pFilp=%p pSession=%p pid=%d/%d %s\n",
+    Log(("vgdrvLinuxRelease: pFilp=%p pSession=%p pid=%d/%d %s\n",
          pFilp, pFilp->private_data, RTProcSelf(), current->pid, current->comm));
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
     /* This housekeeping was needed in older kernel versions to ensure that
      * the file pointer didn't get left on the polling queue. */
-    vboxguestFAsync(-1, pFilp, 0);
+    vgdrvLinuxFAsync(-1, pFilp, 0);
 #endif
-    VbgdCommonCloseSession(&g_DevExt, (PVBOXGUESTSESSION)pFilp->private_data);
+    VGDrvCommonCloseSession(&g_DevExt, (PVBOXGUESTSESSION)pFilp->private_data);
     pFilp->private_data = NULL;
     return 0;
 }
@@ -744,14 +748,15 @@ static int vboxguestLinuxRelease(struct inode *pInode, struct file *pFilp)
 /**
  * Device I/O Control entry point.
  *
+ * @param   pInode      Associated inode pointer.
  * @param   pFilp       Associated file pointer.
  * @param   uCmd        The function specified to ioctl().
  * @param   ulArg       The argument specified to ioctl().
  */
 #ifdef HAVE_UNLOCKED_IOCTL
-static long vboxguestLinuxIOCtl(struct file *pFilp, unsigned int uCmd, unsigned long ulArg)
+static long vgdrvLinuxIOCtl(struct file *pFilp, unsigned int uCmd, unsigned long ulArg)
 #else
-static int vboxguestLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigned int uCmd, unsigned long ulArg)
+static int vgdrvLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigned int uCmd, unsigned long ulArg)
 #endif
 {
     PVBOXGUESTSESSION   pSession = (PVBOXGUESTSESSION)pFilp->private_data;
@@ -761,7 +766,7 @@ static int vboxguestLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigne
     int                 rc;
     uint64_t            au64Buf[32/sizeof(uint64_t)];
 
-    Log6(("vboxguestLinuxIOCtl: pFilp=%p uCmd=%#x ulArg=%p pid=%d/%d\n", pFilp, uCmd, (void *)ulArg, RTProcSelf(), current->pid));
+    Log6(("vgdrvLinuxIOCtl: pFilp=%p uCmd=%#x ulArg=%p pid=%d/%d\n", pFilp, uCmd, (void *)ulArg, RTProcSelf(), current->pid));
 
     /*
      * Buffer the request.
@@ -786,7 +791,7 @@ static int vboxguestLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigne
          * Process the IOCtl.
          */
         size_t cbDataReturned;
-        rc = VbgdCommonIoCtl(uCmd, &g_DevExt, pSession, pvBuf, cbData, &cbDataReturned);
+        rc = VGDrvCommonIoCtl(uCmd, &g_DevExt, pSession, pvBuf, cbData, &cbDataReturned);
 
         /*
          * Copy ioctl data and output buffer back to user space.
@@ -811,7 +816,7 @@ static int vboxguestLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigne
         }
         else
         {
-            Log(("vboxguestLinuxIOCtl: pFilp=%p uCmd=%#x ulArg=%p failed, rc=%d\n", pFilp, uCmd, (void *)ulArg, rc));
+            Log(("vgdrvLinuxIOCtl: pFilp=%p uCmd=%#x ulArg=%p failed, rc=%d\n", pFilp, uCmd, (void *)ulArg, rc));
             rc = -rc; Assert(rc > 0); /* Positive returns == negated VBox error status codes. */
         }
     }
@@ -823,7 +828,7 @@ static int vboxguestLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigne
     if (pvBufFree)
         RTMemFree(pvBufFree);
 
-    Log6(("vboxguestLinuxIOCtl: returns %d (pid=%d/%d)\n", rc, RTProcSelf(), current->pid));
+    Log6(("vgdrvLinuxIOCtl: returns %d (pid=%d/%d)\n", rc, RTProcSelf(), current->pid));
     return rc;
 }
 
@@ -837,7 +842,7 @@ static int vboxguestLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigne
  * @param   pFile       The file structure.
  * @param   fOn         On/off indicator.
  */
-static int vboxguestFAsync(int fd, struct file *pFile, int fOn)
+static int vgdrvLinuxFAsync(int fd, struct file *pFile, int fOn)
 {
     return fasync_helper(fd, pFile, fOn, &g_pFAsyncQueue);
 }
@@ -857,7 +862,7 @@ static int vboxguestFAsync(int fd, struct file *pFile, int fOn)
  * @remarks This is probably not really used, X11 is said to use the fasync
  *          interface instead.
  */
-static unsigned int vboxguestPoll(struct file *pFile, poll_table *pPt)
+static unsigned int vgdrvLinuxPoll(struct file *pFile, poll_table *pPt)
 {
     PVBOXGUESTSESSION   pSession  = (PVBOXGUESTSESSION)pFile->private_data;
     uint32_t            u32CurSeq = ASMAtomicUoReadU32(&g_DevExt.u32MousePosChangedSeq);
@@ -881,9 +886,9 @@ static unsigned int vboxguestPoll(struct file *pFile, poll_table *pPt)
  *
  * @remarks This is probably not really used as X11 lets the driver do its own
  *          event reading. The poll condition is therefore also cleared when we
- *          see VMMDevReq_GetMouseStatus in VbgdCommonIoCtl_VMMRequest.
+ *          see VMMDevReq_GetMouseStatus in vgdrvIoCtl_VMMRequest.
  */
-static ssize_t vboxguestRead(struct file *pFile, char *pbBuf, size_t cbRead, loff_t *poff)
+static ssize_t vgdrvLinuxRead(struct file *pFile, char *pbBuf, size_t cbRead, loff_t *poff)
 {
     PVBOXGUESTSESSION   pSession  = (PVBOXGUESTSESSION)pFile->private_data;
     uint32_t            u32CurSeq = ASMAtomicUoReadU32(&g_DevExt.u32MousePosChangedSeq);
@@ -905,7 +910,7 @@ static ssize_t vboxguestRead(struct file *pFile, char *pbBuf, size_t cbRead, lof
 }
 
 
-void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
+void VGDrvNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 {
 #ifdef VBOXGUEST_WITH_INPUT_DRIVER
     int rc;
@@ -916,9 +921,9 @@ void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
      * Wake up everyone that's in a poll() and post anyone that has
      * subscribed to async notifications.
      */
-    Log3(("VbgdNativeISRMousePollEvent: wake_up_all\n"));
+    Log3(("VGDrvNativeISRMousePollEvent: wake_up_all\n"));
     wake_up_all(&g_PollEventQueue);
-    Log3(("VbgdNativeISRMousePollEvent: kill_fasync\n"));
+    Log3(("VGDrvNativeISRMousePollEvent: kill_fasync\n"));
     kill_fasync(&g_pFAsyncQueue, SIGIO, POLL_IN);
 #ifdef VBOXGUEST_WITH_INPUT_DRIVER
     /* Report events to the kernel input device */
@@ -937,7 +942,7 @@ void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 # endif
     }
 #endif
-    Log3(("VbgdNativeISRMousePollEvent: done\n"));
+    Log3(("VGDrvNativeISRMousePollEvent: done\n"));
 }
 
 
@@ -952,7 +957,7 @@ EXPORT_SYMBOL(VBoxGuestIDCCall);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 
 /** log and dbg_log parameter setter. */
-static int vboxguestLinuxParamLogGrpSet(const char *pszValue, struct kernel_param *pParam)
+static int vgdrvLinuxParamLogGrpSet(const char *pszValue, struct kernel_param *pParam)
 {
     if (g_fLoggerCreated)
     {
@@ -967,7 +972,7 @@ static int vboxguestLinuxParamLogGrpSet(const char *pszValue, struct kernel_para
 }
 
 /** log and dbg_log parameter getter. */
-static int vboxguestLinuxParamLogGrpGet(char *pszBuf, struct kernel_param *pParam)
+static int vgdrvLinuxParamLogGrpGet(char *pszBuf, struct kernel_param *pParam)
 {
     PRTLOGGER pLogger = pParam->name[0] == 'd' ? RTLogDefaultInstance() : RTLogRelGetDefaultInstance();
     *pszBuf = '\0';
@@ -978,7 +983,7 @@ static int vboxguestLinuxParamLogGrpGet(char *pszBuf, struct kernel_param *pPara
 
 
 /** log and dbg_log_flags parameter setter. */
-static int vboxguestLinuxParamLogFlagsSet(const char *pszValue, struct kernel_param *pParam)
+static int vgdrvLinuxParamLogFlagsSet(const char *pszValue, struct kernel_param *pParam)
 {
     if (g_fLoggerCreated)
     {
@@ -992,7 +997,7 @@ static int vboxguestLinuxParamLogFlagsSet(const char *pszValue, struct kernel_pa
 }
 
 /** log and dbg_log_flags parameter getter. */
-static int vboxguestLinuxParamLogFlagsGet(char *pszBuf, struct kernel_param *pParam)
+static int vgdrvLinuxParamLogFlagsGet(char *pszBuf, struct kernel_param *pParam)
 {
     PRTLOGGER pLogger = pParam->name[0] == 'd' ? RTLogDefaultInstance() : RTLogRelGetDefaultInstance();
     *pszBuf = '\0';
@@ -1003,7 +1008,7 @@ static int vboxguestLinuxParamLogFlagsGet(char *pszBuf, struct kernel_param *pPa
 
 
 /** log and dbg_log_dest parameter setter. */
-static int vboxguestLinuxParamLogDstSet(const char *pszValue, struct kernel_param *pParam)
+static int vgdrvLinuxParamLogDstSet(const char *pszValue, struct kernel_param *pParam)
 {
     if (g_fLoggerCreated)
     {
@@ -1017,7 +1022,7 @@ static int vboxguestLinuxParamLogDstSet(const char *pszValue, struct kernel_para
 }
 
 /** log and dbg_log_dest parameter getter. */
-static int vboxguestLinuxParamLogDstGet(char *pszBuf, struct kernel_param *pParam)
+static int vgdrvLinuxParamLogDstGet(char *pszBuf, struct kernel_param *pParam)
 {
     PRTLOGGER pLogger = pParam->name[0] == 'd' ? RTLogDefaultInstance() : RTLogRelGetDefaultInstance();
     *pszBuf = '\0';
@@ -1028,7 +1033,7 @@ static int vboxguestLinuxParamLogDstGet(char *pszBuf, struct kernel_param *pPara
 
 
 /** r3_log_to_host parameter setter. */
-static int vboxguestLinuxParamR3LogToHostSet(const char *pszValue, struct kernel_param *pParam)
+static int vgdrvLinuxParamR3LogToHostSet(const char *pszValue, struct kernel_param *pParam)
 {
     if (    pszValue == NULL
         || *pszValue == '\0'
@@ -1046,7 +1051,7 @@ static int vboxguestLinuxParamR3LogToHostSet(const char *pszValue, struct kernel
 }
 
 /** r3_log_to_host parameter getter. */
-static int vboxguestLinuxParamR3LogToHostGet(char *pszBuf, struct kernel_param *pParam)
+static int vgdrvLinuxParamR3LogToHostGet(char *pszBuf, struct kernel_param *pParam)
 {
     strcpy(pszBuf, g_DevExt.fLoggingEnabled ? "enabled" : "disabled");
     return strlen(pszBuf);
@@ -1056,21 +1061,21 @@ static int vboxguestLinuxParamR3LogToHostGet(char *pszBuf, struct kernel_param *
 /*
  * Define module parameters.
  */
-module_param_call(log,            vboxguestLinuxParamLogGrpSet,   vboxguestLinuxParamLogGrpGet,   NULL, 0664);
-module_param_call(log_flags,      vboxguestLinuxParamLogFlagsSet, vboxguestLinuxParamLogFlagsGet, NULL, 0664);
-module_param_call(log_dest,       vboxguestLinuxParamLogDstSet,   vboxguestLinuxParamLogDstGet,   NULL, 0664);
+module_param_call(log,            vgdrvLinuxParamLogGrpSet,   vgdrvLinuxParamLogGrpGet,   NULL, 0664);
+module_param_call(log_flags,      vgdrvLinuxParamLogFlagsSet, vgdrvLinuxParamLogFlagsGet, NULL, 0664);
+module_param_call(log_dest,       vgdrvLinuxParamLogDstSet,   vgdrvLinuxParamLogDstGet,   NULL, 0664);
 # ifdef LOG_ENABLED
-module_param_call(dbg_log,        vboxguestLinuxParamLogGrpSet,   vboxguestLinuxParamLogGrpGet,   NULL, 0664);
-module_param_call(dbg_log_flags,  vboxguestLinuxParamLogFlagsSet, vboxguestLinuxParamLogFlagsGet, NULL, 0664);
-module_param_call(dbg_log_dest,   vboxguestLinuxParamLogDstSet,   vboxguestLinuxParamLogDstGet,   NULL, 0664);
+module_param_call(dbg_log,        vgdrvLinuxParamLogGrpSet,   vgdrvLinuxParamLogGrpGet,   NULL, 0664);
+module_param_call(dbg_log_flags,  vgdrvLinuxParamLogFlagsSet, vgdrvLinuxParamLogFlagsGet, NULL, 0664);
+module_param_call(dbg_log_dest,   vgdrvLinuxParamLogDstSet,   vgdrvLinuxParamLogDstGet,   NULL, 0664);
 # endif
-module_param_call(r3_log_to_host, vboxguestLinuxParamR3LogToHostSet, vboxguestLinuxParamR3LogToHostGet, NULL, 0664);
+module_param_call(r3_log_to_host, vgdrvLinuxParamR3LogToHostSet, vgdrvLinuxParamR3LogToHostGet, NULL, 0664);
 
 #endif /* 2.6.0 and later */
 
 
-module_init(vboxguestLinuxModInit);
-module_exit(vboxguestLinuxModExit);
+module_init(vgdrvLinuxModInit);
+module_exit(vgdrvLinuxModExit);
 
 MODULE_AUTHOR(VBOX_VENDOR);
 MODULE_DESCRIPTION(VBOX_PRODUCT " Guest Additions for Linux Module");
index 630eee49340a497b353a0385d14252f61a04474c..835a3ff8951ee8bcf001e2625cc93c6f09f97d2c 100644 (file)
  * terms and conditions of either the GPL or the CDDL or both.
  */
 
+/** @page pg_vbdrv VBoxGuest
+ *
+ * VBoxGuest is the device driver for VMMDev.
+ *
+ * The device driver is shipped as part of the guest additions.  It has roots in
+ * the host VMM support driver (usually known as VBoxDrv), so fixes in platform
+ * specific code may apply to both drivers.
+ *
+ * The common code lives in VBoxGuest.cpp and is compiled both as C++ and C.
+ * The VBoxGuest.cpp source file shall not contain platform specific code,
+ * though it must occationally do a few \#ifdef RT_OS_XXX tests to cater for
+ * platform differences.  Though, in those cases, it is common that more than
+ * one platform needs special handling.
+ *
+ * On most platforms the device driver should create two device nodes, one for
+ * full (unrestricted) access to the feature set, and one which only provides a
+ * restrict set of functions.  These are generally referred to as 'vboxguest'
+ * and 'vboxuser' respectively.  Currently, this two device approach is only
+ * implemented on Linux!
+ *
+ */
+
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP   LOG_GROUP_DEFAULT
 #include "VBoxGuestInternal.h"
 #include <VBox/VMMDev.h> /* for VMMDEV_RAM_SIZE */
 #endif
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 #define VBOXGUEST_ACQUIRE_STYLE_EVENTS (VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST | VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST)
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 #ifdef VBOX_WITH_HGCM
-static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User);
+static DECLCALLBACK(int) vgdrvHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User);
 #endif
-static int      vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
-static void     vbgdBitUsageTrackerClear(PVBOXGUESTBITUSAGETRACER pTracker);
-static uint32_t vbgdGetAllowedEventMaskForSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
-static int      vbgdResetEventFilterOnHost(PVBOXGUESTDEVEXT pDevExt, uint32_t fFixedEvents);
-static int      vbgdResetMouseStatusOnHost(PVBOXGUESTDEVEXT pDevExt);
-static int      vbgdResetCapabilitiesOnHost(PVBOXGUESTDEVEXT pDevExt);
-static int      vbgdSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                          uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination);
-static int      vbgdSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                          uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination);
-static int      vbgdSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                           uint32_t fOrMask, uint32_t fNoMask, bool fSessionTermination);
-static int      vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fOrMask,
-                                               uint32_t fNotMask, VBOXGUESTCAPSACQUIRE_FLAGS enmFlags, bool fSessionTermination);
-static int      vbgdDispatchEventsLocked(PVBOXGUESTDEVEXT pDevExt, uint32_t fEvents);
-
-
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+static int      vgdrvIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
+static void     vgdrvBitUsageTrackerClear(PVBOXGUESTBITUSAGETRACER pTracker);
+static uint32_t vgdrvGetAllowedEventMaskForSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
+static int      vgdrvResetEventFilterOnHost(PVBOXGUESTDEVEXT pDevExt, uint32_t fFixedEvents);
+static int      vgdrvResetMouseStatusOnHost(PVBOXGUESTDEVEXT pDevExt);
+static int      vgdrvResetCapabilitiesOnHost(PVBOXGUESTDEVEXT pDevExt);
+static int      vgdrvSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                           uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination);
+static int      vgdrvSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                           uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination);
+static int      vgdrvSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                            uint32_t fOrMask, uint32_t fNoMask, bool fSessionTermination);
+static int      vgdrvAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fOrMask,
+                                                uint32_t fNotMask, VBOXGUESTCAPSACQUIRE_FLAGS enmFlags, bool fSessionTermination);
+static int      vgdrvDispatchEventsLocked(PVBOXGUESTDEVEXT pDevExt, uint32_t fEvents);
+
+
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 static const uint32_t g_cbChangeMemBalloonReq = RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES]);
 
 #if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS)
@@ -127,7 +149,7 @@ PFNRT g_apfnVBoxGuestIPRTDeps[] =
  * @returns VBox status code (ignored).
  * @param   pDevExt     The device extension.
  */
-static int vbgdInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
+static int vgdrvInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
 {
     /*
      * Query the required space.
@@ -150,7 +172,7 @@ static int vbgdInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
      * instance in VT-x and AMD-V mode.
      */
     if (pReq->hypervisorSize == 0)
-        Log(("vbgdInitFixateGuestMappings: nothing to do\n"));
+        Log(("vgdrvInitFixateGuestMappings: nothing to do\n"));
     else
     {
         /*
@@ -162,7 +184,7 @@ static int vbgdInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
         RTR0MEMOBJ  ahTries[5];
         uint32_t    iTry;
         bool        fBitched = false;
-        Log(("vbgdInitFixateGuestMappings: cbHypervisor=%#x\n", cbHypervisor));
+        Log(("vgdrvInitFixateGuestMappings: cbHypervisor=%#x\n", cbHypervisor));
         for (iTry = 0; iTry < RT_ELEMENTS(ahTries); iTry++)
         {
             /*
@@ -257,11 +279,11 @@ static int vbgdInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
 
 
 /**
- * Undo what vbgdInitFixateGuestMappings did.
+ * Undo what vgdrvInitFixateGuestMappings did.
  *
  * @param   pDevExt     The device extension.
  */
-static void vbgdTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
+static void vgdrvTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
 {
     if (pDevExt->hGuestMappings != NIL_RTR0PTR)
     {
@@ -284,7 +306,7 @@ static void vbgdTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
             AssertRC(rc);
         }
         else
-            LogRel(("vbgdTermUnfixGuestMappings: Failed to unfix the guest mappings! rc=%Rrc\n", rc));
+            LogRel(("vgdrvTermUnfixGuestMappings: Failed to unfix the guest mappings! rc=%Rrc\n", rc));
 
         pDevExt->hGuestMappings = NIL_RTR0MEMOBJ;
     }
@@ -298,7 +320,7 @@ static void vbgdTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
  * @returns IPRT status code.
  * @param   enmOSType       The OS type to report.
  */
-static int vbgdReportGuestInfo(VBOXOSTYPE enmOSType)
+static int vgdrvReportGuestInfo(VBOXOSTYPE enmOSType)
 {
     /*
      * Allocate and fill in the two guest info reports.
@@ -306,7 +328,7 @@ static int vbgdReportGuestInfo(VBOXOSTYPE enmOSType)
     VMMDevReportGuestInfo2 *pReqInfo2 = NULL;
     VMMDevReportGuestInfo  *pReqInfo1 = NULL;
     int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo2, sizeof (VMMDevReportGuestInfo2), VMMDevReq_ReportGuestInfo2);
-    Log(("vbgdReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
+    Log(("vgdrvReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
     if (RT_SUCCESS(rc))
     {
         pReqInfo2->guestInfo.additionsMajor    = VBOX_VERSION_MAJOR;
@@ -317,7 +339,7 @@ static int vbgdReportGuestInfo(VBOXOSTYPE enmOSType)
         RTStrCopy(pReqInfo2->guestInfo.szName, sizeof(pReqInfo2->guestInfo.szName), VBOX_VERSION_STRING);
 
         rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo1, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo);
-        Log(("vbgdReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
+        Log(("vgdrvReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
         if (RT_SUCCESS(rc))
         {
             pReqInfo1->guestInfo.interfaceVersion = VMMDEV_VERSION;
@@ -332,21 +354,21 @@ static int vbgdReportGuestInfo(VBOXOSTYPE enmOSType)
              * if not supported by the VMMDev (message ordering requirement).
              */
             rc = VbglGRPerform(&pReqInfo2->header);
-            Log(("vbgdReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
+            Log(("vgdrvReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
             if (RT_SUCCESS(rc))
             {
                 rc = VbglGRPerform(&pReqInfo1->header);
-                Log(("vbgdReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
+                Log(("vgdrvReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
             }
             else if (   rc == VERR_NOT_SUPPORTED
                      || rc == VERR_NOT_IMPLEMENTED)
             {
                 rc = VbglGRPerform(&pReqInfo1->header);
-                Log(("vbgdReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
+                Log(("vgdrvReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
                 if (RT_SUCCESS(rc))
                 {
                     rc = VbglGRPerform(&pReqInfo2->header);
-                    Log(("vbgdReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
+                    Log(("vgdrvReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
                     if (rc == VERR_NOT_IMPLEMENTED)
                         rc = VINF_SUCCESS;
                 }
@@ -366,14 +388,14 @@ static int vbgdReportGuestInfo(VBOXOSTYPE enmOSType)
  * @returns IPRT status code.
  * @param   fActive         Flag whether the driver is now active or not.
  */
-static int vbgdReportDriverStatus(bool fActive)
+static int vgdrvReportDriverStatus(bool fActive)
 {
     /*
      * Report guest status of the VBox driver to the host.
      */
     VMMDevReportGuestStatus *pReq2 = NULL;
     int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq2, sizeof(*pReq2), VMMDevReq_ReportGuestStatus);
-    Log(("vbgdReportDriverStatus: VbglGRAlloc VMMDevReportGuestStatus completed with rc=%Rrc\n", rc));
+    Log(("vgdrvReportDriverStatus: VbglGRAlloc VMMDevReportGuestStatus completed with rc=%Rrc\n", rc));
     if (RT_SUCCESS(rc))
     {
         pReq2->guestStatus.facility = VBoxGuestFacilityType_VBoxGuestDriver;
@@ -382,7 +404,7 @@ static int vbgdReportDriverStatus(bool fActive)
                                   : VBoxGuestFacilityStatus_Inactive;
         pReq2->guestStatus.flags = 0;
         rc = VbglGRPerform(&pReq2->header);
-        Log(("vbgdReportDriverStatus: VbglGRPerform VMMDevReportGuestStatus completed with fActive=%d, rc=%Rrc\n",
+        Log(("vgdrvReportDriverStatus: VbglGRPerform VMMDevReportGuestStatus completed with fActive=%d, rc=%Rrc\n",
              fActive ? 1 : 0, rc));
         if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */
             rc = VINF_SUCCESS;
@@ -406,7 +428,7 @@ static int vbgdReportDriverStatus(bool fActive)
  * @param   pMemObj     Pointer to the R0 memory object.
  * @param   pReq        The pre-allocated request for performing the VMMDev call.
  */
-static int vbgdBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
+static int vgdrvBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
 {
     uint32_t iPage;
     int rc;
@@ -423,7 +445,7 @@ static int vbgdBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
 
     rc = VbglGRPerform(&pReq->header);
     if (RT_FAILURE(rc))
-        LogRel(("vbgdBalloonInflate: VbglGRPerform failed. rc=%Rrc\n", rc));
+        LogRel(("vgdrvBalloonInflate: VbglGRPerform failed. rc=%Rrc\n", rc));
     return rc;
 }
 
@@ -438,7 +460,7 @@ static int vbgdBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
  *                      The memory object will be freed afterwards.
  * @param   pReq        The pre-allocated request for performing the VMMDev call.
  */
-static int vbgdBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
+static int vgdrvBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
 {
     uint32_t iPage;
     int rc;
@@ -456,14 +478,14 @@ static int vbgdBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
     rc = VbglGRPerform(&pReq->header);
     if (RT_FAILURE(rc))
     {
-        LogRel(("vbgdBalloonDeflate: VbglGRPerform failed. rc=%Rrc\n", rc));
+        LogRel(("vgdrvBalloonDeflate: VbglGRPerform failed. rc=%Rrc\n", rc));
         return rc;
     }
 
     rc = RTR0MemObjFree(*pMemObj, true);
     if (RT_FAILURE(rc))
     {
-        LogRel(("vbgdBalloonDeflate: RTR0MemObjFree(%p,true) -> %Rrc; this is *BAD*!\n", *pMemObj, rc));
+        LogRel(("vgdrvBalloonDeflate: RTR0MemObjFree(%p,true) -> %Rrc; this is *BAD*!\n", *pMemObj, rc));
         return rc;
     }
 
@@ -475,16 +497,15 @@ static int vbgdBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
 /**
  * Inflate/deflate the memory balloon and notify the host.
  *
- * This is a worker used by vbgdIoCtl_CheckMemoryBalloon - it takes the mutex.
+ * This is a worker used by vgdrvIoCtl_CheckMemoryBalloon - it takes the mutex.
  *
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
- * @param   pSession        The session.
  * @param   cBalloonChunks  The new size of the balloon in chunks of 1MB.
  * @param   pfHandleInR3    Where to return the handle-in-ring3 indicator
  *                          (VINF_SUCCESS if set).
  */
-static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonChunks, uint32_t *pfHandleInR3)
+static int vgdrvSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonChunks, uint32_t *pfHandleInR3)
 {
     int rc = VINF_SUCCESS;
 
@@ -495,7 +516,7 @@ static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonC
 
         if (cBalloonChunks > pDevExt->MemBalloon.cMaxChunks)
         {
-            LogRel(("vbgdSetBalloonSizeKernel: illegal balloon size %u (max=%u)\n",
+            LogRel(("vgdrvSetBalloonSizeKernel: illegal balloon size %u (max=%u)\n",
                     cBalloonChunks, pDevExt->MemBalloon.cMaxChunks));
             return VERR_INVALID_PARAMETER;
         }
@@ -509,7 +530,7 @@ static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonC
             pDevExt->MemBalloon.paMemObj = (PRTR0MEMOBJ)RTMemAllocZ(sizeof(RTR0MEMOBJ) * pDevExt->MemBalloon.cMaxChunks);
             if (!pDevExt->MemBalloon.paMemObj)
             {
-                LogRel(("vbgdSetBalloonSizeKernel: no memory for paMemObj!\n"));
+                LogRel(("vgdrvSetBalloonSizeKernel: no memory for paMemObj!\n"));
                 return VERR_NO_MEMORY;
             }
         }
@@ -541,7 +562,7 @@ static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonC
                     break;
                 }
 
-                rc = vbgdBalloonInflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
+                rc = vgdrvBalloonInflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
                 if (RT_FAILURE(rc))
                 {
                     Log(("vboxGuestSetBalloonSize(inflate): failed, rc=%Rrc!\n", rc));
@@ -557,7 +578,7 @@ static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonC
             /* deflate */
             for (i = pDevExt->MemBalloon.cChunks; i-- > cBalloonChunks;)
             {
-                rc = vbgdBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
+                rc = vgdrvBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
                 if (RT_FAILURE(rc))
                 {
                     Log(("vboxGuestSetBalloonSize(deflate): failed, rc=%Rrc!\n", rc));
@@ -583,7 +604,7 @@ static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonC
 /**
  * Inflate/deflate the balloon by one chunk.
  *
- * Worker for vbgdIoCtl_ChangeMemoryBalloon - it takes the mutex.
+ * Worker for vgdrvIoCtl_ChangeMemoryBalloon - it takes the mutex.
  *
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
@@ -592,7 +613,7 @@ static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonC
  *                          balloon.
  * @param   fInflate        Inflate if true, deflate if false.
  */
-static int vbgdSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint64_t u64ChunkAddr, bool fInflate)
+static int vgdrvSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint64_t u64ChunkAddr, bool fInflate)
 {
     VMMDevChangeMemBalloon *pReq;
     int rc = VINF_SUCCESS;
@@ -672,7 +693,7 @@ static int vbgdSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSIO
                                 RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS);
         if (RT_SUCCESS(rc))
         {
-            rc = vbgdBalloonInflate(pMemObj, pReq);
+            rc = vgdrvBalloonInflate(pMemObj, pReq);
             if (RT_SUCCESS(rc))
                 pDevExt->MemBalloon.cChunks++;
             else
@@ -685,7 +706,7 @@ static int vbgdSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSIO
     }
     else
     {
-        rc = vbgdBalloonDeflate(pMemObj, pReq);
+        rc = vgdrvBalloonDeflate(pMemObj, pReq);
         if (RT_SUCCESS(rc))
             pDevExt->MemBalloon.cChunks--;
         else
@@ -704,9 +725,9 @@ static int vbgdSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSIO
  * own it already.
  *
  * @param   pDevExt     The device extension.
- * @param   pDevExt     The session.  Can be NULL at unload.
+ * @param   pSession    The session.  Can be NULL at unload.
  */
-static void vbgdCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+static void vgdrvCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
     RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx);
     if (    pDevExt->MemBalloon.pOwner == pSession
@@ -721,10 +742,10 @@ static void vbgdCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSes
                 uint32_t i;
                 for (i = pDevExt->MemBalloon.cChunks; i-- > 0;)
                 {
-                    rc = vbgdBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
+                    rc = vgdrvBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
                     if (RT_FAILURE(rc))
                     {
-                        LogRel(("vbgdCloseMemBalloon: Deflate failed with rc=%Rrc.  Will leak %u chunks.\n",
+                        LogRel(("vgdrvCloseMemBalloon: Deflate failed with rc=%Rrc.  Will leak %u chunks.\n",
                                 rc, pDevExt->MemBalloon.cChunks));
                         break;
                     }
@@ -734,7 +755,7 @@ static void vbgdCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSes
                 VbglGRFree(&pReq->header);
             }
             else
-                LogRel(("vbgdCloseMemBalloon: Failed to allocate VMMDev request buffer (rc=%Rrc).  Will leak %u chunks.\n",
+                LogRel(("vgdrvCloseMemBalloon: Failed to allocate VMMDev request buffer (rc=%Rrc).  Will leak %u chunks.\n",
                         rc, pDevExt->MemBalloon.cChunks));
             RTMemFree(pDevExt->MemBalloon.paMemObj);
             pDevExt->MemBalloon.paMemObj = NULL;
@@ -758,13 +779,13 @@ static void vbgdCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSes
  *
  * @returns VBox status code.
  */
-static int vbgdHeartbeatSend(PVBOXGUESTDEVEXT pDevExt)
+static int vgdrvHeartbeatSend(PVBOXGUESTDEVEXT pDevExt)
 {
     int rc;
     if (pDevExt->pReqGuestHeartbeat)
     {
         rc = VbglGRPerform(pDevExt->pReqGuestHeartbeat);
-        Log(("vbgdHeartbeatSend: VbglGRPerform vbgdHeartbeatSend completed with rc=%Rrc\n", rc));
+        Log(("vgdrvHeartbeatSend: VbglGRPerform vgdrvHeartbeatSend completed with rc=%Rrc\n", rc));
     }
     else
         rc = VERR_INVALID_STATE;
@@ -775,15 +796,15 @@ static int vbgdHeartbeatSend(PVBOXGUESTDEVEXT pDevExt)
 /**
  * Callback for heartbeat timer.
  */
-static DECLCALLBACK(void) vbgdHeartbeatTimerHandler(PRTTIMER hTimer, void *pvUser, uint64_t iTick)
+static DECLCALLBACK(void) vgdrvHeartbeatTimerHandler(PRTTIMER hTimer, void *pvUser, uint64_t iTick)
 {
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
     int rc;
     AssertReturnVoid(pDevExt);
 
-    rc = vbgdHeartbeatSend(pDevExt);
+    rc = vgdrvHeartbeatSend(pDevExt);
     if (RT_FAILURE(rc))
-        Log(("HB Timer: vbgdHeartbeatSend failed: rc=%Rrc\n", rc));
+        Log(("HB Timer: vgdrvHeartbeatSend failed: rc=%Rrc\n", rc));
 
     NOREF(hTimer); NOREF(iTick);
 }
@@ -797,17 +818,17 @@ static DECLCALLBACK(void) vbgdHeartbeatTimerHandler(PRTTIMER hTimer, void *pvUse
  * @param   pDevExt         The device extension.
  * @param   fEnabled        Set true to enable guest heartbeat checks on host.
  */
-static int vbgdHeartbeatHostConfigure(PVBOXGUESTDEVEXT pDevExt, bool fEnabled)
+static int vgdrvHeartbeatHostConfigure(PVBOXGUESTDEVEXT pDevExt, bool fEnabled)
 {
     VMMDevReqHeartbeat *pReq;
     int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_HeartbeatConfigure);
-    Log(("vbgdHeartbeatHostConfigure: VbglGRAlloc vbgdHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
+    Log(("vgdrvHeartbeatHostConfigure: VbglGRAlloc vgdrvHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
     if (RT_SUCCESS(rc))
     {
         pReq->fEnabled = fEnabled;
         pReq->cNsInterval = 0;
         rc = VbglGRPerform(&pReq->header);
-        Log(("vbgdHeartbeatHostConfigure: VbglGRPerform vbgdHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
+        Log(("vgdrvHeartbeatHostConfigure: VbglGRPerform vgdrvHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
         pDevExt->cNsHeartbeatInterval = pReq->cNsInterval;
         VbglGRFree(&pReq->header);
     }
@@ -823,15 +844,15 @@ static int vbgdHeartbeatHostConfigure(PVBOXGUESTDEVEXT pDevExt, bool fEnabled)
  * @returns VBox status (ignored).
  * @param   pDevExt             The device extension.
  */
-static int vbgdHeartbeatInit(PVBOXGUESTDEVEXT pDevExt)
+static int vgdrvHeartbeatInit(PVBOXGUESTDEVEXT pDevExt)
 {
     /*
      * Make sure that heartbeat checking is disabled.
      */
-    int rc = vbgdHeartbeatHostConfigure(pDevExt, false);
+    int rc = vgdrvHeartbeatHostConfigure(pDevExt, false);
     if (RT_SUCCESS(rc))
     {
-        rc = vbgdHeartbeatHostConfigure(pDevExt, true);
+        rc = vgdrvHeartbeatHostConfigure(pDevExt, true);
         if (RT_SUCCESS(rc))
         {
             /*
@@ -843,32 +864,32 @@ static int vbgdHeartbeatInit(PVBOXGUESTDEVEXT pDevExt)
             rc = VbglGRAlloc(&pDevExt->pReqGuestHeartbeat, sizeof(*pDevExt->pReqGuestHeartbeat), VMMDevReq_GuestHeartbeat);
             if (RT_SUCCESS(rc))
             {
-                LogRel(("VbgdCommonInitDevExt: Setting up heartbeat to trigger every %RU64 milliseconds\n",
+                LogRel(("vgdrvHeartbeatInit: Setting up heartbeat to trigger every %RU64 milliseconds\n",
                         pDevExt->cNsHeartbeatInterval / RT_NS_1MS));
                 rc = RTTimerCreateEx(&pDevExt->pHeartbeatTimer, pDevExt->cNsHeartbeatInterval, 0 /*fFlags*/,
-                                     (PFNRTTIMER)vbgdHeartbeatTimerHandler, pDevExt);
+                                     (PFNRTTIMER)vgdrvHeartbeatTimerHandler, pDevExt);
                 if (RT_SUCCESS(rc))
                 {
                     rc = RTTimerStart(pDevExt->pHeartbeatTimer, 0);
                     if (RT_SUCCESS(rc))
                         return VINF_SUCCESS;
 
-                    LogRel(("VbgdCommonInitDevExt: Heartbeat timer failed to start, rc=%Rrc\n", rc));
+                    LogRel(("vgdrvHeartbeatInit: Heartbeat timer failed to start, rc=%Rrc\n", rc));
                 }
                 else
-                    LogRel(("VbgdCommonInitDevExt: Failed to create heartbeat timer: %Rrc\n", rc));
+                    LogRel(("vgdrvHeartbeatInit: Failed to create heartbeat timer: %Rrc\n", rc));
 
                 VbglGRFree(pDevExt->pReqGuestHeartbeat);
                 pDevExt->pReqGuestHeartbeat = NULL;
             }
             else
-                LogRel(("VbgdCommonInitDevExt: VbglGRAlloc(VMMDevReq_GuestHeartbeat): %Rrc\n", rc));
+                LogRel(("vgdrvHeartbeatInit: VbglGRAlloc(VMMDevReq_GuestHeartbeat): %Rrc\n", rc));
 
-            LogRel(("VbgdCommonInitDevExt: Failed to set up the timer, guest heartbeat is disabled\n"));
-            vbgdHeartbeatHostConfigure(pDevExt, false);
+            LogRel(("vgdrvHeartbeatInit: Failed to set up the timer, guest heartbeat is disabled\n"));
+            vgdrvHeartbeatHostConfigure(pDevExt, false);
         }
         else
-            LogRel(("VbgdCommonInitDevExt: Failed to configure host for heartbeat checking: rc=%Rrc\n", rc));
+            LogRel(("vgdrvHeartbeatInit: Failed to configure host for heartbeat checking: rc=%Rrc\n", rc));
     }
     return rc;
 }
@@ -885,18 +906,18 @@ static int vbgdHeartbeatInit(PVBOXGUESTDEVEXT pDevExt)
  *
  * @todo Call this on all platforms, not just windows.
  */
-int VbgdCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType)
+int VGDrvCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType)
 {
-    int rc = vbgdReportGuestInfo(enmOSType);
+    int rc = vgdrvReportGuestInfo(enmOSType);
     if (RT_SUCCESS(rc))
     {
-        rc = vbgdReportDriverStatus(true /* Driver is active */);
+        rc = vgdrvReportDriverStatus(true /* Driver is active */);
         if (RT_FAILURE(rc))
-            Log(("VbgdCommonReinitDevExtAfterHibernation: could not report guest driver status, rc=%Rrc\n", rc));
+            Log(("VGDrvCommonReinitDevExtAfterHibernation: could not report guest driver status, rc=%Rrc\n", rc));
     }
     else
-        Log(("VbgdCommonReinitDevExtAfterHibernation: could not report guest information to host, rc=%Rrc\n", rc));
-    LogFlow(("VbgdCommonReinitDevExtAfterHibernation: returned with rc=%Rrc\n", rc));
+        Log(("VGDrvCommonReinitDevExtAfterHibernation: could not report guest information to host, rc=%Rrc\n", rc));
+    LogFlow(("VGDrvCommonReinitDevExtAfterHibernation: returned with rc=%Rrc\n", rc));
     return rc;
 }
 
@@ -922,8 +943,8 @@ int VbgdCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE
  * @param   fFixedEvents    Events that will be enabled upon init and no client
  *                          will ever be allowed to mask.
  */
-int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
-                         void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fFixedEvents)
+int VGDrvCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
+                          void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fFixedEvents)
 {
     int rc, rc2;
 
@@ -983,16 +1004,16 @@ int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
     pDevExt->pReqGuestHeartbeat = NULL;
 
     pDevExt->fFixedEvents = fFixedEvents;
-    vbgdBitUsageTrackerClear(&pDevExt->EventFilterTracker);
+    vgdrvBitUsageTrackerClear(&pDevExt->EventFilterTracker);
     pDevExt->fEventFilterHost = UINT32_MAX;  /* forces a report */
 
-    vbgdBitUsageTrackerClear(&pDevExt->MouseStatusTracker);
+    vgdrvBitUsageTrackerClear(&pDevExt->MouseStatusTracker);
     pDevExt->fMouseStatusHost = UINT32_MAX;  /* forces a report */
 
     pDevExt->fAcquireModeGuestCaps = 0;
     pDevExt->fSetModeGuestCaps = 0;
     pDevExt->fAcquiredGuestCaps = 0;
-    vbgdBitUsageTrackerClear(&pDevExt->SetGuestCapsTracker);
+    vgdrvBitUsageTrackerClear(&pDevExt->SetGuestCapsTracker);
     pDevExt->fGuestCapsHost = UINT32_MAX; /* forces a report */
 
     /*
@@ -1007,11 +1028,11 @@ int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
             &&  pVMMDev->u32Size <= cbMMIO)
         {
             pDevExt->pVMMDevMemory = pVMMDev;
-            Log(("VbgdCommonInitDevExt: VMMDevMemory: mapping=%p size=%#RX32 (%#RX32) version=%#RX32\n",
+            Log(("VGDrvCommonInitDevExt: VMMDevMemory: mapping=%p size=%#RX32 (%#RX32) version=%#RX32\n",
                  pVMMDev, pVMMDev->u32Size, cbMMIO, pVMMDev->u32Version));
         }
         else /* try live without it. */
-            LogRel(("VbgdCommonInitDevExt: Bogus VMMDev memory; u32Version=%RX32 (expected %RX32) u32Size=%RX32 (expected <= %RX32)\n",
+            LogRel(("VGDrvCommonInitDevExt: Bogus VMMDev memory; u32Version=%RX32 (expected %RX32) u32Size=%RX32 (expected <= %RX32)\n",
                     pVMMDev->u32Version, VMMDEV_MEMORY_VERSION, pVMMDev->u32Size, cbMMIO));
     }
 
@@ -1023,7 +1044,7 @@ int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
         rc = RTSpinlockCreate(&pDevExt->SessionSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxGuestSession");
     if (RT_FAILURE(rc))
     {
-        LogRel(("VbgdCommonInitDevExt: failed to create spinlock, rc=%Rrc!\n", rc));
+        LogRel(("VGDrvCommonInitDevExt: failed to create spinlock, rc=%Rrc!\n", rc));
         if (pDevExt->EventSpinlock != NIL_RTSPINLOCK)
             RTSpinlockDestroy(pDevExt->EventSpinlock);
         return rc;
@@ -1032,7 +1053,7 @@ int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
     rc = RTSemFastMutexCreate(&pDevExt->MemBalloon.hMtx);
     if (RT_FAILURE(rc))
     {
-        LogRel(("VbgdCommonInitDevExt: failed to create mutex, rc=%Rrc!\n", rc));
+        LogRel(("VGDrvCommonInitDevExt: failed to create mutex, rc=%Rrc!\n", rc));
         RTSpinlockDestroy(pDevExt->SessionSpinlock);
         RTSpinlockDestroy(pDevExt->EventSpinlock);
         return rc;
@@ -1043,7 +1064,7 @@ int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
      * set the interrupt control filter mask, and fixate the guest mappings
      * made by the VMM.
      */
-    rc = VbglInit(pDevExt->IOPortBase, (VMMDevMemory *)pDevExt->pVMMDevMemory);
+    rc = VbglInitPrimary(pDevExt->IOPortBase, (VMMDevMemory *)pDevExt->pVMMDevMemory);
     if (RT_SUCCESS(rc))
     {
         rc = VbglGRAlloc((VMMDevRequestHeader **)&pDevExt->pIrqAckEvents, sizeof(VMMDevEvents), VMMDevReq_AcknowledgeEvents);
@@ -1052,57 +1073,57 @@ int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
             pDevExt->PhysIrqAckEvents = VbglPhysHeapGetPhysAddr(pDevExt->pIrqAckEvents);
             Assert(pDevExt->PhysIrqAckEvents != 0);
 
-            rc = vbgdReportGuestInfo(enmOSType);
+            rc = vgdrvReportGuestInfo(enmOSType);
             if (RT_SUCCESS(rc))
             {
                 /*
                  * Set the fixed event and make sure the host doesn't have any lingering
                  * the guest capabilities or mouse status bits set.
                  */
-                rc = vbgdResetEventFilterOnHost(pDevExt, pDevExt->fFixedEvents);
+                rc = vgdrvResetEventFilterOnHost(pDevExt, pDevExt->fFixedEvents);
                 if (RT_SUCCESS(rc))
                 {
-                    rc = vbgdResetCapabilitiesOnHost(pDevExt);
+                    rc = vgdrvResetCapabilitiesOnHost(pDevExt);
                     if (RT_SUCCESS(rc))
                     {
-                        rc = vbgdResetMouseStatusOnHost(pDevExt);
+                        rc = vgdrvResetMouseStatusOnHost(pDevExt);
                         if (RT_SUCCESS(rc))
                         {
                             /*
                              * Initialize stuff which may fail without requiring the driver init to fail.
                              */
-                            vbgdInitFixateGuestMappings(pDevExt);
-                            vbgdHeartbeatInit(pDevExt);
+                            vgdrvInitFixateGuestMappings(pDevExt);
+                            vgdrvHeartbeatInit(pDevExt);
 
                             /*
                              * Done!
                              */
-                            rc = vbgdReportDriverStatus(true /* Driver is active */);
+                            rc = vgdrvReportDriverStatus(true /* Driver is active */);
                             if (RT_FAILURE(rc))
-                                LogRel(("VbgdCommonInitDevExt: VBoxReportGuestDriverStatus failed, rc=%Rrc\n", rc));
+                                LogRel(("VGDrvCommonInitDevExt: VBoxReportGuestDriverStatus failed, rc=%Rrc\n", rc));
 
-                            LogFlowFunc(("VbgdCommonInitDevExt: returns success\n"));
+                            LogFlowFunc(("VGDrvCommonInitDevExt: returns success\n"));
                             return VINF_SUCCESS;
                         }
-                        LogRel(("VbgdCommonInitDevExt: failed to clear mouse status: rc=%Rrc\n", rc));
+                        LogRel(("VGDrvCommonInitDevExt: failed to clear mouse status: rc=%Rrc\n", rc));
                     }
                     else
-                        LogRel(("VbgdCommonInitDevExt: failed to clear guest capabilities: rc=%Rrc\n", rc));
+                        LogRel(("VGDrvCommonInitDevExt: failed to clear guest capabilities: rc=%Rrc\n", rc));
                 }
                 else
-                    LogRel(("VbgdCommonInitDevExt: failed to set fixed event filter: rc=%Rrc\n", rc));
+                    LogRel(("VGDrvCommonInitDevExt: failed to set fixed event filter: rc=%Rrc\n", rc));
             }
             else
-                LogRel(("VbgdCommonInitDevExt: VBoxReportGuestInfo failed: rc=%Rrc\n", rc));
+                LogRel(("VGDrvCommonInitDevExt: VBoxReportGuestInfo failed: rc=%Rrc\n", rc));
             VbglGRFree((VMMDevRequestHeader *)pDevExt->pIrqAckEvents);
         }
         else
-            LogRel(("VbgdCommonInitDevExt: VBoxGRAlloc failed: rc=%Rrc\n", rc));
+            LogRel(("VGDrvCommonInitDevExt: VBoxGRAlloc failed: rc=%Rrc\n", rc));
 
         VbglTerminate();
     }
     else
-        LogRel(("VbgdCommonInitDevExt: VbglInit failed: rc=%Rrc\n", rc));
+        LogRel(("VGDrvCommonInitDevExt: VbglInit failed: rc=%Rrc\n", rc));
 
     rc2 = RTSemFastMutexDestroy(pDevExt->MemBalloon.hMtx); AssertRC(rc2);
     rc2 = RTSpinlockDestroy(pDevExt->EventSpinlock); AssertRC(rc2);
@@ -1120,7 +1141,7 @@ int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
  * Deletes all the items in a wait chain.
  * @param   pList       The head of the chain.
  */
-static void vbgdDeleteWaitList(PRTLISTNODE pList)
+static void vgdrvDeleteWaitList(PRTLISTNODE pList)
 {
     while (!RTListIsEmpty(pList))
     {
@@ -1144,10 +1165,10 @@ static void vbgdDeleteWaitList(PRTLISTNODE pList)
  *
  * @param   pDevExt         The device extension.
  */
-void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
+void VGDrvCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
 {
     int rc2;
-    Log(("VbgdCommonDeleteDevExt:\n"));
+    Log(("VGDrvCommonDeleteDevExt:\n"));
     Log(("VBoxGuest: The additions driver is terminating.\n"));
 
     /*
@@ -1157,7 +1178,7 @@ void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
     if (pDevExt->pHeartbeatTimer)
     {
         RTTimerDestroy(pDevExt->pHeartbeatTimer);
-        vbgdHeartbeatHostConfigure(pDevExt, false);
+        vgdrvHeartbeatHostConfigure(pDevExt, false);
     }
 
     VbglGRFree(pDevExt->pReqGuestHeartbeat);
@@ -1166,7 +1187,7 @@ void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
     /*
      * Clean up the bits that involves the host first.
      */
-    vbgdTermUnfixGuestMappings(pDevExt);
+    vgdrvTermUnfixGuestMappings(pDevExt);
     if (!RTListIsEmpty(&pDevExt->SessionList))
     {
         LogRelFunc(("session list not empty!\n"));
@@ -1174,11 +1195,11 @@ void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
     }
     /* Update the host flags (mouse status etc) not to reflect this session. */
     pDevExt->fFixedEvents = 0;
-    vbgdResetEventFilterOnHost(pDevExt, 0 /*fFixedEvents*/);
-    vbgdResetCapabilitiesOnHost(pDevExt);
-    vbgdResetMouseStatusOnHost(pDevExt);
+    vgdrvResetEventFilterOnHost(pDevExt, 0 /*fFixedEvents*/);
+    vgdrvResetCapabilitiesOnHost(pDevExt);
+    vgdrvResetMouseStatusOnHost(pDevExt);
 
-    vbgdCloseMemBalloon(pDevExt, (PVBOXGUESTSESSION)NULL);
+    vgdrvCloseMemBalloon(pDevExt, (PVBOXGUESTSESSION)NULL);
 
     /*
      * Cleanup all the other resources.
@@ -1187,15 +1208,15 @@ void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
     rc2 = RTSpinlockDestroy(pDevExt->SessionSpinlock); AssertRC(rc2);
     rc2 = RTSemFastMutexDestroy(pDevExt->MemBalloon.hMtx); AssertRC(rc2);
 
-    vbgdDeleteWaitList(&pDevExt->WaitList);
+    vgdrvDeleteWaitList(&pDevExt->WaitList);
 #ifdef VBOX_WITH_HGCM
-    vbgdDeleteWaitList(&pDevExt->HGCMWaitList);
+    vgdrvDeleteWaitList(&pDevExt->HGCMWaitList);
 #endif
 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-    vbgdDeleteWaitList(&pDevExt->WakeUpList);
+    vgdrvDeleteWaitList(&pDevExt->WakeUpList);
 #endif
-    vbgdDeleteWaitList(&pDevExt->WokenUpList);
-    vbgdDeleteWaitList(&pDevExt->FreeList);
+    vgdrvDeleteWaitList(&pDevExt->WokenUpList);
+    vgdrvDeleteWaitList(&pDevExt->FreeList);
 
     VbglTerminate();
 
@@ -1216,18 +1237,18 @@ void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
  * Creates a VBoxGuest user session.
  *
  * The native code calls this when a ring-3 client opens the device.
- * Use VbgdCommonCreateKernelSession when a ring-0 client connects.
+ * Use VGDrvCommonCreateKernelSession when a ring-0 client connects.
  *
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
  * @param   ppSession       Where to store the session on success.
  */
-int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
+int VGDrvCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
 {
     PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)RTMemAllocZ(sizeof(*pSession));
     if (RT_UNLIKELY(!pSession))
     {
-        LogRel(("VbgdCommonCreateUserSession: no memory!\n"));
+        LogRel(("VGDrvCommonCreateUserSession: no memory!\n"));
         return VERR_NO_MEMORY;
     }
 
@@ -1240,7 +1261,7 @@ int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppS
     RTSpinlockRelease(pDevExt->SessionSpinlock);
 
     *ppSession = pSession;
-    LogFlow(("VbgdCommonCreateUserSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
+    LogFlow(("VGDrvCommonCreateUserSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
              pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */
     return VINF_SUCCESS;
 }
@@ -1250,18 +1271,18 @@ int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppS
  * Creates a VBoxGuest kernel session.
  *
  * The native code calls this when a ring-0 client connects to the device.
- * Use VbgdCommonCreateUserSession when a ring-3 client opens the device.
+ * Use VGDrvCommonCreateUserSession when a ring-3 client opens the device.
  *
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
  * @param   ppSession       Where to store the session on success.
  */
-int VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
+int VGDrvCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
 {
     PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)RTMemAllocZ(sizeof(*pSession));
     if (RT_UNLIKELY(!pSession))
     {
-        LogRel(("VbgdCommonCreateKernelSession: no memory!\n"));
+        LogRel(("VGDrvCommonCreateKernelSession: no memory!\n"));
         return VERR_NO_MEMORY;
     }
 
@@ -1274,7 +1295,7 @@ int VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *p
     RTSpinlockRelease(pDevExt->SessionSpinlock);
 
     *ppSession = pSession;
-    LogFlow(("VbgdCommonCreateKernelSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
+    LogFlow(("VGDrvCommonCreateKernelSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
              pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */
     return VINF_SUCCESS;
 }
@@ -1286,25 +1307,25 @@ int VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *p
  * @param   pDevExt         The device extension.
  * @param   pSession        The session to close (and free).
  */
-void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+void VGDrvCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
 #ifdef VBOX_WITH_HGCM
     unsigned i;
 #endif
-    LogFlow(("VbgdCommonCloseSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
+    LogFlow(("VGDrvCommonCloseSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
              pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */
 
     RTSpinlockAcquire(pDevExt->SessionSpinlock);
     RTListNodeRemove(&pSession->ListNode);
     pDevExt->cSessions--;
     RTSpinlockRelease(pDevExt->SessionSpinlock);
-    vbgdAcquireSessionCapabilities(pDevExt, pSession, 0, UINT32_MAX, VBOXGUESTCAPSACQUIRE_FLAGS_NONE,
+    vgdrvAcquireSessionCapabilities(pDevExt, pSession, 0, UINT32_MAX, VBOXGUESTCAPSACQUIRE_FLAGS_NONE,
                                    true /*fSessionTermination*/);
-    vbgdSetSessionCapabilities(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
-    vbgdSetSessionEventFilter(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
-    vbgdSetSessionMouseStatus(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
+    vgdrvSetSessionCapabilities(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
+    vgdrvSetSessionEventFilter(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
+    vgdrvSetSessionMouseStatus(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
 
-    vbgdIoCtl_CancelAllWaitEvents(pDevExt, pSession);
+    vgdrvIoCtl_CancelAllWaitEvents(pDevExt, pSession);
 
 #ifdef VBOX_WITH_HGCM
     for (i = 0; i < RT_ELEMENTS(pSession->aHGCMClientIds); i++)
@@ -1314,15 +1335,15 @@ void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession
             Info.result = 0;
             Info.u32ClientID = pSession->aHGCMClientIds[i];
             pSession->aHGCMClientIds[i] = 0;
-            Log(("VbgdCommonCloseSession: disconnecting client id %#RX32\n", Info.u32ClientID));
-            VbglR0HGCMInternalDisconnect(&Info, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
+            Log(("VGDrvCommonCloseSession: disconnecting client id %#RX32\n", Info.u32ClientID));
+            VbglR0HGCMInternalDisconnect(&Info, vgdrvHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
         }
 #endif
 
     pSession->pDevExt = NULL;
     pSession->Process = NIL_RTPROCESS;
     pSession->R0Process = NIL_RTR0PROCESS;
-    vbgdCloseMemBalloon(pDevExt, pSession);
+    vgdrvCloseMemBalloon(pDevExt, pSession);
     RTMemFree(pSession);
 }
 
@@ -1334,7 +1355,7 @@ void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession
  * @param   pDevExt         The device extension.
  * @param   pSession        The session that's allocating this. Can be NULL.
  */
-static PVBOXGUESTWAIT vbgdWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+static PVBOXGUESTWAIT vgdrvWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
     /*
      * Allocate it one way or the other.
@@ -1357,14 +1378,14 @@ static PVBOXGUESTWAIT vbgdWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
         pWait = (PVBOXGUESTWAIT)RTMemAlloc(sizeof(*pWait));
         if (!pWait)
         {
-            LogRelMax(32, ("vbgdWaitAlloc: out-of-memory!\n"));
+            LogRelMax(32, ("vgdrvWaitAlloc: out-of-memory!\n"));
             return NULL;
         }
 
         rc = RTSemEventMultiCreate(&pWait->Event);
         if (RT_FAILURE(rc))
         {
-            LogRelMax(32, ("VbgdCommonIoCtl: RTSemEventMultiCreate failed with rc=%Rrc!\n", rc));
+            LogRelMax(32, ("vgdrvWaitAlloc: RTSemEventMultiCreate failed with rc=%Rrc!\n", rc));
             RTMemFree(pWait);
             return NULL;
         }
@@ -1400,7 +1421,7 @@ static PVBOXGUESTWAIT vbgdWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
  * @param   pDevExt         The device extension.
  * @param   pWait           The wait-for-event entry to free.
  */
-static void vbgdWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
+static void vgdrvWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
 {
     pWait->fReqEvents = 0;
     pWait->fResEvents = 0;
@@ -1426,10 +1447,10 @@ static void vbgdWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
  * @param   pDevExt         The device extension.
  * @param   pWait           The wait-for-event entry to free.
  */
-static void vbgdWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
+static void vgdrvWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
 {
     RTSpinlockAcquire(pDevExt->EventSpinlock);
-    vbgdWaitFreeLocked(pDevExt, pWait);
+    vgdrvWaitFreeLocked(pDevExt, pWait);
     RTSpinlockRelease(pDevExt->EventSpinlock);
 }
 
@@ -1443,7 +1464,7 @@ static void vbgdWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
  *
  * @param   pDevExt         The device extension.
  */
-void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
+void VGDrvCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
 {
     if (!RTListIsEmpty(&pDevExt->WakeUpList))
     {
@@ -1470,7 +1491,7 @@ void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
             else
             {
                 pWait->fFreeMe = false;
-                vbgdWaitFreeLocked(pDevExt, pWait);
+                vgdrvWaitFreeLocked(pDevExt, pWait);
             }
         }
         RTSpinlockRelease(pDevExt->EventSpinlock);
@@ -1489,9 +1510,9 @@ void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
  * @param   pDevExt     The device extension.
  * @param   pSession    The session.
  */
-int  VbgdCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+int VGDrvCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
-    LogFlow(("VbgdCommonIoCtlFast: iFunction=%#x pDevExt=%p pSession=%p\n", iFunction, pDevExt, pSession));
+    LogFlow(("VGDrvCommonIoCtlFast: iFunction=%#x pDevExt=%p pSession=%p\n", iFunction, pDevExt, pSession));
 
     NOREF(iFunction);
     NOREF(pDevExt);
@@ -1508,7 +1529,7 @@ int  VbgdCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
  * @param   pInfo           The request info.
  * @param   pcbDataReturned (out) contains the number of bytes to return.
  */
-static int vbgdIoCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGuestPortInfo *pInfo, size_t *pcbDataReturned)
+static int vgdrvIoCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGuestPortInfo *pInfo, size_t *pcbDataReturned)
 {
     LogFlow(("VBOXGUEST_IOCTL_GETVMMDEVPORT\n"));
 
@@ -1528,7 +1549,7 @@ static int vbgdIoCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGuestPortInfo *
  * @param   pDevExt         The device extension.
  * @param   pNotify         The new callback information.
  */
-int vbgdIoCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSetNotifyCallback *pNotify)
+int vgdrvIoCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSetNotifyCallback *pNotify)
 {
     LogFlow(("VBOXGUEST_IOCTL_SET_MOUSE_NOTIFY_CALLBACK: pfnNotify=%p pvUser=%p\n", pNotify->pfnNotify, pNotify->pvUser));
 
@@ -1541,7 +1562,7 @@ int vbgdIoCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSet
 
 
 /**
- * Worker vbgdIoCtl_WaitEvent.
+ * Worker vgdrvIoCtl_WaitEvent.
  *
  * The caller enters the spinlock, we leave it.
  *
@@ -1552,7 +1573,7 @@ DECLINLINE(int) vbdgCheckWaitEventCondition(PVBOXGUESTDEVEXT pDevExt, PVBOXGUEST
 {
     uint32_t fMatches = pDevExt->f32PendingEvents & fReqEvents;
     if (fMatches & VBOXGUEST_ACQUIRE_STYLE_EVENTS)
-        fMatches &= vbgdGetAllowedEventMaskForSession(pDevExt, pSession);
+        fMatches &= vgdrvGetAllowedEventMaskForSession(pDevExt, pSession);
     if (fMatches || pSession->fPendingCancelWaitEvents)
     {
         ASMAtomicAndU32(&pDevExt->f32PendingEvents, ~fMatches);
@@ -1573,8 +1594,8 @@ DECLINLINE(int) vbdgCheckWaitEventCondition(PVBOXGUESTDEVEXT pDevExt, PVBOXGUEST
 }
 
 
-static int vbgdIoCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                               VBoxGuestWaitEventInfo *pInfo,  size_t *pcbDataReturned, bool fInterruptible)
+static int vgdrvIoCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                VBoxGuestWaitEventInfo *pInfo,  size_t *pcbDataReturned, bool fInterruptible)
 {
     const uint32_t  fReqEvents = pInfo->u32EventMaskIn;
     uint32_t        fResEvents;
@@ -1612,7 +1633,7 @@ static int vbgdIoCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSess
         return VERR_TIMEOUT;
     }
 
-    pWait = vbgdWaitAlloc(pDevExt, pSession);
+    pWait = vgdrvWaitAlloc(pDevExt, pSession);
     if (!pWait)
         return VERR_NO_MEMORY;
     pWait->fReqEvents = fReqEvents;
@@ -1627,7 +1648,7 @@ static int vbgdIoCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSess
     rc = vbdgCheckWaitEventCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);
     if (rc == VINF_SUCCESS)
     {
-        vbgdWaitFreeUnlocked(pDevExt, pWait);
+        vgdrvWaitFreeUnlocked(pDevExt, pWait);
         return rc;
     }
 
@@ -1651,7 +1672,7 @@ static int vbgdIoCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSess
      */
     RTSpinlockAcquire(pDevExt->EventSpinlock);
     fResEvents = pWait->fResEvents;
-    vbgdWaitFreeLocked(pDevExt, pWait);
+    vgdrvWaitFreeLocked(pDevExt, pWait);
     RTSpinlockRelease(pDevExt->EventSpinlock);
 
     /*
@@ -1695,7 +1716,7 @@ static int vbgdIoCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSess
 }
 
 
-static int vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+static int vgdrvIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
     PVBOXGUESTWAIT          pWait;
     PVBOXGUESTWAIT          pSafe;
@@ -1734,7 +1755,7 @@ static int vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
     NOREF(rc);
 
 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-    VbgdCommonWaitDoWakeUps(pDevExt);
+    VGDrvCommonWaitDoWakeUps(pDevExt);
 #endif
 
     return VINF_SUCCESS;
@@ -1745,12 +1766,13 @@ static int vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
  * Checks if the VMM request is allowed in the context of the given session.
  *
  * @returns VINF_SUCCESS or VERR_PERMISSION_DENIED.
+ * @param   pDevExt             The device extension.
  * @param   pSession            The calling session.
  * @param   enmType             The request type.
  * @param   pReqHdr             The request.
  */
-static int vbgdCheckIfVmmReqIsAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VMMDevRequestType enmType,
-                                      VMMDevRequestHeader const *pReqHdr)
+static int vgdrvCheckIfVmmReqIsAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VMMDevRequestType enmType,
+                                       VMMDevRequestHeader const *pReqHdr)
 {
     /*
      * Categorize the request being made.
@@ -1894,8 +1916,8 @@ static int vbgdCheckIfVmmReqIsAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSIO
     return VERR_PERMISSION_DENIED;
 }
 
-static int vbgdIoCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                VMMDevRequestHeader *pReqHdr, size_t cbData, size_t *pcbDataReturned)
+static int vgdrvIoCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                 VMMDevRequestHeader *pReqHdr, size_t cbData, size_t *pcbDataReturned)
 {
     int                     rc;
     VMMDevRequestHeader    *pReqCopy;
@@ -1929,7 +1951,7 @@ static int vbgdIoCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSes
         return rc;
     }
 
-    rc = vbgdCheckIfVmmReqIsAllowed(pDevExt, pSession, enmType, pReqHdr);
+    rc = vgdrvCheckIfVmmReqIsAllowed(pDevExt, pSession, enmType, pReqHdr);
     if (RT_FAILURE(rc))
     {
         Log(("VBOXGUEST_IOCTL_VMMREQUEST: Operation not allowed! type=%#x rc=%Rrc\n", enmType, rc));
@@ -1983,9 +2005,9 @@ static int vbgdIoCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSes
 
 AssertCompile(RT_INDEFINITE_WAIT == (uint32_t)RT_INDEFINITE_WAIT); /* assumed by code below */
 
-/** Worker for vbgdHgcmAsyncWaitCallback*. */
-static int vbgdHgcmAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHdr, PVBOXGUESTDEVEXT pDevExt,
-                                           bool fInterruptible, uint32_t cMillies)
+/** Worker for vgdrvHgcmAsyncWaitCallback*. */
+static int vgdrvHgcmAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHdr, PVBOXGUESTDEVEXT pDevExt,
+                                            bool fInterruptible, uint32_t cMillies)
 {
     int rc;
 
@@ -2007,7 +2029,7 @@ static int vbgdHgcmAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHd
         }
         RTSpinlockRelease(pDevExt->EventSpinlock);
 
-        pWait = vbgdWaitAlloc(pDevExt, NULL);
+        pWait = vgdrvWaitAlloc(pDevExt, NULL);
         if (pWait)
             break;
         if (fInterruptible)
@@ -2026,7 +2048,7 @@ static int vbgdHgcmAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHd
     RTListAppend(&pDevExt->HGCMWaitList, &pWait->ListNode);
     if ((pHdr->fu32Flags & VBOX_HGCM_REQ_DONE) != 0)
     {
-        vbgdWaitFreeLocked(pDevExt, pWait);
+        vgdrvWaitFreeLocked(pDevExt, pWait);
         RTSpinlockRelease(pDevExt->EventSpinlock);
         return VINF_SUCCESS;
     }
@@ -2046,9 +2068,9 @@ static int vbgdHgcmAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHd
         && rc != VERR_TIMEOUT
         && (   !fInterruptible
             || rc != VERR_INTERRUPTED))
-        LogRel(("vbgdHgcmAsyncWaitCallback: wait failed! %Rrc\n", rc));
+        LogRel(("vgdrvHgcmAsyncWaitCallback: wait failed! %Rrc\n", rc));
 
-    vbgdWaitFreeUnlocked(pDevExt, pWait);
+    vgdrvWaitFreeUnlocked(pDevExt, pWait);
     return rc;
 }
 
@@ -2056,33 +2078,33 @@ static int vbgdHgcmAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHd
 /**
  * This is a callback for dealing with async waits.
  *
- * It operates in a manner similar to vbgdIoCtl_WaitEvent.
+ * It operates in a manner similar to vgdrvIoCtl_WaitEvent.
  */
-static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
+static DECLCALLBACK(int) vgdrvHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
 {
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
-    LogFlow(("vbgdHgcmAsyncWaitCallback: requestType=%d\n", pHdr->header.requestType));
-    return vbgdHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt,
-                                           false /* fInterruptible */, u32User  /* cMillies */);
+    LogFlow(("vgdrvHgcmAsyncWaitCallback: requestType=%d\n", pHdr->header.requestType));
+    return vgdrvHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt,
+                                            false /* fInterruptible */, u32User  /* cMillies */);
 }
 
 
 /**
  * This is a callback for dealing with async waits with a timeout.
  *
- * It operates in a manner similar to vbgdIoCtl_WaitEvent.
+ * It operates in a manner similar to vgdrvIoCtl_WaitEvent.
  */
-static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallbackInterruptible(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
+static DECLCALLBACK(int) vgdrvHgcmAsyncWaitCallbackInterruptible(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
 {
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
-    LogFlow(("vbgdHgcmAsyncWaitCallbackInterruptible: requestType=%d\n", pHdr->header.requestType));
-    return vbgdHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt,
-                                           true /* fInterruptible */, u32User /* cMillies */);
+    LogFlow(("vgdrvHgcmAsyncWaitCallbackInterruptible: requestType=%d\n", pHdr->header.requestType));
+    return vgdrvHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt,
+                                            true /* fInterruptible */, u32User /* cMillies */);
 }
 
 
-static int vbgdIoCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                 VBoxGuestHGCMConnectInfo *pInfo, size_t *pcbDataReturned)
+static int vgdrvIoCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                  VBoxGuestHGCMConnectInfo *pInfo, size_t *pcbDataReturned)
 {
     int rc;
 
@@ -2095,7 +2117,7 @@ static int vbgdIoCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSe
          pInfo->Loc.type == VMMDevHGCMLoc_LocalHost || pInfo->Loc.type == VMMDevHGCMLoc_LocalHost_Existing
          ? pInfo->Loc.u.host.achName : "<not local host>"));
 
-    rc = VbglR0HGCMInternalConnect(pInfo, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
+    rc = VbglR0HGCMInternalConnect(pInfo, vgdrvHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
     if (RT_SUCCESS(rc))
     {
         Log(("VBOXGUEST_IOCTL_HGCM_CONNECT: u32Client=%RX32 result=%Rrc (rc=%Rrc)\n",
@@ -2121,7 +2143,7 @@ static int vbgdIoCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSe
                 LogRelMax(32, ("VBOXGUEST_IOCTL_HGCM_CONNECT: too many HGCMConnect calls for one session!\n"));
                 Info.result = 0;
                 Info.u32ClientID = pInfo->u32ClientID;
-                VbglR0HGCMInternalDisconnect(&Info, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
+                VbglR0HGCMInternalDisconnect(&Info, vgdrvHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
                 return VERR_TOO_MANY_OPEN_FILES;
             }
         }
@@ -2134,8 +2156,8 @@ static int vbgdIoCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSe
 }
 
 
-static int vbgdIoCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                    VBoxGuestHGCMDisconnectInfo *pInfo, size_t *pcbDataReturned)
+static int vgdrvIoCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                     VBoxGuestHGCMDisconnectInfo *pInfo, size_t *pcbDataReturned)
 {
     /*
      * Validate the client id and invalidate its entry while we're in the call.
@@ -2163,7 +2185,7 @@ static int vbgdIoCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
      * to deal with cancelled requests.
      */
     Log(("VBOXGUEST_IOCTL_HGCM_DISCONNECT: u32Client=%RX32\n", pInfo->u32ClientID));
-    rc = VbglR0HGCMInternalDisconnect(pInfo, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
+    rc = VbglR0HGCMInternalDisconnect(pInfo, vgdrvHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
     if (RT_SUCCESS(rc))
     {
         LogFlow(("VBOXGUEST_IOCTL_HGCM_DISCONNECT: result=%Rrc\n", pInfo->result));
@@ -2181,9 +2203,9 @@ static int vbgdIoCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
 }
 
 
-static int vbgdIoCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestHGCMCallInfo *pInfo,
-                              uint32_t cMillies, bool fInterruptible, bool f32bit, bool fUserData,
-                              size_t cbExtra, size_t cbData, size_t *pcbDataReturned)
+static int vgdrvIoCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestHGCMCallInfo *pInfo,
+                               uint32_t cMillies, bool fInterruptible, bool f32bit, bool fUserData,
+                               size_t cbExtra, size_t cbData, size_t *pcbDataReturned)
 {
     const uint32_t  u32ClientId = pInfo->u32ClientID;
     uint32_t        fFlags;
@@ -2241,17 +2263,17 @@ static int vbgdIoCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSessi
     if (f32bit)
     {
         if (fInterruptible)
-            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies);
+            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vgdrvHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies);
         else
-            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallback, pDevExt, cMillies);
+            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vgdrvHgcmAsyncWaitCallback, pDevExt, cMillies);
     }
     else
 #endif
     {
         if (fInterruptible)
-            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies);
+            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vgdrvHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies);
         else
-            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallback, pDevExt, cMillies);
+            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vgdrvHgcmAsyncWaitCallback, pDevExt, cMillies);
     }
     if (RT_SUCCESS(rc))
     {
@@ -2287,8 +2309,8 @@ static int vbgdIoCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSessi
  * @param   pcbDataReturned     Where to store the amount of returned data. Can
  *                              be NULL.
  */
-static int vbgdIoCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                        VBoxGuestCheckBalloonInfo *pInfo, size_t *pcbDataReturned)
+static int vgdrvIoCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                         VBoxGuestCheckBalloonInfo *pInfo, size_t *pcbDataReturned)
 {
     VMMDevGetMemBalloonChangeRequest *pReq;
     int rc;
@@ -2299,7 +2321,7 @@ static int vbgdIoCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
 
     /*
      * The first user trying to query/change the balloon becomes the
-     * owner and owns it until the session is closed (vbgdCloseMemBalloon).
+     * owner and owns it until the session is closed (vgdrvCloseMemBalloon).
      */
     if (   pDevExt->MemBalloon.pOwner != pSession
         && pDevExt->MemBalloon.pOwner == NULL)
@@ -2325,7 +2347,7 @@ static int vbgdIoCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
                 pInfo->cBalloonChunks = pReq->cBalloonChunks;
                 pInfo->fHandleInR3    = false;
 
-                rc = vbgdSetBalloonSizeKernel(pDevExt, pReq->cBalloonChunks, &pInfo->fHandleInR3);
+                rc = vgdrvSetBalloonSizeKernel(pDevExt, pReq->cBalloonChunks, &pInfo->fHandleInR3);
                 /* Ignore various out of memory failures. */
                 if (   rc == VERR_NO_MEMORY
                     || rc == VERR_NO_PHYS_MEMORY
@@ -2360,8 +2382,8 @@ static int vbgdIoCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
  * @param   pcbDataReturned     Where to store the amount of returned data. Can
  *                              be NULL.
  */
-static int vbgdIoCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                         VBoxGuestChangeBalloonInfo *pInfo, size_t *pcbDataReturned)
+static int vgdrvIoCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                          VBoxGuestChangeBalloonInfo *pInfo, size_t *pcbDataReturned)
 {
     int rc;
     LogFlow(("VBOXGUEST_IOCTL_CHANGE_BALLOON: fInflate=%RTbool u64ChunkAddr=%#RX64\n", pInfo->fInflate, pInfo->u64ChunkAddr));
@@ -2373,7 +2395,7 @@ static int vbgdIoCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
     {
         /*
          * The first user trying to query/change the balloon becomes the
-         * owner and owns it until the session is closed (vbgdCloseMemBalloon).
+         * owner and owns it until the session is closed (vgdrvCloseMemBalloon).
          */
         if (   pDevExt->MemBalloon.pOwner != pSession
             && pDevExt->MemBalloon.pOwner == NULL)
@@ -2381,7 +2403,7 @@ static int vbgdIoCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
 
         if (pDevExt->MemBalloon.pOwner == pSession)
         {
-            rc = vbgdSetBalloonSizeFromUser(pDevExt, pSession, pInfo->u64ChunkAddr, !!pInfo->fInflate);
+            rc = vgdrvSetBalloonSizeFromUser(pDevExt, pSession, pInfo->u64ChunkAddr, !!pInfo->fInflate);
             if (pcbDataReturned)
                 *pcbDataReturned = 0;
         }
@@ -2404,7 +2426,7 @@ static int vbgdIoCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
  * @param pDevExt               The device extension.
  * @param pInfo                 The output buffer.
  */
-static int vbgdIoCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreDump *pInfo)
+static int vgdrvIoCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreDump *pInfo)
 {
     VMMDevReqWriteCoreDump *pReq = NULL;
     int rc;
@@ -2436,8 +2458,10 @@ static int vbgdIoCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreD
  * @param   pch                 The log message (need not be NULL terminated).
  * @param   cbData              Size of the buffer.
  * @param   pcbDataReturned     Where to store the amount of returned data. Can be NULL.
+ * @param   fUserSession        Copy of VBOXGUESTSESSION::fUserSession for the
+ *                              call.  True normal user, false root user.
  */
-static int vbgdIoCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbData, size_t *pcbDataReturned, bool fUserSession)
+static int vgdrvIoCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbData, size_t *pcbDataReturned, bool fUserSession)
 {
     if (pDevExt->fLoggingEnabled)
         RTLogBackdoorPrintf("%.*s", cbData, pch);
@@ -2460,7 +2484,7 @@ static int vbgdIoCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbDat
  *
  * @param   pTracker            The tracker to clear.
  */
-static void vbgdBitUsageTrackerClear(PVBOXGUESTBITUSAGETRACER pTracker)
+static void vgdrvBitUsageTrackerClear(PVBOXGUESTBITUSAGETRACER pTracker)
 {
     uint32_t iBit;
     AssertCompile(sizeof(pTracker->acPerBitUsage) == 32 * sizeof(uint32_t));
@@ -2480,7 +2504,7 @@ static void vbgdBitUsageTrackerClear(PVBOXGUESTBITUSAGETRACER pTracker)
  * @param   cMax                Max valid usage value.
  * @param   pszWhat             Identifies the tracker in assertions.
  */
-static void vbgdBitUsageTrackerCheckMask(PCVBOXGUESTBITUSAGETRACER pTracker, uint32_t cMax, const char *pszWhat)
+static void vgdrvBitUsageTrackerCheckMask(PCVBOXGUESTBITUSAGETRACER pTracker, uint32_t cMax, const char *pszWhat)
 {
     uint32_t fMask = 0;
     uint32_t iBit;
@@ -2510,8 +2534,8 @@ static void vbgdBitUsageTrackerCheckMask(PCVBOXGUESTBITUSAGETRACER pTracker, uin
  * @param   cMax                The max valid usage value for assertions.
  * @param   pszWhat             Identifies the tracker in assertions.
  */
-static bool vbgdBitUsageTrackerChange(PVBOXGUESTBITUSAGETRACER pTracker, uint32_t fChanged, uint32_t fPrevious,
-                                      uint32_t cMax, const char *pszWhat)
+static bool vgdrvBitUsageTrackerChange(PVBOXGUESTBITUSAGETRACER pTracker, uint32_t fChanged, uint32_t fPrevious,
+                                       uint32_t cMax, const char *pszWhat)
 {
     bool fGlobalChange = false;
     AssertCompile(sizeof(pTracker->acPerBitUsage) == 32 * sizeof(uint32_t));
@@ -2549,7 +2573,7 @@ static bool vbgdBitUsageTrackerChange(PVBOXGUESTBITUSAGETRACER pTracker, uint32_
     }
 
 #ifdef VBOX_STRICT
-    vbgdBitUsageTrackerCheckMask(pTracker, cMax, pszWhat);
+    vgdrvBitUsageTrackerCheckMask(pTracker, cMax, pszWhat);
 #endif
     NOREF(pszWhat); NOREF(cMax);
     return fGlobalChange;
@@ -2563,7 +2587,7 @@ static bool vbgdBitUsageTrackerChange(PVBOXGUESTBITUSAGETRACER pTracker, uint32_
  * @param   pDevExt         The device extension.
  * @param   fFixedEvents    Fixed events (init time).
  */
-static int vbgdResetEventFilterOnHost(PVBOXGUESTDEVEXT pDevExt, uint32_t fFixedEvents)
+static int vgdrvResetEventFilterOnHost(PVBOXGUESTDEVEXT pDevExt, uint32_t fFixedEvents)
 {
     VMMDevCtlGuestFilterMask *pReq;
     int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_CtlGuestFilterMask);
@@ -2598,8 +2622,8 @@ static int vbgdResetEventFilterOnHost(PVBOXGUESTDEVEXT pDevExt, uint32_t fFixedE
  *
  * @remarks Takes the session spinlock.
  */
-static int vbgdSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                     uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination)
+static int vgdrvSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                      uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination)
 {
     VMMDevCtlGuestFilterMask   *pReq;
     uint32_t                    fChanged;
@@ -2614,7 +2638,7 @@ static int vbgdSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
     { /* nothing */ }
     else if (!fSessionTermination)
     {
-        LogRel(("vbgdSetSessionFilterMask: VbglGRAlloc failure: %Rrc\n", rc));
+        LogRel(("vgdrvSetSessionFilterMask: VbglGRAlloc failure: %Rrc\n", rc));
         return rc;
     }
     else
@@ -2636,8 +2660,8 @@ static int vbgdSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
     fChanged = fPrevious ^ pSession->fEventFilter;
     if (fChanged)
     {
-        bool fGlobalChange = vbgdBitUsageTrackerChange(&pDevExt->EventFilterTracker, fChanged, fPrevious,
-                                                       pDevExt->cSessions, "EventFilterTracker");
+        bool fGlobalChange = vgdrvBitUsageTrackerChange(&pDevExt->EventFilterTracker, fChanged, fPrevious,
+                                                        pDevExt->cSessions, "EventFilterTracker");
 
         /*
          * If there are global changes, update the event filter on the host.
@@ -2663,8 +2687,8 @@ static int vbgdSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
                         pDevExt->fEventFilterHost = UINT32_MAX;
                         if (!fSessionTermination)
                         {
-                            vbgdBitUsageTrackerChange(&pDevExt->EventFilterTracker, fChanged, pSession->fEventFilter,
-                                                      pDevExt->cSessions, "EventFilterTracker");
+                            vgdrvBitUsageTrackerChange(&pDevExt->EventFilterTracker, fChanged, pSession->fEventFilter,
+                                                       pDevExt->cSessions, "EventFilterTracker");
                             pSession->fEventFilter = fPrevious;
                         }
                     }
@@ -2691,7 +2715,7 @@ static int vbgdSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
  * @param   pSession            The session.
  * @param   pInfo               The request.
  */
-static int vbgdIoCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestFilterMaskInfo *pInfo)
+static int vgdrvIoCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestFilterMaskInfo *pInfo)
 {
     LogFlow(("VBOXGUEST_IOCTL_CTL_FILTER_MASK: or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask));
 
@@ -2701,7 +2725,7 @@ static int vbgdIoCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION p
         return VERR_INVALID_PARAMETER;
     }
 
-    return vbgdSetSessionEventFilter(pDevExt, pSession, pInfo->u32OrMask, pInfo->u32NotMask, false /*fSessionTermination*/);
+    return vgdrvSetSessionEventFilter(pDevExt, pSession, pInfo->u32OrMask, pInfo->u32NotMask, false /*fSessionTermination*/);
 }
 
 
@@ -2711,7 +2735,7 @@ static int vbgdIoCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION p
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
  */
-static int vbgdResetMouseStatusOnHost(PVBOXGUESTDEVEXT pDevExt)
+static int vgdrvResetMouseStatusOnHost(PVBOXGUESTDEVEXT pDevExt)
 {
     VMMDevReqMouseStatus *pReq;
     int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetMouseStatus);
@@ -2747,8 +2771,8 @@ static int vbgdResetMouseStatusOnHost(PVBOXGUESTDEVEXT pDevExt)
  *
  * @remarks Takes the session spinlock.
  */
-static int vbgdSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                     uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination)
+static int vgdrvSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                      uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination)
 {
     VMMDevReqMouseStatus   *pReq;
     uint32_t                fChanged;
@@ -2763,7 +2787,7 @@ static int vbgdSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
     { /* nothing */ }
     else if (!fSessionTermination)
     {
-        LogRel(("vbgdSetSessionMouseStatus: VbglGRAlloc failure: %Rrc\n", rc));
+        LogRel(("vgdrvSetSessionMouseStatus: VbglGRAlloc failure: %Rrc\n", rc));
         return rc;
     }
     else
@@ -2785,8 +2809,8 @@ static int vbgdSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
     fChanged = fPrevious ^ pSession->fMouseStatus;
     if (fChanged)
     {
-        bool fGlobalChange = vbgdBitUsageTrackerChange(&pDevExt->MouseStatusTracker, fChanged, fPrevious,
-                                                       pDevExt->cSessions, "MouseStatusTracker");
+        bool fGlobalChange = vgdrvBitUsageTrackerChange(&pDevExt->MouseStatusTracker, fChanged, fPrevious,
+                                                        pDevExt->cSessions, "MouseStatusTracker");
 
         /*
          * If there are global changes, update the event filter on the host.
@@ -2813,8 +2837,8 @@ static int vbgdSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
                         pDevExt->fMouseStatusHost = UINT32_MAX;
                         if (!fSessionTermination)
                         {
-                            vbgdBitUsageTrackerChange(&pDevExt->MouseStatusTracker, fChanged, pSession->fMouseStatus,
-                                                      pDevExt->cSessions, "MouseStatusTracker");
+                            vgdrvBitUsageTrackerChange(&pDevExt->MouseStatusTracker, fChanged, pSession->fMouseStatus,
+                                                       pDevExt->cSessions, "MouseStatusTracker");
                             pSession->fMouseStatus = fPrevious;
                         }
                     }
@@ -2841,14 +2865,14 @@ static int vbgdSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
  * @param   pSession            The session.
  * @param   fFeatures           New bitmap of enabled features.
  */
-static int vbgdIoCtl_SetMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fFeatures)
+static int vgdrvIoCtl_SetMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fFeatures)
 {
     LogFlow(("VBOXGUEST_IOCTL_SET_MOUSE_STATUS: features=%#x\n", fFeatures));
 
     if (fFeatures & ~VMMDEV_MOUSE_GUEST_MASK)
         return VERR_INVALID_PARAMETER;
 
-    return vbgdSetSessionMouseStatus(pDevExt, pSession, fFeatures, ~fFeatures, false /*fSessionTermination*/);
+    return vgdrvSetSessionMouseStatus(pDevExt, pSession, fFeatures, ~fFeatures, false /*fSessionTermination*/);
 }
 
 
@@ -2870,7 +2894,7 @@ static int vbgdIoCtl_SetMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
  * @remarks Needs only be called when dispatching events in the
  *          VBOXGUEST_ACQUIRE_STYLE_EVENTS mask.
  */
-static uint32_t vbgdGetAllowedEventMaskForSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+static uint32_t vgdrvGetAllowedEventMaskForSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
     uint32_t fAcquireModeGuestCaps;
     uint32_t fAcquiredGuestCaps;
@@ -2908,7 +2932,7 @@ static uint32_t vbgdGetAllowedEventMaskForSession(PVBOXGUESTDEVEXT pDevExt, PVBO
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
  */
-static int vbgdResetCapabilitiesOnHost(PVBOXGUESTDEVEXT pDevExt)
+static int vgdrvResetCapabilitiesOnHost(PVBOXGUESTDEVEXT pDevExt)
 {
     VMMDevReqGuestCapabilities2 *pReq;
     int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetGuestCapabilities);
@@ -2933,9 +2957,10 @@ static int vbgdResetCapabilitiesOnHost(PVBOXGUESTDEVEXT pDevExt)
  * we'll simply clear all bits we don't set.
  *
  * @returns VBox status code.
- * @param   fMask       The new mask.
+ * @param   pDevExt             The device extension.
+ * @param   pReq                The request.
  */
-static int vbgdUpdateCapabilitiesOnHostWithReqAndLock(PVBOXGUESTDEVEXT pDevExt, VMMDevReqGuestCapabilities2 *pReq)
+static int vgdrvUpdateCapabilitiesOnHostWithReqAndLock(PVBOXGUESTDEVEXT pDevExt, VMMDevReqGuestCapabilities2 *pReq)
 {
     int rc;
 
@@ -2981,9 +3006,9 @@ static int vbgdUpdateCapabilitiesOnHostWithReqAndLock(PVBOXGUESTDEVEXT pDevExt,
  *
  * @remarks Takes both the session and event spinlocks.
  */
-static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                          uint32_t fOrMask, uint32_t fNotMask, VBOXGUESTCAPSACQUIRE_FLAGS enmFlags,
-                                          bool fSessionTermination)
+static int vgdrvAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                           uint32_t fOrMask, uint32_t fNotMask, VBOXGUESTCAPSACQUIRE_FLAGS enmFlags,
+                                           bool fSessionTermination)
 {
     uint32_t fCurrentOwnedCaps;
     uint32_t fSessionRemovedCaps;
@@ -3000,7 +3025,7 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
                     | VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING
                     | VMMDEV_GUEST_SUPPORTS_GRAPHICS ) )
     {
-        LogRel(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x -- invalid fOrMask\n",
+        LogRel(("vgdrvAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x -- invalid fOrMask\n",
                 pSession, fOrMask, fNotMask, enmFlags));
         return VERR_INVALID_PARAMETER;
     }
@@ -3008,7 +3033,7 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
     if (   enmFlags != VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE
         && enmFlags != VBOXGUESTCAPSACQUIRE_FLAGS_NONE)
     {
-        LogRel(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: invalid enmFlags %d\n",
+        LogRel(("vgdrvAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: invalid enmFlags %d\n",
                 pSession, fOrMask, fNotMask, enmFlags));
         return VERR_INVALID_PARAMETER;
     }
@@ -3028,7 +3053,7 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
         { /* do nothing */ }
         else if (!fSessionTermination)
         {
-            LogRel(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: VbglGRAlloc failure: %Rrc\n",
+            LogRel(("vgdrvAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: VbglGRAlloc failure: %Rrc\n",
                     pSession, fOrMask, fNotMask, enmFlags, rc));
             return rc;
         }
@@ -3053,7 +3078,7 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
         if (pReq)
             VbglGRFree(&pReq->header);
         AssertMsgFailed(("Trying to change caps mode: %#x\n", fOrMask));
-        LogRel(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: calling caps acquire for set caps\n",
+        LogRel(("vgdrvAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: calling caps acquire for set caps\n",
                 pSession, fOrMask, fNotMask, enmFlags));
         return VERR_INVALID_STATE;
     }
@@ -3066,7 +3091,7 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
         RTSpinlockRelease(pDevExt->EventSpinlock);
 
         Assert(!pReq);
-        Log(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: configured acquire caps: 0x%x\n",
+        Log(("vgdrvAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: configured acquire caps: 0x%x\n",
              pSession, fOrMask, fNotMask, enmFlags));
         return VINF_SUCCESS;
     }
@@ -3106,7 +3131,7 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
             Assert(pReq || fSessionTermination);
             if (pReq)
             {
-                rc = vbgdUpdateCapabilitiesOnHostWithReqAndLock(pDevExt, pReq);
+                rc = vgdrvUpdateCapabilitiesOnHostWithReqAndLock(pDevExt, pReq);
                 if (RT_FAILURE(rc) && !fSessionTermination)
                 {
                     /* Failed, roll back. */
@@ -3122,7 +3147,7 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
                     }
 
                     RTSpinlockRelease(pDevExt->EventSpinlock);
-                    LogRel(("vbgdAcquireSessionCapabilities: vbgdUpdateCapabilitiesOnHostWithReqAndLock failed: rc=%Rrc\n", rc));
+                    LogRel(("vgdrvAcquireSessionCapabilities: vgdrvUpdateCapabilitiesOnHostWithReqAndLock failed: rc=%Rrc\n", rc));
                     VbglGRFree(&pReq->header);
                     return rc;
                 }
@@ -3133,7 +3158,7 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
     {
         RTSpinlockRelease(pDevExt->EventSpinlock);
 
-        Log(("vbgdAcquireSessionCapabilities: Caps %#x were busy\n", fOtherConflictingCaps));
+        Log(("vgdrvAcquireSessionCapabilities: Caps %#x were busy\n", fOtherConflictingCaps));
         VbglGRFree(&pReq->header);
         return VERR_RESOURCE_BUSY;
     }
@@ -3160,11 +3185,11 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
 
         RTSpinlockAcquire(pDevExt->EventSpinlock);
         if (fGenFakeEvents || pDevExt->f32PendingEvents)
-            vbgdDispatchEventsLocked(pDevExt, fGenFakeEvents);
+            vgdrvDispatchEventsLocked(pDevExt, fGenFakeEvents);
         RTSpinlockRelease(pDevExt->EventSpinlock);
 
 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-        VbgdCommonWaitDoWakeUps(pDevExt);
+        VGDrvCommonWaitDoWakeUps(pDevExt);
 #endif
     }
 
@@ -3181,16 +3206,16 @@ static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
  * @param   pSession            The session.
  * @param   pAcquire            The request.
  */
-static int vbgdIoCtl_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestCapsAquire *pAcquire)
+static int vgdrvIoCtl_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestCapsAquire *pAcquire)
 {
     int rc;
     LogFlow(("VBOXGUEST_IOCTL_GUEST_CAPS_ACQUIRE: or=%#x not=%#x flags=%#x\n",
              pAcquire->u32OrMask, pAcquire->u32NotMask, pAcquire->enmFlags));
 
-    rc = vbgdAcquireSessionCapabilities(pDevExt, pSession, pAcquire->u32OrMask, pAcquire->u32NotMask, pAcquire->enmFlags,
-                                        false /*fSessionTermination*/);
+    rc = vgdrvAcquireSessionCapabilities(pDevExt, pSession, pAcquire->u32OrMask, pAcquire->u32NotMask, pAcquire->enmFlags,
+                                         false /*fSessionTermination*/);
     if (RT_FAILURE(rc))
-        LogRel(("VbgdCommonIoCtl: GUEST_CAPS_ACQUIRE failed rc=%Rrc\n", rc));
+        LogRel(("VGDrvCommonIoCtl: GUEST_CAPS_ACQUIRE failed rc=%Rrc\n", rc));
     pAcquire->rc = rc;
     return VINF_SUCCESS;
 }
@@ -3211,8 +3236,8 @@ static int vbgdIoCtl_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSIO
  *
  * @remarks Takes the session spinlock.
  */
-static int vbgdSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                      uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination)
+static int vgdrvSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                       uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination)
 {
     /*
      * Preallocate a request buffer so we can do all in one go without leaving the spinlock.
@@ -3223,7 +3248,7 @@ static int vbgdSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSIO
     { /* nothing */ }
     else if (!fSessionTermination)
     {
-        LogRel(("vbgdSetSessionCapabilities: VbglGRAlloc failure: %Rrc\n", rc));
+        LogRel(("vgdrvSetSessionCapabilities: VbglGRAlloc failure: %Rrc\n", rc));
         return rc;
     }
     else
@@ -3254,8 +3279,8 @@ static int vbgdSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSIO
         fChanged = fPrevious ^ pSession->fCapabilities;
         if (fChanged)
         {
-            bool fGlobalChange = vbgdBitUsageTrackerChange(&pDevExt->SetGuestCapsTracker, fChanged, fPrevious,
-                                                           pDevExt->cSessions, "SetGuestCapsTracker");
+            bool fGlobalChange = vgdrvBitUsageTrackerChange(&pDevExt->SetGuestCapsTracker, fChanged, fPrevious,
+                                                            pDevExt->cSessions, "SetGuestCapsTracker");
 
             /*
              * If there are global changes, update the capabilities on the host.
@@ -3265,13 +3290,13 @@ static int vbgdSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSIO
                 Assert(pReq || fSessionTermination);
                 if (pReq)
                 {
-                    rc = vbgdUpdateCapabilitiesOnHostWithReqAndLock(pDevExt, pReq);
+                    rc = vgdrvUpdateCapabilitiesOnHostWithReqAndLock(pDevExt, pReq);
 
                     /* On failure, roll back (unless it's session termination time). */
                     if (RT_FAILURE(rc) && !fSessionTermination)
                     {
-                        vbgdBitUsageTrackerChange(&pDevExt->SetGuestCapsTracker, fChanged, pSession->fCapabilities,
-                                                  pDevExt->cSessions, "SetGuestCapsTracker");
+                        vgdrvBitUsageTrackerChange(&pDevExt->SetGuestCapsTracker, fChanged, pSession->fCapabilities,
+                                                   pDevExt->cSessions, "SetGuestCapsTracker");
                         pSession->fCapabilities = fPrevious;
                     }
                 }
@@ -3299,13 +3324,13 @@ static int vbgdSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSIO
  * @param   pSession            The session.
  * @param   pInfo               The request.
  */
-static int vbgdIoCtl_SetCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestSetCapabilitiesInfo *pInfo)
+static int vgdrvIoCtl_SetCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestSetCapabilitiesInfo *pInfo)
 {
     int rc;
     LogFlow(("VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES: or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask));
 
     if (!((pInfo->u32OrMask | pInfo->u32NotMask) & ~VMMDEV_GUEST_CAPABILITIES_MASK))
-        rc = vbgdSetSessionCapabilities(pDevExt, pSession, pInfo->u32OrMask, pInfo->u32NotMask, false /*fSessionTermination*/);
+        rc = vgdrvSetSessionCapabilities(pDevExt, pSession, pInfo->u32OrMask, pInfo->u32NotMask, false /*fSessionTermination*/);
     else
         rc = VERR_INVALID_PARAMETER;
 
@@ -3330,11 +3355,11 @@ static int vbgdIoCtl_SetCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
  * @param   cbData              The max size of the data buffer.
  * @param   pcbDataReturned     Where to store the amount of returned data. Can be NULL.
  */
-int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                    void *pvData, size_t cbData, size_t *pcbDataReturned)
+int VGDrvCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                     void *pvData, size_t cbData, size_t *pcbDataReturned)
 {
     int rc;
-    LogFlow(("VbgdCommonIoCtl: iFunction=%#x pDevExt=%p pSession=%p pvData=%p cbData=%zu\n",
+    LogFlow(("VGDrvCommonIoCtl: iFunction=%#x pDevExt=%p pSession=%p pvData=%p cbData=%zu\n",
              iFunction, pDevExt, pSession, pvData, cbData));
 
     /*
@@ -3392,7 +3417,7 @@ int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
     if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_VMMREQUEST(0)))
     {
         CHECKRET_MIN_SIZE("VMMREQUEST", sizeof(VMMDevRequestHeader));
-        rc = vbgdIoCtl_VMMRequest(pDevExt, pSession, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned);
+        rc = vgdrvIoCtl_VMMRequest(pDevExt, pSession, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned);
     }
 #ifdef VBOX_WITH_HGCM
     /*
@@ -3402,51 +3427,51 @@ int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
     {
         bool fInterruptible = pSession->R0Process != NIL_RTR0PROCESS;
         CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo));
-        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
-                                fInterruptible, false /*f32bit*/, false /* fUserData */,
-                                0, cbData, pcbDataReturned);
+        rc = vgdrvIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
+                                 fInterruptible, false /*f32bit*/, false /* fUserData */,
+                                 0, cbData, pcbDataReturned);
     }
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED(0)))
     {
         VBoxGuestHGCMCallInfoTimed *pInfo = (VBoxGuestHGCMCallInfoTimed *)pvData;
         CHECKRET_MIN_SIZE("HGCM_CALL_TIMED", sizeof(VBoxGuestHGCMCallInfoTimed));
-        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
-                                !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
-                                false /*f32bit*/, false /* fUserData */,
-                                RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
+        rc = vgdrvIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
+                                 !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
+                                 false /*f32bit*/, false /* fUserData */,
+                                 RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
     }
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(0)))
     {
         bool fInterruptible = true;
         CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo));
-        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
-                                fInterruptible, false /*f32bit*/, true /* fUserData */,
-                                0, cbData, pcbDataReturned);
+        rc = vgdrvIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
+                                 fInterruptible, false /*f32bit*/, true /* fUserData */,
+                                 0, cbData, pcbDataReturned);
     }
 # ifdef RT_ARCH_AMD64
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_32(0)))
     {
         bool fInterruptible = pSession->R0Process != NIL_RTR0PROCESS;
         CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo));
-        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
-                                fInterruptible, true /*f32bit*/, false /* fUserData */,
-                                0, cbData, pcbDataReturned);
+        rc = vgdrvIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
+                                 fInterruptible, true /*f32bit*/, false /* fUserData */,
+                                 0, cbData, pcbDataReturned);
     }
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED_32(0)))
     {
         CHECKRET_MIN_SIZE("HGCM_CALL_TIMED", sizeof(VBoxGuestHGCMCallInfoTimed));
         VBoxGuestHGCMCallInfoTimed *pInfo = (VBoxGuestHGCMCallInfoTimed *)pvData;
-        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
-                                !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
-                                true /*f32bit*/, false /* fUserData */,
-                                RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
+        rc = vgdrvIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
+                                 !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
+                                 true /*f32bit*/, false /* fUserData */,
+                                 RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
     }
 # endif
 #endif /* VBOX_WITH_HGCM */
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_LOG(0)))
     {
         CHECKRET_MIN_SIZE("LOG", 1);
-        rc = vbgdIoCtl_Log(pDevExt, (char *)pvData, cbData, pcbDataReturned, pSession->fUserSession);
+        rc = vgdrvIoCtl_Log(pDevExt, (char *)pvData, cbData, pcbDataReturned, pSession->fUserSession);
     }
     else
     {
@@ -3455,31 +3480,31 @@ int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
             case VBOXGUEST_IOCTL_GETVMMDEVPORT:
                 CHECKRET_RING0("GETVMMDEVPORT");
                 CHECKRET_MIN_SIZE("GETVMMDEVPORT", sizeof(VBoxGuestPortInfo));
-                rc = vbgdIoCtl_GetVMMDevPort(pDevExt, (VBoxGuestPortInfo *)pvData, pcbDataReturned);
+                rc = vgdrvIoCtl_GetVMMDevPort(pDevExt, (VBoxGuestPortInfo *)pvData, pcbDataReturned);
                 break;
 
 #ifndef RT_OS_WINDOWS  /* Windows has its own implementation of this. */
             case VBOXGUEST_IOCTL_SET_MOUSE_NOTIFY_CALLBACK:
                 CHECKRET_RING0("SET_MOUSE_NOTIFY_CALLBACK");
                 CHECKRET_SIZE("SET_MOUSE_NOTIFY_CALLBACK", sizeof(VBoxGuestMouseSetNotifyCallback));
-                rc = vbgdIoCtl_SetMouseNotifyCallback(pDevExt, (VBoxGuestMouseSetNotifyCallback *)pvData);
+                rc = vgdrvIoCtl_SetMouseNotifyCallback(pDevExt, (VBoxGuestMouseSetNotifyCallback *)pvData);
                 break;
 #endif
 
             case VBOXGUEST_IOCTL_WAITEVENT:
                 CHECKRET_MIN_SIZE("WAITEVENT", sizeof(VBoxGuestWaitEventInfo));
-                rc = vbgdIoCtl_WaitEvent(pDevExt, pSession, (VBoxGuestWaitEventInfo *)pvData,
-                                                    pcbDataReturned, pSession->R0Process != NIL_RTR0PROCESS);
+                rc = vgdrvIoCtl_WaitEvent(pDevExt, pSession, (VBoxGuestWaitEventInfo *)pvData,
+                                          pcbDataReturned, pSession->R0Process != NIL_RTR0PROCESS);
                 break;
 
             case VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS:
                 CHECKRET_SIZE("CANCEL_ALL_WAITEVENTS", 0);
-                rc = vbgdIoCtl_CancelAllWaitEvents(pDevExt, pSession);
+                rc = vgdrvIoCtl_CancelAllWaitEvents(pDevExt, pSession);
                 break;
 
             case VBOXGUEST_IOCTL_CTL_FILTER_MASK:
                 CHECKRET_MIN_SIZE("CTL_FILTER_MASK", sizeof(VBoxGuestFilterMaskInfo));
-                rc = vbgdIoCtl_CtlFilterMask(pDevExt, pSession, (VBoxGuestFilterMaskInfo *)pvData);
+                rc = vgdrvIoCtl_CtlFilterMask(pDevExt, pSession, (VBoxGuestFilterMaskInfo *)pvData);
                 break;
 
 #ifdef VBOX_WITH_HGCM
@@ -3488,7 +3513,7 @@ int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
             case VBOXGUEST_IOCTL_HGCM_CONNECT_32:
 # endif
                 CHECKRET_MIN_SIZE("HGCM_CONNECT", sizeof(VBoxGuestHGCMConnectInfo));
-                rc = vbgdIoCtl_HGCMConnect(pDevExt, pSession, (VBoxGuestHGCMConnectInfo *)pvData, pcbDataReturned);
+                rc = vgdrvIoCtl_HGCMConnect(pDevExt, pSession, (VBoxGuestHGCMConnectInfo *)pvData, pcbDataReturned);
                 break;
 
             case VBOXGUEST_IOCTL_HGCM_DISCONNECT:
@@ -3496,51 +3521,51 @@ int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
             case VBOXGUEST_IOCTL_HGCM_DISCONNECT_32:
 # endif
                 CHECKRET_MIN_SIZE("HGCM_DISCONNECT", sizeof(VBoxGuestHGCMDisconnectInfo));
-                rc = vbgdIoCtl_HGCMDisconnect(pDevExt, pSession, (VBoxGuestHGCMDisconnectInfo *)pvData, pcbDataReturned);
+                rc = vgdrvIoCtl_HGCMDisconnect(pDevExt, pSession, (VBoxGuestHGCMDisconnectInfo *)pvData, pcbDataReturned);
                 break;
 #endif /* VBOX_WITH_HGCM */
 
             case VBOXGUEST_IOCTL_CHECK_BALLOON:
                 CHECKRET_MIN_SIZE("CHECK_MEMORY_BALLOON", sizeof(VBoxGuestCheckBalloonInfo));
-                rc = vbgdIoCtl_CheckMemoryBalloon(pDevExt, pSession, (VBoxGuestCheckBalloonInfo *)pvData, pcbDataReturned);
+                rc = vgdrvIoCtl_CheckMemoryBalloon(pDevExt, pSession, (VBoxGuestCheckBalloonInfo *)pvData, pcbDataReturned);
                 break;
 
             case VBOXGUEST_IOCTL_CHANGE_BALLOON:
                 CHECKRET_MIN_SIZE("CHANGE_MEMORY_BALLOON", sizeof(VBoxGuestChangeBalloonInfo));
-                rc = vbgdIoCtl_ChangeMemoryBalloon(pDevExt, pSession, (VBoxGuestChangeBalloonInfo *)pvData, pcbDataReturned);
+                rc = vgdrvIoCtl_ChangeMemoryBalloon(pDevExt, pSession, (VBoxGuestChangeBalloonInfo *)pvData, pcbDataReturned);
                 break;
 
             case VBOXGUEST_IOCTL_WRITE_CORE_DUMP:
                 CHECKRET_MIN_SIZE("WRITE_CORE_DUMP", sizeof(VBoxGuestWriteCoreDump));
-                rc = vbgdIoCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData);
+                rc = vgdrvIoCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData);
                 break;
 
             case VBOXGUEST_IOCTL_SET_MOUSE_STATUS:
                 CHECKRET_SIZE("SET_MOUSE_STATUS", sizeof(uint32_t));
-                rc = vbgdIoCtl_SetMouseStatus(pDevExt, pSession, *(uint32_t *)pvData);
+                rc = vgdrvIoCtl_SetMouseStatus(pDevExt, pSession, *(uint32_t *)pvData);
                 break;
 
 #ifdef VBOX_WITH_DPC_LATENCY_CHECKER
             case VBOXGUEST_IOCTL_DPC_LATENCY_CHECKER:
                 CHECKRET_SIZE("DPC_LATENCY_CHECKER", 0);
-                rc = VbgdNtIOCtl_DpcLatencyChecker();
+                rc = VGDrvNtIOCtl_DpcLatencyChecker();
                 break;
 #endif
 
             case VBOXGUEST_IOCTL_GUEST_CAPS_ACQUIRE:
                 CHECKRET_SIZE("GUEST_CAPS_ACQUIRE", sizeof(VBoxGuestCapsAquire));
-                rc = vbgdIoCtl_GuestCapsAcquire(pDevExt, pSession, (VBoxGuestCapsAquire *)pvData);
+                rc = vgdrvIoCtl_GuestCapsAcquire(pDevExt, pSession, (VBoxGuestCapsAquire *)pvData);
                 *pcbDataReturned = sizeof(VBoxGuestCapsAquire);
                 break;
 
             case VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES:
                 CHECKRET_MIN_SIZE("SET_GUEST_CAPABILITIES", sizeof(VBoxGuestSetCapabilitiesInfo));
-                rc = vbgdIoCtl_SetCapabilities(pDevExt, pSession, (VBoxGuestSetCapabilitiesInfo *)pvData);
+                rc = vgdrvIoCtl_SetCapabilities(pDevExt, pSession, (VBoxGuestSetCapabilitiesInfo *)pvData);
                 break;
 
             default:
             {
-                LogRel(("VbgdCommonIoCtl: Unknown request iFunction=%#x stripped size=%#x\n",
+                LogRel(("VGDrvCommonIoCtl: Unknown request iFunction=%#x stripped size=%#x\n",
                         iFunction, VBOXGUEST_IOCTL_STRIP_SIZE(iFunction)));
                 rc = VERR_NOT_SUPPORTED;
                 break;
@@ -3548,20 +3573,20 @@ int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
         }
     }
 
-    LogFlow(("VbgdCommonIoCtl: returns %Rrc *pcbDataReturned=%zu\n", rc, pcbDataReturned ? *pcbDataReturned : 0));
+    LogFlow(("VGDrvCommonIoCtl: returns %Rrc *pcbDataReturned=%zu\n", rc, pcbDataReturned ? *pcbDataReturned : 0));
     return rc;
 }
 
 
 /**
- * Used by VbgdCommonISR as well as the acquire guest capability code.
+ * Used by VGDrvCommonISR as well as the acquire guest capability code.
  *
  * @returns VINF_SUCCESS on success. On failure, ORed together
  *          RTSemEventMultiSignal errors (completes processing despite errors).
  * @param   pDevExt             The VBoxGuest device extension.
  * @param   fEvents             The events to dispatch.
  */
-static int vbgdDispatchEventsLocked(PVBOXGUESTDEVEXT pDevExt, uint32_t fEvents)
+static int vgdrvDispatchEventsLocked(PVBOXGUESTDEVEXT pDevExt, uint32_t fEvents)
 {
     PVBOXGUESTWAIT  pWait;
     PVBOXGUESTWAIT  pSafe;
@@ -3578,7 +3603,7 @@ static int vbgdDispatchEventsLocked(PVBOXGUESTDEVEXT pDevExt, uint32_t fEvents)
             /* Does this one wait on any of the events we're dispatching?  We do a quick
                check first, then deal with VBOXGUEST_ACQUIRE_STYLE_EVENTS as applicable. */
             if (fHandledEvents & VBOXGUEST_ACQUIRE_STYLE_EVENTS)
-                fHandledEvents &= vbgdGetAllowedEventMaskForSession(pDevExt, pWait->pSession);
+                fHandledEvents &= vgdrvGetAllowedEventMaskForSession(pDevExt, pWait->pSession);
             if (fHandledEvents)
             {
                 pWait->fResEvents = pWait->fReqEvents & fEvents & fHandledEvents;
@@ -3609,7 +3634,7 @@ static int vbgdDispatchEventsLocked(PVBOXGUESTDEVEXT pDevExt, uint32_t fEvents)
  * @returns true if it was our interrupt, false if it wasn't.
  * @param   pDevExt     The VBoxGuest device extension.
  */
-bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt)
+bool VGDrvCommonISR(PVBOXGUESTDEVEXT pDevExt)
 {
     VMMDevEvents volatile  *pReq                  = pDevExt->pIrqAckEvents;
     bool                    fMousePositionChanged = false;
@@ -3642,7 +3667,7 @@ bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt)
         {
             uint32_t        fEvents = pReq->events;
 
-            Log3(("VbgdCommonISR: acknowledge events succeeded %#RX32\n", fEvents));
+            Log3(("VGDrvCommonISR: acknowledge events succeeded %#RX32\n", fEvents));
 
             /*
              * VMMDEV_EVENT_MOUSE_POSITION_CHANGED can only be polled for.
@@ -3686,14 +3711,14 @@ bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt)
             /*
              * Normal FIFO waiter evaluation.
              */
-            rc |= vbgdDispatchEventsLocked(pDevExt, fEvents);
+            rc |= vgdrvDispatchEventsLocked(pDevExt, fEvents);
         }
         else /* something is serious wrong... */
-            Log(("VbgdCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n",
+            Log(("VGDrvCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n",
                  pReq->header.rc, pReq->events));
     }
     else
-        Log3(("VbgdCommonISR: not ours\n"));
+        Log3(("VGDrvCommonISR: not ours\n"));
 
     RTSpinlockRelease(pDevExt->EventSpinlock);
 
@@ -3703,7 +3728,7 @@ bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt)
      * Note. On Windows this isn't possible at this IRQL, so a DPC will take
      *       care of it.  Same on darwin, doing it in the work loop callback.
      */
-    VbgdCommonWaitDoWakeUps(pDevExt);
+    VGDrvCommonWaitDoWakeUps(pDevExt);
 #endif
 
     /*
@@ -3713,7 +3738,7 @@ bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt)
     if (fMousePositionChanged)
     {
         ASMAtomicIncU32(&pDevExt->u32MousePosChangedSeq);
-        VbgdNativeISRMousePollEvent(pDevExt);
+        VGDrvNativeISRMousePollEvent(pDevExt);
     }
 
     Assert(rc == 0);
index f6bac0f6ad33691824670e6b5de2eae5965551e7..2d2819aa6b7b38947cf503a7aa64a8386bf9196c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Rev: 98751 $ */
+/* $Rev: 103598 $ */
 /** @file
  * VBoxGuest - Inter Driver Communication, unix implementation.
  *
@@ -68,7 +68,7 @@ DECLEXPORT(void *) VBOXCALL VBoxGuestIDCOpen(uint32_t *pu32Version)
     mutex_exit(&g_LdiMtx);
 #endif
 
-    rc = VbgdCommonCreateKernelSession(&g_DevExt, &pSession);
+    rc = VGDrvCommonCreateKernelSession(&g_DevExt, &pSession);
     if (RT_SUCCESS(rc))
     {
         *pu32Version = VMMDEV_VERSION;
@@ -88,7 +88,7 @@ DECLEXPORT(void *) VBOXCALL VBoxGuestIDCOpen(uint32_t *pu32Version)
     mutex_exit(&g_LdiMtx);
 #endif
 
-    LogRel(("VBoxGuestIDCOpen: VbgdCommonCreateKernelSession failed. rc=%d\n", rc));
+    LogRel(("VBoxGuestIDCOpen: VGDrvCommonCreateKernelSession failed. rc=%d\n", rc));
     return NULL;
 }
 
@@ -97,15 +97,15 @@ DECLEXPORT(void *) VBOXCALL VBoxGuestIDCOpen(uint32_t *pu32Version)
  * Close an IDC connection.
  *
  * @returns VBox error code.
- * @param   pvState             Opaque pointer to the session object.
+ * @param   pvSession           Opaque pointer to the session object.
  */
 DECLEXPORT(int) VBOXCALL VBoxGuestIDCClose(void *pvSession)
 {
     PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pvSession;
-    LogFlow(("VBoxGuestIDCClose:\n"));
+    LogFlow(("VBoxGuestIDCClose: pvSession=%p\n", pvSession));
 
     AssertPtrReturn(pSession, VERR_INVALID_POINTER);
-    VbgdCommonCloseSession(&g_DevExt, pSession);
+    VGDrvCommonCloseSession(&g_DevExt, pSession);
 
 #ifdef RT_OS_SOLARIS
     mutex_enter(&g_LdiMtx);
@@ -140,9 +140,8 @@ DECLEXPORT(int) VBOXCALL VBoxGuestIDCCall(void *pvSession, unsigned iCmd, void *
     LogFlow(("VBoxGuestIDCCall: %pvSession=%p Cmd=%u pvData=%p cbData=%d\n", pvSession, iCmd, pvData, cbData));
 
     AssertPtrReturn(pSession, VERR_INVALID_POINTER);
-    AssertMsgReturn(pSession->pDevExt == &g_DevExt,
-                    ("SC: %p != %p\n", pSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE);
+    AssertMsgReturn(pSession->pDevExt == &g_DevExt, ("SC: %p != %p\n", pSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE);
 
-    return VbgdCommonIoCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
+    return VGDrvCommonIoCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
 }
 
index 0d43f38e7e6baf1f3a6fcf7651a3dacf4030dcca..bdbfb5a5203685009c719956fa14a1f1056ca43c 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id: VBoxGuestInternal.h $ */
 /** @file
- * VBoxGuest - Guest Additions Driver.
+ * VBoxGuest - Guest Additions Driver, Internal Header.
  */
 
 /*
@@ -36,7 +36,7 @@
 #include <VBox/VBoxGuest.h>
 #include <VBox/VBoxGuestLib.h>
 
-/** @def VBOXGUEST_USE_WAKE_UP_LIST
+/** @def VBOXGUEST_USE_DEFERRED_WAKE_UP
  * Defer wake-up of waiting thread when defined. */
 #if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(DOXYGEN_RUNNING)
 # define VBOXGUEST_USE_DEFERRED_WAKE_UP
@@ -64,11 +64,11 @@ typedef struct VBOXGUESTWAIT
     /** The events we received. */
     uint32_t volatile           fResEvents;
 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-    /** Set by VbgdCommonWaitDoWakeUps before leaving the spinlock to call
+    /** Set by VGDrvCommonWaitDoWakeUps before leaving the spinlock to call
      *  RTSemEventMultiSignal. */
     bool volatile               fPendingWakeUp;
     /** Set by the requestor thread if it got the spinlock before the
-     * signaller.  Deals with the race in VbgdCommonWaitDoWakeUps. */
+     * signaller.  Deals with the race in VGDrvCommonWaitDoWakeUps. */
     bool volatile               fFreeMe;
 #endif
     /** The event semaphore. */
@@ -87,7 +87,7 @@ typedef struct VBOXGUESTWAIT
  */
 typedef struct VBOXGUESTMEMBALLOON
 {
-    /** Mutex protecting the members below from concurrent access.. */
+    /** Mutex protecting the members below from concurrent access. */
     RTSEMFASTMUTEX              hMtx;
     /** The current number of chunks in the balloon. */
     uint32_t                    cChunks;
@@ -313,22 +313,22 @@ typedef struct VBOXGUESTSESSION
 
 RT_C_DECLS_BEGIN
 
-int  VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO,
-                          VBOXOSTYPE enmOSType, uint32_t fEvents);
-bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt);
-void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);
-int  VbgdCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType);
+int  VGDrvCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO,
+                           VBOXOSTYPE enmOSType, uint32_t fEvents);
+bool VGDrvCommonISR(PVBOXGUESTDEVEXT pDevExt);
+void VGDrvCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);
+int  VGDrvCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType);
 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt);
+void VGDrvCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt);
 #endif
 
-int  VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
-int  VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
-void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
+int  VGDrvCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
+int  VGDrvCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
+void VGDrvCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
 
-int  VbgdCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
-int  VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                     void *pvData, size_t cbData, size_t *pcbDataReturned);
+int  VGDrvCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
+int  VGDrvCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                      void *pvData, size_t cbData, size_t *pcbDataReturned);
 
 /**
  * ISR callback for notifying threads polling for mouse events.
@@ -338,11 +338,11 @@ int  VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
  *
  * @param   pDevExt     The device extension.
  */
-void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt);
+void VGDrvNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt);
 
 
 #ifdef VBOX_WITH_DPC_LATENCY_CHECKER
-int VbgdNtIOCtl_DpcLatencyChecker(void);
+int VGDrvNtIOCtl_DpcLatencyChecker(void);
 #endif
 
 RT_C_DECLS_END
index 0b532f19ea059cd6bba1045c58981e9a0fdde33c..a5d64c506e585c9463efc6601e2ea3915c64e43c 100644 (file)
 #include "VBGLInternal.h"
 
 
-DECLVBGL(int) VbglQueryVMMDevMemory (VMMDevMemory **ppVMMDevMemory)
+DECLVBGL(int) VbglQueryVMMDevMemory(VMMDevMemory **ppVMMDevMemory)
 {
-    int rc = vbglR0Enter ();
-
+    int rc = vbglR0Enter();
     if (RT_FAILURE(rc))
         return rc;
 
index 2c32217ef1f024ad9c847439973ff91619c3da59..136ff6dcd48837b4840e749116b69fc00ca3cc30 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #ifndef RTMEM_NO_WRAP_TO_EF_APIS
 # define RTMEM_NO_WRAP_TO_EF_APIS
 #endif
@@ -39,7 +39,7 @@
 
 
 
-RTDECL(void *) RTMemDupTag(const void *pvSrc, size_t cb, const char *pszTag) RT_NO_THROW
+RTDECL(void *) RTMemDupTag(const void *pvSrc, size_t cb, const char *pszTag) RT_NO_THROW_DEF
 {
     void *pvDst = RTMemAllocTag(cb, pszTag);
     if (pvDst)
@@ -49,7 +49,7 @@ RTDECL(void *) RTMemDupTag(const void *pvSrc, size_t cb, const char *pszTag) RT_
 RT_EXPORT_SYMBOL(RTMemDupTag);
 
 
-RTDECL(void *) RTMemDupExTag(const void *pvSrc, size_t cbSrc, size_t cbExtra, const char *pszTag) RT_NO_THROW
+RTDECL(void *) RTMemDupExTag(const void *pvSrc, size_t cbSrc, size_t cbExtra, const char *pszTag) RT_NO_THROW_DEF
 {
     void *pvDst = RTMemAllocTag(cbSrc + cbExtra, pszTag);
     if (pvDst)
index 85916406869b825232f76b4239d5468afeacbdf1..5c44d33a8df83b2e2cb219cdcee5652c480b3e5e 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_DEFAULT
 #include <iprt/heap.h>
 #include "internal/iprt.h"
@@ -42,9 +42,9 @@
 #include "internal/magics.h"
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /** Pointer to the heap anchor block. */
 typedef struct RTHEAPSIMPLEINTERNAL *PRTHEAPSIMPLEINTERNAL;
 /** Pointer to a heap block. */
@@ -164,9 +164,9 @@ AssertCompile(RTHEAPSIMPLE_MIN_BLOCK >= sizeof(RTHEAPSIMPLEFREE) - sizeof(RTHEAP
 #define RTHEAPSIMPLE_ALIGNMENT  (sizeof(RTHEAPSIMPLEBLOCK))
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 #ifdef RT_STRICT
 # define RTHEAPSIMPLE_STRICT 1
 #endif
@@ -267,9 +267,9 @@ AssertCompile(RTHEAPSIMPLE_MIN_BLOCK >= sizeof(RTHEAPSIMPLEFREE) - sizeof(RTHEAP
     } while (0)
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 #ifdef RTHEAPSIMPLE_STRICT
 static void rtHeapSimpleAssertAll(PRTHEAPSIMPLEINTERNAL pHeapInt);
 #endif
index 80c3b6d8fb982a53f18ddd5f77c75b5d5b79fefd..a631929597e1cd8507a60dfc65715c66e8bd48cb 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/err.h>
 #include "internal/iprt.h"
 
@@ -119,7 +119,7 @@ RTDECL(int)  RTErrConvertFromErrno(unsigned uNativeCode)
         case EINVAL:            return VERR_INVALID_PARAMETER;
 #endif
 #ifdef ENFILE
-        case ENFILE:            return VERR_TOO_MANY_OPEN_FILES; /**@Todo fix duplicate error */
+        case ENFILE:            return VERR_TOO_MANY_OPEN_FILES; /** @todo fix duplicate error */
 #endif
 #ifdef EMFILE
         case EMFILE:            return VERR_TOO_MANY_OPEN_FILES;
index 85a4ddde73890ddf437b451e6473c0eb5767a955..a9d14300da770482d8a09f21b6e09aa9aab104a1 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/err.h>
 #include "internal/iprt.h"
 
index 553935044ce4692da928a674d39440215d410805..4631e262b9ce4dc44bc0f6ff6e8174f81f1fabaa 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/log.h>
 #include "internal/iprt.h"
 
@@ -62,9 +62,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /** @def RTLOG_RINGBUF_DEFAULT_SIZE
  * The default ring buffer size. */
 /** @def RTLOG_RINGBUF_MAX_SIZE
@@ -89,9 +89,9 @@ AssertCompile(sizeof(RTLOG_RINGBUF_EYE_CATCHER) == 16);
 AssertCompile(sizeof(RTLOG_RINGBUF_EYE_CATCHER_END) == 16);
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Arguments passed to the output function.
  */
@@ -216,9 +216,9 @@ AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbRingBufUnflushed, sizeof(uint64
 #endif /* !IN_RC */
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 #ifndef IN_RC
 static unsigned rtlogGroupFlags(const char *psz);
 #endif
@@ -242,9 +242,9 @@ static void rtlogLoggerExFLocked(PRTLOGGER pLogger, unsigned fFlags, unsigned iG
 #endif
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 #ifdef IN_RC
 /** Default logger instance. Make it weak because our RC module loader does not
  *  necessarily resolve this symbol and the compiler _must_ check if this is
@@ -3065,13 +3065,13 @@ static void rtR0LogLoggerExFallback(uint32_t fDestFlags, uint32_t fFlags, PRTLOG
  * vprintf like function for writing to the default log.
  *
  * @param   pszFormat   Printf like format string.
- * @param   args        Optional arguments as specified in pszFormat.
+ * @param   va          Optional arguments as specified in pszFormat.
  *
  * @remark The API doesn't support formatting of floating point numbers at the moment.
  */
-RTDECL(void) RTLogPrintfV(const char *pszFormat, va_list args)
+RTDECL(void) RTLogPrintfV(const char *pszFormat, va_list va)
 {
-    RTLogLoggerV(NULL, pszFormat, args);
+    RTLogLoggerV(NULL, pszFormat, va);
 }
 RT_EXPORT_SYMBOL(RTLogPrintfV);
 
@@ -3145,7 +3145,7 @@ static int rtlogFileOpen(PRTLOGGER pLogger, char *pszErrorMsg, size_t cchErrorMs
  * Used by the rtlogFlush() function as well as RTLogCreateExV.
  *
  * @param   pLogger     The logger instance to update. NULL is not allowed!
- * @param   uTimeSlit   Current time slot (for tikme based rotation).
+ * @param   uTimeSlot   Current time slot (for tikme based rotation).
  * @param   fFirst      Flag whether this is the beginning of logging, i.e.
  *                      called from RTLogCreateExV.  Prevents pfnPhase from
  *                      being called.
index 8ddcf3434dd8345da55feb96df57043a4bdedf63..0f67da7eee67299022df42b8e497c832ec0bf806 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 #ifndef IPRT_UART_BASE
 /** The port address of the COM port to log to.
  *
@@ -41,9 +41,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/log.h>
 #include "internal/iprt.h"
 
@@ -55,9 +55,9 @@
 #include <iprt/string.h>
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 static DECLCALLBACK(size_t) rtLogComOutput(void *pv, const char *pachChars, size_t cbChars);
 
 
index e831e332e35b3477fd5f074945cac64dbb03b14f..5ef052ba1ce15dc1d48f27303294f3a36aa143f6 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/log.h>
 #include "internal/iprt.h"
 
index 1161fd8580b8ae3c78b52e30439aecef381c97f8..8c4dd9fe014f81e96b4c992b1a6fc809731ea0d7 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/log.h>
 #include "internal/iprt.h"
 
@@ -42,9 +42,9 @@
 #include <iprt/string.h>
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 static DECLCALLBACK(size_t) rtlogFormatStr(void *pvArg, PFNRTSTROUTPUT pfnOutput,
                                            void *pvArgOutput, const char **ppszFormat,
                                            va_list *pArgs, int cchWidth, int cchPrecision,
index 34df28049ce7ef0152e7430df087b2e19633c68b..873ae84efe0639fa81132c5dffb5942b1f28e65d 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/log.h>
 #include "internal/iprt.h"
 
@@ -57,9 +57,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 #ifdef IN_RC
 /** Default release logger instance. */
 extern "C" DECLIMPORT(RTLOGGERRC)   g_RelLogger;
index 43631f7ac655e65517617b11fb723bd125bcc7d5..e1f78dd170b5f323895321b8927d493505391330 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/log.h>
 #include "internal/iprt.h"
 
index 9d4f54bbacc22ffe443985f162af55972b350ebf..fbbc95c42f706b1a44fb8f1efce14a7a1e6d8b87 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include "internal/iprt.h"
 
index 9247f5bb55dfedaf05b42e239c17531d7ea19f6f..291fceadf4ec59638cc82d0ee5185e9ce67512d7 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include "internal/iprt.h"
 
index 72c7aaf682161f1a9fd5986400fc324bc3097c41..946268e4e9c30e957cc0f70352e54bae2e1c7e17 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include "internal/iprt.h"
 
index 68a1f1455e4184c12443df78c11ee3da6e8908f8..4c68515b061ace402a945056de7c0e6030cc4311 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include "internal/iprt.h"
 
index 6a3a34b26cc48551b1695057a7bd5b07a061c80a..fae8a35b2315351d304126ac272c36f0caea768a 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include "internal/iprt.h"
 
index 08ada4d8af684b149debe5e6c9183e8aebb45b76..439b79b21e871649d9d51c2d0f69c952a04e4823 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include "internal/iprt.h"
 
index e0e17c3ebb1038fb23768f6debe14e8bdaa14248..8a7c8209441d923e7bb958b202668775909f2c26 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include "internal/iprt.h"
 
index 76b93248c3fda9b8a079036dcbef4171c3b96937..bc2fa60c3634e62f01f472d5e1c4da373c068d96 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include "internal/iprt.h"
 
@@ -42,9 +42,9 @@
 #include "internal/assert.h"
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The last assert message, 1st part. */
 RTDATADECL(char)                    g_szRTAssertMsg1[1024];
 RT_EXPORT_SYMBOL(g_szRTAssertMsg1);
index df331f8c3e72ca2d608b604ee73e69bbaddd6b93..0e8a212dce6942f9dbce665b7171e61e68452589 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_THREAD
 #include <iprt/thread.h>
 #include "internal/iprt.h"
@@ -53,9 +53,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 #ifdef IN_RING0
 # define RT_THREAD_LOCK_RW()        RTSpinlockAcquire(g_ThreadSpinlock)
 # define RT_THREAD_UNLOCK_RW()      RTSpinlockRelease(g_ThreadSpinlock)
@@ -69,9 +69,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The AVL thread containing the threads. */
 static PAVLPVNODECORE       g_ThreadTree;
 /** The number of threads in the tree (for ring-0 termination kludge). */
@@ -87,9 +87,9 @@ static RTSPINLOCK       g_ThreadSpinlock = NIL_RTSPINLOCK;
 static bool             g_frtThreadInitialized;
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 static void rtThreadDestroy(PRTTHREADINT pThread);
 #ifdef IN_RING3
 static int rtThreadAdopt(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntFlags, const char *pszName);
index 62578771e2518628fc3a91e952d09004c077cc4a..63846643a67e792c035aecbce1f3567d00f3e70a 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/string.h>
 #include "internal/iprt.h"
 
index ee53f762baf96b6e3769fa72885a9ee936487864..90ee4ec4dcc59f2e6e7383d9dfe9e021272612ec 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/string.h>
 #include "internal/iprt.h"
 
index 8b6a260e4a02eebd3402b1e35c1fc40ec7a07490..b642b327d9384eb5178e39f72edbe97777022415 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/string.h>
 #include "internal/iprt.h"
 
index 64fb1de3ce2a07a4728e3fe6ab628798a42beff4..136942964be229f7792a929bb654ba9482fcb5bc 100644 (file)
  */
 
 
-/*******************************************************************************
-*   Defined Constants                                                          *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants                                                                                                            *
+*********************************************************************************************************************************/
 #define ISDIGIT(c) ((c) >= '0' && (c) <= '9')
 /*#define MAX(a, b)  ((a) >= (b) ? (a) : (b))
 #define MIN(a, b)  ((a) < (b) ? (a) : (b)) */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_STRING
 #include <iprt/string.h>
 #include "internal/iprt.h"
@@ -63,9 +63,9 @@ typedef struct
 } KSIZE64;
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 static unsigned _strnlen(const char *psz, unsigned cchMax);
 static unsigned _strnlenUtf16(PCRTUTF16 pwsz, unsigned cchMax);
 static int rtStrFormatNumber(char *psz, KSIZE64 ullValue, unsigned int uiBase, signed int cchWidth, signed int cchPrecision, unsigned int fFlags);
@@ -554,7 +554,7 @@ RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRF
                             cchWidth -= cchStr;
                             while (cchStr-- > 0)
                             {
-/**@todo #ifndef IN_RC*/
+/**@todo \#ifndef IN_RC*/
 #ifdef IN_RING3
                                 RTUNICP Cp;
                                 RTUtf16GetCpEx(&pwszStr, &Cp);
@@ -588,7 +588,7 @@ RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRF
                             cchWidth -= cchStr;
                             while (cchStr-- > 0)
                             {
-/**@todo #ifndef IN_RC*/
+/**@todo \#ifndef IN_RC*/
 #ifdef IN_RING3
                                 char szUtf8[8]; /* Cp=0x7fffffff -> 6 bytes. */
                                 char *pszEnd = RTStrPutCp(szUtf8, *puszStr++);
index 7b4dd93df951912d9f5d66f4a76a593c0f1aeff2..034f084f7b532c816a9490c042a2f991a6acdb6a 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_STRING
 #include <iprt/string.h>
 #ifndef RT_NO_EXPORT_SYMBOL
 #endif
 #include "internal/string.h"
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 static char g_szHexDigits[17] = "0123456789abcdef";
 
 
index 502b89fb4c8e6b6866e176db10b897a91c19d5d5..a7332ef5d13ad001974fe48cb13403f8b198d778 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_STRING
 #include <iprt/string.h>
 #include "internal/iprt.h"
@@ -38,9 +38,9 @@
 #include "internal/string.h"
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 #ifdef RT_STRICT
 # define RTSTRFORMATTYPE_WITH_LOCKING
 #endif
@@ -49,9 +49,9 @@
 #endif
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /**
  * Description of a registered formatting type.
  *
@@ -85,9 +85,9 @@ typedef RTSTRDYNFMT *PRTSTRDYNFMT;
 typedef RTSTRDYNFMT const *PCRTSTRDYNFMT;
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The registered types, sorted for binary lookup.
  * We use a static array here because it avoids RTMemAlloc dependencies+leaks. */
 static RTSTRDYNFMT      g_aTypes[64];
index fa749e3a9d04f9f49f4dcee89811eab93e933bd3..26475e35789436eb5e82884b625178e1c23b3707 100644 (file)
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/string.h>
 #include "internal/iprt.h"
 
 #include <iprt/assert.h>
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /** strbufoutput() argument structure. */
 typedef struct STRBUFARG
 {
@@ -49,9 +49,9 @@ typedef struct STRBUFARG
 typedef STRBUFARG *PSTRBUFARG;
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 static DECLCALLBACK(size_t) strbufoutput(void *pvArg, const char *pachChars, size_t cbChars);
 
 
index af6ba5c258a665a2b98478615565cd77cb094680..400520aa38dbed8d2c27f377dc95d54a6f2c31e3 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/string.h>
 #include "internal/iprt.h"
 
@@ -36,9 +36,9 @@
 #include <iprt/err.h>
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** 8-bit char -> digit. */
 static const unsigned char g_auchDigits[256] =
 {
index ee090ad4e52d0d766cb4e9cedb95ef5bdfe2917f..612617f41dc7c99d40645ab46a555cd699dc2f15 100644 (file)
 static const char szFileId[] = "Id: kAVLPVInt.c,v 1.5 2003/02/13 02:02:35 bird Exp $";
 #endif
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /*
  * AVL configuration.
  */
@@ -55,9 +56,9 @@ static const char szFileId[] = "Id: kAVLPVInt.c,v 1.5 2003/02/13 02:02:35 bird E
 #define KAVL_NE(key1, key2)         ( (const char*)(key1) != (const char*)(key2) )
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/avl.h>
 #include <iprt/assert.h>
 #include <iprt/err.h>
index 2dcf7514c1944c0601556332110ab8a3d3423820..2f0ccff27c4237ee2db3ee599132fa218903bcf5 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_TIME
 #include <iprt/time.h>
 #include "internal/iprt.h"
@@ -38,9 +38,9 @@
 #include "internal/time.h"
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /** The max year we possibly could implode. */
 #define RTTIME_MAX_YEAR         (292 + 1970)
 /** The min year we possibly could implode. */
@@ -57,9 +57,9 @@
 #define RTTIME_MIN_DAY_NANO     ( INT64_C(1000000000) * (00*3600 + 12*60 + 43) + 145224192 )
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /**
  * Days per month in a common year.
  */
@@ -706,7 +706,7 @@ RTDECL(char *) RTTimeToString(PCRTTIME pTime, char *psz, size_t cb)
             offUTCHour = -offUTCHour;
         }
         cch = RTStrPrintf(psz, cb,
-                          "%RI32-%02u-%02uT%02u:%02u:%02u.%09RU32%c%02%02",
+                          "%RI32-%02u-%02uT%02u:%02u:%02u.%09RU32%c%02d%02d",
                           pTime->i32Year, pTime->u8Month, pTime->u8MonthDay,
                           pTime->u8Hour, pTime->u8Minute, pTime->u8Second, pTime->u32Nanosecond,
                           chSign, offUTCHour, offUTCMinute);
index 032fb38fa26e98b422b27e643aecaab334562552..a079261c1d5465fa3263625064337698fbf2fda0 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include "internal/iprt.h"
 
index 969307fb064673b0f543f27bb7cdbff90aac4616..c9040e26e9b22a7c976049bbfce34067e1fee21b 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/log.h>
 #include "internal/iprt.h"
 
index c195d5aae4e4e611f57b11fb0bed338cf6c4e942..92406c735cafa246cc9be2a6bc34a503a2a4157a 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/log.h>
 #include "internal/iprt.h"
 
index 76fc90fbb8c9af60aa77958008c78b2c4bfd9449..8ead6e8b25a9d26cbb2207755775b6140bcc28f2 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/mp.h>
 #include "internal/iprt.h"
 
index 731a9ca435dd920f9ce26cd216d7c0c95de359fe..bfeb1af1099230f14e3ad8443e746d74d6c6cf93 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_SEM
 #define RTSEMEVENTMULTI_WITHOUT_REMAPPING
 #include <iprt/semaphore.h>
index 0bcf973f0340fd353a96d93fada0dad68317561d..2c0dcc40a81d36dd0415f0e4ace9a5bdfb0d6056 100644 (file)
@@ -26,9 +26,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_SEM
 #define RTSEMEVENTMULTI_WITHOUT_REMAPPING
 #include <iprt/semaphore.h>
index 64500347f551f0365be764123601e44052e3f479..a196c211f4b83d40fe973a66f89bfd760f527d00 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_SEM
 #define RTSEMEVENT_WITHOUT_REMAPPING
 #include <iprt/semaphore.h>
index 703e7829dad5b078ae321bc8f23549c8c7d6db60..804e83cbd50496e731daa64170ed923360d82af4 100644 (file)
@@ -26,9 +26,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP RTLOGGROUP_SEM
 #define RTSEMEVENT_WITHOUT_REMAPPING
 #include <iprt/semaphore.h>
index 9b73886e723eef8581c8e4dd62dbecb53b0b1bd3..c9a67d9659fd4f16104253d24ed8005d8a0c4010 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/err.h>
 #include "internal/iprt.h"
 
index 1809939451d188d6e9f3d51ed0a038c0e6bb4b3d..ea988e0e6a52709c8128ee3e286d9e4152b6ebad 100644 (file)
@@ -25,9 +25,9 @@
  */
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/mp.h>
 #include "internal/iprt.h"
 
index cc4338c1298a010a1ca6ae5a386beb63975589e2..c1727e59d9d07d405f52e1cec5ee197c594b651a 100644 (file)
@@ -5,6 +5,6 @@
 #define VBOX_VENDOR_SHORT "Oracle"
 #define VBOX_PRODUCT "Oracle VM VirtualBox"
 #define VBOX_BUILD_PUBLISHER "_Ubuntu"
-#define VBOX_C_YEAR "2015"
+#define VBOX_C_YEAR "2016"
 
 #endif
index 40b79e4576fd67864b0d72295c177a99b0c0a2e9..66481b81fbf61fde553d48e51912e4c8157dfe2b 100644 (file)
@@ -1 +1 @@
-#define VBOX_SVN_REV 101573
+#define VBOX_SVN_REV 105127
index fe3754568f5d157c78d91d211d5371213245699d..31f0ed14a2d1093a73ef875db125eb596f0b08a6 100644 (file)
@@ -3,9 +3,9 @@
 
 #define VBOX_VERSION_MAJOR 5
 #define VBOX_VERSION_MINOR 0
-#define VBOX_VERSION_BUILD 0
-#define VBOX_VERSION_STRING_RAW "5.0.0"
-#define VBOX_VERSION_STRING "5.0.0_Ubuntu"
+#define VBOX_VERSION_BUILD 14
+#define VBOX_VERSION_STRING_RAW "5.0.14"
+#define VBOX_VERSION_STRING "5.0.14_Ubuntu"
 #define VBOX_API_VERSION_STRING "5_0"
 
 #define VBOX_PRIVATE_BUILD_DESC "Private build by root"
index cc9b3bbaaa0fab62ce6274322f9dd4a5a6a25efe..72359ed552a63e3c647b2ff0d007115c2ab8ac83 100644 (file)
 #include <iprt/assert.h>
 #include <iprt/string.h>
 
-DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
+
+DECLVBGL(int) VbglGRVerify(const VMMDevRequestHeader *pReq, size_t cbReq)
 {
     size_t cbReqExpected;
 
-    if (!pReq || cbReq < sizeof (VMMDevRequestHeader))
+    if (RT_UNLIKELY(!pReq || cbReq < sizeof(VMMDevRequestHeader)))
     {
         dprintf(("VbglGRVerify: Invalid parameter: pReq = %p, cbReq = %zu\n", pReq, cbReq));
         return VERR_INVALID_PARAMETER;
     }
 
-    if (pReq->size > cbReq)
+    if (RT_UNLIKELY(pReq->size > cbReq))
     {
         dprintf(("VbglGRVerify: request size %u > buffer size %zu\n", pReq->size, cbReq));
         return VERR_INVALID_PARAMETER;
@@ -48,8 +49,7 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
 
     /* The request size must correspond to the request type. */
     cbReqExpected = vmmdevGetRequestSize(pReq->requestType);
-
-    if (cbReq < cbReqExpected)
+    if (RT_UNLIKELY(cbReq < cbReqExpected))
     {
         dprintf(("VbglGRVerify: buffer size %zu < expected size %zu\n", cbReq, cbReqExpected));
         return VERR_INVALID_PARAMETER;
@@ -57,10 +57,11 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
 
     if (cbReqExpected == cbReq)
     {
-        /* This is most likely a fixed size request, and in this case the request size
-         * must be also equal to the expected size.
+        /*
+         * This is most likely a fixed size request, and in this case the
+         * request size must be also equal to the expected size.
          */
-        if (pReq->size != cbReqExpected)
+        if (RT_UNLIKELY(pReq->size != cbReqExpected))
         {
             dprintf(("VbglGRVerify: request size %u != expected size %zu\n", pReq->size, cbReqExpected));
             return VERR_INVALID_PARAMETER;
@@ -81,99 +82,89 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
         || pReq->requestType == VMMDevReq_HGCMCall64
 #else
         || pReq->requestType == VMMDevReq_HGCMCall
-#endif /* VBOX_WITH_64_BITS_GUESTS */
+#endif
         || pReq->requestType == VMMDevReq_RegisterSharedModule
         || pReq->requestType == VMMDevReq_ReportGuestUserState
         || pReq->requestType == VMMDevReq_LogString
         || pReq->requestType == VMMDevReq_SetPointerShape
         || pReq->requestType == VMMDevReq_VideoSetVisibleRegion)
     {
-        if (cbReq > VMMDEV_MAX_VMMDEVREQ_SIZE)
+        if (RT_UNLIKELY(cbReq > VMMDEV_MAX_VMMDEVREQ_SIZE))
         {
             dprintf(("VbglGRVerify: VMMDevReq_LogString: buffer size %zu too big\n", cbReq));
-            return VERR_BUFFER_OVERFLOW; /* @todo is this error code ok? */
+            return VERR_BUFFER_OVERFLOW; /** @todo is this error code ok? */
         }
     }
     else
     {
         dprintf(("VbglGRVerify: request size %u > buffer size %zu\n", pReq->size, cbReq));
-        return VERR_IO_BAD_LENGTH; /* @todo is this error code ok? */
+        return VERR_IO_BAD_LENGTH; /** @todo is this error code ok? */
     }
 
     return VINF_SUCCESS;
 }
 
-DECLVBGL(int) VbglGRAlloc (VMMDevRequestHeader **ppReq, uint32_t cbSize, VMMDevRequestType reqType)
+DECLVBGL(int) VbglGRAlloc(VMMDevRequestHeader **ppReq, size_t cbReq, VMMDevRequestType enmReqType)
 {
-    VMMDevRequestHeader *pReq;
-    int rc = vbglR0Enter ();
-
-    if (RT_FAILURE(rc))
-        return rc;
-
-    if (!ppReq || cbSize < sizeof (VMMDevRequestHeader))
-    {
-        dprintf(("VbglGRAlloc: Invalid parameter: ppReq = %p, cbSize = %u\n", ppReq, cbSize));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    pReq = (VMMDevRequestHeader *)VbglPhysHeapAlloc (cbSize);
-    if (!pReq)
+    int rc = vbglR0Enter();
+    if (RT_SUCCESS(rc))
     {
-        AssertMsgFailed(("VbglGRAlloc: no memory\n"));
-        rc = VERR_NO_MEMORY;
-    }
-    else
-    {
-        memset(pReq, 0xAA, cbSize);
-
-        pReq->size        = cbSize;
-        pReq->version     = VMMDEV_REQUEST_HEADER_VERSION;
-        pReq->requestType = reqType;
-        pReq->rc          = VERR_GENERAL_FAILURE;
-        pReq->reserved1   = 0;
-        pReq->reserved2   = 0;
-
-        *ppReq = pReq;
+        if (   ppReq
+            && cbReq >= sizeof(VMMDevRequestHeader)
+            && cbReq == (uint32_t)cbReq)
+        {
+            VMMDevRequestHeader *pReq = (VMMDevRequestHeader *)VbglPhysHeapAlloc((uint32_t)cbReq);
+            AssertMsgReturn(pReq, ("VbglGRAlloc: no memory (cbReq=%u)\n", cbReq), VERR_NO_MEMORY);
+            memset(pReq, 0xAA, cbReq);
+
+            pReq->size        = (uint32_t)cbReq;
+            pReq->version     = VMMDEV_REQUEST_HEADER_VERSION;
+            pReq->requestType = enmReqType;
+            pReq->rc          = VERR_GENERAL_FAILURE;
+            pReq->reserved1   = 0;
+            pReq->reserved2   = 0;
+
+            *ppReq = pReq;
+            rc = VINF_SUCCESS;
+        }
+        else
+        {
+            dprintf(("VbglGRAlloc: Invalid parameter: ppReq=%p cbReq=%u\n", ppReq, cbReq));
+            rc = VERR_INVALID_PARAMETER;
+        }
     }
-
     return rc;
 }
 
-DECLVBGL(int) VbglGRPerform (VMMDevRequestHeader *pReq)
+DECLVBGL(int) VbglGRPerform(VMMDevRequestHeader *pReq)
 {
-    RTCCPHYS physaddr;
-    int rc = vbglR0Enter ();
-
-    if (RT_FAILURE(rc))
-        return rc;
-
-    if (!pReq)
-        return VERR_INVALID_PARAMETER;
-
-    physaddr = VbglPhysHeapGetPhysAddr (pReq);
-    if (  !physaddr
-       || (physaddr >> 32) != 0) /* Port IO is 32 bit. */
+    int rc = vbglR0Enter();
+    if (RT_SUCCESS(rc))
     {
-        rc = VERR_VBGL_INVALID_ADDR;
-    }
-    else
-    {
-        ASMOutU32(g_vbgldata.portVMMDev + VMMDEV_PORT_OFF_REQUEST, (uint32_t)physaddr);
-        /* Make the compiler aware that the host has changed memory. */
-        ASMCompilerBarrier();
-        rc = pReq->rc;
+        if (pReq)
+        {
+            RTCCPHYS PhysAddr = VbglPhysHeapGetPhysAddr(pReq);
+            if (   PhysAddr != 0
+                && PhysAddr < _4G) /* Port IO is 32 bit. */
+            {
+                ASMOutU32(g_vbgldata.portVMMDev + VMMDEV_PORT_OFF_REQUEST, (uint32_t)PhysAddr);
+                /* Make the compiler aware that the host has changed memory. */
+                ASMCompilerBarrier();
+                rc = pReq->rc;
+            }
+            else
+                rc = VERR_VBGL_INVALID_ADDR;
+        }
+        else
+            rc = VERR_INVALID_PARAMETER;
     }
     return rc;
 }
 
-DECLVBGL(void) VbglGRFree (VMMDevRequestHeader *pReq)
+DECLVBGL(void) VbglGRFree(VMMDevRequestHeader *pReq)
 {
-    int rc = vbglR0Enter ();
-
-    if (RT_FAILURE(rc))
-        return;
-
-    VbglPhysHeapFree (pReq);
+    int rc = vbglR0Enter();
+    if (RT_SUCCESS(rc))
+        VbglPhysHeapFree(pReq);
 }
 
index fad53ff21aadd1830a0dc45c4dafe748a44759b1..463875860928c203946a6bcd3fd41f8ca000c794 100644 (file)
 #include <iprt/semaphore.h>
 #include <iprt/string.h>
 
-#define VBGL_HGCM_ASSERTMsg AssertReleaseMsg
+#define VBGL_HGCM_ASSERT_MSG AssertReleaseMsg
 
 /**
  * Initializes the HGCM VBGL bits.
  *
  * @return VBox status code.
  */
-int vbglR0HGCMInit (void)
+int vbglR0HGCMInit(void)
 {
     return RTSemFastMutexCreate(&g_vbgldata.mutexHGCMHandle);
 }
@@ -53,7 +53,7 @@ int vbglR0HGCMInit (void)
  *
  * @return VBox status code.
  */
-int vbglR0HGCMTerminate (void)
+int vbglR0HGCMTerminate(void)
 {
     RTSemFastMutexDestroy(g_vbgldata.mutexHGCMHandle);
     g_vbgldata.mutexHGCMHandle = NIL_RTSEMFASTMUTEX;
@@ -61,161 +61,134 @@ int vbglR0HGCMTerminate (void)
     return VINF_SUCCESS;
 }
 
-DECLINLINE(int) vbglHandleHeapEnter (void)
+DECLINLINE(int) vbglHandleHeapEnter(void)
 {
     int rc = RTSemFastMutexRequest(g_vbgldata.mutexHGCMHandle);
 
-    VBGL_HGCM_ASSERTMsg(RT_SUCCESS(rc),
-                        ("Failed to request handle heap mutex, rc = %Rrc\n", rc));
+    VBGL_HGCM_ASSERT_MSG(RT_SUCCESS(rc), ("Failed to request handle heap mutex, rc = %Rrc\n", rc));
 
     return rc;
 }
 
-DECLINLINE(void) vbglHandleHeapLeave (void)
+DECLINLINE(void) vbglHandleHeapLeave(void)
 {
     RTSemFastMutexRelease(g_vbgldata.mutexHGCMHandle);
 }
 
-struct VBGLHGCMHANDLEDATA *vbglHGCMHandleAlloc (void)
+struct VBGLHGCMHANDLEDATA *vbglHGCMHandleAlloc(void)
 {
-    struct VBGLHGCMHANDLEDATA *p;
-    int rc = vbglHandleHeapEnter ();
-    uint32_t i;
-
-    if (RT_FAILURE (rc))
-        return NULL;
-
-    p = NULL;
-
-    /** Simple linear search in array. This will be called not so often, only connect/disconnect.
-     * @todo bitmap for faster search and other obvious optimizations.
-     */
-
-    for (i = 0; i < RT_ELEMENTS(g_vbgldata.aHGCMHandleData); i++)
+    struct VBGLHGCMHANDLEDATA *p = NULL;
+    int rc = vbglHandleHeapEnter();
+    if (RT_SUCCESS(rc))
     {
-        if (!g_vbgldata.aHGCMHandleData[i].fAllocated)
+        uint32_t i;
+
+        /* Simple linear search in array. This will be called not so often, only connect/disconnect. */
+        /** @todo bitmap for faster search and other obvious optimizations. */
+        for (i = 0; i < RT_ELEMENTS(g_vbgldata.aHGCMHandleData); i++)
         {
-            p = &g_vbgldata.aHGCMHandleData[i];
-            p->fAllocated = 1;
-            break;
+            if (!g_vbgldata.aHGCMHandleData[i].fAllocated)
+            {
+                p = &g_vbgldata.aHGCMHandleData[i];
+                p->fAllocated = 1;
+                break;
+            }
         }
-    }
 
-    vbglHandleHeapLeave ();
-
-    VBGL_HGCM_ASSERTMsg(p != NULL,
-                        ("Not enough HGCM handles.\n"));
+        vbglHandleHeapLeave();
 
+        VBGL_HGCM_ASSERT_MSG(p != NULL, ("Not enough HGCM handles.\n"));
+    }
     return p;
 }
 
-void vbglHGCMHandleFree (struct VBGLHGCMHANDLEDATA *pHandle)
+void vbglHGCMHandleFree(struct VBGLHGCMHANDLEDATA *pHandle)
 {
-    int rc;
-
-    if (!pHandle)
-       return;
-
-    rc = vbglHandleHeapEnter ();
-
-    if (RT_FAILURE (rc))
-        return;
-
-    VBGL_HGCM_ASSERTMsg(pHandle->fAllocated,
-                        ("Freeing not allocated handle.\n"));
+    if (pHandle)
+    {
+        int rc = vbglHandleHeapEnter();
+        if (RT_SUCCESS(rc))
+        {
+            VBGL_HGCM_ASSERT_MSG(pHandle->fAllocated, ("Freeing not allocated handle.\n"));
 
-    memset(pHandle, 0, sizeof (struct VBGLHGCMHANDLEDATA));
-    vbglHandleHeapLeave ();
-    return;
+            RT_ZERO(*pHandle);
+            vbglHandleHeapLeave();
+        }
+    }
 }
 
-DECLVBGL(int) VbglHGCMConnect (VBGLHGCMHANDLE *pHandle, VBoxGuestHGCMConnectInfo *pData)
+DECLVBGL(int) VbglHGCMConnect(VBGLHGCMHANDLE *pHandle, VBoxGuestHGCMConnectInfo *pData)
 {
     int rc;
-    struct VBGLHGCMHANDLEDATA *pHandleData;
-
-    if (!pHandle || !pData)
-        return VERR_INVALID_PARAMETER;
-
-    pHandleData = vbglHGCMHandleAlloc();
-    if (!pHandleData)
-        rc = VERR_NO_MEMORY;
-    else
+    if (pHandle && pData)
     {
-        rc = vbglDriverOpen (&pHandleData->driver);
-        if (RT_SUCCESS(rc))
+        struct VBGLHGCMHANDLEDATA *pHandleData = vbglHGCMHandleAlloc();
+        if (pHandleData)
         {
-            rc = vbglDriverIOCtl (&pHandleData->driver, VBOXGUEST_IOCTL_HGCM_CONNECT, pData, sizeof (*pData));
-            if (RT_SUCCESS(rc))
-                rc = pData->result;
+            rc = vbglDriverOpen(&pHandleData->driver);
             if (RT_SUCCESS(rc))
             {
-                *pHandle = pHandleData;
-                return rc;
+                rc = vbglDriverIOCtl(&pHandleData->driver, VBOXGUEST_IOCTL_HGCM_CONNECT, pData, sizeof(*pData));
+                if (RT_SUCCESS(rc))
+                    rc = pData->result;
+                if (RT_SUCCESS(rc))
+                {
+                    *pHandle = pHandleData;
+                    return rc;
+                }
+
+                vbglDriverClose(&pHandleData->driver);
             }
 
-            vbglDriverClose (&pHandleData->driver);
+            vbglHGCMHandleFree(pHandleData);
         }
-
-        vbglHGCMHandleFree (pHandleData);
+        else
+            rc = VERR_NO_MEMORY;
     }
-
+    else
+        rc = VERR_INVALID_PARAMETER;
     return rc;
 }
 
-DECLVBGL(int) VbglHGCMDisconnect (VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData)
+DECLVBGL(int) VbglHGCMDisconnect(VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData)
 {
-    int rc = VINF_SUCCESS;
-
-    rc = vbglDriverIOCtl (&handle->driver, VBOXGUEST_IOCTL_HGCM_DISCONNECT, pData, sizeof (*pData));
+    int rc = vbglDriverIOCtl(&handle->driver, VBOXGUEST_IOCTL_HGCM_DISCONNECT, pData, sizeof(*pData));
 
-    vbglDriverClose (&handle->driver);
+    vbglDriverClose(&handle->driver);
 
-    vbglHGCMHandleFree (handle);
+    vbglHGCMHandleFree(handle);
 
     return rc;
 }
 
-DECLVBGL(int) VbglHGCMCall (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData)
+DECLVBGL(int) VbglHGCMCall(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData)
 {
-    int rc = VINF_SUCCESS;
+    VBGL_HGCM_ASSERT_MSG(cbData >= sizeof(VBoxGuestHGCMCallInfo) + pData->cParms * sizeof(HGCMFunctionParameter),
+                         ("cbData = %d, cParms = %d (calculated size %d)\n", cbData, pData->cParms,
+                          sizeof(VBoxGuestHGCMCallInfo) + pData->cParms * sizeof(VBoxGuestHGCMCallInfo)));
 
-    VBGL_HGCM_ASSERTMsg(cbData >= sizeof (VBoxGuestHGCMCallInfo) + pData->cParms * sizeof (HGCMFunctionParameter),
-                        ("cbData = %d, cParms = %d (calculated size %d)\n", cbData, pData->cParms, sizeof (VBoxGuestHGCMCallInfo) + pData->cParms * sizeof (VBoxGuestHGCMCallInfo)));
-
-    rc = vbglDriverIOCtl (&handle->driver, VBOXGUEST_IOCTL_HGCM_CALL(cbData), pData, cbData);
-
-    return rc;
+    return vbglDriverIOCtl(&handle->driver, VBOXGUEST_IOCTL_HGCM_CALL(cbData), pData, cbData);
 }
 
 DECLVBGL(int) VbglHGCMCallUserData (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData)
 {
-    int rc = VINF_SUCCESS;
-
-    VBGL_HGCM_ASSERTMsg(cbData >= sizeof (VBoxGuestHGCMCallInfo) + pData->cParms * sizeof (HGCMFunctionParameter),
-                        ("cbData = %d, cParms = %d (calculated size %d)\n", cbData, pData->cParms, sizeof (VBoxGuestHGCMCallInfo) + pData->cParms * sizeof (VBoxGuestHGCMCallInfo)));
-
-    rc = vbglDriverIOCtl (&handle->driver, VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(cbData), pData, cbData);
+    VBGL_HGCM_ASSERT_MSG(cbData >= sizeof(VBoxGuestHGCMCallInfo) + pData->cParms * sizeof(HGCMFunctionParameter),
+                         ("cbData = %d, cParms = %d (calculated size %d)\n", cbData, pData->cParms,
+                          sizeof(VBoxGuestHGCMCallInfo) + pData->cParms * sizeof(VBoxGuestHGCMCallInfo)));
 
-    return rc;
+    return vbglDriverIOCtl(&handle->driver, VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(cbData), pData, cbData);
 }
 
 
-DECLVBGL(int) VbglHGCMCallTimed (VBGLHGCMHANDLE handle,
-                                 VBoxGuestHGCMCallInfoTimed *pData, uint32_t cbData)
+DECLVBGL(int) VbglHGCMCallTimed(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfoTimed *pData, uint32_t cbData)
 {
-    int rc = VINF_SUCCESS;
-
-    uint32_t cbExpected =   sizeof (VBoxGuestHGCMCallInfoTimed)
-                          + pData->info.cParms * sizeof (HGCMFunctionParameter);
-    VBGL_HGCM_ASSERTMsg(cbData >= cbExpected,
-                        ("cbData = %d, cParms = %d (calculated size %d)\n",
-                        cbData, pData->info.cParms, cbExpected));
+    uint32_t cbExpected = sizeof(VBoxGuestHGCMCallInfoTimed)
+                        + pData->info.cParms * sizeof(HGCMFunctionParameter);
+    VBGL_HGCM_ASSERT_MSG(cbData >= cbExpected,
+                         ("cbData = %d, cParms = %d (calculated size %d)\n", cbData, pData->info.cParms, cbExpected));
+    NOREF(cbExpected);
 
-    rc = vbglDriverIOCtl (&handle->driver, VBOXGUEST_IOCTL_HGCM_CALL_TIMED(cbData),
-                          pData, cbData);
-
-    return rc;
+    return vbglDriverIOCtl(&handle->driver, VBOXGUEST_IOCTL_HGCM_CALL_TIMED(cbData), pData, cbData);
 }
 
 #endif /* !VBGL_VBOXGUEST */
index ec899dab2c07065883e83b90120f8af297e28370..f7ffb3f8e8406f9213097a67326de6df9988fab4 100644 (file)
  * terms and conditions of either the GPL or the CDDL or both.
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define VBGL_DECL_DATA
 #include "VBGLInternal.h"
 
 #include <iprt/assert.h>
 #include <iprt/semaphore.h>
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The global VBGL instance data.  */
 VBGLDATA g_vbgldata;
 
@@ -110,7 +112,7 @@ static void vbglQueryDriverInfo (void)
         {
             dprintf (("port = 0x%04X, mem = %p\n", port.portAddress, port.pVMMDevMemory));
 
-            g_vbgldata.portVMMDev = port.portAddress;
+            g_vbgldata.portVMMDev = (RTIOPORT)port.portAddress;
             g_vbgldata.pVMMDevMemory = port.pVMMDevMemory;
 
             g_vbgldata.status = VbglStatusReady;
@@ -184,14 +186,14 @@ DECLVBGL(void) vbglTerminateCommon (void)
 
 #ifdef VBGL_VBOXGUEST
 
-DECLVBGL(int) VbglInit (VBGLIOPORT portVMMDev, VMMDevMemory *pVMMDevMemory)
+DECLVBGL(int) VbglInitPrimary(RTIOPORT portVMMDev, VMMDevMemory *pVMMDevMemory)
 {
     int rc = VINF_SUCCESS;
 
 # ifdef RT_OS_WINDOWS /** @todo r=bird: this doesn't make sense. Is there something special going on on windows? */
     dprintf(("vbglInit: starts g_vbgldata.status %d\n", g_vbgldata.status));
 
-    if (g_vbgldata.status == VbglStatusInitializing
+    if (   g_vbgldata.status == VbglStatusInitializing
         || g_vbgldata.status == VbglStatusReady)
     {
         /* Initialization is already in process. */
@@ -230,11 +232,11 @@ DECLVBGL(void) VbglTerminate (void)
 
 #else /* !VBGL_VBOXGUEST */
 
-DECLVBGL(int) VbglInit (void)
+DECLVBGL(int) VbglInitClient(void)
 {
     int rc = VINF_SUCCESS;
 
-    if (g_vbgldata.status == VbglStatusInitializing
+    if (   g_vbgldata.status == VbglStatusInitializing
         || g_vbgldata.status == VbglStatusReady)
     {
         /* Initialization is already in process. */
index 62617919ad6bbbcf6684b6f5eef30de2e254f685..fc5e99e9354c07f630275c7978222ccedea55cf7 100644 (file)
@@ -512,7 +512,7 @@ DECLVBGL(uint32_t) VbglPhysHeapGetPhysAddr (void *p)
     return physAddr;
 }
 
-DECLVBGL(void) VbglPhysHeapFree (void *p)
+DECLVBGL(void) VbglPhysHeapFree(void *p)
 {
     VBGLPHYSHEAPBLOCK *pBlock;
     VBGLPHYSHEAPBLOCK *pNeighbour;
index 6e5e20a85870a1f8ebdcbc539cdd69695719a992..000477382ea85b6e95d287b2d76ba3be8fc7e72f 100644 (file)
@@ -50,7 +50,7 @@
  * @param   fWriteAccess    Lock for read-write (true) or readonly (false).
  * @param   fFlags          HGCM call flags, VBGLR0_HGCM_F_XXX.
  */
-int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess, uint32_t fFlags)
+int vbglLockLinear(void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess, uint32_t fFlags)
 {
     int         rc      = VINF_SUCCESS;
 #ifndef RT_OS_WINDOWS
@@ -73,7 +73,7 @@ int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess
     /** @todo just use IPRT here. the extra allocation shouldn't matter much...
      *        Then we can move all this up one level even. */
 #ifdef RT_OS_WINDOWS
-    PMDL pMdl = IoAllocateMdl (pv, u32Size, FALSE, FALSE, NULL);
+    PMDL pMdl = IoAllocateMdl(pv, u32Size, FALSE, FALSE, NULL);
 
     if (pMdl == NULL)
     {
@@ -84,16 +84,16 @@ int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess
     {
         __try {
             /* Calls to MmProbeAndLockPages must be enclosed in a try/except block. */
-            MmProbeAndLockPages (pMdl,
-                                 /** @todo (fFlags & VBGLR0_HGCMCALL_F_MODE_MASK) == VBGLR0_HGCMCALL_F_USER? UserMode: KernelMode */
-                                 KernelMode,
-                                 (fWriteAccess) ? IoModifyAccess : IoReadAccess);
+            MmProbeAndLockPages(pMdl,
+                                /** @todo (fFlags & VBGLR0_HGCMCALL_F_MODE_MASK) == VBGLR0_HGCMCALL_F_USER? UserMode: KernelMode */
+                                KernelMode,
+                                (fWriteAccess) ? IoModifyAccess : IoReadAccess);
 
             *ppvCtx = pMdl;
 
         } __except(EXCEPTION_EXECUTE_HANDLER) {
 
-            IoFreeMdl (pMdl);
+            IoFreeMdl(pMdl);
             /** @todo  */
             rc = VERR_INVALID_PARAMETER;
             AssertMsgFailed(("MmProbeAndLockPages %p %x failed!!\n", pv, u32Size));
@@ -123,7 +123,7 @@ int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess
     return rc;
 }
 
-void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size)
+void vbglUnlockLinear(void *pvCtx, void *pv, uint32_t u32Size)
 {
 #ifdef RT_OS_WINDOWS
     PMDL pMdl = (PMDL)pvCtx;
@@ -131,8 +131,8 @@ void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size)
     Assert(pMdl);
     if (pMdl != NULL)
     {
-        MmUnlockPages (pMdl);
-        IoFreeMdl (pMdl);
+        MmUnlockPages(pMdl);
+        IoFreeMdl(pMdl);
     }
 
 #else
@@ -163,13 +163,13 @@ RT_C_DECLS_END
 # if !defined(RT_OS_OS2) \
   && !defined(RT_OS_WINDOWS)
 RT_C_DECLS_BEGIN
-extern DECLVBGL(void *) VBoxGuestIDCOpen (uint32_t *pu32Version);
-extern DECLVBGL(void)   VBoxGuestIDCClose (void *pvOpaque);
-extern DECLVBGL(int)    VBoxGuestIDCCall (void *pvOpaque, unsigned int iCmd, void *pvData, size_t cbSize, size_t *pcbReturn);
+extern DECLVBGL(void *) VBoxGuestIDCOpen(uint32_t *pu32Version);
+extern DECLVBGL(void)   VBoxGuestIDCClose(void *pvOpaque);
+extern DECLVBGL(int)    VBoxGuestIDCCall(void *pvOpaque, unsigned int iCmd, void *pvData, size_t cbSize, size_t *pcbReturn);
 RT_C_DECLS_END
 # endif
 
-bool vbglDriverIsOpened (VBGLDRIVER *pDriver)
+bool vbglDriverIsOpened(VBGLDRIVER *pDriver)
 {
 # ifdef RT_OS_WINDOWS
     return pDriver->pFileObject != NULL;
@@ -180,19 +180,17 @@ bool vbglDriverIsOpened (VBGLDRIVER *pDriver)
 # endif
 }
 
-int vbglDriverOpen (VBGLDRIVER *pDriver)
+int vbglDriverOpen(VBGLDRIVER *pDriver)
 {
 # ifdef RT_OS_WINDOWS
     UNICODE_STRING uszDeviceName;
-    RtlInitUnicodeString (&uszDeviceName, L"\\Device\\VBoxGuest");
+    RtlInitUnicodeString(&uszDeviceName, L"\\Device\\VBoxGuest");
 
     PDEVICE_OBJECT pDeviceObject = NULL;
     PFILE_OBJECT pFileObject = NULL;
 
-    NTSTATUS rc = IoGetDeviceObjectPointer (&uszDeviceName, FILE_ALL_ACCESS,
-                                            &pFileObject, &pDeviceObject);
-
-    if (NT_SUCCESS (rc))
+    NTSTATUS rc = IoGetDeviceObjectPointer(&uszDeviceName, FILE_ALL_ACCESS, &pFileObject, &pDeviceObject);
+    if (NT_SUCCESS(rc))
     {
         Log(("vbglDriverOpen VBoxGuest successful pDeviceObject=%x\n", pDeviceObject));
         pDriver->pDeviceObject = pDeviceObject;
@@ -207,9 +205,9 @@ int vbglDriverOpen (VBGLDRIVER *pDriver)
     /*
      * Just check whether the connection was made or not.
      */
-    if (    g_VBoxGuestIDC.u32Version == VMMDEV_VERSION
-        &&  VALID_PTR(g_VBoxGuestIDC.u32Session)
-        &&  VALID_PTR(g_VBoxGuestIDC.pfnServiceEP))
+    if (   g_VBoxGuestIDC.u32Version == VMMDEV_VERSION
+        && RT_VALID_PTR(g_VBoxGuestIDC.u32Session)
+        && RT_VALID_PTR(g_VBoxGuestIDC.pfnServiceEP))
     {
         pDriver->u32Session = g_VBoxGuestIDC.u32Session;
         return VINF_SUCCESS;
@@ -220,9 +218,9 @@ int vbglDriverOpen (VBGLDRIVER *pDriver)
 
 # else
     uint32_t u32VMMDevVersion;
-    pDriver->pvOpaque = VBoxGuestIDCOpen (&u32VMMDevVersion);
-    if (    pDriver->pvOpaque
-        &&  u32VMMDevVersion == VMMDEV_VERSION)
+    pDriver->pvOpaque = VBoxGuestIDCOpen(&u32VMMDevVersion);
+    if (   pDriver->pvOpaque
+        && u32VMMDevVersion == VMMDEV_VERSION)
         return VINF_SUCCESS;
 
     Log(("vbglDriverOpen: failed\n"));
@@ -231,34 +229,32 @@ int vbglDriverOpen (VBGLDRIVER *pDriver)
 }
 
 # ifdef RT_OS_WINDOWS
-static NTSTATUS vbglDriverIOCtlCompletion (IN PDEVICE_OBJECT DeviceObject,
-                                           IN PIRP Irp,
-                                           IN PVOID Context)
+static NTSTATUS vbglDriverIOCtlCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
 {
     Log(("VBGL completion %x\n", Irp));
 
     KEVENT *pEvent = (KEVENT *)Context;
-    KeSetEvent (pEvent, IO_NO_INCREMENT, FALSE);
+    KeSetEvent(pEvent, IO_NO_INCREMENT, FALSE);
 
     return STATUS_MORE_PROCESSING_REQUIRED;
 }
 # endif
 
-int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData)
+int vbglDriverIOCtl(VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData)
 {
     Log(("vbglDriverIOCtl: pDriver: %p, Func: %x, pvData: %p, cbData: %d\n", pDriver, u32Function, pvData, cbData));
 
 # ifdef RT_OS_WINDOWS
     KEVENT Event;
 
-    KeInitializeEvent (&Event, NotificationEvent, FALSE);
+    KeInitializeEvent(&Event, NotificationEvent, FALSE);
 
     /* Have to use the IoAllocateIRP method because this code is generic and
      * must work in any thread context.
      * The IoBuildDeviceIoControlRequest, which was used here, does not work
      * when APCs are disabled, for example.
      */
-    PIRP irp = IoAllocateIrp (pDriver->pDeviceObject->StackSize, FALSE);
+    PIRP irp = IoAllocateIrp(pDriver->pDeviceObject->StackSize, FALSE);
 
     Log(("vbglDriverIOCtl: irp %p, IRQL = %d\n", irp, KeGetCurrentIrql()));
 
@@ -272,7 +268,7 @@ int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, ui
      * Setup the IRP_MJ_DEVICE_CONTROL IRP.
      */
 
-    PIO_STACK_LOCATION nextStack = IoGetNextIrpStackLocation (irp);
+    PIO_STACK_LOCATION nextStack = IoGetNextIrpStackLocation(irp);
 
     nextStack->MajorFunction = IRP_MJ_DEVICE_CONTROL;
     nextStack->MinorFunction = 0;
@@ -286,25 +282,21 @@ int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, ui
     irp->MdlAddress = NULL;
 
     /* A completion routine is required to signal the Event. */
-    IoSetCompletionRoutine (irp, vbglDriverIOCtlCompletion, &Event, TRUE, TRUE, TRUE);
+    IoSetCompletionRoutine(irp, vbglDriverIOCtlCompletion, &Event, TRUE, TRUE, TRUE);
 
-    NTSTATUS rc = IoCallDriver (pDriver->pDeviceObject, irp);
+    NTSTATUS rc = IoCallDriver(pDriver->pDeviceObject, irp);
 
     if (NT_SUCCESS (rc))
     {
         /* Wait the event to be signalled by the completion routine. */
-        KeWaitForSingleObject (&Event,
-                               Executive,
-                               KernelMode,
-                               FALSE,
-                               NULL);
+        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
 
         rc = irp->IoStatus.Status;
 
         Log(("vbglDriverIOCtl: wait completed IRQL = %d\n", KeGetCurrentIrql()));
     }
 
-    IoFreeIrp (irp);
+    IoFreeIrp(irp);
 
     if (rc != STATUS_SUCCESS)
         Log(("vbglDriverIOCtl: ntstatus=%x\n", rc));
@@ -330,11 +322,11 @@ int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, ui
 # endif
 }
 
-void vbglDriverClose (VBGLDRIVER *pDriver)
+void vbglDriverClose(VBGLDRIVER *pDriver)
 {
 # ifdef RT_OS_WINDOWS
     Log(("vbglDriverClose pDeviceObject=%x\n", pDriver->pDeviceObject));
-    ObDereferenceObject (pDriver->pFileObject);
+    ObDereferenceObject(pDriver->pFileObject);
     pDriver->pFileObject = NULL;
     pDriver->pDeviceObject = NULL;
 
@@ -342,7 +334,7 @@ void vbglDriverClose (VBGLDRIVER *pDriver)
     pDriver->u32Session = 0;
 
 # else
-    VBoxGuestIDCClose (pDriver->pvOpaque);
+    VBoxGuestIDCClose(pDriver->pvOpaque);
     pDriver->pvOpaque = NULL;
 # endif
 }
index fede8b0babdc8695049077ad6b852280f0811f1d..ee554ff55a0e3584b309379d86441975e096cf0b 100644 (file)
@@ -24,8 +24,8 @@
  * terms and conditions of either the GPL or the CDDL or both.
  */
 
-#ifndef __VBoxGuestLib_SysHlp_h
-#define __VBoxGuestLib_SysHlp_h
+#ifndef ___VBoxGuestLib_SysHlp_h
+#define ___VBoxGuestLib_SysHlp_h
 
 #include <iprt/types.h>
 
@@ -55,8 +55,8 @@ RT_C_DECLS_END
 /* XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist on NT4, so...
  * The same for ExAllocatePool.
  */
-#undef ExAllocatePool
-#undef ExFreePool
+# undef ExAllocatePool
+# undef ExFreePool
 #endif
 
 typedef struct _VBGLDRIVER
@@ -71,8 +71,8 @@ typedef struct _VBGLDRIVER
 #endif
 } VBGLDRIVER;
 
-int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess, uint32_t fFlags);
-void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size);
+int  vbglLockLinear(void **ppvCtx, void *pv, uint32_t cb, bool fWriteAccess, uint32_t fFlags);
+void vbglUnlockLinear(void *pvCtx, void *pv, uint32_t cb);
 
 
 #ifndef VBGL_VBOXGUEST
@@ -82,9 +82,9 @@ void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size);
  *
  * @param pDriver      Pointer to the driver structure.
  *
- * @return VBox error code
+ * @return VBox status code
  */
-int vbglDriverOpen (VBGLDRIVER *pDriver);
+int vbglDriverOpen(VBGLDRIVER *pDriver);
 
 /**
  * Answers whether the VBoxGuest driver is opened
@@ -93,7 +93,7 @@ int vbglDriverOpen (VBGLDRIVER *pDriver);
  *
  * @return true - if opened, false - otherwise
  */
-bool vbglDriverIsOpened (VBGLDRIVER *pDriver);
+bool vbglDriverIsOpened(VBGLDRIVER *pDriver);
 
 /**
  * Call VBoxGuest driver.
@@ -103,20 +103,20 @@ bool vbglDriverIsOpened (VBGLDRIVER *pDriver);
  * @param pvData       Pointer to supplied in/out data buffer.
  * @param cbData       Size of data buffer.
  *
- * @return VBox error code
+ * @returns VBox status code
  */
-int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
+int vbglDriverIOCtl(VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
 
 /**
  * Close VBoxGuest driver.
  *
  * @param pDriver      Pointer to the driver structure.
  *
- * @return VBox error code
+ * @returns VBox status code
  */
-void vbglDriverClose (VBGLDRIVER *pDriver);
+void vbglDriverClose(VBGLDRIVER *pDriver);
 
 #endif
 
-#endif /* !__VBoxGuestLib_SysHlp_h */
+#endif
 
index fe9b01a93eaf4b2e79c7f77e5a40a1a0371f91ac..e4233fbb8447ee1b4f85edc5d57e07a65e978a20 100644 (file)
@@ -72,11 +72,11 @@ enum VbglLibStatus
  * Global VBGL ring-0 data.
  * Lives in VbglR0Init.cpp.
  */
-typedef struct _VBGLDATA
+typedef struct VBGLDATA
 {
     enum VbglLibStatus status;
 
-    VBGLIOPORT portVMMDev;
+    RTIOPORT portVMMDev;
 
     VMMDevMemory *pVMMDevMemory;
 
@@ -154,9 +154,11 @@ int vbglR0Enter (void);
 
 #ifdef VBOX_WITH_HGCM
 # ifndef VBGL_VBOXGUEST
-int vbglR0HGCMInit (void);
-int vbglR0HGCMTerminate (void);
+int                         vbglR0HGCMInit(void);
+int                         vbglR0HGCMTerminate(void);
 # endif
+struct VBGLHGCMHANDLEDATA  *vbglHGCMHandleAlloc(void);
+void                        vbglHGCMHandleFree(struct VBGLHGCMHANDLEDATA *pHandle);
 #endif /* VBOX_WITH_HGCM */
 
 #ifndef VBGL_VBOXGUEST
index aa0883dd630e60712c300244e74b9548e2611a1c..b05fb9282d0ca73a504b8cbe972b2bb6259d5f85 100644 (file)
 /* Entire file is ifdef'ed with !VBGL_VBOXGUEST */
 #ifndef VBGL_VBOXGUEST
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #define LOG_GROUP LOG_GROUP_SHARED_FOLDERS
-#ifdef RT_OS_LINUX
-# include "VBoxGuestR0LibSharedFolders.h"
-#else
-# include "VBoxGuestR0LibSharedFolders.h"
-#endif
+#include <VBox/VBoxGuestLibSharedFolders.h>
 #include <VBox/log.h>
 #include <iprt/time.h>
 #include <iprt/mem.h>
 #include <iprt/string.h>
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 #define SHFL_CPARMS_SET_UTF8 0
 #define SHFL_CPARMS_SET_SYMLINKS 0
 
-#define VBOX_INIT_CALL(a, b, c)          \
-    LogFunc(("%s, u32ClientID=%d\n", "SHFL_FN_" # b, \
-            (c)->ulClientID)); \
-    (a)->result      = VINF_SUCCESS;     \
-    (a)->u32ClientID = (c)->ulClientID;  \
-    (a)->u32Function = SHFL_FN_##b;      \
+#define VBOX_INIT_CALL(a, b, c) \
+    LogFunc(("%s, idClient=%d\n", "SHFL_FN_" # b, (c)->idClient)); \
+    (a)->result      = VINF_SUCCESS; \
+    (a)->u32ClientID = (c)->idClient; \
+    (a)->u32Function = SHFL_FN_##b; \
     (a)->cParms      = SHFL_CPARMS_##b
 
 
 
-DECLVBGL(int) vboxInit (void)
+DECLVBGL(int) VbglR0SfInit(void)
 {
-    int rc = VINF_SUCCESS;
-
-    rc = VbglInit ();
-    return rc;
+    return VbglInitClient();
 }
 
-DECLVBGL(void) vboxUninit (void)
+DECLVBGL(void) VbglR0SfTerm(void)
 {
-    VbglTerminate ();
+    VbglTerminate();
 }
 
-DECLVBGL(int) vboxConnect (PVBSFCLIENT pClient)
+DECLVBGL(int) VbglR0SfConnect(PVBGLSFCLIENT pClient)
 {
     int rc;
     VBoxGuestHGCMConnectInfo data;
@@ -84,50 +77,40 @@ DECLVBGL(int) vboxConnect (PVBSFCLIENT pClient)
     data.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
     strcpy (data.Loc.u.host.achName, "VBoxSharedFolders");
 
-    rc = VbglHGCMConnect (&pClient->handle, &data);
-
-/*    Log(("VBOXSF: VBoxSF::vboxConnect: VbglHGCMConnect rc = %#x, result = %#x\n",
-         rc, data.result));
-*/
-    if (RT_SUCCESS (rc))
-    {
+    rc = VbglHGCMConnect(&pClient->handle, &data);
+/*    Log(("VBOXSF: VbglR0SfConnect: VbglHGCMConnect rc = %#x, result = %#x\n", rc, data.result)); */
+    if (RT_SUCCESS(rc))
         rc = data.result;
-    }
-
-    if (RT_SUCCESS (rc))
+    if (RT_SUCCESS(rc))
     {
-        pClient->ulClientID = data.u32ClientID;
-        LogFunc(("u32ClientID=%d\n", pClient->ulClientID));
+        pClient->idClient = data.u32ClientID;
+        LogFunc(("idClient=%d\n", pClient->idClient));
     }
     return rc;
 }
 
-DECLVBGL(void) vboxDisconnect (PVBSFCLIENT pClient)
+DECLVBGL(void) VbglR0SfDisconnect(PVBGLSFCLIENT pClient)
 {
     int rc;
     VBoxGuestHGCMDisconnectInfo data;
 
-    LogFunc(("u32ClientID=%d\n", pClient->ulClientID));
+    LogFunc(("u32ClientID=%d\n", pClient->idClient));
     if (pClient->handle == NULL)
         return;                 /* not connected */
 
     RT_ZERO(data);
     data.result      = VINF_SUCCESS;
-    data.u32ClientID = pClient->ulClientID;
+    data.u32ClientID = pClient->idClient;
 
-    rc = VbglHGCMDisconnect (pClient->handle, &data);
+    rc = VbglHGCMDisconnect(pClient->handle, &data);
     NOREF(rc);
-/*    Log(("VBOXSF: VBoxSF::vboxDisconnect: "
-         "VbglHGCMDisconnect rc = %#x, result = %#x\n", rc, data.result));
-*/
+/*    Log(("VBOXSF: VbglR0SfDisconnect: VbglHGCMDisconnect rc = %#x, result = %#x\n", rc, data.result)); */
     return;
 }
 
-DECLVBGL(int) vboxCallQueryMappings (PVBSFCLIENT pClient, SHFLMAPPING paMappings[],
-                                     uint32_t *pcMappings)
+DECLVBGL(int) VbglR0SfQueryMappings(PVBGLSFCLIENT pClient, SHFLMAPPING paMappings[], uint32_t *pcMappings)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFQueryMappings data;
 
     VBOX_INIT_CALL(&data.callInfo, QUERY_MAPPINGS, pClient);
@@ -139,35 +122,23 @@ DECLVBGL(int) vboxCallQueryMappings (PVBSFCLIENT pClient, SHFLMAPPING paMappings
     data.numberOfMappings.u.value32      = *pcMappings;
 
     data.mappings.type                   = VMMDevHGCMParmType_LinAddr;
-    data.mappings.u.Pointer.size         = sizeof (SHFLMAPPING) * *pcMappings;
+    data.mappings.u.Pointer.size         = sizeof(SHFLMAPPING) * *pcMappings;
     data.mappings.u.Pointer.u.linearAddr = (uintptr_t)&paMappings[0];
 
-/*    Log(("VBOXSF: in ifs difference %d\n",
-         (char *)&data.flags.type - (char *)&data.callInfo.cParms));
-*/
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*
-    Log(("VBOXSF: VBoxSF::vboxCallQueryMappings: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
-    {
+/*    Log(("VBOXSF: in ifs difference %d\n", (char *)&data.flags.type - (char *)&data.callInfo.cParms)); */
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfQueryMappings: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
         rc = data.callInfo.result;
-    }
-
-    if (RT_SUCCESS (rc))
-    {
+    if (RT_SUCCESS(rc))
         *pcMappings = data.numberOfMappings.u.value32;
-    }
 
     return rc;
 }
 
-DECLVBGL(int) vboxCallQueryMapName (PVBSFCLIENT pClient, SHFLROOT root, SHFLSTRING *pString, uint32_t size)
+DECLVBGL(int) VbglR0SfQueryMapName(PVBGLSFCLIENT pClient, SHFLROOT root, SHFLSTRING *pString, uint32_t size)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFQueryMapName data;
 
     VBOX_INIT_CALL(&data.callInfo, QUERY_MAP_NAME, pClient);
@@ -179,30 +150,23 @@ DECLVBGL(int) vboxCallQueryMapName (PVBSFCLIENT pClient, SHFLROOT root, SHFLSTRI
     data.name.u.Pointer.size         = size;
     data.name.u.Pointer.u.linearAddr = (uintptr_t)pString;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallQueryMapName: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
-    {
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfQueryMapName: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
         rc = data.callInfo.result;
-    }
 
     return rc;
 }
 
-DECLVBGL(int) vboxCallMapFolder(PVBSFCLIENT pClient, PSHFLSTRING szFolderName,
-                                PVBSFMAP pMap)
+DECLVBGL(int) VbglR0SfMapFolder(PVBGLSFCLIENT pClient, PSHFLSTRING szFolderName, PVBGLSFMAP pMap)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFMapFolder data;
 
     VBOX_INIT_CALL(&data.callInfo, MAP_FOLDER, pClient);
 
     data.path.type                    = VMMDevHGCMParmType_LinAddr;
-    data.path.u.Pointer.size          = ShflStringSizeOfBuffer (szFolderName);
+    data.path.u.Pointer.size          = ShflStringSizeOfBuffer(szFolderName);
     data.path.u.Pointer.u.linearAddr  = (uintptr_t)szFolderName;
 
     data.root.type                    = VMMDevHGCMParmType_32bit;
@@ -218,12 +182,9 @@ DECLVBGL(int) vboxCallMapFolder(PVBSFCLIENT pClient, PSHFLSTRING szFolderName,
     data.fCaseSensitive.u.value32     = 1;
 #endif
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallMapFolder: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfMapFolder: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
     {
         pMap->root = data.root.u.value32;
         rc         = data.callInfo.result;
@@ -245,9 +206,8 @@ DECLVBGL(int) vboxCallMapFolder(PVBSFCLIENT pClient, PSHFLSTRING szFolderName,
         OldData.delimiter.type               = VMMDevHGCMParmType_32bit;
         OldData.delimiter.u.value32          = RTPATH_DELIMITER;
 
-        rc = VbglHGCMCall (pClient->handle, &OldData.callInfo, sizeof (OldData));
-
-        if (RT_SUCCESS (rc))
+        rc = VbglHGCMCall(pClient->handle, &OldData.callInfo, sizeof(OldData));
+        if (RT_SUCCESS(rc))
         {
             pMap->root = OldData.root.u.value32;
             rc         = OldData.callInfo.result;
@@ -256,10 +216,9 @@ DECLVBGL(int) vboxCallMapFolder(PVBSFCLIENT pClient, PSHFLSTRING szFolderName,
     return rc;
 }
 
-DECLVBGL(int) vboxCallUnmapFolder(PVBSFCLIENT pClient, PVBSFMAP pMap)
+DECLVBGL(int) VbglR0SfUnmapFolder(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFUnmapFolder data;
 
     VBOX_INIT_CALL(&data.callInfo, UNMAP_FOLDER, pClient);
@@ -267,24 +226,17 @@ DECLVBGL(int) vboxCallUnmapFolder(PVBSFCLIENT pClient, PVBSFMAP pMap)
     data.root.type                      = VMMDevHGCMParmType_32bit;
     data.root.u.value32                 = pMap->root;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallUnmapFolder: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
-    {
-        rc         = data.callInfo.result;
-    }
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfUnmapFolder: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
+        rc = data.callInfo.result;
     return rc;
 }
 
-DECLVBGL(int) vboxCallCreate (PVBSFCLIENT pClient, PVBSFMAP pMap,
-                              PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms)
+DECLVBGL(int) VbglR0SfCreate(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms)
 {
     /** @todo copy buffers to physical or mapped memory. */
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFCreate data;
 
     VBOX_INIT_CALL(&data.callInfo, CREATE, pClient);
@@ -297,25 +249,19 @@ DECLVBGL(int) vboxCallCreate (PVBSFCLIENT pClient, PVBSFMAP pMap,
     data.path.u.Pointer.u.linearAddr  = (uintptr_t)pParsedPath;
 
     data.parms.type                   = VMMDevHGCMParmType_LinAddr;
-    data.parms.u.Pointer.size         = sizeof (SHFLCREATEPARMS);
+    data.parms.u.Pointer.size         = sizeof(SHFLCREATEPARMS);
     data.parms.u.Pointer.u.linearAddr = (uintptr_t)pCreateParms;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallCreate: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
-    {
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfCreate: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
         rc = data.callInfo.result;
-    }
     return rc;
 }
 
-DECLVBGL(int) vboxCallClose (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE Handle)
+DECLVBGL(int) VbglR0SfClose(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE Handle)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFClose data;
 
     VBOX_INIT_CALL(&data.callInfo, CLOSE, pClient);
@@ -326,21 +272,14 @@ DECLVBGL(int) vboxCallClose (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE Hand
     data.handle.type                    = VMMDevHGCMParmType_64bit;
     data.handle.u.value64               = Handle;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallClose: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
-    {
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfClose: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
         rc = data.callInfo.result;
-    }
-
     return rc;
 }
 
-DECLVBGL(int) vboxCallRemove (PVBSFCLIENT pClient, PVBSFMAP pMap,
-                              PSHFLSTRING pParsedPath, uint32_t flags)
+DECLVBGL(int) VbglR0SfRemove(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING pParsedPath, uint32_t flags)
 {
     int rc = VINF_SUCCESS;
 
@@ -352,30 +291,22 @@ DECLVBGL(int) vboxCallRemove (PVBSFCLIENT pClient, PVBSFMAP pMap,
     data.root.u.value32                 = pMap->root;
 
     data.path.type                      = VMMDevHGCMParmType_LinAddr_In;
-    data.path.u.Pointer.size            = ShflStringSizeOfBuffer (pParsedPath);
+    data.path.u.Pointer.size            = ShflStringSizeOfBuffer(pParsedPath);
     data.path.u.Pointer.u.linearAddr    = (uintptr_t)pParsedPath;
 
     data.flags.type                     = VMMDevHGCMParmType_32bit;
     data.flags.u.value32                = flags;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallRemove: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfRemove: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
     if (RT_SUCCESS (rc))
-    {
         rc = data.callInfo.result;
-    }
-
     return rc;
 }
 
-DECLVBGL(int) vboxCallRename (PVBSFCLIENT pClient, PVBSFMAP pMap,
-                              PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags)
+DECLVBGL(int) VbglR0SfRename(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFRename data;
 
     VBOX_INIT_CALL(&data.callInfo, RENAME, pClient);
@@ -384,33 +315,27 @@ DECLVBGL(int) vboxCallRename (PVBSFCLIENT pClient, PVBSFMAP pMap,
     data.root.u.value32                 = pMap->root;
 
     data.src.type                       = VMMDevHGCMParmType_LinAddr_In;
-    data.src.u.Pointer.size             = ShflStringSizeOfBuffer (pSrcPath);
+    data.src.u.Pointer.size             = ShflStringSizeOfBuffer(pSrcPath);
     data.src.u.Pointer.u.linearAddr     = (uintptr_t)pSrcPath;
 
     data.dest.type                      = VMMDevHGCMParmType_LinAddr_In;
-    data.dest.u.Pointer.size            = ShflStringSizeOfBuffer (pDestPath);
+    data.dest.u.Pointer.size            = ShflStringSizeOfBuffer(pDestPath);
     data.dest.u.Pointer.u.linearAddr    = (uintptr_t)pDestPath;
 
     data.flags.type                     = VMMDevHGCMParmType_32bit;
     data.flags.u.value32                = flags;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallRename: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfRename: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
     if (RT_SUCCESS (rc))
-    {
         rc = data.callInfo.result;
-    }
     return rc;
 }
 
-DECLVBGL(int) vboxCallRead(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
+DECLVBGL(int) VbglR0SfRead(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile,
                            uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFRead data;
 
     VBOX_INIT_CALL(&data.callInfo, READ, pClient);
@@ -428,12 +353,9 @@ DECLVBGL(int) vboxCallRead(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
     data.buffer.u.Pointer.size          = *pcbBuffer;
     data.buffer.u.Pointer.u.linearAddr  = (uintptr_t)pBuffer;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallRead: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfRead: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
     {
         rc = data.callInfo.result;
         *pcbBuffer = data.cb.u.value32;
@@ -441,9 +363,8 @@ DECLVBGL(int) vboxCallRead(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
     return rc;
 }
 
-DECLVBGL(int) VbglR0SharedFolderReadPageList(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
-                                             uint64_t offset, uint32_t *pcbBuffer,
-                                             uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages)
+DECLVBGL(int) VbglR0SfReadPageList(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer,
+                                   uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages)
 {
     uint32_t            cbToRead  = *pcbBuffer;
     uint32_t            cbData    = (uint32_t)(sizeof(VBoxSFRead) + RT_UOFFSETOF(HGCMPageListInfo, aPages[cPages]));
@@ -477,7 +398,8 @@ DECLVBGL(int) VbglR0SharedFolderReadPageList(PVBSFCLIENT pClient, PVBSFMAP pMap,
         pPgLst->aPages[iPage] = paPages[iPage];
 
     rc = VbglHGCMCall(pClient->handle, &pData->callInfo, cbData);
-    if (RT_SUCCESS (rc))
+/*    Log(("VBOXSF: VbglR0SfReadPageList: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
     {
         rc = pData->callInfo.result;
         *pcbBuffer = pData->cb.u.value32;
@@ -487,11 +409,10 @@ DECLVBGL(int) VbglR0SharedFolderReadPageList(PVBSFCLIENT pClient, PVBSFMAP pMap,
     return rc;
 }
 
-DECLVBGL(int) vboxCallWrite(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
+DECLVBGL(int) VbglR0SfWrite(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile,
                             uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFWrite data;
 
     VBOX_INIT_CALL(&data.callInfo, WRITE, pClient);
@@ -505,16 +426,13 @@ DECLVBGL(int) vboxCallWrite(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile
     data.offset.u.value64               = offset;
     data.cb.type                        = VMMDevHGCMParmType_32bit;
     data.cb.u.value32                   = *pcbBuffer;
-    data.buffer.type                    = (fLocked) ? VMMDevHGCMParmType_LinAddr_Locked_In : VMMDevHGCMParmType_LinAddr_In;
+    data.buffer.type                    = fLocked ? VMMDevHGCMParmType_LinAddr_Locked_In : VMMDevHGCMParmType_LinAddr_In;
     data.buffer.u.Pointer.size          = *pcbBuffer;
     data.buffer.u.Pointer.u.linearAddr  = (uintptr_t)pBuffer;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallWrite: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfWrite: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
     {
         rc = data.callInfo.result;
         *pcbBuffer = data.cb.u.value32;
@@ -522,7 +440,8 @@ DECLVBGL(int) vboxCallWrite(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile
     return rc;
 }
 
-DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, RTCCPHYS PhysBuffer)
+DECLVBGL(int) VbglR0SfWritePhysCont(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset,
+                                    uint32_t *pcbBuffer, RTCCPHYS PhysBuffer)
 {
     uint32_t            cbToWrite = *pcbBuffer;
     uint32_t            cPages    = RT_ALIGN_32((PhysBuffer & PAGE_OFFSET_MASK) + cbToWrite, PAGE_SIZE) >> PAGE_SHIFT;
@@ -557,8 +476,9 @@ DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHAND
     for (iPage = 0; iPage < cPages; iPage++, PhysBuffer += PAGE_SIZE)
         pPgLst->aPages[iPage] = PhysBuffer;
 
-    rc = VbglHGCMCall (pClient->handle, &pData->callInfo, cbData);
-    if (RT_SUCCESS (rc))
+    rc = VbglHGCMCall(pClient->handle, &pData->callInfo, cbData);
+/*    Log(("VBOXSF: VbglR0SfWritePhysCont: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
     {
         rc = pData->callInfo.result;
         *pcbBuffer = pData->cb.u.value32;
@@ -569,9 +489,8 @@ DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHAND
 
 }
 
-DECLVBGL(int) VbglR0SharedFolderWritePageList(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
-                                              uint64_t offset, uint32_t *pcbBuffer,
-                                              uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages)
+DECLVBGL(int) VbglR0SfWritePageList(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer,
+                                    uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages)
 {
     uint32_t            cbToWrite = *pcbBuffer;
     uint32_t            cbData    = (uint32_t)(sizeof(VBoxSFWrite) + RT_UOFFSETOF(HGCMPageListInfo, aPages[cPages]));
@@ -604,8 +523,9 @@ DECLVBGL(int) VbglR0SharedFolderWritePageList(PVBSFCLIENT pClient, PVBSFMAP pMap
     for (iPage = 0; iPage < cPages; iPage++)
         pPgLst->aPages[iPage] = paPages[iPage];
 
-    rc = VbglHGCMCall (pClient->handle, &pData->callInfo, cbData);
-    if (RT_SUCCESS (rc))
+    rc = VbglHGCMCall(pClient->handle, &pData->callInfo, cbData);
+/*    Log(("VBOXSF: VbglR0SfWritePageList: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
     {
         rc = pData->callInfo.result;
         *pcbBuffer = pData->cb.u.value32;
@@ -615,10 +535,9 @@ DECLVBGL(int) VbglR0SharedFolderWritePageList(PVBSFCLIENT pClient, PVBSFMAP pMap
     return rc;
 }
 
-DECLVBGL(int) vboxCallFlush(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile)
+DECLVBGL(int) VbglR0SfFlush(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFFlush data;
 
     VBOX_INIT_CALL(&data.callInfo, FLUSH, pClient);
@@ -629,21 +548,16 @@ DECLVBGL(int) vboxCallFlush(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile
     data.handle.type                    = VMMDevHGCMParmType_64bit;
     data.handle.u.value64               = hFile;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallFlush: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
-    {
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfFlush: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
         rc = data.callInfo.result;
-    }
     return rc;
 }
 
-DECLVBGL(int) vboxCallDirInfo (
-    PVBSFCLIENT pClient,
-    PVBSFMAP pMap,
+DECLVBGL(int) VbglR0SfDirInfo(
+    PVBGLSFCLIENT pClient,
+    PVBGLSFMAP pMap,
     SHFLHANDLE hFile,
     PSHFLSTRING ParsedPath,
     uint32_t flags,
@@ -652,8 +566,7 @@ DECLVBGL(int) vboxCallDirInfo (
     PSHFLDIRINFO pBuffer,
     uint32_t *pcFiles)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFList data;
 
     VBOX_INIT_CALL(&data.callInfo, LIST, pClient);
@@ -668,8 +581,7 @@ DECLVBGL(int) vboxCallDirInfo (
     data.cb.type                        = VMMDevHGCMParmType_32bit;
     data.cb.u.value32                   = *pcbBuffer;
     data.path.type                      = VMMDevHGCMParmType_LinAddr_In;
-    data.path.u.Pointer.size            =
-        (ParsedPath) ? ShflStringSizeOfBuffer(ParsedPath) : 0;
+    data.path.u.Pointer.size            = ParsedPath ? ShflStringSizeOfBuffer(ParsedPath) : 0;
     data.path.u.Pointer.u.linearAddr    = (uintptr_t) ParsedPath;
 
     data.buffer.type                    = VMMDevHGCMParmType_LinAddr_Out;
@@ -681,25 +593,19 @@ DECLVBGL(int) vboxCallDirInfo (
     data.cFiles.type                    = VMMDevHGCMParmType_32bit;
     data.cFiles.u.value32               = 0; /* out parameters only */
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallDirInfo: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
-    {
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfDirInfo: rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
         rc = data.callInfo.result;
-    }
     *pcbBuffer = data.cb.u.value32;
     *pcFiles   = data.cFiles.u.value32;
     return rc;
 }
 
-DECLVBGL(int) vboxCallFSInfo(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
+DECLVBGL(int) VbglR0SfFsInfo(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile,
                              uint32_t flags, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFInformation data;
 
     VBOX_INIT_CALL(&data.callInfo, INFORMATION, pClient);
@@ -717,12 +623,9 @@ DECLVBGL(int) vboxCallFSInfo(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFil
     data.info.u.Pointer.size            = *pcbBuffer;
     data.info.u.Pointer.u.linearAddr    = (uintptr_t)pBuffer;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallFileInfo: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
-    if (RT_SUCCESS (rc))
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfFsInfo: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
     {
         rc = data.callInfo.result;
         *pcbBuffer = data.cb.u.value32;
@@ -730,11 +633,10 @@ DECLVBGL(int) vboxCallFSInfo(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFil
     return rc;
 }
 
-DECLVBGL(int) vboxCallLock(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
+DECLVBGL(int) VbglR0SfLock(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile,
                            uint64_t offset, uint64_t cbSize, uint32_t fLock)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFLock data;
 
     VBOX_INIT_CALL(&data.callInfo, LOCK, pClient);
@@ -752,38 +654,29 @@ DECLVBGL(int) vboxCallLock(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
     data.flags.type                     = VMMDevHGCMParmType_32bit;
     data.flags.u.value32                = fLock;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallLock: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfLock: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
     if (RT_SUCCESS (rc))
-    {
         rc = data.callInfo.result;
-    }
     return rc;
 }
 
-DECLVBGL(int) vboxCallSetUtf8 (PVBSFCLIENT pClient)
+DECLVBGL(int) VbglR0SfSetUtf8(PVBGLSFCLIENT pClient)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxGuestHGCMCallInfo callInfo;
 
-    VBOX_INIT_CALL (&callInfo, SET_UTF8, pClient);
-    rc = VbglHGCMCall (pClient->handle, &callInfo, sizeof (callInfo));
-    if (RT_SUCCESS (rc))
-    {
+    VBOX_INIT_CALL(&callInfo, SET_UTF8, pClient);
+    rc = VbglHGCMCall(pClient->handle, &callInfo, sizeof(callInfo));
+/*    Log(("VBOXSF: VbglR0SfSetUtf8: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
         rc = callInfo.result;
-    }
     return rc;
 }
 
-DECLVBGL(int) vboxReadLink (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath,
-                            uint32_t cbBuffer, uint8_t *pBuffer)
+DECLVBGL(int) VbglR0SfReadLink(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING pParsedPath, uint32_t cbBuffer, uint8_t *pBuffer)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFReadLink data;
 
     VBOX_INIT_CALL(&data.callInfo, READLINK, pClient);
@@ -799,23 +692,17 @@ DECLVBGL(int) vboxReadLink (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pPar
     data.buffer.u.Pointer.size          = cbBuffer;
     data.buffer.u.Pointer.u.linearAddr  = (uintptr_t)pBuffer;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallReadline: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfReadLink: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
     if (RT_SUCCESS (rc))
-    {
         rc = data.callInfo.result;
-    }
     return rc;
 }
 
-DECLVBGL(int) vboxCallSymlink (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pNewPath, PSHFLSTRING pOldPath,
-                               PSHFLFSOBJINFO pBuffer)
+DECLVBGL(int) VbglR0SfSymlink(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, PSHFLSTRING pNewPath, PSHFLSTRING pOldPath,
+                              PSHFLFSOBJINFO pBuffer)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxSFSymlink data;
 
     VBOX_INIT_CALL(&data.callInfo, SYMLINK, pClient);
@@ -835,30 +722,23 @@ DECLVBGL(int) vboxCallSymlink (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING p
     data.info.u.Pointer.size            = sizeof(SHFLFSOBJINFO);
     data.info.u.Pointer.u.linearAddr    = (uintptr_t)pBuffer;
 
-    rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
-
-/*    Log(("VBOXSF: VBoxSF::vboxCallSymlink: "
-         "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
-*/
+    rc = VbglHGCMCall(pClient->handle, &data.callInfo, sizeof(data));
+/*    Log(("VBOXSF: VbglR0SfSymlink: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
     if (RT_SUCCESS (rc))
-    {
         rc = data.callInfo.result;
-    }
     return rc;
 }
 
-DECLVBGL(int) vboxCallSetSymlinks (PVBSFCLIENT pClient)
+DECLVBGL(int) VbglR0SfSetSymlinks(PVBGLSFCLIENT pClient)
 {
-    int rc = VINF_SUCCESS;
-
+    int rc;
     VBoxGuestHGCMCallInfo callInfo;
 
-    VBOX_INIT_CALL (&callInfo, SET_SYMLINKS, pClient);
-    rc = VbglHGCMCall (pClient->handle, &callInfo, sizeof (callInfo));
-    if (RT_SUCCESS (rc))
-    {
+    VBOX_INIT_CALL(&callInfo, SET_SYMLINKS, pClient);
+    rc = VbglHGCMCall(pClient->handle, &callInfo, sizeof(callInfo));
+/*    Log(("VBOXSF: VbglR0SfSetSymlinks: VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result)); */
+    if (RT_SUCCESS(rc))
         rc = callInfo.result;
-    }
     return rc;
 }
 
index 0b532f19ea059cd6bba1045c58981e9a0fdde33c..a5d64c506e585c9463efc6601e2ea3915c64e43c 100644 (file)
 #include "VBGLInternal.h"
 
 
-DECLVBGL(int) VbglQueryVMMDevMemory (VMMDevMemory **ppVMMDevMemory)
+DECLVBGL(int) VbglQueryVMMDevMemory(VMMDevMemory **ppVMMDevMemory)
 {
-    int rc = vbglR0Enter ();
-
+    int rc = vbglR0Enter();
     if (RT_FAILURE(rc))
         return rc;
 
index f1465bd3f7a53145dd902bed2e4af935a31dfad9..c0c9a5c997a54b377a18f59c5b5a853253cd0814 100644 (file)
@@ -62,9 +62,9 @@ static int sf_dir_open(struct inode *inode, struct file *file)
                        | SHFL_CF_ACCESS_READ
                        ;
 
-    LogFunc(("sf_dir_open(): calling vboxCallCreate, folder %s, flags %#x\n",
+    LogFunc(("sf_dir_open(): calling VbglR0SfCreate, folder %s, flags %#x\n",
              sf_i->path->String.utf8, params.CreateFlags));
-    rc = vboxCallCreate(&client_handle, &sf_g->map, sf_i->path, &params);
+    rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, &params);
     if (RT_SUCCESS(rc))
     {
         if (params.Result == SHFL_FILE_EXISTS)
@@ -76,9 +76,9 @@ static int sf_dir_open(struct inode *inode, struct file *file)
         else
             err = -ENOENT;
 
-        rc = vboxCallClose(&client_handle, &sf_g->map, params.Handle);
+        rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
         if (RT_FAILURE(rc))
-            LogFunc(("sf_dir_open(): vboxCallClose(%s) after err=%d failed rc=%Rrc\n",
+            LogFunc(("sf_dir_open(): VbglR0SfClose(%s) after err=%d failed rc=%Rrc\n",
                      sf_i->path->String.utf8, err, rc));
     }
     else
@@ -110,12 +110,35 @@ static int sf_dir_release(struct inode *inode, struct file *file)
     return 0;
 }
 
+/**
+ * Translate RTFMODE into DT_xxx (in conjunction to rtDirType())
+ * @param fMode     file mode
+ * returns d_type
+ */
+static int sf_get_d_type(RTFMODE fMode)
+{
+    int d_type;
+    switch (fMode & RTFS_TYPE_MASK)
+    {
+        case RTFS_TYPE_FIFO:      d_type = DT_FIFO;    break;
+        case RTFS_TYPE_DEV_CHAR:  d_type = DT_CHR;     break;
+        case RTFS_TYPE_DIRECTORY: d_type = DT_DIR;     break;
+        case RTFS_TYPE_DEV_BLOCK: d_type = DT_BLK;     break;
+        case RTFS_TYPE_FILE:      d_type = DT_REG;     break;
+        case RTFS_TYPE_SYMLINK:   d_type = DT_LNK;     break;
+        case RTFS_TYPE_SOCKET:    d_type = DT_SOCK;    break;
+        case RTFS_TYPE_WHITEOUT:  d_type = DT_WHT;     break;
+        default:                  d_type = DT_UNKNOWN; break;
+    }
+    return d_type;
+}
+
 /**
  * Extract element ([dir]->f_pos) from the directory [dir] into [d_name].
  *
  * @returns 0 for success, 1 for end reached, Linux error code otherwise.
  */
-static int sf_getdent(struct file *dir, char d_name[NAME_MAX])
+static int sf_getdent(struct file *dir, char d_name[NAME_MAX], int *d_type)
 {
     loff_t cur;
     struct sf_glob_info *sf_g;
@@ -150,12 +173,12 @@ static int sf_getdent(struct file *dir, char d_name[NAME_MAX])
                            | SHFL_CF_ACCESS_READ
                            ;
 
-        LogFunc(("sf_getdent: calling vboxCallCreate, folder %s, flags %#x\n",
+        LogFunc(("sf_getdent: calling VbglR0SfCreate, folder %s, flags %#x\n",
                   sf_i->path->String.utf8, params.CreateFlags));
-        rc = vboxCallCreate(&client_handle, &sf_g->map, sf_i->path, &params);
+        rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, &params);
         if (RT_FAILURE(rc))
         {
-            LogFunc(("vboxCallCreate(%s) failed rc=%Rrc\n",
+            LogFunc(("VbglR0SfCreate(%s) failed rc=%Rrc\n",
                         sf_i->path->String.utf8, rc));
             return -EPERM;
         }
@@ -169,9 +192,9 @@ static int sf_getdent(struct file *dir, char d_name[NAME_MAX])
 
         sf_dir_info_empty(sf_d);
         err = sf_dir_read_all(sf_g, sf_i, sf_d, params.Handle);
-        rc = vboxCallClose(&client_handle, &sf_g->map, params.Handle);
+        rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
         if (RT_FAILURE(rc))
-            LogFunc(("vboxCallClose(%s) failed rc=%Rrc\n", sf_i->path->String.utf8, rc));
+            LogFunc(("VbglR0SfClose(%s) failed rc=%Rrc\n", sf_i->path->String.utf8, rc));
         if (err)
             return err;
 
@@ -201,6 +224,8 @@ static int sf_getdent(struct file *dir, char d_name[NAME_MAX])
             info = (SHFLDIRINFO *) ((uintptr_t) info + size);
         }
 
+        *d_type = sf_get_d_type(info->Info.Attr.fMode);
+
         return sf_nlscpy(sf_g, d_name, NAME_MAX,
                          info->name.String.utf8, info->name.u16Length);
     }
@@ -244,8 +269,9 @@ static int sf_dir_read(struct file *dir, void *opaque, filldir_t filldir)
         ino_t fake_ino;
         loff_t sanity;
         char d_name[NAME_MAX];
+        int d_type = DT_UNKNOWN;
 
-        err = sf_getdent(dir, d_name);
+        err = sf_getdent(dir, d_name, &d_type);
         switch (err)
         {
             case 1:
@@ -280,13 +306,13 @@ static int sf_dir_read(struct file *dir, void *opaque, filldir_t filldir)
         }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
-        if (!dir_emit(ctx, d_name, strlen(d_name), fake_ino, DT_UNKNOWN))
+        if (!dir_emit(ctx, d_name, strlen(d_name), fake_ino, d_type))
         {
             LogFunc(("dir_emit failed\n"));
             return 0;
         }
 #else
-        err = filldir(opaque, d_name, strlen(d_name), dir->f_pos, fake_ino, DT_UNKNOWN);
+        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,9 +561,9 @@ static int sf_create_aux(struct inode *parent, struct dentry *dentry,
                            ;
     params.Info.Attr.enmAdditional = RTFSOBJATTRADD_NOTHING;
 
-    LogFunc(("sf_create_aux: calling vboxCallCreate, folder %s, flags %#x\n",
+    LogFunc(("sf_create_aux: calling VbglR0SfCreate, folder %s, flags %#x\n",
               path->String.utf8, params.CreateFlags));
-    rc = vboxCallCreate(&client_handle, &sf_g->map, path, &params);
+    rc = VbglR0SfCreate(&client_handle, &sf_g->map, path, &params);
     if (RT_FAILURE(rc))
     {
         if (rc == VERR_WRITE_PROTECT)
@@ -546,7 +572,7 @@ static int sf_create_aux(struct inode *parent, struct dentry *dentry,
             goto fail1;
         }
         err = -EPROTO;
-        LogFunc(("(%d): vboxCallCreate(%s) failed rc=%Rrc\n",
+        LogFunc(("(%d): VbglR0SfCreate(%s) failed rc=%Rrc\n",
                     fDirectory, sf_i->path->String.utf8, rc));
         goto fail1;
     }
@@ -575,18 +601,18 @@ static int sf_create_aux(struct inode *parent, struct dentry *dentry,
      */
     if (fDirectory)
     {
-        rc = vboxCallClose(&client_handle, &sf_g->map, params.Handle);
+        rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
         if (RT_FAILURE(rc))
-            LogFunc(("(%d): vboxCallClose failed rc=%Rrc\n", fDirectory, rc));
+            LogFunc(("(%d): VbglR0SfClose failed rc=%Rrc\n", fDirectory, rc));
     }
 
     sf_i->force_restat = 1;
     return 0;
 
 fail2:
-    rc = vboxCallClose(&client_handle, &sf_g->map, params.Handle);
+    rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
     if (RT_FAILURE(rc))
-        LogFunc(("(%d): vboxCallClose failed rc=%Rrc\n", fDirectory, rc));
+        LogFunc(("(%d): VbglR0SfClose failed rc=%Rrc\n", fDirectory, rc));
 
 fail1:
     kfree(path);
@@ -601,9 +627,10 @@ fail0:
  * @param parent        inode of the directory
  * @param dentry        directory cache entry
  * @param mode          file mode
+ * @param excl          Possible O_EXCL...
  * @returns 0 on success, Linux error code otherwise
  */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) || defined(DOXYGEN_RUNNING)
 static int sf_create(struct inode *parent, struct dentry *dentry, umode_t mode, bool excl)
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
 static int sf_create(struct inode *parent, struct dentry *dentry, umode_t mode, struct nameidata *nd)
@@ -663,11 +690,10 @@ static int sf_unlink_aux(struct inode *parent, struct dentry *dentry, int fDirec
         && dentry->d_inode
         && ((dentry->d_inode->i_mode & S_IFLNK) == S_IFLNK))
         fFlags |= SHFL_REMOVE_SYMLINK;
-    rc = vboxCallRemove(&client_handle, &sf_g->map, path, fFlags);
+    rc = VbglR0SfRemove(&client_handle, &sf_g->map, path, fFlags);
     if (RT_FAILURE(rc))
     {
-        LogFunc(("(%d): vboxCallRemove(%s) failed rc=%Rrc\n", fDirectory,
-                    path->String.utf8, rc));
+        LogFunc(("(%d): VbglR0SfRemove(%s) failed rc=%Rrc\n", fDirectory, path->String.utf8, rc));
         err = -RTErrConvertToErrno(rc);
         goto fail1;
     }
@@ -757,7 +783,7 @@ static int sf_rename(struct inode *old_parent, struct dentry *old_dentry,
         {
             int fDir = ((old_dentry->d_inode->i_mode & S_IFDIR) != 0);
 
-            rc = vboxCallRename(&client_handle, &sf_g->map, old_path,
+            rc = VbglR0SfRename(&client_handle, &sf_g->map, old_path,
                                 new_path, fDir ? 0 : SHFL_RENAME_FILE | SHFL_RENAME_REPLACE_IF_EXISTS);
             if (RT_SUCCESS(rc))
             {
@@ -769,7 +795,7 @@ static int sf_rename(struct inode *old_parent, struct dentry *old_dentry,
             }
             else
             {
-                LogFunc(("vboxCallRename failed rc=%Rrc\n", rc));
+                LogFunc(("VbglR0SfRename failed rc=%Rrc\n", rc));
                 err = -RTErrConvertToErrno(rc);
                 kfree(new_path);
             }
@@ -812,7 +838,7 @@ static int sf_symlink(struct inode *parent, struct dentry *dentry, const char *s
     ssymname->u16Size = symname_len;
     memcpy(ssymname->String.utf8, symname, symname_len);
 
-    rc = vboxCallSymlink(&client_handle, &sf_g->map, path, ssymname, &info);
+    rc = VbglR0SfSymlink(&client_handle, &sf_g->map, path, ssymname, &info);
     kfree(ssymname);
 
     if (RT_FAILURE(rc))
@@ -822,7 +848,7 @@ static int sf_symlink(struct inode *parent, struct dentry *dentry, const char *s
             err = -EROFS;
             goto fail1;
         }
-        LogFunc(("vboxCallSymlink(%s) failed rc=%Rrc\n",
+        LogFunc(("VbglR0SfSymlink(%s) failed rc=%Rrc\n",
                     sf_i->path->String.utf8, rc));
         err = -EPROTO;
         goto fail1;
index 9ac005f1b9720b4b0ed5c04de6fc18763a5bf859..6d1e2820fc9e17b34032a8917de152f3ab852abd 100644 (file)
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
+#  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
 static const char *sf_follow_link(struct dentry *dentry, void **cookie)
-# else
+#  else
 static void *sf_follow_link(struct dentry *dentry, struct nameidata *nd)
-# endif
+#  endif
 {
     struct inode *inode = dentry->d_inode;
     struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
@@ -36,40 +37,69 @@ static void *sf_follow_link(struct dentry *dentry, struct nameidata *nd)
     if (path)
     {
         error = 0;
-        rc = vboxReadLink(&client_handle, &sf_g->map, sf_i->path, PATH_MAX, path);
+        rc = VbglR0SfReadLink(&client_handle, &sf_g->map, sf_i->path, PATH_MAX, path);
         if (RT_FAILURE(rc))
         {
-            LogFunc(("vboxReadLink failed, caller=%s, rc=%Rrc\n", __func__, rc));
+            LogFunc(("VbglR0SfReadLink failed, caller=%s, rc=%Rrc\n", __func__, rc));
             free_page((unsigned long)path);
             error = -EPROTO;
         }
     }
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+#  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     return error ? ERR_PTR(error) : (*cookie = path);
-# else
+#  else
     nd_set_link(nd, error ? ERR_PTR(error) : path);
     return NULL;
-# endif
+#  endif
 }
 
-# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
+#  if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
 static void sf_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
 {
     char *page = nd_get_link(nd);
     if (!IS_ERR(page))
         free_page((unsigned long)page);
 }
-#endif
+#  endif
+
+# else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) */
+static const char *sf_get_link(struct dentry *dentry, struct inode *inode,
+                               struct delayed_call *done)
+{
+    struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
+    struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
+    char *path;
+    int rc;
+
+    if (!dentry)
+        return ERR_PTR(-ECHILD);
+    path = kzalloc(PAGE_SIZE, GFP_KERNEL);
+    if (!path)
+        return ERR_PTR(-ENOMEM);
+    rc = VbglR0SfReadLink(&client_handle, &sf_g->map, sf_i->path, PATH_MAX, path);
+    if (RT_FAILURE(rc))
+    {
+        LogFunc(("VbglR0SfReadLink failed, caller=%s, rc=%Rrc\n", __func__, rc));
+        kfree(path);
+        return ERR_PTR(-EPROTO);
+    }
+    set_delayed_call(done, kfree_link, path);
+    return path;
+}
+# endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) */
 
 struct inode_operations sf_lnk_iops =
 {
     .readlink       = generic_readlink,
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
+    .get_link       = sf_get_link
+# elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     .follow_link    = sf_follow_link,
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     .put_link       = free_page_put_link,
 # else
+    .follow_link    = sf_follow_link,
     .put_link       = sf_put_link
 # endif
 };
 
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
index cc4338c1298a010a1ca6ae5a386beb63975589e2..c1727e59d9d07d405f52e1cec5ee197c594b651a 100644 (file)
@@ -5,6 +5,6 @@
 #define VBOX_VENDOR_SHORT "Oracle"
 #define VBOX_PRODUCT "Oracle VM VirtualBox"
 #define VBOX_BUILD_PUBLISHER "_Ubuntu"
-#define VBOX_C_YEAR "2015"
+#define VBOX_C_YEAR "2016"
 
 #endif
index 4a3aa36e60297cb4327d8bce97d18de7367781ae..b59073408c80cd64119904aac1e443486b1ce416 100644 (file)
@@ -63,11 +63,11 @@ static int sf_reg_read_aux(const char *caller, struct sf_glob_info *sf_g,
     /** @todo bird: yes, kmap() and kmalloc() input only. Since the buffer is
      *        contiguous in physical memory (kmalloc or single page), we should
      *        use a physical address here to speed things up. */
-    int rc = vboxCallRead(&client_handle, &sf_g->map, sf_r->handle,
+    int rc = VbglR0SfRead(&client_handle, &sf_g->map, sf_r->handle,
                           pos, nread, buf, false /* already locked? */);
     if (RT_FAILURE(rc))
     {
-        LogFunc(("vboxCallRead failed. caller=%s, rc=%Rrc\n", caller, rc));
+        LogFunc(("VbglR0SfRead failed. caller=%s, rc=%Rrc\n", caller, rc));
         return -EPROTO;
     }
     return 0;
@@ -80,11 +80,11 @@ static int sf_reg_write_aux(const char *caller, struct sf_glob_info *sf_g,
     /** @todo bird: yes, kmap() and kmalloc() input only. Since the buffer is
      *        contiguous in physical memory (kmalloc or single page), we should
      *        use a physical address here to speed things up. */
-    int rc = vboxCallWrite(&client_handle, &sf_g->map, sf_r->handle,
+    int rc = VbglR0SfWrite(&client_handle, &sf_g->map, sf_r->handle,
                            pos, nwritten, buf, false /* already locked? */);
     if (RT_FAILURE(rc))
     {
-        LogFunc(("vboxCallWrite failed. caller=%s, rc=%Rrc\n",
+        LogFunc(("VbglR0SfWrite failed. caller=%s, rc=%Rrc\n",
                     caller, rc));
         return -EPROTO;
     }
@@ -373,12 +373,12 @@ static int sf_reg_open(struct inode *inode, struct file *file)
     }
 
     params.Info.Attr.fMode = inode->i_mode;
-    LogFunc(("sf_reg_open: calling vboxCallCreate, file %s, flags=%#x, %#x\n",
+    LogFunc(("sf_reg_open: calling VbglR0SfCreate, file %s, flags=%#x, %#x\n",
               sf_i->path->String.utf8 , file->f_flags, params.CreateFlags));
-    rc = vboxCallCreate(&client_handle, &sf_g->map, sf_i->path, &params);
+    rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, &params);
     if (RT_FAILURE(rc))
     {
-        LogFunc(("vboxCallCreate failed flags=%d,%#x rc=%Rrc\n",
+        LogFunc(("VbglR0SfCreate failed flags=%d,%#x rc=%Rrc\n",
                   file->f_flags, params.CreateFlags, rc));
         kfree(sf_r);
         return -RTErrConvertToErrno(rc);
@@ -438,9 +438,9 @@ static int sf_reg_release(struct inode *inode, struct file *file)
         && filemap_fdatawrite(inode->i_mapping) != -EIO)
         filemap_fdatawait(inode->i_mapping);
 #endif
-    rc = vboxCallClose(&client_handle, &sf_g->map, sf_r->handle);
+    rc = VbglR0SfClose(&client_handle, &sf_g->map, sf_r->handle);
     if (RT_FAILURE(rc))
-        LogFunc(("vboxCallClose failed rc=%Rrc\n", rc));
+        LogFunc(("VbglR0SfClose failed rc=%Rrc\n", rc));
 
     kfree(sf_r);
     sf_i->file = NULL;
@@ -481,7 +481,7 @@ static struct page *sf_reg_nopage(struct vm_area_struct *vma, unsigned long vadd
     }
 #endif
 
-    /* Don't use GFP_HIGHUSER as long as sf_reg_read_aux() calls vboxCallRead()
+    /* Don't use GFP_HIGHUSER as long as sf_reg_read_aux() calls VbglR0SfRead()
      * which works on virtual addresses. On Linux cannot reliably determine the
      * physical address for high memory, see rtR0MemObjNativeLockKernel(). */
     page = alloc_page(GFP_USER);
index 1b72bd0760ccbd8329182464321360d3b92a9172..44cd9088dfd9c66072f6d32f1f8e68346f823cae 100644 (file)
@@ -182,9 +182,9 @@ int sf_stat(const char *caller, struct sf_glob_info *sf_g,
     RT_ZERO(params);
     params.Handle = SHFL_HANDLE_NIL;
     params.CreateFlags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW;
-    LogFunc(("sf_stat: calling vboxCallCreate, file %s, flags %#x\n",
+    LogFunc(("sf_stat: calling VbglR0SfCreate, file %s, flags %#x\n",
              path->String.utf8, params.CreateFlags));
-    rc = vboxCallCreate(&client_handle, &sf_g->map, path, &params);
+    rc = VbglR0SfCreate(&client_handle, &sf_g->map, path, &params);
     if (rc == VERR_INVALID_NAME)
     {
         /* this can happen for names like 'foo*' on a Windows host */
@@ -192,14 +192,14 @@ int sf_stat(const char *caller, struct sf_glob_info *sf_g,
     }
     if (RT_FAILURE(rc))
     {
-        LogFunc(("vboxCallCreate(%s) failed.  caller=%s, rc=%Rrc\n",
+        LogFunc(("VbglR0SfCreate(%s) failed.  caller=%s, rc=%Rrc\n",
                     path->String.utf8, rc, caller));
         return -EPROTO;
     }
     if (params.Result != SHFL_FILE_EXISTS)
     {
         if (!ok_to_fail)
-            LogFunc(("vboxCallCreate(%s) file does not exist.  caller=%s, result=%d\n",
+            LogFunc(("VbglR0SfCreate(%s) file does not exist.  caller=%s, result=%d\n",
                         path->String.utf8, params.Result, caller));
         return -ENOENT;
     }
@@ -328,10 +328,10 @@ int sf_setattr(struct dentry *dentry, struct iattr *iattr)
     if (iattr->ia_valid & ATTR_SIZE)
         params.CreateFlags |= SHFL_CF_ACCESS_WRITE;
 
-    rc = vboxCallCreate(&client_handle, &sf_g->map, sf_i->path, &params);
+    rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, &params);
     if (RT_FAILURE(rc))
     {
-        LogFunc(("vboxCallCreate(%s) failed rc=%Rrc\n",
+        LogFunc(("VbglR0SfCreate(%s) failed rc=%Rrc\n",
                  sf_i->path->String.utf8, rc));
         err = -RTErrConvertToErrno(rc);
         goto fail2;
@@ -378,12 +378,12 @@ int sf_setattr(struct dentry *dentry, struct iattr *iattr)
         /* ignore ctime (inode change time) as it can't be set from userland anyway */
 
         cbBuffer = sizeof(info);
-        rc = vboxCallFSInfo(&client_handle, &sf_g->map, params.Handle,
-                SHFL_INFO_SET | SHFL_INFO_FILE, &cbBuffer,
-                (PSHFLDIRINFO)&info);
+        rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, params.Handle,
+                            SHFL_INFO_SET | SHFL_INFO_FILE, &cbBuffer,
+                            (PSHFLDIRINFO)&info);
         if (RT_FAILURE(rc))
         {
-            LogFunc(("vboxCallFSInfo(%s, FILE) failed rc=%Rrc\n",
+            LogFunc(("VbglR0SfFsInfo(%s, FILE) failed rc=%Rrc\n",
                         sf_i->path->String.utf8, rc));
             err = -RTErrConvertToErrno(rc);
             goto fail1;
@@ -395,28 +395,28 @@ int sf_setattr(struct dentry *dentry, struct iattr *iattr)
         RT_ZERO(info);
         info.cbObject = iattr->ia_size;
         cbBuffer = sizeof(info);
-        rc = vboxCallFSInfo(&client_handle, &sf_g->map, params.Handle,
+        rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, params.Handle,
                             SHFL_INFO_SET | SHFL_INFO_SIZE, &cbBuffer,
                             (PSHFLDIRINFO)&info);
         if (RT_FAILURE(rc))
         {
-            LogFunc(("vboxCallFSInfo(%s, SIZE) failed rc=%Rrc\n",
+            LogFunc(("VbglR0SfFsInfo(%s, SIZE) failed rc=%Rrc\n",
                         sf_i->path->String.utf8, rc));
             err = -RTErrConvertToErrno(rc);
             goto fail1;
         }
     }
 
-    rc = vboxCallClose(&client_handle, &sf_g->map, params.Handle);
+    rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
     if (RT_FAILURE(rc))
-        LogFunc(("vboxCallClose(%s) failed rc=%Rrc\n", sf_i->path->String.utf8, rc));
+        LogFunc(("VbglR0SfClose(%s) failed rc=%Rrc\n", sf_i->path->String.utf8, rc));
 
     return sf_inode_revalidate(dentry);
 
 fail1:
-    rc = vboxCallClose(&client_handle, &sf_g->map, params.Handle);
+    rc = VbglR0SfClose(&client_handle, &sf_g->map, params.Handle);
     if (RT_FAILURE(rc))
-        LogFunc(("vboxCallClose(%s) failed rc=%Rrc\n", sf_i->path->String.utf8, rc));
+        LogFunc(("VbglR0SfClose(%s) failed rc=%Rrc\n", sf_i->path->String.utf8, rc));
 
 fail2:
     return err;
@@ -793,7 +793,7 @@ int sf_dir_read_all(struct sf_glob_info *sf_g, struct sf_inode_info *sf_i,
         buf = b->buf;
         cbSize = b->cbFree;
 
-        rc = vboxCallDirInfo(&client_handle, &sf_g->map, handle, mask,
+        rc = VbglR0SfDirInfo(&client_handle, &sf_g->map, handle, mask,
                              0, 0, &cbSize, buf, &cEntries);
         switch (rc)
         {
@@ -807,7 +807,7 @@ int sf_dir_read_all(struct sf_glob_info *sf_g, struct sf_inode_info *sf_i,
                 break;
             default:
                 err = -RTErrConvertToErrno(rc);
-                LogFunc(("vboxCallDirInfo failed rc=%Rrc\n", rc));
+                LogFunc(("VbglR0SfDirInfo failed rc=%Rrc\n", rc));
                 goto fail1;
         }
 
@@ -836,7 +836,7 @@ int sf_get_volume_info(struct super_block *sb, STRUCT_STATFS *stat)
 
     sf_g = GET_GLOB_INFO(sb);
     cbBuffer = sizeof(SHFLVolumeInfo);
-    rc = vboxCallFSInfo(&client_handle, &sf_g->map, 0, SHFL_INFO_GET | SHFL_INFO_VOLUME,
+    rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, 0, SHFL_INFO_GET | SHFL_INFO_VOLUME,
                         &cbBuffer, (PSHFLDIRINFO)&SHFLVolumeInfo);
     if (RT_FAILURE(rc))
         return -RTErrConvertToErrno(rc);
index fe3754568f5d157c78d91d211d5371213245699d..31f0ed14a2d1093a73ef875db125eb596f0b08a6 100644 (file)
@@ -3,9 +3,9 @@
 
 #define VBOX_VERSION_MAJOR 5
 #define VBOX_VERSION_MINOR 0
-#define VBOX_VERSION_BUILD 0
-#define VBOX_VERSION_STRING_RAW "5.0.0"
-#define VBOX_VERSION_STRING "5.0.0_Ubuntu"
+#define VBOX_VERSION_BUILD 14
+#define VBOX_VERSION_STRING_RAW "5.0.14"
+#define VBOX_VERSION_STRING "5.0.14_Ubuntu"
 #define VBOX_API_VERSION_STRING "5_0"
 
 #define VBOX_PRIVATE_BUILD_DESC "Private build by root"
index b465a29d3a07cc8f2baa82e8e63ea1cda1ea3050..a3cd550f960b03db73ef31d45f9984a0ab3faeda 100644 (file)
@@ -38,7 +38,7 @@ MODULE_VERSION(VBOX_VERSION_STRING " (interface " RT_XSTR(VMMDEV_VERSION) ")");
 #endif
 
 /* globals */
-VBSFCLIENT client_handle;
+VBGLSFCLIENT client_handle;
 
 /* forward declarations */
 static struct super_operations sf_super_ops;
@@ -144,13 +144,13 @@ static int sf_glob_alloc(struct vbsf_mount_info_new *info, struct sf_glob_info *
 #undef _IS_EMPTY
     }
 
-    rc = vboxCallMapFolder(&client_handle, str_name, &sf_g->map);
+    rc = VbglR0SfMapFolder(&client_handle, str_name, &sf_g->map);
     kfree(str_name);
 
     if (RT_FAILURE(rc))
     {
         err = -EPROTO;
-        LogFunc(("vboxCallMapFolder failed rc=%d\n", rc));
+        LogFunc(("VbglR0SfMapFolder failed rc=%d\n", rc));
         goto fail2;
     }
 
@@ -193,9 +193,9 @@ sf_glob_free(struct sf_glob_info *sf_g)
     int rc;
 
     TRACE();
-    rc = vboxCallUnmapFolder(&client_handle, &sf_g->map);
+    rc = VbglR0SfUnmapFolder(&client_handle, &sf_g->map);
     if (RT_FAILURE(rc))
-        LogFunc(("vboxCallUnmapFolder failed rc=%d\n", rc));
+        LogFunc(("VbglR0SfUnmapFolder failed rc=%d\n", rc));
 
     if (sf_g->nls)
         unload_nls(sf_g->nls);
@@ -594,26 +594,26 @@ static int __init init(void)
         return err;
     }
 
-    rcVBox = vboxInit();
+    rcVBox = VbglR0SfInit();
     if (RT_FAILURE(rcVBox))
     {
-        LogRelFunc(("vboxInit failed, rc=%d\n", rcVBox));
+        LogRelFunc(("VbglR0SfInit failed, rc=%d\n", rcVBox));
         rcRet = -EPROTO;
         goto fail0;
     }
 
-    rcVBox = vboxConnect(&client_handle);
+    rcVBox = VbglR0SfConnect(&client_handle);
     if (RT_FAILURE(rcVBox))
     {
-        LogRelFunc(("vboxConnect failed, rc=%d\n", rcVBox));
+        LogRelFunc(("VbglR0SfConnect failed, rc=%d\n", rcVBox));
         rcRet = -EPROTO;
         goto fail1;
     }
 
-    rcVBox = vboxCallSetUtf8(&client_handle);
+    rcVBox = VbglR0SfSetUtf8(&client_handle);
     if (RT_FAILURE(rcVBox))
     {
-        LogRelFunc(("vboxCallSetUtf8 failed, rc=%d\n", rcVBox));
+        LogRelFunc(("VbglR0SfSetUtf8 failed, rc=%d\n", rcVBox));
         rcRet = -EPROTO;
         goto fail2;
     }
@@ -621,7 +621,7 @@ static int __init init(void)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
     if (!follow_symlinks)
     {
-        rcVBox = vboxCallSetSymlinks(&client_handle);
+        rcVBox = VbglR0SfSetSymlinks(&client_handle);
         if (RT_FAILURE(rcVBox))
         {
             printk(KERN_WARNING
@@ -638,10 +638,10 @@ static int __init init(void)
     return 0;
 
 fail2:
-    vboxDisconnect(&client_handle);
+    VbglR0SfDisconnect(&client_handle);
 
 fail1:
-    vboxUninit();
+    VbglR0SfTerm();
 
 fail0:
     unregister_filesystem(&vboxsf_fs_type);
@@ -652,8 +652,8 @@ static void __exit fini(void)
 {
     TRACE();
 
-    vboxDisconnect(&client_handle);
-    vboxUninit();
+    VbglR0SfDisconnect(&client_handle);
+    VbglR0SfTerm();
     unregister_filesystem(&vboxsf_fs_type);
 }
 
index b310a4261704ce08a98716202b2cf9bd38574ba0..482a8488deed6088f9e0143d87294312f5fa0583 100644 (file)
@@ -27,7 +27,7 @@
 # include <linux/backing-dev.h>
 #endif
 
-#include "VBoxGuestR0LibSharedFolders.h"
+#include <VBox/VBoxGuestLibSharedFolders.h>
 #include "vbsfmount.h"
 
 #define DIR_BUFFER_SIZE (16*_1K)
@@ -35,7 +35,7 @@
 /* per-shared folder information */
 struct sf_glob_info
 {
-    VBSFMAP map;
+    VBGLSFMAP map;
     struct nls_table *nls;
     int ttl;
     int uid;
@@ -85,7 +85,7 @@ struct sf_reg_info
 };
 
 /* globals */
-extern VBSFCLIENT client_handle;
+extern VBGLSFCLIENT client_handle;
 
 /* forward declarations */
 extern struct inode_operations         sf_dir_iops;
index e68d47238cc309abd5f3c84319323203e53675a5..b51d47cdc8c7cce9121564118b8be8adcc61284f 100644 (file)
@@ -1,8 +1,11 @@
 KBUILD_EXTMOD=${srctree}/ubuntu/vbox
-#
+# $Id: Makefile.module $
+## @file
 # VirtualBox Guest Additions Module Makefile.
 #
 # (For 2.6.x this file must be 'Makefile'!)
+#
+
 #
 # Copyright (C) 2006-2011 Oracle Corporation
 #
@@ -51,3 +54,4 @@ endif
 MOD_CLEAN  = . linux r0drv r0drv/linux
 
 include $(obj)/Makefile.include.footer
+
index cc4338c1298a010a1ca6ae5a386beb63975589e2..c1727e59d9d07d405f52e1cec5ee197c594b651a 100644 (file)
@@ -5,6 +5,6 @@
 #define VBOX_VENDOR_SHORT "Oracle"
 #define VBOX_PRODUCT "Oracle VM VirtualBox"
 #define VBOX_BUILD_PUBLISHER "_Ubuntu"
-#define VBOX_C_YEAR "2015"
+#define VBOX_C_YEAR "2016"
 
 #endif
index e29ff1725a833168f76417119f6b0b18cb2f5ed9..ff093ec9011cd1d9a15591007e996359bf0e52d1 100644 (file)
@@ -1,5 +1,5 @@
-/** @file $Id: vboxvideo_drm.c $
- *
+/* $Id: vboxvideo_drm.c $ */
+/** @file
  * VirtualBox Additions Linux kernel driver, DRM support
  */
 
 # define DRM_NEW_BUS_INIT 1
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
+# ifdef RHEL_RELEASE_CODE
+#  if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7, 2)
+#   define DRM_HAVE_DRM_MAP
+#  endif
+# else
+#  define DRM_HAVE_DRM_MAP
+# endif
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
+# define DRM_WANTS_SET_BUSID
+#else
+# ifdef RHEL_RELEASE_CODE
+#  if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 2)
+#   define DRM_WANTS_SET_BUSID
+#  endif
+# endif
+#endif
+
 static struct pci_device_id pciidlist[] = {
         vboxvideo_PCI_IDS
 };
@@ -89,7 +109,7 @@ static struct file_operations driver_fops =
         .open = drm_open,
         .release = drm_release,
         .unlocked_ioctl = drm_ioctl,
-# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
+# ifdef DRM_HAVE_DRM_MAP
         /* This shouldn't be necessary even for old kernels as there is
          * nothing sensible to mmap. But we play safe and keep it for
          * legacy reasons. */
@@ -103,7 +123,7 @@ static struct drm_driver driver =
 {
     /* .driver_features = DRIVER_USE_MTRR, */
     .load = vboxvideo_driver_load,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
+#ifdef DRM_WANTS_SET_BUSID
     /* If this is missing a warning gets printed to dmesg.  We will not
      * attempt to make kernels work to which the change (915b4d11b) got back-
      * ported, as the problem is only cosmetic. */
index 11407e945a61c6b17171e8d1dc956bf5ffb4db2d..d6a43a4c6fd63c07c5bd7592c33785d5d14e4d79 100644 (file)
@@ -1,5 +1,5 @@
-/** @file $Id: vboxvideo_drm.h $
- *
+/* $Id: vboxvideo_drm.h $ */
+/** @file
  * VirtualBox Additions Linux kernel driver, DRM support
  */
 
index fe3754568f5d157c78d91d211d5371213245699d..31f0ed14a2d1093a73ef875db125eb596f0b08a6 100644 (file)
@@ -3,9 +3,9 @@
 
 #define VBOX_VERSION_MAJOR 5
 #define VBOX_VERSION_MINOR 0
-#define VBOX_VERSION_BUILD 0
-#define VBOX_VERSION_STRING_RAW "5.0.0"
-#define VBOX_VERSION_STRING "5.0.0_Ubuntu"
+#define VBOX_VERSION_BUILD 14
+#define VBOX_VERSION_STRING_RAW "5.0.14"
+#define VBOX_VERSION_STRING "5.0.14_Ubuntu"
 #define VBOX_API_VERSION_STRING "5_0"
 
 #define VBOX_PRIVATE_BUILD_DESC "Private build by root"