VirtualBox

Ignore:
Timestamp:
Jul 15, 2008 2:36:00 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33373
Message:

Increased the IOC version to 7.4 with the exporting of SUPR0ComponentQueryFactory and friends. Added release logging to darwin, windows and freebsd.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r10603 r10662  
     1/* $Id: $ */
    12/** @file
     3 *
    24 * VBox host drivers - Ring-0 support drivers - Darwin host:
    35 * Darwin driver C code
     
    2931 */
    3032
    31 
    3233/*******************************************************************************
    3334*   Header Files                                                               *
    3435*******************************************************************************/
     36#define LOG_GROUP LOG_GROUP_SUP_DRV
    3537/*
    3638 * Deal with conflicts first.
     
    5456#include <iprt/uuid.h>
    5557#include <iprt/err.h>
     58#include <VBox/log.h>
    5659
    5760#include <mach/kmod.h>
     
    219222{
    220223    int rc;
    221     dprintf(("VBoxDrvDarwinStart\n"));
     224#ifdef DEBUG
     225    printf("VBoxDrvDarwinStart\n");
     226#endif
    222227
    223228    /*
     
    251256                    if (g_hDevFsDevice)
    252257                    {
    253                         OSDBGPRINT(("VBoxDrv: Successfully started. (major=%d)\n", g_iMajorDeviceNo));
     258                        LogRel(("VBoxDrv: version " VBOX_VERSION_STRING " r%d; IOCtl version %#x; IDC version %#x; dev major=%d\n",
     259                                VBOX_SVN_REV, SUPDRVIOC_VERSION, SUPDRV_IDC_VERSION, g_iMajorDeviceNo));
    254260                        return KMOD_RETURN_SUCCESS;
    255261                    }
    256262
    257                     OSDBGPRINT(("VBoxDrv: devfs_make_node(makedev(%d,0),,,,%s) failed\n",
    258                                 g_iMajorDeviceNo, DEVICE_NAME));
     263                    LogRel(("VBoxDrv: devfs_make_node(makedev(%d,0),,,,%s) failed\n", g_iMajorDeviceNo, DEVICE_NAME));
    259264                    cdevsw_remove(g_iMajorDeviceNo, &g_DevCW);
    260265                    g_iMajorDeviceNo = -1;
    261266                }
    262267                else
    263                     OSDBGPRINT(("VBoxDrv: cdevsw_add failed (%d)\n", g_iMajorDeviceNo));
     268                    LogRel(("VBoxDrv: cdevsw_add failed (%d)\n", g_iMajorDeviceNo));
    264269                RTSpinlockDestroy(g_Spinlock);
    265270                g_Spinlock = NIL_RTSPINLOCK;
    266271            }
    267272            else
    268                 OSDBGPRINT(("VBoxDrv: RTSpinlockCreate failed (rc=%d)\n", rc));
     273                LogRel(("VBoxDrv: RTSpinlockCreate failed (rc=%d)\n", rc));
    269274            supdrvDeleteDevExt(&g_DevExt);
    270275        }
    271276        else
    272             OSDBGPRINT(("VBoxDrv: failed to initialize device extension (rc=%d)\n", rc));
     277            printf("VBoxDrv: failed to initialize device extension (rc=%d)\n", rc);
    273278        RTR0Term();
    274279    }
    275280    else
    276         OSDBGPRINT(("VBoxDrv: failed to initialize IPRT (rc=%d)\n", rc));
     281        printf("VBoxDrv: failed to initialize IPRT (rc=%d)\n", rc);
    277282
    278283    memset(&g_DevExt, 0, sizeof(g_DevExt));
     
    287292{
    288293    int rc;
    289     dprintf(("VBoxDrvDarwinStop\n"));
     294    LogFlow(("VBoxDrvDarwinStop\n"));
    290295
    291296    /** @todo I've got a nagging feeling that we'll have to keep track of users and refuse
     
    311316
    312317    memset(&g_DevExt, 0, sizeof(g_DevExt));
    313     dprintf(("VBoxDrvDarwinStop - done\n"));
     318#ifdef DEBUG
     319    printf("VBoxDrvDarwinStop - done\n");
     320#endif
    314321    return KMOD_RETURN_SUCCESS;
    315322}
     
    330337    szName[0] = '\0';
    331338    proc_name(proc_pid(pProcess), szName, sizeof(szName));
    332     dprintf(("VBoxDrvDarwinOpen: pid=%d '%s'\n", proc_pid(pProcess), szName));
     339    Log(("VBoxDrvDarwinOpen: pid=%d '%s'\n", proc_pid(pProcess), szName));
    333340#endif
    334341
     
    362369    OSDBGPRINT(("VBoxDrvDarwinOpen: pid=%d '%s' pSession=%p rc=%d\n", proc_pid(pProcess), szName, pSession, rc));
    363370#else
    364     dprintf(("VBoxDrvDarwinOpen: g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, proc_pid(pProcess)));
     371    Log(("VBoxDrvDarwinOpen: g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, proc_pid(pProcess)));
    365372#endif
    366373    return VBoxDrvDarwinErr2DarwinErr(rc);
     
    378385    PSUPDRVSESSION  pSession;
    379386
    380     dprintf(("VBoxDrvDarwinClose: pid=%d\n", (int)Process));
     387    Log(("VBoxDrvDarwinClose: pid=%d\n", (int)Process));
    381388
    382389    /*
     
    488495static int VBoxDrvDarwinIOCtlSlow(PSUPDRVSESSION pSession, u_long iCmd, caddr_t pData, struct proc *pProcess)
    489496{
    490     dprintf(("VBoxDrvDarwinIOCtlSlow: pSession=%p iCmd=%p pData=%p pProcess=%p\n", pSession, iCmd, pData, pProcess));
     497    LogFlow(("VBoxDrvDarwinIOCtlSlow: pSession=%p iCmd=%p pData=%p pProcess=%p\n", pSession, iCmd, pData, pProcess));
    491498
    492499
     
    571578    else
    572579    {
    573         dprintf(("VBoxDrvDarwinIOCtlSlow: huh? cbReq=%#x iCmd=%#lx\n", cbReq, iCmd));
     580        Log(("VBoxDrvDarwinIOCtlSlow: huh? cbReq=%#x iCmd=%#lx\n", cbReq, iCmd));
    574581        return EINVAL;
    575582    }
     
    617624        }
    618625
    619         dprintf(("VBoxDrvDarwinIOCtlSlow: pid=%d iCmd=%lx pData=%p failed, rc=%d\n", proc_pid(pProcess), iCmd, (void *)pData, rc));
     626        Log(("VBoxDrvDarwinIOCtlSlow: pid=%d iCmd=%lx pData=%p failed, rc=%d\n", proc_pid(pProcess), iCmd, (void *)pData, rc));
    620627        rc = EINVAL;
    621628    }
    622629
    623     dprintf2(("VBoxDrvDarwinIOCtlSlow: returns %d\n", rc));
     630    Log2(("VBoxDrvDarwinIOCtlSlow: returns %d\n", rc));
    624631    return rc;
    625632}
     
    778785bool org_virtualbox_SupDrv::init(OSDictionary *pDictionary)
    779786{
    780     dprintf(("org_virtualbox_SupDrv::init([%p], %p)\n", this, pDictionary));
     787    LogFlow(("org_virtualbox_SupDrv::init([%p], %p)\n", this, pDictionary));
    781788    if (IOService::init(pDictionary))
    782789    {
     
    793800void org_virtualbox_SupDrv::free(void)
    794801{
    795     dprintf(("IOService::free([%p])\n", this));
     802    LogFlow(("IOService::free([%p])\n", this));
    796803    IOService::free();
    797804}
     
    804811IOService *org_virtualbox_SupDrv::probe(IOService *pProvider, SInt32 *pi32Score)
    805812{
    806     dprintf(("org_virtualbox_SupDrv::probe([%p])\n", this));
     813    LogFlow(("org_virtualbox_SupDrv::probe([%p])\n", this));
    807814    return IOService::probe(pProvider, pi32Score);
    808815}
     
    814821bool org_virtualbox_SupDrv::start(IOService *pProvider)
    815822{
    816     dprintf(("org_virtualbox_SupDrv::start([%p])\n", this));
     823    LogFlow(("org_virtualbox_SupDrv::start([%p])\n", this));
    817824
    818825    if (IOService::start(pProvider))
     
    831838void org_virtualbox_SupDrv::stop(IOService *pProvider)
    832839{
    833     dprintf(("org_virtualbox_SupDrv::stop([%p], %p)\n", this, pProvider));
     840    LogFlow(("org_virtualbox_SupDrv::stop([%p], %p)\n", this, pProvider));
    834841    IOService::stop(pProvider);
    835842}
     
    845852{
    846853    bool fRc;
    847     dprintf(("org_virtualbox_SupDrv::terminate: reference_count=%d g_cSessions=%d (fOptions=%#x)\n",
     854    LogFlow(("org_virtualbox_SupDrv::terminate: reference_count=%d g_cSessions=%d (fOptions=%#x)\n",
    848855             KMOD_INFO_NAME.reference_count, ASMAtomicUoReadS32(&g_cSessions), fOptions));
    849856    if (    KMOD_INFO_NAME.reference_count != 0
     
    852859    else
    853860        fRc = IOService::terminate(fOptions);
    854     dprintf(("org_virtualbox_SupDrv::terminate: returns %d\n", fRc));
     861    LogFlow(("org_virtualbox_SupDrv::terminate: returns %d\n", fRc));
    855862    return fRc;
    856863}
     
    869876bool org_virtualbox_SupDrvClient::initWithTask(task_t OwningTask, void *pvSecurityId, UInt32 u32Type)
    870877{
    871     dprintf(("org_virtualbox_SupDrvClient::initWithTask([%p], %#x, %p, %#x)\n", this, OwningTask, pvSecurityId, u32Type));
     878    LogFlow(("org_virtualbox_SupDrvClient::initWithTask([%p], %#x, %p, %#x)\n", this, OwningTask, pvSecurityId, u32Type));
    872879
    873880    if (!OwningTask)
     
    889896bool org_virtualbox_SupDrvClient::start(IOService *pProvider)
    890897{
    891     dprintf(("org_virtualbox_SupDrvClient::start([%p], %p)\n", this, pProvider));
     898    LogFlow(("org_virtualbox_SupDrvClient::start([%p], %p)\n", this, pProvider));
    892899    if (IOUserClient::start(pProvider))
    893900    {
     
    898905            return true;
    899906        }
    900         dprintf(("org_virtualbox_SupDrvClient::start: %p isn't org_virtualbox_SupDrv\n", pProvider));
     907        LogFlow(("org_virtualbox_SupDrvClient::start: %p isn't org_virtualbox_SupDrv\n", pProvider));
    901908    }
    902909    return false;
     
    909916IOReturn org_virtualbox_SupDrvClient::clientClose(void)
    910917{
    911     dprintf(("org_virtualbox_SupDrvClient::clientClose([%p])\n", this));
     918    LogFlow(("org_virtualbox_SupDrvClient::clientClose([%p])\n", this));
    912919
    913920    m_pProvider = NULL;
     
    923930IOReturn org_virtualbox_SupDrvClient::clientDied(void)
    924931{
    925     dprintf(("org_virtualbox_SupDrvClient::clientDied([%p]) m_Task=%p R0Process=%p Process=%d\n",
     932    LogFlow(("org_virtualbox_SupDrvClient::clientDied([%p]) m_Task=%p R0Process=%p Process=%d\n",
    926933             this, m_Task, RTR0ProcHandleSelf(), RTProcSelf()));
    927934
     
    937944        for (PSUPDRVSESSION pSession = g_apSessionHashTab[i]; pSession; pSession = pSession->pNextHash)
    938945        {
    939             dprintf2(("pSession=%p R0Process=%p (=? %p)\n", pSession, pSession->R0Process, R0Process));
     946            Log2(("pSession=%p R0Process=%p (=? %p)\n", pSession, pSession->R0Process, R0Process));
    940947            if (pSession->R0Process == R0Process)
    941948            {
     
    963970bool org_virtualbox_SupDrvClient::terminate(IOOptionBits fOptions)
    964971{
    965     dprintf(("org_virtualbox_SupDrvClient::terminate([%p], %#x)\n", this, fOptions));
     972    LogFlow(("org_virtualbox_SupDrvClient::terminate([%p], %#x)\n", this, fOptions));
    966973    return IOUserClient::terminate(fOptions);
    967974}
     
    973980bool org_virtualbox_SupDrvClient::finalize(IOOptionBits fOptions)
    974981{
    975     dprintf(("org_virtualbox_SupDrvClient::finalize([%p], %#x)\n", this, fOptions));
     982    LogFlow(("org_virtualbox_SupDrvClient::finalize([%p], %#x)\n", this, fOptions));
    976983    return IOUserClient::finalize(fOptions);
    977984}
     
    983990void org_virtualbox_SupDrvClient::stop(IOService *pProvider)
    984991{
    985     dprintf(("org_virtualbox_SupDrvClient::stop([%p])\n", this));
     992    LogFlow(("org_virtualbox_SupDrvClient::stop([%p])\n", this));
    986993    IOUserClient::stop(pProvider);
    987994}
Note: See TracChangeset for help on using the changeset viewer.

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