Commit c38c5a7f authored by Richard Weinberger's avatar Richard Weinberger

ubifs: Allow setting assert action as mount parameter

Expose our three options to userspace.
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 2e52eb74
...@@ -56,3 +56,14 @@ void ubifs_warn(const struct ubifs_info *c, const char *fmt, ...) ...@@ -56,3 +56,14 @@ void ubifs_warn(const struct ubifs_info *c, const char *fmt, ...)
va_end(args); va_end(args);
} }
static char *assert_names[] = {
[ASSACT_REPORT] = "report",
[ASSACT_RO] = "read-only",
[ASSACT_PANIC] = "panic",
};
const char *ubifs_assert_action_name(struct ubifs_info *c)
{
return assert_names[c->assert_action];
}
...@@ -287,4 +287,6 @@ static inline int ubifs_next_log_lnum(const struct ubifs_info *c, int lnum) ...@@ -287,4 +287,6 @@ static inline int ubifs_next_log_lnum(const struct ubifs_info *c, int lnum)
return lnum; return lnum;
} }
const char *ubifs_assert_action_name(struct ubifs_info *c);
#endif /* __UBIFS_MISC_H__ */ #endif /* __UBIFS_MISC_H__ */
...@@ -445,6 +445,7 @@ static int ubifs_show_options(struct seq_file *s, struct dentry *root) ...@@ -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)); 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); seq_printf(s, ",ubi=%d,vol=%d", c->vi.ubi_num, c->vi.vol_id);
return 0; return 0;
...@@ -922,6 +923,7 @@ static int check_volume_empty(struct ubifs_info *c) ...@@ -922,6 +923,7 @@ static int check_volume_empty(struct ubifs_info *c)
* Opt_chk_data_crc: check CRCs when reading data nodes * Opt_chk_data_crc: check CRCs when reading data nodes
* Opt_no_chk_data_crc: do not 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_override_compr: override default compressor
* Opt_assert: set ubifs_assert() action
* Opt_err: just end of array marker * Opt_err: just end of array marker
*/ */
enum { enum {
...@@ -932,6 +934,7 @@ enum { ...@@ -932,6 +934,7 @@ enum {
Opt_chk_data_crc, Opt_chk_data_crc,
Opt_no_chk_data_crc, Opt_no_chk_data_crc,
Opt_override_compr, Opt_override_compr,
Opt_assert,
Opt_ignore, Opt_ignore,
Opt_err, Opt_err,
}; };
...@@ -946,6 +949,7 @@ static const match_table_t tokens = { ...@@ -946,6 +949,7 @@ static const match_table_t tokens = {
{Opt_override_compr, "compr=%s"}, {Opt_override_compr, "compr=%s"},
{Opt_ignore, "ubi=%s"}, {Opt_ignore, "ubi=%s"},
{Opt_ignore, "vol=%s"}, {Opt_ignore, "vol=%s"},
{Opt_assert, "assert=%s"},
{Opt_err, NULL}, {Opt_err, NULL},
}; };
...@@ -1046,6 +1050,26 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, ...@@ -1046,6 +1050,26 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
c->default_compr = c->mount_opts.compr_type; c->default_compr = c->mount_opts.compr_type;
break; 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: case Opt_ignore:
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment