Changeset 40584 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Mar 23, 2012 6:03:08 AM (13 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris-streams.c
r40562 r40584 578 578 pvDataOut cbDataOut rcExp pfnExtra fCanTransparent */ 579 579 { VUIDGFORMAT, sizeof(int), NULL, 0, 580 PVGFORMAT, CBGFORMAT, 0, NULL, false },580 PVGFORMAT, CBGFORMAT, 0, NULL, true }, 581 581 { VUIDGFORMAT, sizeof(int) - 1, NULL, 0, 582 582 NULL, 0, EINVAL, NULL, false }, 583 583 { VUIDGFORMAT, sizeof(int) + 1, NULL, 0, 584 PVGFORMAT, CBGFORMAT, 0, NULL, false },584 PVGFORMAT, CBGFORMAT, 0, NULL, true }, 585 585 { VUIDSFORMAT, sizeof(int), PVGFORMAT, CBGFORMAT, 586 NULL, 0, 0, NULL, false },586 NULL, 0, 0, NULL, true }, 587 587 { MSIOSRESOLUTION, CBMSIOSRES, PMSIOSRES, CBMSIOSRES, 588 NULL, 0, 0, testSetResolution, false },588 NULL, 0, 0, testSetResolution, true }, 589 589 { VUIDGWHEELINFO, 0, NULL, 0, 590 590 NULL, 0, EINVAL, NULL, true } … … 663 663 if (g_asTestWPut[i].cbData > 0) 664 664 RTTEST_CHECK_MSG(hTest, MBlk.b_flag == 1, (hTest, "i=%u\n", i)); 665 if (!g_asTestWPut[i].rcExp) 666 RTTEST_CHECK_MSG(hTest, RD(&aQueues[0])->q_first = &MBlk, 667 (hTest, "i=%u\n", i)); 665 668 if (g_asTestWPut[i].pfnExtra) 666 669 g_asTestWPut[i].pfnExtra(hTest, WR(&aQueues[0]), &MBlk); … … 678 681 struct datab DBlk; 679 682 struct iocblk IOCBlk; 683 struct copyreq *pCopyReq = (struct copyreq *)&IOCBlk; 680 684 int rc, cFormat = 0; 681 685 unsigned char acData[1024]; 682 686 687 if (g_asTestWPut[i].cbDataIn == 0 && g_asTestWPut[i].cbDataOut != 0) 688 return; /* This case will be handled once the current ones work. */ 683 689 RT_ZERO(aQueues); 684 690 doInitQueues(&aQueues[0]); … … 706 712 MBlk.b_datap = &DBlk; 707 713 rc = vbgr0SolWPut(WR(&aQueues[0]), &MBlk); 708 RTTEST_CHECK_MSG(hTest, IOCBlk.ioc_error == g_asTestWPut[i].rcExp, 709 (hTest, "i=%u, IOCBlk.ioc_error=%d\n", i, 710 IOCBlk.ioc_error)); 711 RTTEST_CHECK_MSG(hTest, IOCBlk.ioc_count == g_asTestWPut[i].cbDataOut, 712 (hTest, "i=%u, ioc_count=%u\n", i, IOCBlk.ioc_count)); 713 RTTEST_CHECK_MSG(hTest, !memcmp(acData, g_asTestWPut[i].pvDataOut, 714 g_asTestWPut[i].cbDataOut), 715 (hTest, "i=%u\n", i)); 716 /* Hack to ensure that miocpullup() gets called when needed. */ 717 if (g_asTestWPut[i].cbData > 0) 718 RTTEST_CHECK_MSG(hTest, MBlk.b_flag == 1, (hTest, "i=%u\n", i)); 719 if (g_asTestWPut[i].pfnExtra) 714 RTTEST_CHECK_MSG(hTest, ( ( g_asTestWPut[i].cbDataIn 715 && (MBlk.b_datap->db_type == M_COPYIN)) 716 || ( g_asTestWPut[i].cbDataOut 717 && (MBlk.b_datap->db_type == M_COPYOUT)) 718 || ( (g_asTestWPut[i].rcExp == 0) 719 && MBlk.b_datap->db_type == M_IOCACK) 720 || (MBlk.b_datap->db_type == M_IOCNAK)), 721 (hTest, "i=%u, db_type=%u\n", i, 722 (unsigned) MBlk.b_datap->db_type)); 723 /* Our TRANSPARENT IOCtls can only return non-zero if they have no payload. 724 * Others should either return zero or be non-TRANSPARENT only. */ 725 if (MBlk.b_datap->db_type == M_IOCNAK) 726 RTTEST_CHECK_MSG(hTest, IOCBlk.ioc_error == g_asTestWPut[i].rcExp, 727 (hTest, "i=%u, IOCBlk.ioc_error=%d\n", i, 728 IOCBlk.ioc_error)); 729 if (g_asTestWPut[i].cbData) 730 { 731 RTTEST_CHECK_MSG(hTest, pCopyReq->cq_addr == acData, 732 (hTest, "i=%u, cq_addr=%p\n", i, pCopyReq->cq_addr)); 733 RTTEST_CHECK_MSG(hTest, pCopyReq->cq_size == g_asTestWPut[i].cbData, 734 (hTest, "i=%u, cq_size=%llu\n", i, 735 (unsigned long long)pCopyReq->cq_size)); 736 } 737 /* Implementation detail - check that the private pointer is correctly 738 * set to the user address *for two direction IOCtls* or NULL otherwise. */ 739 if (g_asTestWPut[i].cbDataIn && g_asTestWPut[i].cbDataOut) 740 RTTEST_CHECK_MSG(hTest, pCopyReq->cq_private == acData, 741 (hTest, "i=%u, cq_private=%p\n", i, 742 pCopyReq->cq_private)); 743 else if ( (MBlk.b_datap->db_type == M_COPYIN) 744 || (MBlk.b_datap->db_type == M_COPYOUT)) 745 RTTEST_CHECK_MSG(hTest, !pCopyReq->cq_private, 746 (hTest, "i=%u, cq_private=%p\n", i, 747 pCopyReq->cq_private)); 748 if (!g_asTestWPut[i].rcExp) 749 RTTEST_CHECK_MSG(hTest, RD(&aQueues[0])->q_first = &MBlk, 750 (hTest, "i=%u\n", i)); 751 if (g_asTestWPut[i].pfnExtra && !g_asTestWPut[i].cbData) 720 752 g_asTestWPut[i].pfnExtra(hTest, WR(&aQueues[0]), &MBlk); 721 753 vbgr0SolClose(RD(&aQueues[1]), 0, NULL); … … 780 812 { 781 813 { VUIDGFORMAT, sizeof(int), OUT }, 782 { VUIDSFORMAT, 0, NONE }, 814 { VUIDSFORMAT, sizeof(int), IN }, 815 { VUIDGADDR, 0, UNSPECIFIED }, 783 816 { VUIDGADDR, 0, UNSPECIFIED }, 784 817 { MSIOGETPARMS, sizeof(Ms_parms), OUT }, 785 { MSIOSETPARMS, 0, NONE},818 { MSIOSETPARMS, sizeof(Ms_parms), IN }, 786 819 { MSIOSRESOLUTION, sizeof(Ms_screen_resolution), IN }, 787 820 { MSIOBUTTONS, sizeof(int), OUT }, -
trunk/src/VBox/Additions/common/VBoxGuest/testcase/solaris.h
r40560 r40584 180 180 int mi_id; 181 181 int mi_nextid; 182 char *mi_base; /* Was caddr_t */182 char *mi_base; /* Was caddr_t. */ 183 183 size_t mi_size; 184 184 int mi_rev; … … 234 234 }; 235 235 236 struct copyreq 237 { 238 int cq_cmd; 239 cred_t *cq_cr; 240 uint_t cq_id; 241 uint_t cq_flag; 242 mblk_t *cq_private; 243 char *cq_addr; /* Was caddr_t. */ 244 size_t cq_size; 245 }; 246 236 247 struct copyresp 237 248 { … … 241 252 uint_t cp_flag; 242 253 mblk_t *cp_private; 243 char *cp_rval; /* Was caddr_t */254 char *cp_rval; /* Was caddr_t. */ 244 255 }; 245 256 … … 321 332 #define qprocsoff(...) do {} while(0) 322 333 #define flushq(...) do {} while(0) 323 #define qreply(...) do {} while(0)324 #define mcopyin(...) do {} while(0)325 #define mcopyout(...) do {} while(0)326 334 #define freemsg(...) do {} while(0) 327 335 #define putnext(...) do {} while(0) … … 354 362 /* Externally defined helpers. */ 355 363 364 /** Flags set in the struct mblk b_flag member for verification purposes. 365 * @{ */ 366 /** miocpullup was called for this message. */ 367 #define F_TEST_PULLUP 1 368 /** @} */ 369 356 370 extern void miocack(queue_t *pWriteQueue, mblk_t *pMBlk, int cbData, int rc); 357 371 extern void miocnak(queue_t *pWriteQueue, mblk_t *pMBlk, int cbData, int iErr); 358 372 extern int miocpullup(mblk_t *pMBlk, size_t cbMsg); 373 extern void mcopyin(mblk_t *pMBlk, void *pvState, size_t cbData, void *pvUser); 374 extern void mcopyout(mblk_t *pMBlk, void *pvState, size_t cbData, void *pvUser, 375 mblk_t *pMBlkData); 376 extern void qreply(queue_t *pQueue, mblk_t *pMBlk); 359 377 360 378 /* API stubs with simple logic */ … … 371 389 #define mod_install(linkage) (s_pvLinkage && ((linkage) == s_pvLinkage) ? 0 : EINVAL) 372 390 #define QREADR 0x00000010 391 #define OTHERQ(q) ((q)->q_flag & QREADR ? (q) + 1 : (q) - 1) 373 392 #define WR(q) ((q)->q_flag & QREADR ? (q) + 1 : (q)) 374 393 #define RD(q) ((q)->q_flag & QREADR ? (q) : (q) - 1) -
trunk/src/VBox/Additions/common/VBoxGuest/testcase/tstVBoxGuest-solaris.c
r40560 r40584 58 58 || pMBlk->b_cont->b_wptr < pMBlk->b_cont->b_rptr + cbMsg) 59 59 return EINVAL; 60 pMBlk->b_flag = 1; /* Test for this to be sure miocpullup was called. */60 pMBlk->b_flag |= F_TEST_PULLUP; 61 61 return 0; 62 62 } 63 64 void mcopyin(mblk_t *pMBlk, void *pvState, size_t cbData, void *pvUser) 65 { 66 struct iocblk *pIOCBlk = (struct iocblk *)pMBlk->b_rptr; 67 struct copyreq *pCopyReq = (struct copyreq *)pMBlk->b_rptr; 68 69 AssertReturnVoid( pvUser 70 || ( pMBlk->b_datap->db_type == M_IOCTL 71 && pIOCBlk->ioc_count == TRANSPARENT 72 && pMBlk->b_cont->b_rptr)); 73 pMBlk->b_datap->db_type = M_COPYIN; 74 pMBlk->b_wptr = pMBlk->b_rptr + sizeof(*pCopyReq); 75 pCopyReq->cq_private = pvState; 76 pCopyReq->cq_size = cbData; 77 pCopyReq->cq_addr = pvUser ? pvUser : pMBlk->b_cont->b_rptr; 78 if (pMBlk->b_cont) 79 { 80 freemsg(pMBlk->b_cont); 81 pMBlk->b_cont = NULL; 82 } 83 } 84 85 void mcopyout(mblk_t *pMBlk, void *pvState, size_t cbData, void *pvUser, 86 mblk_t *pMBlkData) 87 { 88 struct iocblk *pIOCBlk = (struct iocblk *)pMBlk->b_rptr; 89 struct copyreq *pCopyReq = (struct copyreq *)pMBlk->b_rptr; 90 91 AssertReturnVoid( pvUser 92 || ( pMBlk->b_datap->db_type == M_IOCTL 93 && pIOCBlk->ioc_count == TRANSPARENT 94 && pMBlk->b_cont->b_rptr)); 95 pMBlk->b_datap->db_type = M_COPYOUT; 96 pMBlk->b_wptr = pMBlk->b_rptr + sizeof(*pCopyReq); 97 pCopyReq->cq_private = pvState; 98 pCopyReq->cq_size = cbData; 99 pCopyReq->cq_addr = pvUser ? pvUser : pMBlk->b_cont->b_rptr; 100 if (pMBlkData) 101 { 102 if (pMBlk->b_cont) 103 freemsg(pMBlk->b_cont); 104 pMBlk->b_cont = pMBlkData; 105 pMBlkData->b_wptr = pMBlkData->b_rptr + cbData; 106 } 107 } 108 109 /* This does not work like the real version but is easy to test the result of. 110 */ 111 void qreply(queue_t *pQueue, mblk_t *pMBlk) 112 { 113 OTHERQ(pQueue)->q_first = pMBlk; 114 }
Note:
See TracChangeset
for help on using the changeset viewer.