VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestIDC-unix.c.h@ 28801

Last change on this file since 28801 was 28800, checked in by vboxsync, 14 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/* $Rev: 28800 $ */
2/** @file
3 * VBoxGuest - Inter Driver Communcation, unix implementation.
4 *
5 * This file is included by the platform specific source file.
6 */
7
8/*
9 * Copyright (C) 2006-2009 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 * Some lines of code to disable the local APIC on x86_64 machines taken
19 * from a Mandriva patch by Gwenole Beauchesne <gbeauchesne@mandriva.com>.
20 */
21
22
23/** @todo Use some header that we have in common with VBoxGuestLib.h... */
24DECLVBGL(void *) VBoxGuestIDCOpen(uint32_t *pu32Version);
25DECLVBGL(int) VBoxGuestIDCClose(void *pvSession);
26DECLVBGL(int) VBoxGuestIDCCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned);
27
28
29/**
30 * Open a new IDC connection.
31 *
32 * @returns Opaque pointer to session object.
33 * @param pu32Version Where to store VMMDev version.
34 */
35DECLVBGL(void *) VBoxGuestIDCOpen(uint32_t *pu32Version)
36{
37 PVBOXGUESTSESSION pSession;
38 int rc;
39 LogFlow(("VBoxGuestIDCOpen: Version=%#x\n", pu32Version ? *pu32Version : 0));
40
41 AssertPtrReturn(pu32Version, NULL);
42 rc = VBoxGuestCreateKernelSession(&g_DevExt, &pSession);
43 if (RT_SUCCESS(rc))
44 {
45 *pu32Version = VMMDEV_VERSION;
46 return pSession;
47 }
48 LogRel(("VBoxGuestIDCOpen: VBoxGuestCreateKernelSession failed. rc=%d\n", rc));
49 return NULL;
50}
51
52
53/**
54 * Close an IDC connection.
55 *
56 * @returns VBox error code.
57 * @param pvState Opaque pointer to the session object.
58 */
59DECLVBGL(int) VBoxGuestIDCClose(void *pvSession)
60{
61 PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pvSession;
62 LogFlow(("VBoxGuestIDCClose:\n"));
63
64 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
65 VBoxGuestCloseSession(&g_DevExt, pSession);
66 return VINF_SUCCESS;
67}
68
69
70/**
71 * Perform an IDC call.
72 *
73 * @returns VBox error code.
74 * @param pvSession Opaque pointer to the session.
75 * @param iCmd Requested function.
76 * @param pvData IO data buffer.
77 * @param cbData Size of the data buffer.
78 * @param pcbDataReturned Where to store the amount of returned data.
79 */
80DECLVBGL(int) VBoxGuestIDCCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned)
81{
82 PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pvSession;
83 LogFlow(("VBoxGuestIDCCall: %pvSesssion=%p Cmd=%u pvData=%p cbData=%d\n", pvSession, iCmd, pvData, cbData));
84
85 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
86 AssertMsgReturn(pSession->pDevExt == &g_DevExt,
87 ("SC: %p != %p\n", pSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE);
88
89 return VBoxGuestCommonIOCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
90}
91
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette