[Devel] [PATCH rh7] ve: Strip unset options in ve.mount_opts

Kirill Tkhai ktkhai at odin.com
Mon Oct 12 05:16:03 PDT 2015


Igor reports "(null)" in not set options may confuse user:

echo "0 182:223361;1 balloon_ino=12,pfcache_csum,,2: (null);"

The patch removes not set options from there:

echo "0 182:223361;1 balloon_ino=12,pfcache_csum,,;"

N.B. No any problem there, because *printf handles
zero strings for a long time.

Requested-by: Igor Sukhih <igor at odin.com>
Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
---
 kernel/ve/ve.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 12cfa33..39a95e8 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -906,9 +906,12 @@ static int ve_mount_opts_show(struct seq_file *m, void *v)
 	struct ve_devmnt *devmnt = v;
 	dev_t dev = devmnt->dev;
 
-	seq_printf(m, "0 %u:%u;1 %s;2 %s;\n", MAJOR(dev), MINOR(dev),
-					      devmnt->hidden_options,
-					      devmnt->allowed_options);
+	seq_printf(m, "0 %u:%u;", MAJOR(dev), MINOR(dev));
+	if (devmnt->hidden_options)
+		seq_printf(m, "1 %s;", devmnt->hidden_options);
+	if (devmnt->allowed_options)
+		seq_printf(m, "2 %s;", devmnt->allowed_options);
+	seq_putc(m, '\n');
 	return 0;
 }
 




More information about the Devel mailing list