summaryrefslogtreecommitdiff
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2018-07-12 14:01:59 +0300
committerRichard Weinberger <richard@nod.at>2018-08-15 01:25:21 +0300
commitc38c5a7f2e5056555c22e7603c2151b118f3a494 (patch)
tree3b1b99d7cf709d3c0196b2304383277d8d4dcb85 /fs/ubifs/super.c
parent2e52eb74463f15c745d64948cedfaee722d6268c (diff)
downloadlinux-c38c5a7f2e5056555c22e7603c2151b118f3a494.tar.xz
ubifs: Allow setting assert action as mount parameter
Expose our three options to userspace. Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r--fs/ubifs/super.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index df73b0e1c2f7..c31e7b4f1e1c 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -445,6 +445,7 @@ static int ubifs_show_options(struct seq_file *s, struct dentry *root)
ubifs_compr_name(c, c->mount_opts.compr_type));
}
+ seq_printf(s, ",assert=%s", ubifs_assert_action_name(c));
seq_printf(s, ",ubi=%d,vol=%d", c->vi.ubi_num, c->vi.vol_id);
return 0;
@@ -922,6 +923,7 @@ static int check_volume_empty(struct ubifs_info *c)
* Opt_chk_data_crc: check CRCs when reading data nodes
* Opt_no_chk_data_crc: do not check CRCs when reading data nodes
* Opt_override_compr: override default compressor
+ * Opt_assert: set ubifs_assert() action
* Opt_err: just end of array marker
*/
enum {
@@ -932,6 +934,7 @@ enum {
Opt_chk_data_crc,
Opt_no_chk_data_crc,
Opt_override_compr,
+ Opt_assert,
Opt_ignore,
Opt_err,
};
@@ -946,6 +949,7 @@ static const match_table_t tokens = {
{Opt_override_compr, "compr=%s"},
{Opt_ignore, "ubi=%s"},
{Opt_ignore, "vol=%s"},
+ {Opt_assert, "assert=%s"},
{Opt_err, NULL},
};
@@ -1046,6 +1050,26 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
c->default_compr = c->mount_opts.compr_type;
break;
}
+ case Opt_assert:
+ {
+ char *act = match_strdup(&args[0]);
+
+ if (!act)
+ return -ENOMEM;
+ if (!strcmp(act, "report"))
+ c->assert_action = ASSACT_REPORT;
+ else if (!strcmp(act, "read-only"))
+ c->assert_action = ASSACT_RO;
+ else if (!strcmp(act, "panic"))
+ c->assert_action = ASSACT_PANIC;
+ else {
+ ubifs_err(c, "unknown assert action \"%s\"", act);
+ kfree(act);
+ return -EINVAL;
+ }
+ kfree(act);
+ break;
+ }
case Opt_ignore:
break;
default: