VirtualBox

Ignore:
Timestamp:
Jan 16, 2009 2:05:07 PM (16 years ago)
Author:
vboxsync
Message:

Linux vboxdrv: 2.6.29-rc1 compile fix; small cosmetical fixes

File:
1 edited

Legend:

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

    r13939 r15992  
    299299#ifdef CONFIG_X86_LOCAL_APIC
    300300# ifdef DO_DISABLE_NMI
    301 
    302301/** Stop AMD NMI watchdog (x86_64 only). */
    303 static int stop_k7_watchdog(void)
     302static int StopK7Watchdog(void)
    304303{
    305304    wrmsr(MSR_K7_EVNTSEL0, 0, 0);
     
    308307
    309308/** Stop Intel P4 NMI watchdog (x86_64 only). */
    310 static int stop_p4_watchdog(void)
     309static int StopP4Watchdog(void)
    311310{
    312311    wrmsr(MSR_P4_IQ_CCCR0,  0, 0);
     
    317316
    318317/** The new method of detecting the event counter */
    319 static int stop_intel_arch_watchdog(void)
     318static int StopIntelArchWatchdog(void)
    320319{
    321320    unsigned ebx;
     
    328327
    329328/** Stop NMI watchdog. */
    330 static void vbox_stop_apic_nmi_watchdog(void *unused)
     329static void VBoxStopApicNmiWatchdog(void *unused)
    331330{
    332331    int stopped = 0;
     
    344343            if (strstr(boot_cpu_data.x86_model_id, "Screwdriver"))
    345344               return;
    346             stopped = stop_k7_watchdog();
     345            stopped = StopK7Watchdog();
    347346            break;
    348347        case X86_VENDOR_INTEL:
    349348            if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON))
    350349            {
    351                 stopped = stop_intel_arch_watchdog();
     350                stopped = StopIntelArchWatchdog();
    352351                break;
    353352            }
    354             stopped = stop_p4_watchdog();
     353            stopped = StopP4Watchdog();
    355354            break;
    356355        default:
     
    364363
    365364/** Disable LAPIC NMI watchdog. */
    366 static void disable_lapic_nmi_watchdog(void)
     365static void DisableLapicNmiWatchdog(void)
    367366{
    368367    BUG_ON(nmi_watchdog != NMI_LOCAL_APIC);
     
    371370        return;
    372371
    373     on_each_cpu(vbox_stop_apic_nmi_watchdog, NULL, 1, 1);
     372    on_each_cpu(VBoxStopApicNmiWatchdog, NULL, 1, 1);
    374373
    375374    BUG_ON(nmi_atomic_read(&nmi_active) != 0);
     
    380379
    381380/** Shutdown NMI. */
    382 static void nmi_cpu_shutdown(void * dummy)
     381static void vboxdrvNmiCpuShutdown(void * dummy)
    383382{
    384383    unsigned int vERR, vPC;
     
    395394}
    396395
    397 static void nmi_shutdown(void)
    398 {
    399     on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1);
     396static void vboxdrvNmiShutdown(void)
     397{
     398    on_each_cpu(vboxdrvNmiCpuShutdown, NULL, 0, 1);
    400399}
    401400# endif /* DO_DISABLE_NMI */
    402401#endif /* CONFIG_X86_LOCAL_APIC */
    403402
     403
     404DECLINLINE(RTUID) vboxdrvLinuxUid(void)
     405{
     406#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
     407    return current->cred->uid;
     408#else
     409    return current->uid;
     410#endif
     411}
     412
     413DECLINLINE(RTGID) vboxdrvLinuxGid(void)
     414{
     415#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
     416    return current->cred->gid;
     417#else
     418    return current->gid;
     419#endif
     420}
     421
     422DECLINLINE(RTUID) vboxdrvLinuxEuid(void)
     423{
     424#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
     425    return current->cred->euid;
     426#else
     427    return current->euid;
     428#endif
     429}
    404430
    405431/**
     
    436462        {
    437463            case NMI_LOCAL_APIC:
    438                 disable_lapic_nmi_watchdog();
     464                DisableLapicNmiWatchdog();
    439465                break;
    440466            case NMI_NONE:
     
    445471        if (nmi_atomic_read(&nmi_active) == 0)
    446472        {
    447             nmi_shutdown();
     473            vboxdrvNmiShutdown();
    448474            printk(KERN_DEBUG DEVICE_NAME ": Successfully done.\n");
    449475        }
     
    704730     * Only root is allowed to access the device, enforce it!
    705731     */
    706     if (current->euid != 0 /* root */ )
    707     {
    708         Log(("VBoxDrvLinuxCreate: euid=%d, expected 0 (root)\n", current->euid));
     732    if (vboxdrvLinuxEuid != 0 /* root */ )
     733    {
     734        Log(("VBoxDrvLinuxCreate: euid=%d, expected 0 (root)\n", vboxdrvLinuxEuid));
    709735        return -EPERM;
    710736    }
     
    717743    if (!rc)
    718744    {
    719         pSession->Uid = current->uid;
    720         pSession->Gid = current->gid;
     745        pSession->Uid = vboxdrvLinuxUid();
     746        pSession->Gid = vboxdrvLinuxGid();
    721747    }
    722748
     
    963989 * Initializes any OS specific object creator fields.
    964990 */
    965 void VBOXCALL   supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession)
     991void VBOXCALL supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession)
    966992{
    967993    NOREF(pObj);
     
    9811007 * @param   prc         Where to store the result when returning true.
    9821008 */
    983 bool VBOXCALL   supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc)
     1009bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc)
    9841010{
    9851011    NOREF(pObj);
     
    9911017
    9921018
    993 bool VBOXCALL  supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
     1019bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
    9941020{
    9951021    return force_async_tsc != 0;
     
    10031029 * @param   rc  supdrv error code (SUPDRV_ERR_* defines).
    10041030 */
    1005 static int     VBoxDrvLinuxErr2LinuxErr(int rc)
     1031static int VBoxDrvLinuxErr2LinuxErr(int rc)
    10061032{
    10071033    switch (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