Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config subsys v4 #1516

Merged
merged 19 commits into from Nov 7, 2019
Merged

Conversation

Labels
None yet
Projects
None yet
3 participants
@nmathewson
Copy link
Contributor

@nmathewson nmathewson commented Nov 7, 2019

No description provided.

nmathewson added 19 commits Nov 7, 2019
This file is a workaround for the issue that if you say `a ## b` to
create a token that is the name of a macro, the C preprocessor won't
expand that macro.  So you can't say this:

#define FOO__SQUARE(x) ((x)*(x))
#define FOO__CUBE(x)   ((x)*(x)*(x))
#define FOO(func, x)   FOO__##func(x)

Instead, the standard C trick is to add a layer of indirection:

#define PASTE(a,b)     PASTE__(a,b)
#define PASTE__(a,b)   a ## b

#define FOO__SQUARE(x) ((x)*(x))
#define FOO__CUBE(x)   ((x)*(x)*(x))
#define FOO(func, x)   PASTE(FOO__, func)(x)

We should use this kind of trick sparingly, since it gets confusing.
In our old design, we had to declare configuration structures (like
or_options_t) and variable tables (like option_vars_) separately,
and we used some magic to enforce their consistency (see
conftesting.h).

With this design, we write a single definition for the configuration
object and its fields, and use C macros to expand it either into a
structure, or a variable table.  Since they are both made from the
same source, they can't become inconsistent.

The two designs can coexist happily, and we can migrate from one to
the other at our convenience.
This version uses the enum rather than the type definitions, to
avoid layering violations and linking problems.
These settings allow doxygen to find and understand doxygen comments
in configuration definitions made using the macros in confdecl.h.
The subsysmgr code wants to use them.
We used to have only one boolean per subsystem, but we're about to
have a little more information.
The formats, when provided, are now added to the global config_mgr_t
objects.
These functions are in the subsystem, not in the config_format_t,
since they are about how the format is _used_, not about _what it
is_.
This is a comparatively simple change.
We still interpret "AccelName" as turning on the "HardwareAccel"
feature, but we no longer modify the user's options here.

Fixes bug 32382; bugfix on 0.2.2.1-alpha when we added openssl
engine support.
Instead, create a separate "has_config_suite" boolean, so that only
top-level formats with config_suites need to declare an offset at
all.
This also lets us test a failing set_options().
When we are failing because of a lack of a _required_ engine, note
that the engine was "required".

When engines are disabled, any required engine should cause a
failure.
@coveralls
Copy link

@coveralls coveralls commented Nov 7, 2019

Pull Request Test Coverage Report for Build 7134

  • 120 of 126 (95.24%) changed or added relevant lines in 9 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.06%) to 62.424%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/app/config/statefile.c 4 5 80.0%
src/app/main/subsysmgr.c 73 78 93.59%
Files with Coverage Reduction New Missed Lines %
src/feature/hs/hs_common.c 1 84.27%
Totals Coverage Status
Change from base Build 7133: 0.06%
Covered Lines: 48710
Relevant Lines: 78031

💛 - Coveralls

@torproject-pusher torproject-pusher merged commit de7053b into torproject:master Nov 7, 2019
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment