Page MenuHomeFreeBSD

cdevpriv(9): add iterator
ClosedPublic

Authored by kib on Mar 22 2024, 3:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 4:58 PM
Unknown Object (File)
Fri, Apr 12, 1:16 PM
Unknown Object (File)
Fri, Apr 5, 11:10 AM
Unknown Object (File)
Fri, Apr 5, 3:25 AM
Unknown Object (File)
Thu, Apr 4, 3:05 AM
Unknown Object (File)
Mar 25 2024, 5:02 PM
Unknown Object (File)
Mar 23 2024, 6:59 AM
Unknown Object (File)
Mar 22 2024, 10:41 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.