{
struct libusb_device *dev, *next;
char *dbg = getenv("LIBUSB_DEBUG");
+ size_t priv_size = usbi_backend.context_priv_size;
struct libusb_context *ctx;
static int first_init = 1;
int r = 0;
return 0;
}
- ctx = calloc(1, sizeof(*ctx));
+ ctx = calloc(1, sizeof(*ctx) + priv_size);
if (!ctx) {
r = LIBUSB_ERROR_NO_MEM;
goto err_unlock;
#endif
struct list_head list;
+
+ PTR_ALIGNED unsigned char os_priv[ZERO_SIZED_ARRAY];
};
enum usbi_event_flags {
clockid_t (*get_timerfd_clockid)(void);
#endif
+ /* Number of bytes to reserve for per-context private backend data.
+ * This private data area is accessible through the "os_priv" field of
+ * struct libusb_context. */
+ size_t context_priv_size;
+
/* Number of bytes to reserve for per-device private backend data.
* This private data area is accessible through the "os_priv" field of
* struct libusb_device. */
/*.get_timerfd_clockid =*/ NULL,
#endif
+ /*.context_priv_size=*/ 0,
/*.device_priv_size =*/ sizeof(USBDevice *),
/*.device_handle_priv_size =*/ sizeof(USBDeviceHandle *),
/*.transfer_priv_size =*/ sizeof(USBTransfer *),
netbsd_handle_transfer_completion,
netbsd_clock_gettime,
+ 0, /* context_priv_size */
sizeof(struct device_priv),
sizeof(struct handle_priv),
0, /* transfer_priv_size */
obsd_handle_transfer_completion,
obsd_clock_gettime,
+ 0, /* context_priv_size */
sizeof(struct device_priv),
sizeof(struct handle_priv),
0, /* transfer_priv_size */
NULL, /* handle_transfer_completion() */
wince_clock_gettime,
+ 0,
sizeof(struct wince_device_priv),
0,
sizeof(struct wince_transfer_priv),
#if defined(USBI_TIMERFD_AVAILABLE)
NULL,
#endif
+ 0,
sizeof(struct usbdk_device_priv),
0,
sizeof(struct usbdk_transfer_priv),
#if defined(USBI_TIMERFD_AVAILABLE)
NULL,
#endif
+ 0,
sizeof(struct windows_device_priv),
sizeof(struct windows_device_handle_priv),
sizeof(struct windows_transfer_priv),
-#define LIBUSB_NANO 11206
+#define LIBUSB_NANO 11207