Hi, On 08/22/2012 05:05 PM, Alan Stern wrote: > On Wed, 22 Aug 2012, Hans de Goede wrote: > >> Apps which deal with devices which also have a kernel driver, need to do >> the following: >> 1) Check which driver is attached, so as to not detach the wrong driver >> (ie detaching usbfs while another instance of the app is using the >> device) >> 2) Detach the kernel driver >> 3) Claim the interface >> >> Where moving from one step to the next for both 1-2 and 2-3 consists of >> a (small) race window. So currently such apps are racy and people just live >> with it. >> >> This patch adds a new ioctl which makes it possible for apps to do this >> in a race free manner. For flexibility apps can choose to: >> 1) Specify the driver to disconnect >> 2) Specify to disconnect any driver except for the one named by the app >> 3) Disconnect any driver >> >> Note that if there is no driver attached, the ioctl will just act like the >> regular claim-interface ioctl, this is by design, as returning an error for >> this condition would open a new bag of race-conditions. > > ... > >> + if ((dc.flags & USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER) && >> + strncmp(dc.driver, intf->dev.driver->name, >> + sizeof(dc.driver)) != 0) >> + return -EBUSY; >> + >> + if ((dc.flags & USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER) && >> + strncmp(dc.driver, intf->dev.driver->name, >> + sizeof(dc.driver)) == 0) >> + return -EBUSY; > > Please don't indent continuation lines by exactly one tab stop. It > makes them look like the start of a sub-block.
Ok, so you want 4 spaces there to but the 's' of strncmp below the second '(' I assume? I actually had that first, then changed to this :) Before I respin the patch, any other remarks from you? Regards, Hams ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel