Changeset 11423 in vbox
- Timestamp:
- Aug 14, 2008 12:23:04 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 34751
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
r10662 r11423 49 49 50 50 #include "../SUPDrvInternal.h" 51 #include <VBox/log.h> 51 52 #include <iprt/semaphore.h> 52 53 #include <iprt/spinlock.h> … … 188 189 int _init(void) 189 190 { 190 dprintf(("VBoxDrvSolaris_init"));191 LogFlow((DEVICE_NAME ":_init")); 191 192 192 193 int rc = ddi_soft_state_init(&g_pVBoxDrvSolarisState, sizeof(vbox_devstate_t), 8); … … 200 201 } 201 202 202 cmn_err(CE_CONT, "VBoxDrvSolaris _init failed with rc=%d ", rc);203 cmn_err(CE_CONT, "VBoxDrvSolaris _init failed with rc=%d\n", rc); 203 204 return rc; 204 205 } … … 207 208 int _fini(void) 208 209 { 209 dprintf(("VBoxDrvSolaris_fini"));210 LogFlow((DEVICE_NAME ":_fini")); 210 211 211 212 int e = mod_remove(&g_VBoxDrvSolarisModLinkage); … … 220 221 int _info(struct modinfo *pModInfo) 221 222 { 222 dprintf(("VBoxDrvSolaris_info"));223 LogFlow((DEVICE_NAME ":_info")); 223 224 int e = mod_info(&g_VBoxDrvSolarisModLinkage, pModInfo); 224 dprintf(("VBoxDrvSolaris _info returns %d", e));225 225 return e; 226 226 } … … 237 237 static int VBoxDrvSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd) 238 238 { 239 dprintf(("VBoxDrvSolarisAttach"));239 LogFlow((DEVICE_NAME ":VBoxDrvSolarisAttach\n")); 240 240 241 241 switch (enmCmd) … … 250 250 if (ddi_soft_state_zalloc(g_pVBoxDrvSolarisState, instance) != DDI_SUCCESS) 251 251 { 252 cmn_err(CE_NOTE, "VBoxDrvSolarisAttach: state alloc failed");252 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: state alloc failed\n")); 253 253 return DDI_FAILURE; 254 254 } … … 290 290 /* Is this really necessary? */ 291 291 ddi_remove_minor_node(pDip, NULL); 292 cmn_err(CE_NOTE,"VBoxDrvSolarisAttach: ddi_create_minor_node failed.");292 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: ddi_create_minor_node failed.\n")); 293 293 294 294 RTSpinlockDestroy(g_Spinlock); … … 296 296 } 297 297 else 298 cmn_err(CE_NOTE, "VBoxDrvSolarisAttach: RTSpinlockCreate failed");298 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: RTSpinlockCreate failed\n")); 299 299 supdrvDeleteDevExt(&g_DevExt); 300 300 } 301 301 else 302 cmn_err(CE_NOTE, "VBoxDrvSolarisAttach: supdrvInitDevExt failed");302 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: supdrvInitDevExt failed\n")); 303 303 RTR0Term(); 304 304 } 305 305 else 306 cmn_err(CE_NOTE, "VBoxDrvSolarisAttach: failed to init R0Drv");306 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: failed to init R0Drv\n")); 307 307 memset(&g_DevExt, 0, sizeof(g_DevExt)); 308 308 break; … … 339 339 int rc = VINF_SUCCESS; 340 340 341 342 dprintf(("VBoxDrvSolarisDetach")); 341 LogFlow((DEVICE_NAME ":VBoxDrvSolarisDetach\n")); 343 342 switch (enmCmd) 344 343 { … … 363 362 364 363 memset(&g_DevExt, 0, sizeof(g_DevExt)); 365 dprintf(("VBoxDrvSolarisDetach: Clean Up Done."));366 364 return DDI_SUCCESS; 367 365 } … … 391 389 int rc; 392 390 PSUPDRVSESSION pSession; 393 dprintf(("VBoxDrvSolarisOpen: pDev=%p:%#x\n", pDev, *pDev));391 LogFlow((DEVICE_NAME ":VBoxDrvSolarisOpen: pDev=%p:%#x\n", pDev, *pDev)); 394 392 395 393 #ifndef USE_SESSION_HASH … … 413 411 if (!pState) 414 412 { 415 cmn_err(CE_NOTE,"VBoxDrvSolarisOpen: too many open instances.");413 LogRel((DEVICE_NAME ":VBoxDrvSolarisOpen: too many open instances.\n")); 416 414 return ENXIO; 417 415 } … … 428 426 pState->pSession = pSession; 429 427 *pDev = makedevice(getmajor(*pDev), iOpenInstance); 430 dprintf(("VBoxDrvSolarisOpen: returns pDev=%#x pSession=%p pState=%p\n", *pDev, pSession, pState)); 431 OSDBGPRINT(("VBoxDrvSolarisOpen: Dev=%#x pSession=%p pid=%d r0proc=%p thread=%p\n", 428 LogFlow((DEVICE_NAME ":VBoxDrvSolarisOpen: Dev=%#x pSession=%p pid=%d r0proc=%p thread=%p\n", 432 429 *pDev, pSession, RTProcSelf(), RTR0ProcHandleSelf(), RTThreadNativeSelf() )); 433 430 return 0; … … 460 457 g_apSessionHashTab[iHash] = pSession; 461 458 RTSpinlockReleaseNoInts(g_Spinlock, &Tmp); 462 OSDBGPRINT(("VBoxDrvSolarisOpen success"));459 LogFlow((DEVICE_NAME ":VBoxDrvSolarisOpen success\n")); 463 460 } 464 461 … … 473 470 if (instance >= DEVICE_MAXINSTANCES) 474 471 { 475 cmn_err(CE_NOTE, "VBoxDrvSolarisOpen: All instances exhausted\n");472 LogRel((DEVICE_NAME ":VBoxDrvSolarisOpen: All instances exhausted\n")); 476 473 return ENXIO; 477 474 } … … 486 483 static int VBoxDrvSolarisClose(dev_t Dev, int flag, int otyp, cred_t *cred) 487 484 { 488 dprintf(("VBoxDrvSolarisClose: Dev=%#x\n", Dev)); 485 LogFlow((DEVICE_NAME ":VBoxDrvSolarisClose: Dev=%#x\n", Dev)); 486 489 487 #ifndef USE_SESSION_HASH 490 488 /* … … 494 492 if (!pState) 495 493 { 496 OSDBGPRINT(("VBoxDrvSolarisClose: no state data for %#x (%d)\n", Dev, getminor(Dev)));494 LogRel((DEVICE_NAME ":VBoxDrvSolarisClose: no state data for %#x (%d)\n", Dev, getminor(Dev))); 497 495 return EFAULT; 498 496 } … … 504 502 if (!pSession) 505 503 { 506 OSDBGPRINT(("VBoxDrvSolarisClose: no session in state data for %#x (%d)\n", Dev, getminor(Dev)));504 LogRel((DEVICE_NAME ":VBoxDrvSolarisClose: no session in state data for %#x (%d)\n", Dev, getminor(Dev))); 507 505 return EFAULT; 508 506 } 509 dprintf(("VBoxDrvSolarisClose: Dev=%#x pSession=%p pid=%d r0proc=%p thread=%p\n", Dev, pSession, RTProcSelf(), RTR0ProcHandleSelf(), RTThreadNativeSelf() )); 507 LogFlow((DEVICE_NAME ":VBoxDrvSolarisClose: Dev=%#x pSession=%p pid=%d r0proc=%p thread=%p\n", 508 Dev, pSession, RTProcSelf(), RTR0ProcHandleSelf(), RTThreadNativeSelf() )); 510 509 511 510 #else … … 549 548 if (!pSession) 550 549 { 551 OSDBGPRINT(("VBoxDrvSolarisClose: WHAT?!? pSession == NULL! This must be a mistake... pid=%d (close)\n",550 LogRel((DEVICE_NAME ":VBoxDrvSolarisClose: WHAT?!? pSession == NULL! This must be a mistake... pid=%d (close)\n", 552 551 (int)Process)); 553 552 return EFAULT; … … 559 558 */ 560 559 supdrvCloseSession(&g_DevExt, pSession); 561 dprintf(("VBoxDrvSolarisClose: returns\n"));562 560 return 0; 563 561 } … … 566 564 static int VBoxDrvSolarisRead(dev_t Dev, struct uio *pUio, cred_t *pCred) 567 565 { 568 dprintf(("VBoxDrvSolarisRead"));566 LogFlow((DEVICE_NAME ":VBoxDrvSolarisRead")); 569 567 return 0; 570 568 } … … 573 571 static int VBoxDrvSolarisWrite(dev_t Dev, struct uio *pUio, cred_t *pCred) 574 572 { 575 dprintf(("VBoxDrvSolarisWrite"));573 LogFlow((DEVICE_NAME ":VBoxDrvSolarisWrite")); 576 574 return 0; 577 575 } … … 599 597 if (!pState) 600 598 { 601 OSDBGPRINT(("VBoxDrvSolarisIOCtl: no state data for %#x (%d)\n", Dev, getminor(Dev)));599 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtl: no state data for %#x (%d)\n", Dev, getminor(Dev))); 602 600 return EINVAL; 603 601 } … … 606 604 if (!pSession) 607 605 { 608 OSDBGPRINT(("VBoxDrvSolarisIOCtl: no session in state data for %#x (%d)\n", Dev, getminor(Dev)));606 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtl: no session in state data for %#x (%d)\n", Dev, getminor(Dev))); 609 607 return DDI_SUCCESS; 610 608 } … … 628 626 if (!pSession) 629 627 { 630 OSDBGPRINT(("VBoxSupDrvIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x\n",628 LogRel((DEVICE_NAME ":VBoxSupDrvIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x\n", 631 629 (int)Process, Cmd)); 632 630 return EINVAL; … … 682 680 if (RT_UNLIKELY(IOCPARM_LEN(iCmd) != sizeof(Hdr))) 683 681 { 684 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: iCmd=%#x len %d expected %d\n", iCmd, IOCPARM_LEN(iCmd), sizeof(Hdr)));682 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtlSlow: iCmd=%#x len %d expected %d\n", iCmd, IOCPARM_LEN(iCmd), sizeof(Hdr))); 685 683 return EINVAL; 686 684 } … … 688 686 if (RT_UNLIKELY(rc)) 689 687 { 690 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: ddi_copyin(,%#lx,) failed; iCmd=%#x. rc=%d\n", iArg, iCmd, rc));688 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtlSlow: ddi_copyin(,%#lx,) failed; iCmd=%#x. rc=%d\n", iArg, iCmd, rc)); 691 689 return EFAULT; 692 690 } 693 691 if (RT_UNLIKELY((Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC)) 694 692 { 695 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: bad header magic %#x; iCmd=%#x\n", Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK, iCmd));693 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtlSlow: bad header magic %#x; iCmd=%#x\n", Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK, iCmd)); 696 694 return EINVAL; 697 695 } … … 701 699 || cbBuf > _1M*16)) 702 700 { 703 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: max(%#x,%#x); iCmd=%#x\n", Hdr.cbIn, Hdr.cbOut, iCmd));701 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtlSlow: max(%#x,%#x); iCmd=%#x\n", Hdr.cbIn, Hdr.cbOut, iCmd)); 704 702 return EINVAL; 705 703 } … … 711 709 if (RT_UNLIKELY(!pHdr)) 712 710 { 713 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: failed to allocate buffer of %d bytes for iCmd=%#x.\n", cbBuf, iCmd));711 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtlSlow: failed to allocate buffer of %d bytes for iCmd=%#x.\n", cbBuf, iCmd)); 714 712 return ENOMEM; 715 713 } … … 717 715 if (RT_UNLIKELY(rc)) 718 716 { 719 dprintf(("VBoxDrvSolarisIOCtlSlow: copy_from_user(,%#lx, %#x) failed; iCmd=%#x. rc=%d\n", iArg, Hdr.cbIn, iCmd, rc));717 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtlSlow: copy_from_user(,%#lx, %#x) failed; iCmd=%#x. rc=%d\n", iArg, Hdr.cbIn, iCmd, rc)); 720 718 RTMemFree(pHdr); 721 719 return EFAULT; … … 735 733 if (RT_UNLIKELY(cbOut > cbBuf)) 736 734 { 737 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: too much output! %#x > %#x; iCmd=%#x!\n", cbOut, cbBuf, iCmd));735 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtlSlow: too much output! %#x > %#x; iCmd=%#x!\n", cbOut, cbBuf, iCmd)); 738 736 cbOut = cbBuf; 739 737 } … … 742 740 { 743 741 /* this is really bad */ 744 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: ddi_copyout(,%p,%d) failed. rc=%d\n", (void *)iArg, cbBuf, rc));742 LogRel((DEVICE_NAME ":VBoxDrvSolarisIOCtlSlow: ddi_copyout(,%p,%d) failed. rc=%d\n", (void *)iArg, cbBuf, rc)); 745 743 rc = EFAULT; 746 744 } … … 862 860 863 861 szMsg[sizeof(szMsg) - 1] = '\0'; 864 #if 0 865 uprintf("SUPR0Printf: %s", szMsg); 866 #endif 867 #if 1 868 cmn_err(CE_CONT, "VBoxDrv: %s", szMsg); 869 #endif 870 862 cmn_err(CE_CONT, "%s", szMsg); 871 863 return 0; 872 864 }
Note:
See TracChangeset
for help on using the changeset viewer.