1 | /** @file
|
---|
2 | *
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
17 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
18 | * additional information or have any questions.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #include "the-linux-kernel.h"
|
---|
22 | #include "vboxmod.h"
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * HGCM
|
---|
26 | *
|
---|
27 | */
|
---|
28 | static DECLVBGL(void)
|
---|
29 | vboxadd_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 |
|
---|
35 | static DECLVBGL(void)
|
---|
36 | vboxadd_hgcm_callback_interruptible (VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data)
|
---|
37 | {
|
---|
38 | VBoxDevice *dev = pvData;
|
---|
39 | wait_event_interruptible (dev->eventq, pHeader->fu32Flags & VBOX_HGCM_REQ_DONE);
|
---|
40 | }
|
---|
41 |
|
---|
42 | DECLVBGL (int) vboxadd_cmc_call (void *opaque, uint32_t func, void *data)
|
---|
43 | {
|
---|
44 | switch (func)
|
---|
45 | {
|
---|
46 | /* this function can NOT handle cancelled requests */
|
---|
47 | case VBOXGUEST_IOCTL_HGCM_CONNECT:
|
---|
48 | return VbglHGCMConnect (data, vboxadd_hgcm_callback, opaque, 0);
|
---|
49 |
|
---|
50 | /* this function can NOT handle cancelled requests */
|
---|
51 | case VBOXGUEST_IOCTL_HGCM_DISCONNECT:
|
---|
52 | return VbglHGCMDisconnect (data, vboxadd_hgcm_callback, opaque, 0);
|
---|
53 |
|
---|
54 | /* this function can handle cancelled requests */
|
---|
55 | case VBOXGUEST_IOCTL_HGCM_CALL:
|
---|
56 | return VbglHGCMCall (data, vboxadd_hgcm_callback_interruptible, opaque, 0);
|
---|
57 |
|
---|
58 | default:
|
---|
59 | return VERR_VBGL_IOCTL_FAILED;
|
---|
60 | }
|
---|
61 | }
|
---|
62 |
|
---|
63 | int vboxadd_cmc_init (void)
|
---|
64 | {
|
---|
65 | return 0;
|
---|
66 | }
|
---|
67 |
|
---|
68 | void vboxadd_cmc_fini (void)
|
---|
69 | {
|
---|
70 | }
|
---|
71 |
|
---|
72 | DECLVBGL (int)
|
---|
73 | vboxadd_cmc_ctl_guest_filter_mask (uint32_t or_mask, uint32_t not_mask)
|
---|
74 | {
|
---|
75 | int rc;
|
---|
76 | VMMDevCtlGuestFilterMask *req;
|
---|
77 |
|
---|
78 | rc = VbglGRAlloc ((VMMDevRequestHeader**) &req, sizeof (*req),
|
---|
79 | VMMDevReq_CtlGuestFilterMask);
|
---|
80 |
|
---|
81 | if (VBOX_FAILURE (rc))
|
---|
82 | {
|
---|
83 | elog ("VbglGRAlloc (CtlGuestFilterMask) failed rc=%d\n", rc);
|
---|
84 | return -1;
|
---|
85 | }
|
---|
86 |
|
---|
87 | req->u32OrMask = or_mask;
|
---|
88 | req->u32NotMask = not_mask;
|
---|
89 |
|
---|
90 | rc = VbglGRPerform (&req->header);
|
---|
91 | VbglGRFree (&req->header);
|
---|
92 | if (VBOX_FAILURE (rc))
|
---|
93 | {
|
---|
94 | elog ("VbglGRPerform (CtlGuestFilterMask) failed rc=%d\n", rc);
|
---|
95 | return -1;
|
---|
96 | }
|
---|
97 | return 0;
|
---|
98 | }
|
---|
99 |
|
---|
100 | EXPORT_SYMBOL (vboxadd_cmc_call);
|
---|
101 | EXPORT_SYMBOL (vboxadd_cmc_ctl_guest_filter_mask);
|
---|