VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/module/cmc.c@ 2054

Last change on this file since 2054 was 1067, checked in by vboxsync, 18 years ago

removed dead code; cosmetics

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/** @file
2 *
3 */
4
5/*
6 * Copyright (C) 2006 InnoTek Systemberatung GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * If you received this file as part of a commercial VirtualBox
17 * distribution, then only the terms of your commercial VirtualBox
18 * license agreement apply instead of the previous paragraph.
19 */
20
21#include "the-linux-kernel.h"
22#include "vboxmod.h"
23
24/**
25 * HGCM
26 *
27 */
28static DECLVBGL(void)
29vboxadd_hgcm_callback (VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data)
30{
31 VBoxDevice *dev = pvData;
32 wait_event (dev->eventq, pHeader->fu32Flags & VBOX_HGCM_REQ_DONE);
33}
34
35static int vboxadd_hgcm_connect (VBoxDevice *dev, VBoxGuestHGCMConnectInfo *info)
36{
37 return VbglHGCMConnect (info, vboxadd_hgcm_callback, dev, 0);
38}
39
40static int vboxadd_hgcm_disconnect (VBoxDevice *dev, VBoxGuestHGCMDisconnectInfo *info)
41{
42 return VbglHGCMDisconnect (info, vboxadd_hgcm_callback, dev, 0);
43}
44
45static int vboxadd_hgcm_call (VBoxDevice *dev, VBoxGuestHGCMCallInfo *info)
46{
47 return VbglHGCMCall (info, vboxadd_hgcm_callback, dev, 0);
48}
49
50DECLVBGL (int) vboxadd_cmc_call (void *opaque, uint32_t func, void *data)
51{
52 switch (func)
53 {
54 case IOCTL_VBOXGUEST_HGCM_CONNECT:
55 return vboxadd_hgcm_connect (opaque, data);
56
57 case IOCTL_VBOXGUEST_HGCM_DISCONNECT:
58 return vboxadd_hgcm_disconnect (opaque, data);
59
60 case IOCTL_VBOXGUEST_HGCM_CALL:
61 return vboxadd_hgcm_call (opaque, data);
62
63 default:
64 return VERR_VBGL_IOCTL_FAILED;
65 }
66}
67
68int vboxadd_cmc_init (void)
69{
70 return 0;
71}
72
73void vboxadd_cmc_fini (void)
74{
75}
76
77DECLVBGL (int)
78vboxadd_cmc_ctl_guest_filter_mask (uint32_t or_mask, uint32_t not_mask)
79{
80 int rc;
81 VMMDevCtlGuestFilterMask *req;
82
83 rc = VbglGRAlloc ((VMMDevRequestHeader**) &req, sizeof (*req),
84 VMMDevReq_CtlGuestFilterMask);
85
86 if (VBOX_FAILURE (rc))
87 {
88 elog ("VbglGRAlloc (CtlGuestFilterMask) failed rc=%d\n", rc);
89 return -1;
90 }
91
92 req->u32OrMask = or_mask;
93 req->u32NotMask = not_mask;
94
95 rc = VbglGRPerform (&req->header);
96 VbglGRFree (&req->header);
97 if (VBOX_FAILURE (rc))
98 {
99 elog ("VbglGRPerform (CtlGuestFilterMask) failed rc=%d\n", rc);
100 return -1;
101 }
102 return 0;
103}
104
105EXPORT_SYMBOL (vboxadd_cmc_call);
106EXPORT_SYMBOL (vboxadd_cmc_ctl_guest_filter_mask);
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