Changeset 41020 in vbox for trunk/src/VBox/Additions/common/VBoxGuest
- Timestamp:
- Apr 23, 2012 9:07:36 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
r40584 r41020 549 549 # define CBMSIOSRES (sizeof(g_TestResolution)) 550 550 551 static inline voidtestSetResolution(RTTEST hTest, queue_t *pWriteQueue,551 static inline bool testSetResolution(RTTEST hTest, queue_t *pWriteQueue, 552 552 struct msgb *pMBlk) 553 553 { 554 554 PVBGR0STATE pState = (PVBGR0STATE)pWriteQueue->q_ptr; 555 RTTEST_CHECK_MSG(hTest, pState->cMaxScreenX 556 == g_TestResolution.width - 1, 557 (hTest, "pState->cMaxScreenX=%d\n", pState->cMaxScreenX)); 558 RTTEST_CHECK_MSG(hTest, pState->cMaxScreenY 559 == g_TestResolution.height - 1, 560 (hTest, "pState->cMaxScreenY=%d\n", pState->cMaxScreenY)); 555 RTTEST_CHECK_MSG_RET(hTest, pState->cMaxScreenX 556 == g_TestResolution.width - 1, 557 (hTest, "pState->cMaxScreenX=%d\n", 558 pState->cMaxScreenX), false); 559 RTTEST_CHECK_MSG_RET(hTest, pState->cMaxScreenY 560 == g_TestResolution.height - 1, 561 (hTest, "pState->cMaxScreenY=%d\n", 562 pState->cMaxScreenY), false); 563 return true; 561 564 } 562 565 … … 571 574 size_t cbDataOut; 572 575 int rcExp; 573 void(*pfnExtra)(RTTEST hTest, queue_t *pWriteQueue, struct msgb *pMBlk);576 bool (*pfnExtra)(RTTEST hTest, queue_t *pWriteQueue, struct msgb *pMBlk); 574 577 bool fCanTransparent; 575 578 } g_asTestWPut[] = … … 599 602 static void testWPutStreams(RTTEST hTest, unsigned i); 600 603 static void testWPutTransparent(RTTEST hTest, unsigned i); 604 static void testWPutIOCDataIn(RTTEST hTest, unsigned i); 601 605 602 606 /** Test WPut's handling of different IOCtls, which is bulk of the logic in … … 609 613 for (i = 0; i < RT_ELEMENTS(g_asTestWPut); ++i) 610 614 { 615 AssertReturnVoid(g_asTestWPut[i].cbDataIn <= g_asTestWPut[i].cbData); 616 AssertReturnVoid(g_asTestWPut[i].cbDataOut <= g_asTestWPut[i].cbData); 611 617 testWPutStreams(hTest, i); 612 618 if (g_asTestWPut[i].fCanTransparent) 613 619 testWPutTransparent(hTest, i); 614 } 615 } 620 if (g_asTestWPut[i].fCanTransparent && g_asTestWPut[i].cbDataIn) 621 testWPutIOCDataIn(hTest, i); 622 } 623 } 624 625 626 #define MSG_DATA_SIZE 1024 616 627 617 628 /** Simulate sending a streams IOCtl to WPut with the parameters from table … … 621 632 queue_t aQueues[2]; 622 633 dev_t device = 0; 623 struct msgb MBlk, MBlkCont;624 struct datab DBlk;625 struct iocblk IOCBlk;634 struct msgb *pMBlk = allocb(sizeof(struct iocblk), BPRI_MED); 635 struct msgb *pMBlkCont = allocb(MSG_DATA_SIZE, BPRI_MED); 636 struct iocblk *pIOCBlk = pMBlk ? (struct iocblk *)pMBlk->b_rptr : NULL; 626 637 int rc, cFormat = 0; 627 unsigned char acData[1024]; 628 638 639 AssertReturnVoid(pMBlk); 640 AssertReturnVoidStmt(pMBlkCont, freemsg(pMBlk)); 629 641 RT_ZERO(aQueues); 630 642 doInitQueues(&aQueues[0]); … … 633 645 RTTEST_CHECK_MSG(hTest, g_aOpenNodeStates[1].pWriteQueue 634 646 == WR(&aQueues[0]), (hTest, "i=%u\n", i)); 635 RT_ZERO(MBlk); 636 RT_ZERO(DBlk); 637 RT_ZERO(IOCBlk); 638 RT_ZERO(MBlkCont); 639 RT_ZERO(acData); 640 DBlk.db_type = M_IOCTL; 641 IOCBlk.ioc_cmd = g_asTestWPut[i].iIOCCmd; 642 IOCBlk.ioc_count = g_asTestWPut[i].cbData; 643 AssertReturnVoid(g_asTestWPut[i].cbData <= sizeof(acData)); 644 AssertReturnVoid(g_asTestWPut[i].cbDataIn <= g_asTestWPut[i].cbData); 645 AssertReturnVoid(g_asTestWPut[i].cbDataOut <= g_asTestWPut[i].cbData); 646 memcpy(acData, g_asTestWPut[i].pvDataIn, g_asTestWPut[i].cbDataIn); 647 MBlkCont.b_rptr = acData; 648 MBlkCont.b_wptr = acData + g_asTestWPut[i].cbData; 649 MBlk.b_cont = &MBlkCont; 650 MBlk.b_rptr = (unsigned char *)&IOCBlk; 651 MBlk.b_wptr = (unsigned char *)&IOCBlk + sizeof(IOCBlk); 652 MBlk.b_datap = &DBlk; 653 rc = vbgr0SolWPut(WR(&aQueues[0]), &MBlk); 654 RTTEST_CHECK_MSG(hTest, IOCBlk.ioc_error == g_asTestWPut[i].rcExp, 647 pMBlk->b_datap->db_type = M_IOCTL; 648 pIOCBlk->ioc_cmd = g_asTestWPut[i].iIOCCmd; 649 pIOCBlk->ioc_count = g_asTestWPut[i].cbData; 650 AssertReturnVoid(g_asTestWPut[i].cbData <= MSG_DATA_SIZE); 651 memcpy(pMBlkCont->b_rptr, g_asTestWPut[i].pvDataIn, 652 g_asTestWPut[i].cbDataIn); 653 pMBlk->b_cont = pMBlkCont; 654 rc = vbgr0SolWPut(WR(&aQueues[0]), pMBlk); 655 RTTEST_CHECK_MSG(hTest, pIOCBlk->ioc_error == g_asTestWPut[i].rcExp, 655 656 (hTest, "i=%u, IOCBlk.ioc_error=%d\n", i, 656 IOCBlk.ioc_error)); 657 RTTEST_CHECK_MSG(hTest, IOCBlk.ioc_count == g_asTestWPut[i].cbDataOut, 658 (hTest, "i=%u, ioc_count=%u\n", i, IOCBlk.ioc_count)); 659 RTTEST_CHECK_MSG(hTest, !memcmp(acData, g_asTestWPut[i].pvDataOut, 657 pIOCBlk->ioc_error)); 658 RTTEST_CHECK_MSG(hTest, pIOCBlk->ioc_count == g_asTestWPut[i].cbDataOut, 659 (hTest, "i=%u, ioc_count=%u\n", i, pIOCBlk->ioc_count)); 660 RTTEST_CHECK_MSG(hTest, !memcmp(pMBlkCont->b_rptr, 661 g_asTestWPut[i].pvDataOut, 660 662 g_asTestWPut[i].cbDataOut), 661 663 (hTest, "i=%u\n", i)); 662 664 /* Hack to ensure that miocpullup() gets called when needed. */ 663 665 if (g_asTestWPut[i].cbData > 0) 664 RTTEST_CHECK_MSG(hTest, MBlk.b_flag == 1, (hTest, "i=%u\n", i));666 RTTEST_CHECK_MSG(hTest, pMBlk->b_flag == 1, (hTest, "i=%u\n", i)); 665 667 if (!g_asTestWPut[i].rcExp) 666 RTTEST_CHECK_MSG(hTest, RD(&aQueues[0])->q_first = &MBlk,668 RTTEST_CHECK_MSG(hTest, RD(&aQueues[0])->q_first == pMBlk, 667 669 (hTest, "i=%u\n", i)); 668 670 if (g_asTestWPut[i].pfnExtra) 669 g_asTestWPut[i].pfnExtra(hTest, WR(&aQueues[0]), &MBlk); 671 if (!g_asTestWPut[i].pfnExtra(hTest, WR(&aQueues[0]), pMBlk)) 672 RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Called from %s.\n", 673 __PRETTY_FUNCTION__); 670 674 vbgr0SolClose(RD(&aQueues[1]), 0, NULL); 671 } 672 675 freemsg(pMBlk); 676 } 677 678 679 #define USER_ADDRESS 0xfeedbacc 673 680 674 681 /** Simulate sending a transparent IOCtl to WPut with the parameters from table … … 678 685 queue_t aQueues[2]; 679 686 dev_t device = 0; 680 struct msgb MBlk, MBlkCont;681 struct datab DBlk;682 struct iocblk IOCBlk;683 struct copyreq *pCopyReq = (struct copyreq *)&IOCBlk;687 struct msgb *pMBlk = allocb(sizeof(struct iocblk), BPRI_MED); 688 struct msgb *pMBlkCont = allocb(sizeof(void *), BPRI_MED); 689 struct iocblk *pIOCBlk = pMBlk ? (struct iocblk *)pMBlk->b_rptr : NULL; 690 struct copyreq *pCopyReq; 684 691 int rc, cFormat = 0; 685 unsigned char acData[1024]; 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. */ 692 693 /* if (g_asTestWPut[i].cbDataIn == 0 && g_asTestWPut[i].cbDataOut != 0) 694 return; */ /* This case will be handled once the current ones work. */ 695 AssertReturnVoid(pMBlk); 696 AssertReturnVoidStmt(pMBlkCont, freemsg(pMBlk)); 689 697 RT_ZERO(aQueues); 690 698 doInitQueues(&aQueues[0]); … … 693 701 RTTEST_CHECK_MSG(hTest, g_aOpenNodeStates[1].pWriteQueue 694 702 == WR(&aQueues[0]), (hTest, "i=%u\n", i)); 695 RT_ZERO(MBlk); 696 RT_ZERO(DBlk); 697 RT_ZERO(IOCBlk); 698 RT_ZERO(MBlkCont); 699 RT_ZERO(acData); 700 DBlk.db_type = M_IOCTL; 701 IOCBlk.ioc_cmd = g_asTestWPut[i].iIOCCmd; 702 IOCBlk.ioc_count = TRANSPARENT; 703 AssertReturnVoid(g_asTestWPut[i].cbData <= sizeof(acData)); 704 AssertReturnVoid(g_asTestWPut[i].cbDataIn <= g_asTestWPut[i].cbData); 705 AssertReturnVoid(g_asTestWPut[i].cbDataOut <= g_asTestWPut[i].cbData); 706 memcpy(acData, g_asTestWPut[i].pvDataIn, g_asTestWPut[i].cbDataIn); 707 MBlkCont.b_rptr = acData; 708 MBlkCont.b_wptr = acData + g_asTestWPut[i].cbData; 709 MBlk.b_cont = &MBlkCont; 710 MBlk.b_rptr = (unsigned char *)&IOCBlk; 711 MBlk.b_wptr = (unsigned char *)&IOCBlk + sizeof(IOCBlk); 712 MBlk.b_datap = &DBlk; 713 rc = vbgr0SolWPut(WR(&aQueues[0]), &MBlk); 703 pMBlk->b_datap->db_type = M_IOCTL; 704 pIOCBlk->ioc_cmd = g_asTestWPut[i].iIOCCmd; 705 pIOCBlk->ioc_count = TRANSPARENT; 706 *(void **)pMBlkCont->b_rptr = (void *)USER_ADDRESS; 707 pMBlk->b_cont = pMBlkCont; 708 rc = vbgr0SolWPut(WR(&aQueues[0]), pMBlk); 709 pCopyReq = (struct copyreq *)pMBlk->b_rptr; 714 710 RTTEST_CHECK_MSG(hTest, ( ( g_asTestWPut[i].cbDataIn 715 && ( MBlk.b_datap->db_type == M_COPYIN))711 && (pMBlk->b_datap->db_type == M_COPYIN)) 716 712 || ( g_asTestWPut[i].cbDataOut 717 && ( MBlk.b_datap->db_type == M_COPYOUT))713 && (pMBlk->b_datap->db_type == M_COPYOUT)) 718 714 || ( (g_asTestWPut[i].rcExp == 0) 719 && MBlk.b_datap->db_type == M_IOCACK)720 || ( MBlk.b_datap->db_type == M_IOCNAK)),715 && pMBlk->b_datap->db_type == M_IOCACK) 716 || (pMBlk->b_datap->db_type == M_IOCNAK)), 721 717 (hTest, "i=%u, db_type=%u\n", i, 722 (unsigned) MBlk.b_datap->db_type));718 (unsigned) pMBlk->b_datap->db_type)); 723 719 /* Our TRANSPARENT IOCtls can only return non-zero if they have no payload. 724 720 * 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,721 if (pMBlk->b_datap->db_type == M_IOCNAK) 722 RTTEST_CHECK_MSG(hTest, pIOCBlk->ioc_error == g_asTestWPut[i].rcExp, 727 723 (hTest, "i=%u, IOCBlk.ioc_error=%d\n", i, 728 IOCBlk.ioc_error));724 pIOCBlk->ioc_error)); 729 725 if (g_asTestWPut[i].cbData) 730 726 { 731 RTTEST_CHECK_MSG(hTest, pCopyReq->cq_addr == acData, 727 RTTEST_CHECK_MSG(hTest, pCopyReq->cq_addr == (char *)USER_ADDRESS, 728 (hTest, "i=%u, cq_addr=%p\n", i, pCopyReq->cq_addr)); 729 RTTEST_CHECK_MSG( hTest, pCopyReq->cq_size 730 == g_asTestWPut[i].cbDataIn 731 ? g_asTestWPut[i].cbDataIn 732 : g_asTestWPut[i].cbDataOut, 733 (hTest, "i=%u, cq_size=%llu\n", i, 734 (unsigned long long)pCopyReq->cq_size)); 735 } 736 /* Implementation detail - check that the private pointer is correctly 737 * set to the user address *for two direction IOCtls* or NULL otherwise. */ 738 if (g_asTestWPut[i].cbDataIn && g_asTestWPut[i].cbDataOut) 739 RTTEST_CHECK_MSG(hTest, pCopyReq->cq_private == (mblk_t *)USER_ADDRESS, 740 (hTest, "i=%u, cq_private=%p\n", i, 741 pCopyReq->cq_private)); 742 else if ( (pMBlk->b_datap->db_type == M_COPYIN) 743 || (pMBlk->b_datap->db_type == M_COPYOUT)) 744 RTTEST_CHECK_MSG(hTest, !pCopyReq->cq_private, 745 (hTest, "i=%u, cq_private=%p\n", i, 746 pCopyReq->cq_private)); 747 if (!g_asTestWPut[i].rcExp) 748 RTTEST_CHECK_MSG(hTest, RD(&aQueues[0])->q_first == pMBlk, 749 (hTest, "i=%u\n", i)); 750 if (g_asTestWPut[i].pfnExtra && !g_asTestWPut[i].cbData) 751 if (!g_asTestWPut[i].pfnExtra(hTest, WR(&aQueues[0]), pMBlk)) 752 RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Called from %s.\n", 753 __PRETTY_FUNCTION__); 754 vbgr0SolClose(RD(&aQueues[1]), 0, NULL); 755 freemsg(pMBlk); 756 } 757 758 759 /** Simulate sending follow-on IOCData messages to a transparent IOCtl to WPut 760 * with the parameters from table line @a i. */ 761 void testWPutIOCDataIn(RTTEST hTest, unsigned i) 762 { 763 queue_t aQueues[2]; 764 dev_t device = 0; 765 struct msgb *pMBlk = allocb(sizeof(struct copyresp), BPRI_MED); 766 struct msgb *pMBlkCont = allocb(MSG_DATA_SIZE, BPRI_MED); 767 struct copyresp *pCopyResp = pMBlk ? (struct copyresp *)pMBlk->b_rptr 768 : NULL; 769 void *pvData = pMBlkCont ? pMBlkCont->b_rptr : NULL; 770 struct copyreq *pCopyReq; 771 int rc, cFormat = 0; 772 773 AssertReturnVoid(pMBlk); 774 AssertReturnVoidStmt(pMBlkCont, freemsg(pMBlk)); 775 AssertReturnVoid(g_asTestWPut[i].cbDataIn); 776 RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "%s: i=%u\n", __PRETTY_FUNCTION__, 777 i); 778 RT_ZERO(aQueues); 779 doInitQueues(&aQueues[0]); 780 rc = vbgr0SolOpen(RD(&aQueues[0]), &device, 0, 0, NULL); 781 RTTEST_CHECK_MSG(hTest, rc == 0, (hTest, "i=%u, rc=%d\n", i, rc)); 782 RTTEST_CHECK_MSG(hTest, g_aOpenNodeStates[1].pWriteQueue 783 == WR(&aQueues[0]), (hTest, "i=%u\n", i)); 784 pMBlk->b_datap->db_type = M_IOCDATA; 785 pCopyResp->cp_cmd = g_asTestWPut[i].iIOCCmd; 786 AssertReturnVoid(g_asTestWPut[i].cbData <= MSG_DATA_SIZE); 787 memcpy(pMBlkCont->b_rptr, g_asTestWPut[i].pvDataIn, g_asTestWPut[i].cbDataIn); 788 pMBlk->b_cont = pMBlkCont; 789 rc = vbgr0SolWPut(WR(&aQueues[0]), pMBlk); 790 pCopyReq = (struct copyreq *)pMBlk->b_rptr; 791 RTTEST_CHECK_MSG(hTest, ( ( g_asTestWPut[i].cbDataOut 792 && (pMBlk->b_datap->db_type == M_COPYOUT)) 793 || ( (g_asTestWPut[i].rcExp == 0) 794 && pMBlk->b_datap->db_type == M_IOCACK) 795 || (pMBlk->b_datap->db_type == M_IOCNAK)), 796 (hTest, "i=%u, db_type=%u\n", i, 797 (unsigned) pMBlk->b_datap->db_type)); 798 if (g_asTestWPut[i].cbDataOut) 799 { 800 RTTEST_CHECK_MSG(hTest, pCopyReq->cq_addr == (char *)pvData, 732 801 (hTest, "i=%u, cq_addr=%p\n", i, pCopyReq->cq_addr)); 733 802 RTTEST_CHECK_MSG(hTest, pCopyReq->cq_size == g_asTestWPut[i].cbData, 734 803 (hTest, "i=%u, cq_size=%llu\n", i, 735 804 (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)); 805 RTTEST_CHECK_MSG(hTest, !memcmp(pvData, g_asTestWPut[i].pvDataOut, 806 g_asTestWPut[i].cbDataOut), 807 (hTest, "i=%u\n", i)); 808 } 809 RTTEST_CHECK_MSG(hTest, !pCopyReq->cq_private, 810 (hTest, "i=%u, cq_private=%p\n", i, 811 pCopyReq->cq_private)); 748 812 if (!g_asTestWPut[i].rcExp) 749 RTTEST_CHECK_MSG(hTest, RD(&aQueues[0])->q_first = &MBlk,813 RTTEST_CHECK_MSG(hTest, RD(&aQueues[0])->q_first == pMBlk, 750 814 (hTest, "i=%u\n", i)); 751 if (g_asTestWPut[i].pfnExtra && !g_asTestWPut[i].cbData) 752 g_asTestWPut[i].pfnExtra(hTest, WR(&aQueues[0]), &MBlk); 815 if (g_asTestWPut[i].pfnExtra && !g_asTestWPut[i].cbDataOut) 816 if (!g_asTestWPut[i].pfnExtra(hTest, WR(&aQueues[0]), pMBlk)) 817 RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Called from %s.\n", 818 __PRETTY_FUNCTION__); 753 819 vbgr0SolClose(RD(&aQueues[1]), 0, NULL); 820 freemsg(pMBlk); 754 821 } 755 822 #endif … … 951 1018 int err; 952 1019 953 if (cbData < cbTransparent)954 return EINVAL;955 1020 if (!pMBlk->b_cont) 956 1021 return EINVAL; … … 1001 1066 else if (enmDirection == OUT) 1002 1067 { 1003 mblk_t *pMBlkOut = allocb(cb Out, BPRI_MED);1068 mblk_t *pMBlkOut = allocb(cbTransparent, BPRI_MED); 1004 1069 void *pvData; 1005 1070 … … 1567 1632 { 1568 1633 queue_t *pReadQueue = RD(pState->pWriteQueue); 1569 mblk_t *pMBlk = allocb(sizeof(Firm_event , BPRI_HI));1634 mblk_t *pMBlk = allocb(sizeof(Firm_event), BPRI_HI); 1570 1635 Firm_event *pEvent; 1571 1636 AssertReturnVoid(cEvent == LOC_X_ABSOLUTE || cEvent == LOC_Y_ABSOLUTE); -
trunk/src/VBox/Additions/common/VBoxGuest/testcase/solaris.h
r40584 r41020 40 40 #define MOD_NOAUTOUNLOAD 0x1 41 41 42 #define M_DATA 0x00 42 43 #define M_BREAK 0x08 43 44 #define M_PASSFP 0x09 … … 70 71 #define M_CMD 0x93 71 72 73 #define BPRI_LO 1 74 #define BPRI_MED 2 75 #define BPRI_HI 3 76 72 77 #define FLUSHALL 1 73 78 #define FLUSHDATA 0 … … 229 234 uint_t ioc_id; 230 235 uint_t ioc_flag; 231 uint_t ioc_count;236 size_t ioc_count; 232 237 int ioc_rval; 233 238 int ioc_error; 239 #if defined(RT_ARCH_AMD64) /* Actually this should be LP64. */ 240 int dummy; /* For simplicity, to ensure the structure size matches 241 struct copyreq. */ 242 #endif 234 243 }; 235 244 … … 311 320 312 321 #define cmn_err(...) do {} while(0) 313 #define allocb(...) NULL314 322 #define mod_remove(...) 0 315 323 #define mod_info(...) 0 … … 332 340 #define qprocsoff(...) do {} while(0) 333 341 #define flushq(...) do {} while(0) 334 #define freemsg(...) do {} while(0)335 342 #define putnext(...) do {} while(0) 336 343 #define ddi_get_instance(...) 0 … … 375 382 mblk_t *pMBlkData); 376 383 extern void qreply(queue_t *pQueue, mblk_t *pMBlk); 384 extern mblk_t *allocb(size_t cb, uint_t cPrio); 385 extern void freemsg(mblk_t *pMsg); 377 386 378 387 /* API stubs with simple logic */ -
trunk/src/VBox/Additions/common/VBoxGuest/testcase/tstVBoxGuest-solaris.c
r40584 r41020 20 20 21 21 #include "solaris.h" 22 #include <iprt/alloc.h> 22 23 23 24 /****************************************************************************** … … 75 76 pCopyReq->cq_private = pvState; 76 77 pCopyReq->cq_size = cbData; 77 pCopyReq->cq_addr = pvUser ? pvUser : pMBlk->b_cont->b_rptr;78 pCopyReq->cq_addr = pvUser ? pvUser : *(void **)pMBlk->b_cont->b_rptr; 78 79 if (pMBlk->b_cont) 79 80 { … … 97 98 pCopyReq->cq_private = pvState; 98 99 pCopyReq->cq_size = cbData; 99 pCopyReq->cq_addr = pvUser ? pvUser : pMBlk->b_cont->b_rptr;100 pCopyReq->cq_addr = pvUser ? pvUser : *(void **)pMBlk->b_cont->b_rptr; 100 101 if (pMBlkData) 101 102 { … … 113 114 OTHERQ(pQueue)->q_first = pMBlk; 114 115 } 116 117 /** @todo reference counting */ 118 mblk_t *allocb(size_t cb, uint_t cPrio) 119 { 120 unsigned char *pch = RTMemAllocZ(cb); 121 struct msgb *pMBlk = (struct msgb *)RTMemAllocZ(sizeof(struct msgb)); 122 struct datab *pDBlk = (struct datab *)RTMemAllocZ(sizeof(struct datab)); 123 if (!pch || !pMBlk || !pDBlk) 124 { 125 RTMemFree(pch); 126 RTMemFree(pMBlk); 127 RTMemFree(pDBlk); 128 return NULL; 129 } 130 NOREF(cPrio); 131 pMBlk->b_rptr = pch; 132 pMBlk->b_wptr = pMBlk->b_rptr + cb; 133 pMBlk->b_datap = pDBlk; 134 pDBlk->db_base = pMBlk->b_rptr; 135 pDBlk->db_lim = pMBlk->b_wptr; 136 pDBlk->db_type = M_DATA; 137 return pMBlk; 138 } 139 140 /** @todo reference counting */ 141 void freemsg(mblk_t *pMBlk) 142 { 143 if (!pMBlk) 144 return; 145 RTMemFree(pMBlk->b_rptr); 146 RTMemFree(pMBlk->b_datap); 147 freemsg(pMBlk->b_cont); 148 RTMemFree(pMBlk); 149 }
Note:
See TracChangeset
for help on using the changeset viewer.