Changeset 10662 in vbox for trunk/src/VBox/HostDrivers/Support/darwin
- Timestamp:
- Jul 15, 2008 2:36:00 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 33373
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
r10603 r10662 1 /* $Id: $ */ 1 2 /** @file 3 * 2 4 * VBox host drivers - Ring-0 support drivers - Darwin host: 3 5 * Darwin driver C code … … 29 31 */ 30 32 31 32 33 /******************************************************************************* 33 34 * Header Files * 34 35 *******************************************************************************/ 36 #define LOG_GROUP LOG_GROUP_SUP_DRV 35 37 /* 36 38 * Deal with conflicts first. … … 54 56 #include <iprt/uuid.h> 55 57 #include <iprt/err.h> 58 #include <VBox/log.h> 56 59 57 60 #include <mach/kmod.h> … … 219 222 { 220 223 int rc; 221 dprintf(("VBoxDrvDarwinStart\n")); 224 #ifdef DEBUG 225 printf("VBoxDrvDarwinStart\n"); 226 #endif 222 227 223 228 /* … … 251 256 if (g_hDevFsDevice) 252 257 { 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)); 254 260 return KMOD_RETURN_SUCCESS; 255 261 } 256 262 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)); 259 264 cdevsw_remove(g_iMajorDeviceNo, &g_DevCW); 260 265 g_iMajorDeviceNo = -1; 261 266 } 262 267 else 263 OSDBGPRINT(("VBoxDrv: cdevsw_add failed (%d)\n", g_iMajorDeviceNo));268 LogRel(("VBoxDrv: cdevsw_add failed (%d)\n", g_iMajorDeviceNo)); 264 269 RTSpinlockDestroy(g_Spinlock); 265 270 g_Spinlock = NIL_RTSPINLOCK; 266 271 } 267 272 else 268 OSDBGPRINT(("VBoxDrv: RTSpinlockCreate failed (rc=%d)\n", rc));273 LogRel(("VBoxDrv: RTSpinlockCreate failed (rc=%d)\n", rc)); 269 274 supdrvDeleteDevExt(&g_DevExt); 270 275 } 271 276 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); 273 278 RTR0Term(); 274 279 } 275 280 else 276 OSDBGPRINT(("VBoxDrv: failed to initialize IPRT (rc=%d)\n", rc));281 printf("VBoxDrv: failed to initialize IPRT (rc=%d)\n", rc); 277 282 278 283 memset(&g_DevExt, 0, sizeof(g_DevExt)); … … 287 292 { 288 293 int rc; 289 dprintf(("VBoxDrvDarwinStop\n"));294 LogFlow(("VBoxDrvDarwinStop\n")); 290 295 291 296 /** @todo I've got a nagging feeling that we'll have to keep track of users and refuse … … 311 316 312 317 memset(&g_DevExt, 0, sizeof(g_DevExt)); 313 dprintf(("VBoxDrvDarwinStop - done\n")); 318 #ifdef DEBUG 319 printf("VBoxDrvDarwinStop - done\n"); 320 #endif 314 321 return KMOD_RETURN_SUCCESS; 315 322 } … … 330 337 szName[0] = '\0'; 331 338 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)); 333 340 #endif 334 341 … … 362 369 OSDBGPRINT(("VBoxDrvDarwinOpen: pid=%d '%s' pSession=%p rc=%d\n", proc_pid(pProcess), szName, pSession, rc)); 363 370 #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))); 365 372 #endif 366 373 return VBoxDrvDarwinErr2DarwinErr(rc); … … 378 385 PSUPDRVSESSION pSession; 379 386 380 dprintf(("VBoxDrvDarwinClose: pid=%d\n", (int)Process));387 Log(("VBoxDrvDarwinClose: pid=%d\n", (int)Process)); 381 388 382 389 /* … … 488 495 static int VBoxDrvDarwinIOCtlSlow(PSUPDRVSESSION pSession, u_long iCmd, caddr_t pData, struct proc *pProcess) 489 496 { 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)); 491 498 492 499 … … 571 578 else 572 579 { 573 dprintf(("VBoxDrvDarwinIOCtlSlow: huh? cbReq=%#x iCmd=%#lx\n", cbReq, iCmd));580 Log(("VBoxDrvDarwinIOCtlSlow: huh? cbReq=%#x iCmd=%#lx\n", cbReq, iCmd)); 574 581 return EINVAL; 575 582 } … … 617 624 } 618 625 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)); 620 627 rc = EINVAL; 621 628 } 622 629 623 dprintf2(("VBoxDrvDarwinIOCtlSlow: returns %d\n", rc));630 Log2(("VBoxDrvDarwinIOCtlSlow: returns %d\n", rc)); 624 631 return rc; 625 632 } … … 778 785 bool org_virtualbox_SupDrv::init(OSDictionary *pDictionary) 779 786 { 780 dprintf(("org_virtualbox_SupDrv::init([%p], %p)\n", this, pDictionary));787 LogFlow(("org_virtualbox_SupDrv::init([%p], %p)\n", this, pDictionary)); 781 788 if (IOService::init(pDictionary)) 782 789 { … … 793 800 void org_virtualbox_SupDrv::free(void) 794 801 { 795 dprintf(("IOService::free([%p])\n", this));802 LogFlow(("IOService::free([%p])\n", this)); 796 803 IOService::free(); 797 804 } … … 804 811 IOService *org_virtualbox_SupDrv::probe(IOService *pProvider, SInt32 *pi32Score) 805 812 { 806 dprintf(("org_virtualbox_SupDrv::probe([%p])\n", this));813 LogFlow(("org_virtualbox_SupDrv::probe([%p])\n", this)); 807 814 return IOService::probe(pProvider, pi32Score); 808 815 } … … 814 821 bool org_virtualbox_SupDrv::start(IOService *pProvider) 815 822 { 816 dprintf(("org_virtualbox_SupDrv::start([%p])\n", this));823 LogFlow(("org_virtualbox_SupDrv::start([%p])\n", this)); 817 824 818 825 if (IOService::start(pProvider)) … … 831 838 void org_virtualbox_SupDrv::stop(IOService *pProvider) 832 839 { 833 dprintf(("org_virtualbox_SupDrv::stop([%p], %p)\n", this, pProvider));840 LogFlow(("org_virtualbox_SupDrv::stop([%p], %p)\n", this, pProvider)); 834 841 IOService::stop(pProvider); 835 842 } … … 845 852 { 846 853 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", 848 855 KMOD_INFO_NAME.reference_count, ASMAtomicUoReadS32(&g_cSessions), fOptions)); 849 856 if ( KMOD_INFO_NAME.reference_count != 0 … … 852 859 else 853 860 fRc = IOService::terminate(fOptions); 854 dprintf(("org_virtualbox_SupDrv::terminate: returns %d\n", fRc));861 LogFlow(("org_virtualbox_SupDrv::terminate: returns %d\n", fRc)); 855 862 return fRc; 856 863 } … … 869 876 bool org_virtualbox_SupDrvClient::initWithTask(task_t OwningTask, void *pvSecurityId, UInt32 u32Type) 870 877 { 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)); 872 879 873 880 if (!OwningTask) … … 889 896 bool org_virtualbox_SupDrvClient::start(IOService *pProvider) 890 897 { 891 dprintf(("org_virtualbox_SupDrvClient::start([%p], %p)\n", this, pProvider));898 LogFlow(("org_virtualbox_SupDrvClient::start([%p], %p)\n", this, pProvider)); 892 899 if (IOUserClient::start(pProvider)) 893 900 { … … 898 905 return true; 899 906 } 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)); 901 908 } 902 909 return false; … … 909 916 IOReturn org_virtualbox_SupDrvClient::clientClose(void) 910 917 { 911 dprintf(("org_virtualbox_SupDrvClient::clientClose([%p])\n", this));918 LogFlow(("org_virtualbox_SupDrvClient::clientClose([%p])\n", this)); 912 919 913 920 m_pProvider = NULL; … … 923 930 IOReturn org_virtualbox_SupDrvClient::clientDied(void) 924 931 { 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", 926 933 this, m_Task, RTR0ProcHandleSelf(), RTProcSelf())); 927 934 … … 937 944 for (PSUPDRVSESSION pSession = g_apSessionHashTab[i]; pSession; pSession = pSession->pNextHash) 938 945 { 939 dprintf2(("pSession=%p R0Process=%p (=? %p)\n", pSession, pSession->R0Process, R0Process));946 Log2(("pSession=%p R0Process=%p (=? %p)\n", pSession, pSession->R0Process, R0Process)); 940 947 if (pSession->R0Process == R0Process) 941 948 { … … 963 970 bool org_virtualbox_SupDrvClient::terminate(IOOptionBits fOptions) 964 971 { 965 dprintf(("org_virtualbox_SupDrvClient::terminate([%p], %#x)\n", this, fOptions));972 LogFlow(("org_virtualbox_SupDrvClient::terminate([%p], %#x)\n", this, fOptions)); 966 973 return IOUserClient::terminate(fOptions); 967 974 } … … 973 980 bool org_virtualbox_SupDrvClient::finalize(IOOptionBits fOptions) 974 981 { 975 dprintf(("org_virtualbox_SupDrvClient::finalize([%p], %#x)\n", this, fOptions));982 LogFlow(("org_virtualbox_SupDrvClient::finalize([%p], %#x)\n", this, fOptions)); 976 983 return IOUserClient::finalize(fOptions); 977 984 } … … 983 990 void org_virtualbox_SupDrvClient::stop(IOService *pProvider) 984 991 { 985 dprintf(("org_virtualbox_SupDrvClient::stop([%p])\n", this));992 LogFlow(("org_virtualbox_SupDrvClient::stop([%p])\n", this)); 986 993 IOUserClient::stop(pProvider); 987 994 }
Note:
See TracChangeset
for help on using the changeset viewer.