VirtualBox

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

最後變更 在這個檔案從21506是 21408,由 vboxsync 提交於 16 年 前

OSE header

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.0 KB
 
1/* $Rev: 21408 $ */
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 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.alldomusa.eu.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 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 * Some lines of code to disable the local APIC on x86_64 machines taken
23 * from a Mandriva patch by Gwenole Beauchesne <[email protected]>.
24 */
25
26
27/**
28 * Open a new IDC connection.
29 *
30 * @returns Opaque pointer to session object.
31 * @param pu32Version Where to store VMMDev version.
32 */
33DECLVBGL(void *) VBoxGuestIDCOpen(uint32_t *pu32Version)
34{
35 PVBOXGUESTSESSION pSession;
36 int rc;
37 LogFlow(("VBoxGuestIDCOpen: Version=%#x\n", pu32Version ? *pu32Version : 0));
38
39 AssertPtrReturn(pu32Version, NULL);
40 rc = VBoxGuestCreateKernelSession(&g_DevExt, &pSession);
41 if (RT_SUCCESS(rc))
42 {
43 *pu32Version = VMMDEV_VERSION;
44 return pSession;
45 }
46 LogRel(("VBoxGuestIDCOpen: VBoxGuestCreateKernelSession failed. rc=%d\n", rc));
47 return NULL;
48}
49
50
51/**
52 * Close an IDC connection.
53 *
54 * @returns VBox error code.
55 * @param pvState Opaque pointer to the session object.
56 */
57DECLVBGL(int) VBoxGuestIDCClose(void *pvSession)
58{
59 PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pvSession;
60 LogFlow(("VBoxGuestIDCClose:\n"));
61
62 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
63 VBoxGuestCloseSession(&g_DevExt, pSession);
64 return VINF_SUCCESS;
65}
66
67
68/**
69 * Perform an IDC call.
70 *
71 * @returns VBox error code.
72 * @param pvSession Opaque pointer to the session.
73 * @param iCmd Requested function.
74 * @param pvData IO data buffer.
75 * @param cbData Size of the data buffer.
76 * @param pcbDataReturned Where to store the amount of returned data.
77 */
78DECLVBGL(int) VBoxGuestIDCCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned)
79{
80 PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pvSession;
81 LogFlow(("VBoxGuestIDCCall: %pvSesssion=%p Cmd=%u pvData=%p cbData=%d\n", pvSession, iCmd, pvData, cbData));
82
83 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
84 AssertMsgReturn(pSession->pDevExt == &g_DevExt,
85 ("SC: %p != %p\n", pSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE);
86
87 return VBoxGuestCommonIOCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
88}
89
90
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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