Page MenuHomeFreeBSD

Add eventhandler notifications for newbus device attach/detach.
ClosedPublic

Authored by ian on Oct 1 2017, 6:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 7:01 AM
Unknown Object (File)
Sat, Oct 11, 10:48 PM
Unknown Object (File)
Sat, Oct 11, 10:48 PM
Unknown Object (File)
Sat, Oct 11, 10:48 PM
Unknown Object (File)
Sat, Oct 11, 1:27 PM
Unknown Object (File)
Fri, Oct 10, 11:19 PM
Unknown Object (File)
Fri, Oct 10, 9:47 PM
Unknown Object (File)
Fri, Oct 10, 9:45 PM
Subscribers

Details

Summary

The detach case is slightly complicated by the fact that some in-kernel consumers may want to know before a device detaches (so they can release related resources, stop using the device, etc), but the detach can fail. So there are pre- and post-detach notifications for those consumers who need to handle all cases.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Note that in the current newbus locking model, DETACH_BEGIN and DETACH_COMPLETE/FAILED sequence of event handler invocation might interweave with other attach/detach events arbitrary. The handlers should be prepared for such situations.

This revision is now accepted and ready to land.Oct 1 2017, 7:00 PM

Is there a suitable man page to put the protocol on?

Otherwise lgtm.

Also should note that detach may be called after the parent bus knows the hardware has left the building. In-kernel consumers have to be prepared to cope with this race...

This revision was automatically updated to reflect the committed changes.