VirtualBox

Changeset 5169 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Oct 5, 2007 3:12:30 PM (17 years ago)
Author:
vboxsync
Message:

Use unlocked_ioctl when available, otherwise leave the kernel lock.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r5138 r5169  
    5757# endif
    5858#endif
     59#ifndef HAVE_UNLOCKED_IOCTL /* linux/fs.h defines this */
     60# include <linux/smp_lock.h>
     61#endif
    5962
    6063#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
     
    294297static int      VBoxDrvLinuxCreate(struct inode *pInode, struct file *pFilp);
    295298static int      VBoxDrvLinuxClose(struct inode *pInode, struct file *pFilp);
     299#ifdef HAVE_UNLOCKED_IOCTL
     300static long     VBoxDrvLinuxIOCtl(struct file *pFilp, unsigned int uCmd, unsigned long ulArg);
     301#else
    296302static int      VBoxDrvLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigned int uCmd, unsigned long ulArg);
    297 static int      VBoxDrvLinuxIOCtlSlow(struct inode *pInode, struct file *pFilp, unsigned int uCmd, unsigned long ulArg);
     303#endif
     304static int      VBoxDrvLinuxIOCtlSlow(struct file *pFilp, unsigned int uCmd, unsigned long ulArg);
    298305static int      VBoxDrvLinuxInitGip(PSUPDRVDEVEXT pDevExt);
    299306static int      VBoxDrvLinuxTermGip(PSUPDRVDEVEXT pDevExt);
     
    312319    open:       VBoxDrvLinuxCreate,
    313320    release:    VBoxDrvLinuxClose,
     321#ifdef HAVE_UNLOCKED_IOCTL
     322    unlocked_ioctl: VBoxDrvLinuxIOCtl,
     323#else
    314324    ioctl:      VBoxDrvLinuxIOCtl,
     325#endif
    315326};
    316327
     
    747758 * Device I/O Control entry point.
    748759 *
    749  * @param   pInode      Pointer to inode info structure.
    750760 * @param   pFilp       Associated file pointer.
    751761 * @param   uCmd        The function specified to ioctl().
    752762 * @param   ulArg       The argument specified to ioctl().
    753763 */
     764#ifdef HAVE_UNLOCKED_IOCTL
     765static long VBoxDrvLinuxIOCtl(struct file *pFilp, unsigned int uCmd, unsigned long ulArg)
     766#else
    754767static int VBoxDrvLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigned int uCmd, unsigned long ulArg)
     768#endif
    755769{
    756770    /*
     
    758772     * the session and iCmd, and only returns a VBox status code.
    759773     */
     774#ifdef HAVE_UNLOCKED_IOCTL
    760775    if (RT_LIKELY(   uCmd == SUP_IOCTL_FAST_DO_RAW_RUN
    761776                  || uCmd == SUP_IOCTL_FAST_DO_HWACC_RUN
    762777                  || uCmd == SUP_IOCTL_FAST_DO_NOP))
    763778        return supdrvIOCtlFast(uCmd, &g_DevExt, (PSUPDRVSESSION)pFilp->private_data);
    764     return VBoxDrvLinuxIOCtlSlow(pInode, pFilp, uCmd, ulArg);
     779    return VBoxDrvLinuxIOCtlSlow(pFilp, uCmd, ulArg);
     780
     781#else   /* !HAVE_UNLOCKED_IOCTL */
     782
     783    int rc;
     784    unlock_kernel();
     785    if (RT_LIKELY(   uCmd == SUP_IOCTL_FAST_DO_RAW_RUN
     786                  || uCmd == SUP_IOCTL_FAST_DO_HWACC_RUN
     787                  || uCmd == SUP_IOCTL_FAST_DO_NOP))
     788        rc = supdrvIOCtlFast(uCmd, &g_DevExt, (PSUPDRVSESSION)pFilp->private_data);
     789    else
     790        rc = VBoxDrvLinuxIOCtlSlow(pFilp, uCmd, ulArg);
     791    lock_kernel();
     792    return rc;
     793#endif  /* !HAVE_UNLOCKED_IOCTL */
    765794}
    766795
     
    769798 * Device I/O Control entry point.
    770799 *
    771  * @param   pInode      Pointer to inode info structure.
    772800 * @param   pFilp       Associated file pointer.
    773801 * @param   uCmd        The function specified to ioctl().
    774802 * @param   ulArg       The argument specified to ioctl().
    775803 */
    776 static int VBoxDrvLinuxIOCtlSlow(struct inode *pInode, struct file *pFilp, unsigned int uCmd, unsigned long ulArg)
     804static int VBoxDrvLinuxIOCtlSlow(struct file *pFilp, unsigned int uCmd, unsigned long ulArg)
    777805{
    778806    int                 rc;
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