HomeFreeBSD

ctld: Add a dedicated API between parse.y and the rest of the program

Description

ctld: Add a dedicated API between parse.y and the rest of the program

The primary purpose of this is to permit the rest of ctld to use C++.
However, this also has the nice side effect of reducing code
duplication with the UCL parser.

As a general rule, setting of options including error handling for
invalid values, etc. is moved out of parse.y and into conf.c. The
globals for the current configuration, auth group, portal group, lun,
and target are also moved into conf.c hiding the types from parse.y.
The intention is that all of the functions declared in conf.h will be
extern "C" for use by parse.y and that the backing data structures can
be reimplemented as C++ classes instead of C structures if desired.

A few other small changes are included with this refactoring:

  • Warn and fail a configuration that specifies the same LUN multiple times for a target.
  • Use T_* constants for SCSI device types instead of magic numbers.
  • Warn and fail for a few UCL properties that aren't the required type including "discovery-auth-group" in a portal group context, "auth-type" and "port" in a target context.
  • Fix a bug where chap-mutual in a target in UCL would not auto-create a new auth-group.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48934

Details

Provenance
jhbAuthored on Feb 26 2025, 3:10 PM
Differential Revision
D48934: ctld: Add a dedicated API between parse.y and the rest of the program
Parents
rG8c108dccd7f8: acpidump: do not use pointer arithmetic to check for overflow
Branches
Unknown
Tags
Unknown