Page MenuHomeFreeBSD

libnvmf: Add nvmf_nqn_valid_strict() function
AcceptedPublic

Authored by jhb on Fri, Jan 31, 8:16 PM.
Tags
None
Referenced Files
F109730859: D48767.id150288.diff
Sat, Feb 8, 8:30 PM
F109730027: D48767.diff
Sat, Feb 8, 8:13 PM
Unknown Object (File)
Sat, Feb 8, 4:49 PM
Unknown Object (File)
Fri, Feb 7, 12:36 AM
Unknown Object (File)
Thu, Feb 6, 12:09 PM
Unknown Object (File)
Tue, Feb 4, 4:42 AM
Unknown Object (File)
Tue, Feb 4, 2:47 AM
Unknown Object (File)
Tue, Feb 4, 2:31 AM
Subscribers

Details

Reviewers
asomers
mav
trasz
Summary

This moves the checks previously under #ifdef STRICT in
nvmf_nqn_valid() into a separate helper for userland. This
requires that the NQN starts with "nqn.YYYY-MM." followed by at
least one additional character.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62172
Build 59056: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Fri, Jan 31, 8:16 PM

The only improvement I could suggest would be to factor out the guts of both functions into a third, private function. That would save callers of nvmf_nqn_valid_strict from calling strlen twice. But it's probably premature optimization.

This revision is now accepted and ready to land.Fri, Jan 31, 10:05 PM

The only improvement I could suggest would be to factor out the guts of both functions into a third, private function. That would save callers of nvmf_nqn_valid_strict from calling strlen twice. But it's probably premature optimization.

Yeah, I thought about it and initially I had made the common routine in the header take a bool strict argument, but the kernel never uses the strict version, only ctld(8) in userspace when parsing a config file (which is not a hot path).