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)
Sun, Nov 9, 10:57 PM
Unknown Object (File)
Thu, Nov 6, 8:20 AM
Unknown Object (File)
Wed, Nov 5, 2:08 PM
Unknown Object (File)
Sun, Nov 2, 4:55 AM
Unknown Object (File)
Wed, Oct 29, 1:38 PM
Unknown Object (File)
Wed, Oct 29, 1:16 PM
Unknown Object (File)
Wed, Oct 29, 1:09 PM
Unknown Object (File)
Wed, Oct 29, 1:09 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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

Can mask be a pointer to const?

2498

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–2413

It can, done!

2498

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
2434–2435

[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.

2498

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