VirtualBox

Ignore:
Timestamp:
Nov 19, 2008 2:10:24 PM (16 years ago)
Author:
vboxsync
Message:

Additions/HGCM: merged code for HGCMCall and HGCMCallTimed, as per todo

Location:
trunk/src/VBox/Additions/linux/module
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/module/cmc.c

    r14304 r14352  
    3131{
    3232    VBoxDevice *dev = pvData;
    33     wait_event (dev->eventq, pHeader->fu32Flags & VBOX_HGCM_REQ_DONE);
     33    if (u32Data == RT_INDEFINITE_WAIT)
     34        wait_event (dev->eventq, pHeader->fu32Flags & VBOX_HGCM_REQ_DONE);
     35    else
     36        wait_event_timeout (dev->eventq, pHeader->fu32Flags & VBOX_HGCM_REQ_DONE,
     37                            msecs_to_jiffies (u32Data));
    3438}
    3539
     
    3842{
    3943    VBoxDevice *dev = pvData;
    40     wait_event_interruptible (dev->eventq, pHeader->fu32Flags & VBOX_HGCM_REQ_DONE);
    41 }
    42 
    43 static DECLVBGL(void)
    44 vboxadd_hgcm_callback_timeout (VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data)
    45 {
    46     VBoxDevice *dev = pvData;
    47     wait_event_interruptible_timeout (dev->eventq, pHeader->fu32Flags & VBOX_HGCM_REQ_DONE,
    48                                       msecs_to_jiffies (u32Data));
     44    if (u32Data == RT_INDEFINITE_WAIT)
     45        wait_event_interruptible (dev->eventq, pHeader->fu32Flags & VBOX_HGCM_REQ_DONE);
     46    else
     47        wait_event_interruptible_timeout (dev->eventq, pHeader->fu32Flags & VBOX_HGCM_REQ_DONE,
     48                                          msecs_to_jiffies (u32Data));
    4949}
    5050
     
    5656    if (   VBOXGUEST_IOCTL_STRIP_SIZE(func)
    5757        == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL(0)))
    58         rc = VbglHGCMCall (data, vboxadd_hgcm_callback_interruptible, opaque, 0);
     58        rc = VbglHGCMCall (data, vboxadd_hgcm_callback_interruptible, opaque, RT_INDEFINITE_WAIT);
    5959    /* this function can handle cancelled requests */
    6060    else if (   VBOXGUEST_IOCTL_STRIP_SIZE(func)
    61              == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMEOUT(0)))
     61             == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED(0)))
    6262    {
    63         VBoxGuestHGCMCallInfoTimeout *pCallInfo;
    64         pCallInfo = (VBoxGuestHGCMCallInfoTimeout *) data;
    65         rc = VbglHGCMCall (&pCallInfo->info, vboxadd_hgcm_callback_timeout,
    66                            opaque, pCallInfo->u32Timeout);
     63        VBoxGuestHGCMCallInfoTimed *pCallInfo;
     64        pCallInfo = (VBoxGuestHGCMCallInfoTimed *) data;
     65        if (pCallInfo->fInterruptible)
     66            rc = VbglHGCMCall (&pCallInfo->info, vboxadd_hgcm_callback_interruptible,
     67                               opaque, pCallInfo->u32Timeout);
     68        else
     69            rc = VbglHGCMCall (&pCallInfo->info, vboxadd_hgcm_callback,
     70                               opaque, pCallInfo->u32Timeout);
    6771    }
    6872    else switch (func)
     
    7074        /* this function can NOT handle cancelled requests */
    7175        case VBOXGUEST_IOCTL_HGCM_CONNECT:
    72             rc = VbglHGCMConnect (data, vboxadd_hgcm_callback, opaque, 0);
     76            rc = VbglHGCMConnect (data, vboxadd_hgcm_callback, opaque, RT_INDEFINITE_WAIT);
    7377            break;
    7478
    7579        /* this function can NOT handle cancelled requests */
    7680        case VBOXGUEST_IOCTL_HGCM_DISCONNECT:
    77             rc = VbglHGCMDisconnect (data, vboxadd_hgcm_callback, opaque, 0);
     81            rc = VbglHGCMDisconnect (data, vboxadd_hgcm_callback, opaque, RT_INDEFINITE_WAIT);
    7882            break;
    7983
  • trunk/src/VBox/Additions/linux/module/vboxmod.c

    r14218 r14352  
    420420 * @param  u32Size        the size of the userspace structure
    421421 */
    422 static int vboxadd_hgcm_call_timeout(unsigned long userspace_info,
     422static int vboxadd_hgcm_call_timed(unsigned long userspace_info,
    423423                                     uint32_t u32Size)
    424424{
    425         VBoxGuestHGCMCallInfoTimeout *pInfo = NULL;
     425        VBoxGuestHGCMCallInfoTimed *pInfo = NULL;
    426426        int rc = 0;
    427427       
     
    445445                LogRelFunc(("client ID %u\n", pInfo->info.u32ClientID));
    446446                vrc = vboxadd_cmc_call(vboxDev,
    447                               VBOXGUEST_IOCTL_HGCM_CALL_TIMEOUT(u32Size), pInfo);
     447                              VBOXGUEST_IOCTL_HGCM_CALL_TIMED(u32Size), pInfo);
    448448                rc = -RTErrConvertToErrno(vrc);
    449449                if (   rc >= 0
     
    624624                IOCTL_EXIT("VBOXGUEST_IOCTL_HGCM_CALL", arg);
    625625        }
    626         else if (   VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMEOUT(0))
     626        else if (   VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED(0))
    627627                 == VBOXGUEST_IOCTL_STRIP_SIZE(cmd))
    628628        {
    629629        /* Do the HGCM call using the Vbgl bits */
    630                 IOCTL_ENTRY("VBOXGUEST_IOCTL_HGCM_CALL_TIMEOUT", arg);
    631                 rc = vboxadd_hgcm_call_timeout(arg, _IOC_SIZE(cmd));
    632                 IOCTL_EXIT("VBOXGUEST_IOCTL_HGCM_CALL_TIMEOUT", arg);
     630                IOCTL_ENTRY("VBOXGUEST_IOCTL_HGCM_CALL_TIMED", arg);
     631                rc = vboxadd_hgcm_call_timed(arg, _IOC_SIZE(cmd));
     632                IOCTL_EXIT("VBOXGUEST_IOCTL_HGCM_CALL_TIMED", arg);
    633633        }
    634634        else
Note: See TracChangeset for help on using the changeset viewer.

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