Changeset 15101 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt
- Timestamp:
- Dec 8, 2008 11:04:31 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
r14280 r15101 369 369 vboxnetflt_stream_t *g_VBoxNetFltSolarisStreams; 370 370 371 /** Global mutex protecting open/close. */ 372 static RTSEMFASTMUTEX g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX; 373 371 374 /** 372 375 * g_VBoxNetFltInstance is the current PVBOXNETFLTINS to be associated with the stream being created … … 410 413 g_VBoxNetFltSolarisInstance = NULL; 411 414 412 /* 413 * Initialize the globals and connect to the support driver. 414 * 415 * This will call back vboxNetFltOsOpenSupDrv (and maybe vboxNetFltOsCloseSupDrv) 416 * for establishing the connect to the support driver. 417 */ 418 memset(&g_VBoxNetFltSolarisGlobals, 0, sizeof(g_VBoxNetFltSolarisGlobals)); 419 rc = vboxNetFltInitGlobals(&g_VBoxNetFltSolarisGlobals); 415 int rc = RTSemFastMutexCreate(&g_VBoxNetFltSolarisMtx); 420 416 if (RT_SUCCESS(rc)) 421 417 { 422 rc = mod_install(&g_VBoxNetFltSolarisModLinkage); 423 if (!rc) 424 return rc; 425 426 LogRel((DEVICE_NAME ":mod_install failed. rc=%d\n", rc)); 427 vboxNetFltTryDeleteGlobals(&g_VBoxNetFltSolarisGlobals); 428 } 429 else 430 LogRel((DEVICE_NAME ":failed to initialize globals.\n")); 418 /* 419 * Initialize the globals and connect to the support driver. 420 * 421 * This will call back vboxNetFltOsOpenSupDrv (and maybe vboxNetFltOsCloseSupDrv) 422 * for establishing the connect to the support driver. 423 */ 424 memset(&g_VBoxNetFltSolarisGlobals, 0, sizeof(g_VBoxNetFltSolarisGlobals)); 425 rc = vboxNetFltInitGlobals(&g_VBoxNetFltSolarisGlobals); 426 if (RT_SUCCESS(rc)) 427 { 428 rc = mod_install(&g_VBoxNetFltSolarisModLinkage); 429 if (!rc) 430 return rc; 431 432 LogRel((DEVICE_NAME ":mod_install failed. rc=%d\n", rc)); 433 vboxNetFltTryDeleteGlobals(&g_VBoxNetFltSolarisGlobals); 434 } 435 else 436 LogRel((DEVICE_NAME ":failed to initialize globals.\n")); 437 438 RTSemFastMutexDestroy(g_VBoxNetFltSolarisMtx); 439 g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX; 440 } 431 441 432 442 RTR0Term(); … … 453 463 LogRel((DEVICE_NAME ":_fini - busy!\n")); 454 464 return EBUSY; 465 } 466 467 if (g_VBoxNetFltSolarisMtx != NIL_RTSEMFASTMUTEX) 468 { 469 RTSemFastMutexDestroy(g_VBoxNetFltSolarisMtx); 470 g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX; 455 471 } 456 472 … … 595 611 fOpenMode, fStreamMode)); 596 612 613 int rc = RTSemFastMutexRequest(g_VBoxNetFltSolarisMtx); 614 AssertRCReturn(rc, rc); 615 597 616 /* 598 617 * Already open? … … 601 620 { 602 621 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen invalid open.\n")); 622 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 603 623 return ENOENT; 604 624 } … … 611 631 { 612 632 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed to get VirtualBox instance.\n")); 633 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 613 634 return ENOENT; 614 635 } … … 620 641 { 621 642 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed due to undefined VirtualBox open mode.\n")); 643 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 622 644 return ENOENT; 623 645 } … … 648 670 { 649 671 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed to allocate promiscuous stream data.\n")); 672 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 650 673 return ENOMEM; 651 674 } … … 668 691 { 669 692 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed to allocate stream data.\n")); 693 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 670 694 return ENOMEM; 671 695 } … … 701 725 pStream->pNext = *ppPrevStream; 702 726 *ppPrevStream = pStream; 727 728 /* 729 * Release global lock, & do not hold locks across putnext calls. 730 */ 731 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 703 732 704 733 qprocson(pQueue); … … 771 800 LogFlow((DEVICE_NAME ":VBoxNetFltSolarisModClose pQueue=%p fOpenMode=%d\n", pQueue, fOpenMode)); 772 801 802 int rc = RTSemFastMutexRequest(g_VBoxNetFltSolarisMtx); 803 AssertRCReturn(rc, rc); 804 773 805 vboxnetflt_stream_t *pStream = NULL; 774 806 vboxnetflt_stream_t **ppPrevStream = NULL; … … 782 814 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModClose failed to get stream.\n")); 783 815 vboxNetFltRelease(pStream->pThis, false /* fBusy */); 816 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 784 817 return ENXIO; 785 818 } … … 848 881 NOREF(fOpenMode); 849 882 NOREF(pCred); 883 884 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx); 850 885 851 886 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.