Page MenuHomeFreeBSD

protosw: refactor protosw and domain static declaration and load
AbandonedPublic

Authored by glebius on Aug 16 2022, 7:50 PM.

Details

Summary

o Assert that every protosw has pr_attach. Now this structure is
only for socket protocols declarations and nothing else.
o Merge struct pr_usrreqs into struct protosw. This was suggested
in 1996 by wollman@ (see 7b187005d18ef), and later reiterated
in 2006 by rwatson@ (see 6fbb9cf860dcd).
o Make struct domain hold a variable sized array of protosw pointers.
For most protocols these pointers are initialized statically.
Those domains that may have loadable protocols have spacers. IPv4
and IPv6 have 8 spacers each (andre@ dff3237ee54ea).
o For inetsw and inet6sw leave a comment noting that many protosw
entries very likely are dead code.
o Refactor pf_proto_[un]register() into protow_[un]register().
o Isolate pr_*_notsupp() methods into uipc_domain.c

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Warnings
SeverityLocationCodeMessage
Warningsys/compat/linuxkpi/common/include/linux/net.h:61SPELL1Possible Spelling Mistake
Warningsys/compat/linuxkpi/common/include/linux/net.h:63SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_domain.c:81SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_domain.c:93SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_domain.c:99SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_domain.c:106SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_domain.c:112SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_domain.c:144SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_domain.c:196SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_socket.c:921SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_socket.c:932SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_socket.c:1328SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_socket.c:1362SPELL1Possible Spelling Mistake
Warningsys/kern/uipc_socket.c:1364SPELL1Possible Spelling Mistake
Warningsys/sys/protosw.h:244SPELL1Possible Spelling Mistake
Unit
No Test Coverage
Build Status
Buildable 46993
Build 43882: arc lint + arc unit

Event Timeline

melifaro added inline comments.
sys/kern/uipc_domain.c
387

Is this needed?

408

Is this special case needed? E.g. if adding domains with AF_UNSPEC is not a valid use case, we would naturally return NULL after search.

477

maybe name prp like proto_slot so it can be a bit more readable?

501

Shouldn't we catch it on attach instead?