[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Refactor "OBSOLETE" type
commit a08969e460af2834c037761e96e2c1e9fedf5b14
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Thu Nov 7 09:25:56 2019 -0500
Refactor "OBSOLETE" type
It no longer warns, and is now defined in terms of an "IGNORE" type.
(The "IGNORE" type is the same as "OBSOLETE", except that it is not
reported as obsolete. It should be useful for disabled modules.)
Closes ticket 32404.
---
changes/ticket32404 | 5 +++++
src/lib/conf/confdecl.h | 1 +
src/lib/conf/conftypes.h | 3 ++-
src/lib/confmgt/type_defs.c | 15 +++++++--------
4 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/changes/ticket32404 b/changes/ticket32404
new file mode 100644
index 000000000..1bffbc652
--- /dev/null
+++ b/changes/ticket32404
@@ -0,0 +1,5 @@
+ o Minor features (configuration):
+ - We use a flag-driven logic to warn about obsolete configuration fields,
+ so that we can include their names. In 0.4.2, we used
+ a special type, which prevented us from generating good warnings.
+ Implements ticket 32404.
diff --git a/src/lib/conf/confdecl.h b/src/lib/conf/confdecl.h
index 19b6f8509..e16515575 100644
--- a/src/lib/conf/confdecl.h
+++ b/src/lib/conf/confdecl.h
@@ -191,6 +191,7 @@ extern const struct var_type_def_t CSV_INTERVAL_type_defn;
extern const struct var_type_def_t LINELIST_type_defn;
extern const struct var_type_def_t LINELIST_V_type_defn;
extern const struct var_type_def_t LINELIST_S_type_defn;
+extern const struct var_type_def_t IGNORE_type_defn;
extern const struct var_type_def_t OBSOLETE_type_defn;
/**@}*/
diff --git a/src/lib/conf/conftypes.h b/src/lib/conf/conftypes.h
index bf748efbb..ea1c8d476 100644
--- a/src/lib/conf/conftypes.h
+++ b/src/lib/conf/conftypes.h
@@ -64,7 +64,8 @@ typedef enum config_type_t {
CONFIG_TYPE_LINELIST_V, /**< Catch-all "virtual" option to summarize
* context-sensitive config lines when fetching.
*/
- CONFIG_TYPE_OBSOLETE, /**< Obsolete (ignored) option. */
+ CONFIG_TYPE_OBSOLETE, /**< Ignored (obsolete) option. Uses no storage. */
+ CONFIG_TYPE_IGNORE, /**< Ignored option. Uses no storage. */
/**
* Extended type: definition appears in the <b>type_def</b> pointer
* of the corresponding struct_member_t.
diff --git a/src/lib/confmgt/type_defs.c b/src/lib/confmgt/type_defs.c
index 0bf82ee93..7200218f7 100644
--- a/src/lib/confmgt/type_defs.c
+++ b/src/lib/confmgt/type_defs.c
@@ -682,17 +682,13 @@ static const var_type_fns_t linelist_s_fns = {
/////
// CONFIG_TYPE_ROUTERSET
//
-// XXXX This type is not implemented here, since routerset_t is not available
// XXXX to this module.
/////
/////
-// CONFIG_TYPE_OBSOLETE
+// CONFIG_TYPE_IGNORE
//
-// Used to indicate an obsolete option.
-//
-// XXXX This is not a type, and should be handled at a higher level of
-// XXXX abstraction.
+// Used to indicate an option that cannot be stored or encoded.
/////
static int
@@ -703,8 +699,6 @@ ignore_parse(void *target, const char *value, char **errmsg,
(void)value;
(void)errmsg;
(void)params;
- // XXXX move this to a higher level, once such a level exists.
- log_warn(LD_GENERAL, "Skipping obsolete configuration option.");
return 0;
}
@@ -774,6 +768,10 @@ const var_type_def_t LINELIST_S_type_defn = {
const var_type_def_t LINELIST_V_type_defn = {
.name="Virtual", .fns=&linelist_v_fns,
.flags=CFLG_NOREPLACE|CFLG_NOSET };
+const var_type_def_t IGNORE_type_defn = {
+ .name="Ignored", .fns=&ignore_fns,
+ .flags=CFLG_NOCOPY|CFLG_NOCMP|CFLG_NODUMP|CFLG_NOSET,
+};
const var_type_def_t OBSOLETE_type_defn = {
.name="Obsolete", .fns=&ignore_fns,
.flags=CFLG_GROUP_OBSOLETE,
@@ -800,6 +798,7 @@ static const var_type_def_t *type_definitions_table[] = {
[CONFIG_TYPE_LINELIST] = &LINELIST_type_defn,
[CONFIG_TYPE_LINELIST_S] = &LINELIST_S_type_defn,
[CONFIG_TYPE_LINELIST_V] = &LINELIST_V_type_defn,
+ [CONFIG_TYPE_IGNORE] = &IGNORE_type_defn,
[CONFIG_TYPE_OBSOLETE] = &OBSOLETE_type_defn,
};
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits