1 | /** @file
|
---|
2 | *
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 innotek 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 | */
|
---|
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 | DECLVBGL (int) vboxadd_cmc_call (void *opaque, uint32_t func, void *data)
|
---|
36 | {
|
---|
37 | switch (func)
|
---|
38 | {
|
---|
39 | case IOCTL_VBOXGUEST_HGCM_CONNECT:
|
---|
40 | return VbglHGCMConnect (data, vboxadd_hgcm_callback, opaque, 0);
|
---|
41 |
|
---|
42 | case IOCTL_VBOXGUEST_HGCM_DISCONNECT:
|
---|
43 | return VbglHGCMDisconnect (data, vboxadd_hgcm_callback, opaque, 0);
|
---|
44 |
|
---|
45 | case IOCTL_VBOXGUEST_HGCM_CALL:
|
---|
46 | return VbglHGCMCall (data, vboxadd_hgcm_callback, opaque, 0);
|
---|
47 |
|
---|
48 | default:
|
---|
49 | return VERR_VBGL_IOCTL_FAILED;
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | int vboxadd_cmc_init (void)
|
---|
54 | {
|
---|
55 | return 0;
|
---|
56 | }
|
---|
57 |
|
---|
58 | void vboxadd_cmc_fini (void)
|
---|
59 | {
|
---|
60 | }
|
---|
61 |
|
---|
62 | DECLVBGL (int)
|
---|
63 | vboxadd_cmc_ctl_guest_filter_mask (uint32_t or_mask, uint32_t not_mask)
|
---|
64 | {
|
---|
65 | int rc;
|
---|
66 | VMMDevCtlGuestFilterMask *req;
|
---|
67 |
|
---|
68 | rc = VbglGRAlloc ((VMMDevRequestHeader**) &req, sizeof (*req),
|
---|
69 | VMMDevReq_CtlGuestFilterMask);
|
---|
70 |
|
---|
71 | if (VBOX_FAILURE (rc))
|
---|
72 | {
|
---|
73 | elog ("VbglGRAlloc (CtlGuestFilterMask) failed rc=%d\n", rc);
|
---|
74 | return -1;
|
---|
75 | }
|
---|
76 |
|
---|
77 | req->u32OrMask = or_mask;
|
---|
78 | req->u32NotMask = not_mask;
|
---|
79 |
|
---|
80 | rc = VbglGRPerform (&req->header);
|
---|
81 | VbglGRFree (&req->header);
|
---|
82 | if (VBOX_FAILURE (rc))
|
---|
83 | {
|
---|
84 | elog ("VbglGRPerform (CtlGuestFilterMask) failed rc=%d\n", rc);
|
---|
85 | return -1;
|
---|
86 | }
|
---|
87 | return 0;
|
---|
88 | }
|
---|
89 |
|
---|
90 | EXPORT_SYMBOL (vboxadd_cmc_call);
|
---|
91 | EXPORT_SYMBOL (vboxadd_cmc_ctl_guest_filter_mask);
|
---|