for better type safety
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 62209 Build 59093: arc lint + arc unit
Event Timeline
usr.sbin/ctld/ctld.h | ||
---|---|---|
109 | It's too bad we can't just use UNKNOWN here. If this were C++, these could be namespaced so you could avoid ambiguity that way? |
usr.sbin/ctld/ctld.h | ||
---|---|---|
109 | Yeah, namespaces would be great. |
usr.sbin/ctld/ctld.h | ||
---|---|---|
109 | C++ also lets you use the namespace I think, it's just not mandatory unless you use an enum class, though for this case an enum class so that UNKNOWN is never ambiguous is what we would want. |
I'm somewhat torn on doing a big change while the nvme stuff is in flight, but I do think maybe we should just bite the bullet. git can handle renames pretty sanely for rebasing I think.
So what I think I would like to do is go ahead and convert ctld(8) to C++. The first commit would be to just rename all the .c files to .cc and change the Makefile, but make no other functional changes. We might need to a prep commit to add BEGIN_DECLS and END_DECLS to libiscsiutil.h. After that lands, you could rebase this and use C++ enum classes for these. I might also use classes instead of my protocol_ops structure in the nvme vs iscsi changes. It might be nice to use classes for several of the data structures in fact including auth_groups, portal_groups, etc. Also while updating certain things it might nice to use STL containers in place of queue macros, but that can be done incrementally.
FYI, one hiccup with this plan is that yacc only generates C code. I am working on creating a dedicated C API to sit between parse.y and ctld.c so that the rest of ctld can be C++. Blech.
That's annoying. Should we deprecate the legacy config file format in FreeBSD 15, and remove it in 16? UCL is better.