Changeset 41212 in vbox
- Timestamp:
- May 8, 2012 3:55:06 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris-streams.c
r41020 r41212 24 24 # include <sys/conf.h> 25 25 # include <sys/modctl.h> 26 # include <sys/msio.h> 26 27 # include <sys/mutex.h> 27 28 # include <sys/pci.h> … … 29 30 # include <sys/ddi.h> 30 31 # include <sys/ddi_intr.h> 32 # include <sys/open.h> 33 # include <sys/strsun.h> 34 # include <sys/stropts.h> 31 35 # include <sys/sunddi.h> 32 # include <sys/open.h>33 36 # include <sys/sunldi.h> 37 # include <sys/vuid_event.h> 38 # include <sys/vuid_wheel.h> 34 39 # include <sys/file.h> 35 40 #undef u /* /usr/include/sys/user.h:249:1 is where this is defined to (curproc->p_user). very cool. */ … … 48 53 #include <iprt/cdefs.h> 49 54 #include <iprt/asm.h> 55 #include <iprt/string.h> 50 56 51 57 #ifdef TESTCASE /* Include this last as we . */ … … 163 169 nochpoll, /* c poll */ 164 170 ddi_prop_op, /* property ops */ 165 g_vbgr0SolStreamTab,171 &g_vbgr0SolStreamTab, 166 172 D_NEW | D_MP, /* compat. flag */ 167 173 }; … … 260 266 /** The IRQ Mutex */ 261 267 static kmutex_t g_IrqMutex; 268 /** Layered device handle for kernel keep-attached opens */ 269 static ldi_handle_t g_LdiHandle = NULL; 270 /** Ref counting for IDCOpen calls */ 271 static uint64_t g_cLdiOpens = 0; 272 /** The Mutex protecting the LDI handle in IDC opens */ 273 static kmutex_t g_LdiMtx; 262 274 263 275 … … 281 293 rc = RTLogCreate(&pRelLogger, 0 /* fFlags */, "all", 282 294 "VBOX_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups, 283 RTLOGDEST_STDOUT | RTLOGDEST_DEBUGGER, NULL); 295 RTLOGDEST_STDOUT | RTLOGDEST_DEBUGGER 296 | RTLOGDEST_USER, NULL); 284 297 if (RT_SUCCESS(rc)) 285 298 RTLogRelSetDefaultInstance(pRelLogger); … … 295 308 else 296 309 LogRel((DEVICE_NAME ":failed to disable autounloading!\n")); 297 /* Initialise the node state mutex. This will be taken in the ISR. */298 mutex_init(&g_StateMutex, NULL, MUTEX_DRIVER,299 DDI_INTR_PRI(uIntrPriority));300 310 rc = mod_install(&g_vbgr0SolModLinkage); 301 311 } … … 306 316 } 307 317 318 LogRel((DEVICE_NAME ": initialisation returning %d.\n", rc)); 308 319 return rc; 309 320 } … … 325 336 int rc; 326 337 327 Log Flow((DEVICE_NAME ":_fini\n"));338 LogRelFlow((DEVICE_NAME ":_fini\n")); 328 339 rc = mod_remove(&g_vbgr0SolModLinkage); 329 340 mutex_destroy(&g_StateMutex); … … 384 395 NOREF(fFlag); 385 396 NOREF(pCred); 386 Log Flow((DEVICE_NAME "::Open\n"));397 LogRelFlow((DEVICE_NAME "::Open\n")); 387 398 388 399 /* … … 393 404 */ 394 405 if (fMode) 406 { 407 LogRelFlow((DEVICE_NAME "::Open: invalid attempt to clone device.")); 395 408 return EINVAL; 409 } 396 410 397 411 for (cInstance = 1; cInstance < MAX_OPEN_NODES; cInstance++) … … 406 420 if (!pState) 407 421 { 408 Log ((DEVICE_NAME "::Open: too many open instances."));422 LogRelFlow((DEVICE_NAME "::Open: too many open instances.")); 409 423 return ENXIO; 410 424 } … … 421 435 WR(pReadQueue)->q_ptr = (char *)pState; 422 436 pReadQueue->q_ptr = (char *)pState; 423 qprocson(p State->pWriteQueue);424 Log ((DEVICE_NAME "::Open: pSession=%p pState=%p pid=%d\n", pSession, pState, (int)RTProcSelf()));437 qprocson(pReadQueue); 438 LogRel((DEVICE_NAME "::Open: pSession=%p pState=%p pid=%d\n", pSession, pState, (int)RTProcSelf())); 425 439 return 0; 426 440 } … … 452 466 return EFAULT; 453 467 } 454 qprocsoff(p State->pWriteQueue);468 qprocsoff(pReadQueue); 455 469 pSession = pState->pSession; 456 470 vbgr0SolResetSoftState(pState); … … 506 520 int vbgr0SolWPut(queue_t *pWriteQueue, mblk_t *pMBlk) 507 521 { 508 PVBGR0STATE pState = (PVBGR0STATE)pWriteQueue->q_ptr; 509 510 LogFlowFunc((DEVICE_NAME "::\n")); 522 LogRelFlowFunc((DEVICE_NAME "::\n")); 511 523 switch (pMBlk->b_datap->db_type) 512 524 { … … 603 615 static void testWPutTransparent(RTTEST hTest, unsigned i); 604 616 static void testWPutIOCDataIn(RTTEST hTest, unsigned i); 617 static void testWPutIOCDataOut(RTTEST hTest, unsigned i); 605 618 606 619 /** Test WPut's handling of different IOCtls, which is bulk of the logic in … … 620 633 if (g_asTestWPut[i].fCanTransparent && g_asTestWPut[i].cbDataIn) 621 634 testWPutIOCDataIn(hTest, i); 635 if (g_asTestWPut[i].fCanTransparent && g_asTestWPut[i].cbDataOut) 636 testWPutIOCDataOut(hTest, i); 622 637 } 623 638 } … … 773 788 AssertReturnVoid(pMBlk); 774 789 AssertReturnVoidStmt(pMBlkCont, freemsg(pMBlk)); 775 AssertReturnVoid(g_asTestWPut[i].cbDataIn);776 790 RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "%s: i=%u\n", __PRETTY_FUNCTION__, 777 791 i); 792 AssertReturnVoidStmt(g_asTestWPut[i].cbDataIn, freemsg(pMBlk)); 778 793 RT_ZERO(aQueues); 779 794 doInitQueues(&aQueues[0]); … … 784 799 pMBlk->b_datap->db_type = M_IOCDATA; 785 800 pCopyResp->cp_cmd = g_asTestWPut[i].iIOCCmd; 801 if (g_asTestWPut[i].cbDataOut) 802 pCopyResp->cp_private = USER_ADDRESS; 786 803 AssertReturnVoid(g_asTestWPut[i].cbData <= MSG_DATA_SIZE); 787 804 memcpy(pMBlkCont->b_rptr, g_asTestWPut[i].pvDataIn, g_asTestWPut[i].cbDataIn); … … 820 837 freemsg(pMBlk); 821 838 } 839 840 841 /** Simulate sending follow-on IOCData messages to a transparent IOCtl to WPut 842 * with the parameters from table line @a i. */ 843 void testWPutIOCDataOut(RTTEST hTest, unsigned i) 844 { 845 queue_t aQueues[2]; 846 dev_t device = 0; 847 struct msgb *pMBlk = allocb(sizeof(struct copyresp), BPRI_MED); 848 struct copyresp *pCopyResp = pMBlk ? (struct copyresp *)pMBlk->b_rptr 849 : NULL; 850 int rc, cFormat = 0; 851 852 AssertReturnVoid(pMBlk); 853 AssertReturnVoidStmt(g_asTestWPut[i].cbDataOut, freemsg(pMBlk)); 854 RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "%s: i=%u\n", __PRETTY_FUNCTION__, 855 i); 856 RT_ZERO(aQueues); 857 doInitQueues(&aQueues[0]); 858 rc = vbgr0SolOpen(RD(&aQueues[0]), &device, 0, 0, NULL); 859 RTTEST_CHECK_MSG(hTest, rc == 0, (hTest, "i=%u, rc=%d\n", i, rc)); 860 RTTEST_CHECK_MSG(hTest, g_aOpenNodeStates[1].pWriteQueue 861 == WR(&aQueues[0]), (hTest, "i=%u\n", i)); 862 pMBlk->b_datap->db_type = M_IOCDATA; 863 pCopyResp->cp_cmd = g_asTestWPut[i].iIOCCmd; 864 rc = vbgr0SolWPut(WR(&aQueues[0]), pMBlk); 865 RTTEST_CHECK_MSG(hTest, pMBlk->b_datap->db_type == M_IOCACK, 866 (hTest, "i=%u, db_type=%u\n", i, 867 (unsigned) pMBlk->b_datap->db_type)); 868 if (!g_asTestWPut[i].rcExp) 869 RTTEST_CHECK_MSG(hTest, RD(&aQueues[0])->q_first == pMBlk, 870 (hTest, "i=%u\n", i)); 871 vbgr0SolClose(RD(&aQueues[1]), 0, NULL); 872 freemsg(pMBlk); 873 } 822 874 #endif 823 875 … … 904 956 { 905 957 struct iocblk *pIOCBlk = (struct iocblk *)pMBlk->b_rptr; 906 int iCmd = pIOCBlk->ioc_cmd, iCmdType = iCmd & ~0xff;958 int iCmd = pIOCBlk->ioc_cmd, iCmdType = iCmd & (0xff << 8); 907 959 size_t cbBuffer; 908 960 enum IOCTLDIRECTION enmDirection; 909 961 910 LogFlowFunc((DEVICE_NAME "::iCmdType=%c, iCmd=%d\n", iCmdType, iCmd)); 962 LogFlowFunc((DEVICE_NAME "::iCmdType=%c, iCmd=%d\n", 963 (char) (iCmdType >> 8), iCmd)); 911 964 switch (iCmdType) 912 965 { … … 928 981 } 929 982 case 'V' << 8: 983 return ENOTTY; 930 984 return vbgr0SolHandleIOCtl(pWriteQueue, pMBlk, vbgr0SolGuestIOCtl, 931 985 iCmd, 0, UNSPECIFIED); … … 977 1031 { 978 1032 struct iocblk *pIOCBlk = (struct iocblk *)pMBlk->b_rptr; 979 PVBGR0STATE pState = (PVBGR0STATE)pWriteQueue->q_ptr;980 1033 981 1034 if (pMBlk->b_datap->db_type == M_IOCDATA) … … 1473 1526 if (g_pIntr) 1474 1527 { 1475 size_t IntrAllocated;1528 int IntrAllocated; 1476 1529 unsigned i; 1477 1530 rc = ddi_intr_alloc(pDip, g_pIntr, IntrType, 0, IntrCount, &IntrAllocated, DDI_INTR_ALLOC_NORMAL); … … 1487 1540 mutex_init(&g_IrqMutex, NULL, MUTEX_DRIVER, DDI_INTR_PRI(uIntrPriority)); 1488 1541 1542 /* Initialise the node state mutex. This will 1543 * be taken in the ISR. */ 1544 mutex_init(&g_StateMutex, NULL, MUTEX_DRIVER, 1545 DDI_INTR_PRI(uIntrPriority)); 1489 1546 /* Assign interrupt handler functions and enable interrupts. */ 1490 1547 for (i = 0; i < IntrAllocated; i++) -
trunk/src/VBox/Additions/common/VBoxGuest/testcase/solaris.h
r41020 r41212 140 140 #define FE_PAIR_DELTA 2 141 141 #define FE_PAIR_ABSOLUTE 3 142 143 typedef struct __ldi_handle *ldi_handle_t; 142 144 143 145 typedef enum
Note:
See TracChangeset
for help on using the changeset viewer.