VirtualBox

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

Last change on this file since 10541 was 10541, checked in by vboxsync, 16 years ago

Removed deprecated IOCTL namings.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
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 */
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 DECLVBGL(void)
36vboxadd_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
42DECLVBGL (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
63int vboxadd_cmc_init (void)
64{
65 return 0;
66}
67
68void vboxadd_cmc_fini (void)
69{
70}
71
72DECLVBGL (int)
73vboxadd_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
100EXPORT_SYMBOL (vboxadd_cmc_call);
101EXPORT_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