Changeset 96720 in vbox for trunk/src/VBox/Devices/USB/linux
- Timestamp:
- Sep 13, 2022 1:04:56 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 153605
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/linux/USBProxyDevice-linux.cpp
r96719 r96720 95 95 typedef struct USBPROXYURBLNX 96 96 { 97 /** The kernel URB data. */98 #if RT_GNUC_PREREQ(6, 0)99 /* gcc 6.2 complains about the [] member of KUrb */100 # pragma GCC diagnostic push101 # pragma GCC diagnostic ignored "-Wpedantic"102 #endif103 union104 {105 struct usbdevfs_urb KUrb;106 /** Make sure we've got sufficient space for isochronous packets. */107 uint8_t abKUrbPadding[ RT_UOFFSETOF(struct usbdevfs_urb, iso_frame_desc)108 + sizeof(struct usbdevfs_iso_packet_desc) * 8];109 };110 #if RT_GNUC_PREREQ(6, 0)111 # pragma GCC diagnostic pop112 #endif113 97 /** Node to link the URB in of the existing lists. */ 114 98 RTLISTNODE NodeList; 115 99 /** If we've split the VUSBURB up into multiple linux URBs, this is points to the head. */ 116 struct USBPROXYURBLNX 100 struct USBPROXYURBLNX *pSplitHead; 117 101 /** The next linux URB if split up. */ 118 struct USBPROXYURBLNX 102 struct USBPROXYURBLNX *pSplitNext; 119 103 /** Don't report these back. */ 120 104 bool fCanceledBySubmit; … … 125 109 /** Size to transfer in remaining fragments of a split URB */ 126 110 uint32_t cbSplitRemaining; 111 112 #if RT_GNUC_PREREQ(6, 0) /* gcc 6.2 complains about the [] member of KUrb */ 113 # pragma GCC diagnostic push 114 # pragma GCC diagnostic ignored "-Wpedantic" 115 #endif 116 /** The kernel URB data (variable size array included). */ 117 struct usbdevfs_urb KUrb; 118 #if RT_GNUC_PREREQ(6, 0) 119 # pragma GCC diagnostic pop 120 #endif 127 121 } USBPROXYURBLNX, *PUSBPROXYURBLNX; 128 122 … … 278 272 } 279 273 274 280 275 /** 281 276 * Unlinks the given URB from the in flight list. 277 * 282 278 * @returns nothing. 283 279 * @param pDevLnx The proxy device instance - Linux specific data. … … 299 295 } 300 296 297 301 298 /** 302 299 * Allocates a linux URB request structure. 300 * 303 301 * @returns Pointer to an active URB request. 304 302 * @returns NULL on failure. … … 327 325 { 328 326 RTCritSectLeave(&pDevLnx->CritSect); 329 pUrbLnx = (PUSBPROXYURBLNX)RTMemAlloc(sizeof(*pUrbLnx)); 327 PVUSBURB pVUrbDummy; RT_NOREF(pVUrbDummy); 328 pUrbLnx = (PUSBPROXYURBLNX)RTMemAlloc(RT_UOFFSETOF_DYN(USBPROXYURBLNX, 329 KUrb.iso_frame_desc[RT_ELEMENTS(pVUrbDummy->aIsocPkts)])); 330 330 if (!pUrbLnx) 331 331 return NULL; … … 996 996 * Clean up after a failed URB submit. 997 997 */ 998 static void usbProxyLinuxCleanupFailedSubmit(PUSBPROXYDEV pProxyDev, PUSBPROXYURBLNX pUrbLnx, PUSBPROXYURBLNX pCur, PVUSBURB pUrb, bool *pfUnplugged) 998 static void usbProxyLinuxCleanupFailedSubmit(PUSBPROXYDEV pProxyDev, PUSBPROXYURBLNX pUrbLnx, PUSBPROXYURBLNX pCur, 999 PVUSBURB pUrb, bool *pfUnplugged) 999 1000 { 1000 1001 if (pUrb->enmType == VUSBXFERTYPE_MSG) … … 1503 1504 return NULL; 1504 1505 } 1505 pUrbLnx = (PUSBPROXYURBLNX)pKUrb;1506 pUrbLnx = RT_FROM_MEMBER(pKUrb, USBPROXYURBLNX, KUrb); 1506 1507 1507 1508 /* split list: Is the entire split list done yet? */ … … 1578 1579 if (pUrb->enmType == VUSBXFERTYPE_ISOC) 1579 1580 { 1580 AssertCompile( sizeof(pUrbLnx->abKUrbPadding)1581 >= RT_UOFFSETOF(struct usbdevfs_urb, iso_frame_desc)1582 + sizeof(struct usbdevfs_iso_packet_desc) * RT_ELEMENTS(pUrb->aIsocPkts));1583 1581 unsigned i, off; 1584 1582 for (i = 0, off = 0; i < pUrb->cIsocPkts; i++)
Note:
See TracChangeset
for help on using the changeset viewer.