commit | 0e8f3997bd7b11390e9ec7b7de7eb31f403c1c83 | [log] [tgz] |
---|---|---|
author | Chris Dickens <christopher.a.dickens@gmail.com> | Wed Feb 26 15:14:56 2020 -0800 |
committer | Chris Dickens <christopher.a.dickens@gmail.com> | Wed Feb 26 15:14:56 2020 -0800 |
tree | 82d76c8514da3ee274364963950dfc056a099d6c | |
parent | 136346391677455b9259e446c8445e7fbb1ad36e [diff] |
core: Optimize the memory layout of the transfer structure Prior to this commit, the memory layout of the transfer structure was as follows: ------------------------------------------------------ | usbi_transfer | libusb_transfer [variable] | os_priv | ------------------------------------------------------ With this layout, accessing the os_priv area requires calculating the size of the area used by the libusb_transfer, which varies based on the number of iso packets allocated for the transfer. This commit changes the memory layout of the transfer structure to the following: ------------------------------------------------------ | os_priv | usbi_transfer | libusb_transfer [variable] | ------------------------------------------------------ Having the os_priv in a fixed position relative to the usbi_transfer allows for constant-time access with the added benefit of not allowing the user to corrupt the data by accessing elements of the libusb_transfer structure that are out-of-bounds. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb is a library for USB device access from Linux, macOS, Windows, OpenBSD/NetBSD and Haiku userspace. It is written in C (Haiku backend in C++) and licensed under the GNU Lesser General Public License version 2.1 or, at your option, any later version (see COPYING).
libusb is abstracted internally in such a way that it can hopefully be ported to other operating systems. Please see the PORTING file for more information.
libusb homepage: http://libusb.info/
Developers will wish to consult the API documentation: http://api.libusb.info
Use the mailing list for questions, comments, etc: http://mailing-list.libusb.info
(Please use the mailing list rather than mailing developers directly)