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
F168970474: D12557.id33825.diff
Mon, Aug 31, 12:32 AM
Unknown Object (File)
Sun, Aug 30, 12:09 PM
Unknown Object (File)
Sun, Aug 30, 9:04 AM
Unknown Object (File)
Sat, Aug 29, 10:09 AM
Unknown Object (File)
Sat, Aug 29, 5:01 AM
Unknown Object (File)
Sat, Aug 29, 12:32 AM
Unknown Object (File)
Wed, Aug 26, 2:34 PM
Unknown Object (File)
Wed, Aug 26, 2:12 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.