From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/2] state: refuse to set dirty parameter via setenv
Date: Tue, 6 Feb 2018 08:47:29 +0100 [thread overview]
Message-ID: <20180206074730.28084-1-s.hauer@pengutronix.de> (raw)
The dirty parameter is readonly, so refuse to set it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/state/state.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/common/state/state.c b/common/state/state.c
index 6399bd3736..5a1a1af856 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -153,6 +153,11 @@ void state_backend_set_readonly(struct state *state)
state_storage_set_readonly(&state->storage);
}
+static int state_set_deny(struct param_d *p, void *priv)
+{
+ return -EROFS;
+}
+
static struct state *state_new(const char *name)
{
struct state *state;
@@ -172,7 +177,7 @@ static struct state *state_new(const char *name)
}
state->dirty = 1;
- dev_add_param_bool(&state->dev, "dirty", NULL, NULL, &state->dirty,
+ dev_add_param_bool(&state->dev, "dirty", state_set_deny, NULL, &state->dirty,
NULL);
state->save_on_shutdown = 1;
dev_add_param_bool(&state->dev, "save_on_shutdown", NULL, NULL,
--
2.15.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2018-02-06 7:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-06 7:47 Sascha Hauer [this message]
2018-02-06 7:47 ` [PATCH 2/2] state: Add 'init_from_defaults' parameter Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180206074730.28084-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox