aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-03-16 06:59:40 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-16 16:48:06 -0400
commitc7f404b40a3665d9f4e9a927cc5c1ee0479ed8f9 (patch)
tree2d6fa2bef00efa759f36b17f3be0d4fab3ac9bb5 /fs/namespace.c
parentf8ad9c4bae99854c961ca79ed130a0d11d9ab53c (diff)
vfs: new superblock methods to override /proc/*/mount{s,info}
a) ->show_devname(m, mnt) - what to put into devname columns in mounts, mountinfo and mountstats b) ->show_path(m, mnt) - what to put into relative path column in mountinfo Leaving those NULL gives old behaviour. NFS switched to using those. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index dffe6f49ab93..75d843ae46d2 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -978,7 +978,13 @@ static int show_vfsmnt(struct seq_file *m, void *v)
978 int err = 0; 978 int err = 0;
979 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; 979 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
980 980
981 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); 981 if (mnt->mnt_sb->s_op->show_devname) {
982 err = mnt->mnt_sb->s_op->show_devname(m, mnt);
983 if (err)
984 goto out;
985 } else {
986 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
987 }
982 seq_putc(m, ' '); 988 seq_putc(m, ' ');
983 seq_path(m, &mnt_path, " \t\n\\"); 989 seq_path(m, &mnt_path, " \t\n\\");
984 seq_putc(m, ' '); 990 seq_putc(m, ' ');
@@ -1025,7 +1031,12 @@ static int show_mountinfo(struct seq_file *m, void *v)
1025 1031
1026 seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, mnt->mnt_parent->mnt_id, 1032 seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, mnt->mnt_parent->mnt_id,
1027 MAJOR(sb->s_dev), MINOR(sb->s_dev)); 1033 MAJOR(sb->s_dev), MINOR(sb->s_dev));
1028 seq_dentry(m, mnt->mnt_root, " \t\n\\"); 1034 if (sb->s_op->show_path)
1035 err = sb->s_op->show_path(m, mnt);
1036 else
1037 seq_dentry(m, mnt->mnt_root, " \t\n\\");
1038 if (err)
1039 goto out;
1029 seq_putc(m, ' '); 1040 seq_putc(m, ' ');
1030 seq_path_root(m, &mnt_path, &root, " \t\n\\"); 1041 seq_path_root(m, &mnt_path, &root, " \t\n\\");
1031 if (root.mnt != p->root.mnt || root.dentry != p->root.dentry) { 1042 if (root.mnt != p->root.mnt || root.dentry != p->root.dentry) {
@@ -1060,7 +1071,12 @@ static int show_mountinfo(struct seq_file *m, void *v)
1060 seq_puts(m, " - "); 1071 seq_puts(m, " - ");
1061 show_type(m, sb); 1072 show_type(m, sb);
1062 seq_putc(m, ' '); 1073 seq_putc(m, ' ');
1063 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); 1074 if (sb->s_op->show_devname)
1075 err = sb->s_op->show_devname(m, mnt);
1076 else
1077 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
1078 if (err)
1079 goto out;
1064 seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw"); 1080 seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
1065 err = show_sb_opts(m, sb); 1081 err = show_sb_opts(m, sb);
1066 if (err) 1082 if (err)
@@ -1086,11 +1102,15 @@ static int show_vfsstat(struct seq_file *m, void *v)
1086 int err = 0; 1102 int err = 0;
1087 1103
1088 /* device */ 1104 /* device */
1089 if (mnt->mnt_devname) { 1105 if (mnt->mnt_sb->s_op->show_devname) {
1090 seq_puts(m, "device "); 1106 err = mnt->mnt_sb->s_op->show_devname(m, mnt);
1091 mangle(m, mnt->mnt_devname); 1107 } else {
1092 } else 1108 if (mnt->mnt_devname) {
1093 seq_puts(m, "no device"); 1109 seq_puts(m, "device ");
1110 mangle(m, mnt->mnt_devname);
1111 } else
1112 seq_puts(m, "no device");
1113 }
1094 1114
1095 /* mount point */ 1115 /* mount point */
1096 seq_puts(m, " mounted on "); 1116 seq_puts(m, " mounted on ");
@@ -1104,7 +1124,8 @@ static int show_vfsstat(struct seq_file *m, void *v)
1104 /* optional statistics */ 1124 /* optional statistics */
1105 if (mnt->mnt_sb->s_op->show_stats) { 1125 if (mnt->mnt_sb->s_op->show_stats) {
1106 seq_putc(m, ' '); 1126 seq_putc(m, ' ');
1107 err = mnt->mnt_sb->s_op->show_stats(m, mnt); 1127 if (!err)
1128 err = mnt->mnt_sb->s_op->show_stats(m, mnt);
1108 } 1129 }
1109 1130
1110 seq_putc(m, '\n'); 1131 seq_putc(m, '\n');