mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Make foo_validate() functions call config_validate().
The former foo_validate() functions are now toplevel legacy_validate_fn callbacks. The new foo_validate() functions now call them. This change lets us remove the old shared_random disk state validation callback entirely.
This commit is contained in:
@@ -59,9 +59,6 @@ DUMMY_TYPECHECK_INSTANCE(sr_disk_state_t);
|
||||
/** Our persistent state magic number. */
|
||||
#define SR_DISK_STATE_MAGIC 0x98AB1254
|
||||
|
||||
static int
|
||||
disk_state_validate_cb(const void *old_state, void *state, char **msg);
|
||||
|
||||
/** Array of variables that are saved to disk as a persistent state. */
|
||||
static const config_var_t state_vars[] = {
|
||||
V(Version, POSINT, "0"),
|
||||
@@ -94,7 +91,6 @@ static const config_format_t state_format = {
|
||||
offsetof(sr_disk_state_t, magic_),
|
||||
},
|
||||
.vars = state_vars,
|
||||
.legacy_validate_fn = disk_state_validate_cb,
|
||||
.extra = &state_extra_var,
|
||||
.config_suite_offset = -1,
|
||||
};
|
||||
@@ -339,21 +335,6 @@ disk_state_validate(const sr_disk_state_t *state)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Validate the disk state (NOP for now). */
|
||||
static int
|
||||
disk_state_validate_cb(const void *old_state, void *state, char **msg)
|
||||
{
|
||||
/* We don't use these; only options do. */
|
||||
(void) old_state;
|
||||
|
||||
/* This is called by config_dump which is just before we are about to
|
||||
* write it to disk. At that point, our global memory state has been
|
||||
* copied to the disk state so it's fair to assume it's trustable. */
|
||||
(void) state;
|
||||
(void) msg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Parse the Commit line(s) in the disk state and translate them to the
|
||||
* the memory state. Return 0 on success else -1 on error. */
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user