Page MenuHomeFreeBSD

kern_domainset: Split domainset validation logic into a separate function
ClosedPublic

Authored by bnovkov on Sep 8 2024, 6:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 24, 5:37 PM
Unknown Object (File)
Mon, Nov 24, 5:01 PM
Unknown Object (File)
Mon, Nov 24, 5:01 PM
Unknown Object (File)
Sun, Nov 23, 2:34 AM
Unknown Object (File)
Wed, Nov 19, 7:56 AM
Unknown Object (File)
Sun, Nov 16, 5:40 PM
Unknown Object (File)
Sat, Nov 15, 11:45 PM
Unknown Object (File)
Sun, Nov 9, 10:57 PM

Details

Summary

This patch splits the validation and struct domainset-filling logic from kern_cpuset_setdomain into a separate function - domainset_populate.
This function's main use is to validate user-provided domainset(9) policies and populate a struct domainset before handing it off to domainset_create. No functional change intended.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

markj added inline comments.
share/man/man9/domainset.9
25
157
161
sys/kern/kern_cpuset.c
2412

Can mask be a pointer to const?

2464

It feels a bit weird to include this last section here--is it appropriate for a generic helper function, or is it really a policy of the syscall layer?

bnovkov marked an inline comment as done.

Address @markj 's comments.

bnovkov added inline comments.
sys/kern/kern_cpuset.c
2412

It can, done!

2464

Hm right, it's a bit unclear where the cutoff point should be.

I guess it'd be useful to give other consumers of this interface a chance to return an error when faced with an empty domainset, the only issue with this is that it would require making domainset_vm_empty (and perhaps domainset_copy) public functions. Does that sound reasonable?

markj added inline comments.
sys/kern/kern_cpuset.c
2433

[annoying style nitpicking] This function consistently omitted braces for single statements, but now it has a mix of both styles. Either style is ok, but it'd be nice to be consistent.

2464

I think making those symbols public is fine, yes.

This revision is now accepted and ready to land.Jun 25 2025, 8:14 PM
bnovkov marked an inline comment as done.

Fix style issues and make domainset_empty_vm public.

This revision now requires review to proceed.Jul 3 2025, 10:15 PM
share/man/man9/domainset.9
29

Right?

markj added inline comments.
sys/sys/domainset.h
116

It'd be nice to have a comment above this function, like the others do.

This revision is now accepted and ready to land.Jul 5 2025, 3:56 PM