internal/kobject: pass action kind for range
All checks were successful
Test / Create distribution (push) Successful in 1m5s
Test / Sandbox (push) Successful in 2m52s
Test / ShareFS (push) Successful in 3m47s
Test / Hakurei (push) Successful in 3m52s
Test / Sandbox (race detector) (push) Successful in 5m24s
Test / Hakurei (race detector) (push) Successful in 6m33s
Test / Flake checks (push) Successful in 1m22s

Useful for handling most uevents.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-27 17:58:01 +09:00
parent 12a6061051
commit b18f40d974
5 changed files with 41 additions and 23 deletions

View File

@@ -388,7 +388,9 @@ func TestIter(t *testing.T) {
"SEQNUM=1",
}}
synctest.Wait()
s.Range(t.Context(), func(o *Object) bool { return false })
s.Range(t.Context(), func(*Object, uevent.KobjectAction) bool {
return false
})
var got []*Object
check := func(want []*Object) {
@@ -405,7 +407,7 @@ func TestIter(t *testing.T) {
defer cancel()
var done bool
wg.Go(func() {
s.Range(ctx, func(o *Object) bool {
s.Range(ctx, func(o *Object, _ uevent.KobjectAction) bool {
got = append(got, o.Clone())
return !done
})
@@ -437,7 +439,11 @@ func TestIter(t *testing.T) {
},
})
wg.Go(func() { s.Range(ctx, func(*Object) bool { return true }) })
wg.Go(func() {
s.Range(ctx, func(*Object, uevent.KobjectAction) bool {
return true
})
})
synctest.Wait()
iter := reflect.ValueOf(s).Elem().FieldByName("iter")