Commit dd2cc4dff3b08ab54c4c177a080046bcc84ac41d

Authored by Miklos Szeredi
Committed by Linus Torvalds
1 parent d1875dbaa5

mount options: fix hostfs

Add the "host path" option to /proc/mounts for UML hostfs filesystems.

The mount source (mnt_devname) should really be used for this, but not
easy to change now in a backward compatible way.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 14 additions and 0 deletions Side-by-side Diff

fs/hostfs/hostfs_kern.c
... ... @@ -11,6 +11,7 @@
11 11 #include <linux/mm.h>
12 12 #include <linux/pagemap.h>
13 13 #include <linux/statfs.h>
  14 +#include <linux/seq_file.h>
14 15 #include "hostfs.h"
15 16 #include "init.h"
16 17 #include "kern.h"
17 18  
... ... @@ -322,12 +323,25 @@
322 323 kfree(HOSTFS_I(inode));
323 324 }
324 325  
  326 +static int hostfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
  327 +{
  328 + struct inode *root = vfs->mnt_sb->s_root->d_inode;
  329 + const char *root_path = HOSTFS_I(root)->host_filename;
  330 + size_t offset = strlen(root_ino) + 1;
  331 +
  332 + if (strlen(root_path) > offset)
  333 + seq_printf(seq, ",%s", root_path + offset);
  334 +
  335 + return 0;
  336 +}
  337 +
325 338 static const struct super_operations hostfs_sbops = {
326 339 .alloc_inode = hostfs_alloc_inode,
327 340 .drop_inode = generic_delete_inode,
328 341 .delete_inode = hostfs_delete_inode,
329 342 .destroy_inode = hostfs_destroy_inode,
330 343 .statfs = hostfs_statfs,
  344 + .show_options = hostfs_show_options,
331 345 };
332 346  
333 347 int hostfs_readdir(struct file *file, void *ent, filldir_t filldir)