summaryrefslogtreecommitdiffstats
path: root/src/barebox-state.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-29 14:35:04 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-31 13:57:59 +0200
commit51d390cc2c7e41bc7778c6010cc62664239ce88d (patch)
treeb95d4b47b07bd1838a5222d289cb93833b037b4a /src/barebox-state.c
parent99335922839a3f11895d0f8c2424a9bed61d5da1 (diff)
downloaddt-utils-51d390cc2c7e41bc7778c6010cc62664239ce88d.tar.gz
dt-utils-51d390cc2c7e41bc7778c6010cc62664239ce88d.tar.xz
barebox-state: implement skipping authentification (again)
Implement authentification again, this time wihtout the need of passing a "force" argument through half of the function call stack. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'src/barebox-state.c')
-rw-r--r--src/barebox-state.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/barebox-state.c b/src/barebox-state.c
index 5399209..4bd77cf 100644
--- a/src/barebox-state.c
+++ b/src/barebox-state.c
@@ -308,7 +308,7 @@ static int state_set_var(struct state *state, const char *var, const char *val)
}
-struct state *state_get(const char *name, bool readonly)
+struct state *state_get(const char *name, bool readonly, bool auth)
{
struct device_node *root, *node, *partition_node;
char *path;
@@ -368,7 +368,11 @@ struct state *state_get(const char *name, bool readonly)
return ERR_CAST(state);
}
- ret = state_load(state);
+ if (auth)
+ ret = state_load(state);
+ else
+ ret = state_load_no_auth(state);
+
if (ret)
pr_err("Failed to load persistent state, continuing with defaults, %d\n", ret);
@@ -433,12 +437,13 @@ int main(int argc, char *argv[])
int nr_states = 0;
bool readonly = true;
int pr_level = 5;
+ int auth = 1;
INIT_LIST_HEAD(&sg_list);
INIT_LIST_HEAD(&state_list.list);
while (1) {
- c = getopt_long(argc, argv, "hg:s:dvn:q", long_options, &option_index);
+ c = getopt_long(argc, argv, "hg:s:dvn:qf", long_options, &option_index);
if (c < 0)
break;
switch (c) {
@@ -458,6 +463,9 @@ int main(int argc, char *argv[])
list_add_tail(&sg->list, &sg_list);
readonly = false;
break;
+ case 'f':
+ auth = 0;
+ break;
case 'd':
do_dump = 1;
break;