Page MenuHomeFreeBSD

cdevpriv(9): add iterator
ClosedPublic

Authored by kib on Mar 22 2024, 3:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 7:25 AM
Unknown Object (File)
Wed, Nov 6, 7:12 AM
Unknown Object (File)
Mon, Oct 21, 5:02 PM
Unknown Object (File)
Sat, Oct 19, 2:15 PM
Unknown Object (File)
Sat, Oct 19, 2:15 PM
Unknown Object (File)
Sat, Oct 19, 2:15 PM
Unknown Object (File)
Sat, Oct 19, 1:16 PM
Unknown Object (File)
Oct 4 2024, 11:10 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I will add the documentation after the interface proves itself to be useful.

I think it's better if the return value of devfs_foreach_cdevpriv() and the callback return an int. We can have a convention where a non-zero return value from the callback means we want to break out of the loop and return from devfs_foreach_cdevpriv(), which can follow the same convention and return 0 if the loop finished normally, or non-zero if the callback signaled to stop the loop. This would be very useful in the D44411 case.

The code sample you shown did not needed the break out of the loop. Anyway, added.

In D44469#1014111, @kib wrote:

The code sample you shown did not needed the break out of the loop. Anyway, added.

Indeed, my bad. However, this change is still good because we can replace the if-statement by using the return value of devfs_foreach_cdevpriv().

This revision is now accepted and ready to land.Mar 23 2024, 5:51 AM
This revision was automatically updated to reflect the committed changes.