aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRabin Vincent <rabinv@axis.com>2017-05-31 05:40:27 -0400
committerRichard Weinberger <richard@nod.at>2017-07-14 16:49:07 -0400
commit319c10427498620d220931189dcdba7d4244feba (patch)
treec71a55321e009fb633e7ac6e170627265485d8fe
parenta02a6eba9999221b27c691330e93bb54e4b45bb0 (diff)
ubifs: allow userspace to map mounts to volumes
There currently appears to be no way for userspace to find out the underlying volume number for a mounted ubifs file system, since ubifs uses anonymous block devices. The volume name is present in /proc/mounts but UBI volumes can be renamed after the volume has been mounted. To remedy this, show the UBI number and UBI volume number as part of the options visible under /proc/mounts. Also, accept and ignore the ubi= vol= options if they are used mounting (patch from Richard Weinberger). # mount -t ubifs ubi:baz x # mount ubi:baz on /root/x type ubifs (rw,relatime,ubi=0,vol=2) # ubirename /dev/ubi0 baz bazz # mount ubi:baz on /root/x type ubifs (rw,relatime,ubi=0,vol=2) # ubinfo -d 0 -n 2 Volume ID: 2 (on ubi0) Type: dynamic Alignment: 1 Size: 67 LEBs (1063424 bytes, 1.0 MiB) State: OK Name: bazz Character device major/minor: 254:3 Signed-off-by: Rabin Vincent <rabinv@axis.com> Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--fs/ubifs/super.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index ce684f367f9c..845c5d7af909 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -446,6 +446,8 @@ static int ubifs_show_options(struct seq_file *s, struct dentry *root)
446 ubifs_compr_name(c->mount_opts.compr_type)); 446 ubifs_compr_name(c->mount_opts.compr_type));
447 } 447 }
448 448
449 seq_printf(s, ",ubi=%d,vol=%d", c->vi.ubi_num, c->vi.vol_id);
450
449 return 0; 451 return 0;
450} 452}
451 453
@@ -931,6 +933,7 @@ enum {
931 Opt_chk_data_crc, 933 Opt_chk_data_crc,
932 Opt_no_chk_data_crc, 934 Opt_no_chk_data_crc,
933 Opt_override_compr, 935 Opt_override_compr,
936 Opt_ignore,
934 Opt_err, 937 Opt_err,
935}; 938};
936 939
@@ -942,6 +945,8 @@ static const match_table_t tokens = {
942 {Opt_chk_data_crc, "chk_data_crc"}, 945 {Opt_chk_data_crc, "chk_data_crc"},
943 {Opt_no_chk_data_crc, "no_chk_data_crc"}, 946 {Opt_no_chk_data_crc, "no_chk_data_crc"},
944 {Opt_override_compr, "compr=%s"}, 947 {Opt_override_compr, "compr=%s"},
948 {Opt_ignore, "ubi=%s"},
949 {Opt_ignore, "vol=%s"},
945 {Opt_err, NULL}, 950 {Opt_err, NULL},
946}; 951};
947 952
@@ -1042,6 +1047,8 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
1042 c->default_compr = c->mount_opts.compr_type; 1047 c->default_compr = c->mount_opts.compr_type;
1043 break; 1048 break;
1044 } 1049 }
1050 case Opt_ignore:
1051 break;
1045 default: 1052 default:
1046 { 1053 {
1047 unsigned long flag; 1054 unsigned long flag;