@@ -445,6 +445,7 @@ static int ubifs_show_options(struct seq_file *s, struct dentry *root)
445445 ubifs_compr_name (c , c -> mount_opts .compr_type ));
446446 }
447447
448+ seq_printf (s , ",assert=%s" , ubifs_assert_action_name (c ));
448449 seq_printf (s , ",ubi=%d,vol=%d" , c -> vi .ubi_num , c -> vi .vol_id );
449450
450451 return 0 ;
@@ -922,6 +923,7 @@ static int check_volume_empty(struct ubifs_info *c)
922923 * Opt_chk_data_crc: check CRCs when reading data nodes
923924 * Opt_no_chk_data_crc: do not check CRCs when reading data nodes
924925 * Opt_override_compr: override default compressor
926+ * Opt_assert: set ubifs_assert() action
925927 * Opt_err: just end of array marker
926928 */
927929enum {
@@ -932,6 +934,7 @@ enum {
932934 Opt_chk_data_crc ,
933935 Opt_no_chk_data_crc ,
934936 Opt_override_compr ,
937+ Opt_assert ,
935938 Opt_ignore ,
936939 Opt_err ,
937940};
@@ -946,6 +949,7 @@ static const match_table_t tokens = {
946949 {Opt_override_compr , "compr=%s" },
947950 {Opt_ignore , "ubi=%s" },
948951 {Opt_ignore , "vol=%s" },
952+ {Opt_assert , "assert=%s" },
949953 {Opt_err , NULL },
950954};
951955
@@ -1046,6 +1050,26 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
10461050 c -> default_compr = c -> mount_opts .compr_type ;
10471051 break ;
10481052 }
1053+ case Opt_assert :
1054+ {
1055+ char * act = match_strdup (& args [0 ]);
1056+
1057+ if (!act )
1058+ return - ENOMEM ;
1059+ if (!strcmp (act , "report" ))
1060+ c -> assert_action = ASSACT_REPORT ;
1061+ else if (!strcmp (act , "read-only" ))
1062+ c -> assert_action = ASSACT_RO ;
1063+ else if (!strcmp (act , "panic" ))
1064+ c -> assert_action = ASSACT_PANIC ;
1065+ else {
1066+ ubifs_err (c , "unknown assert action \"%s\"" , act );
1067+ kfree (act );
1068+ return - EINVAL ;
1069+ }
1070+ kfree (act );
1071+ break ;
1072+ }
10491073 case Opt_ignore :
10501074 break ;
10511075 default :
0 commit comments