mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
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>
This commit is contained in:
parent
f8ad9c4bae
commit
c7f404b40a
@ -978,7 +978,13 @@ static int show_vfsmnt(struct seq_file *m, void *v)
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
||||||
|
|
||||||
mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
|
if (mnt->mnt_sb->s_op->show_devname) {
|
||||||
|
err = mnt->mnt_sb->s_op->show_devname(m, mnt);
|
||||||
|
if (err)
|
||||||
|
goto out;
|
||||||
|
} else {
|
||||||
|
mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
|
||||||
|
}
|
||||||
seq_putc(m, ' ');
|
seq_putc(m, ' ');
|
||||||
seq_path(m, &mnt_path, " \t\n\\");
|
seq_path(m, &mnt_path, " \t\n\\");
|
||||||
seq_putc(m, ' ');
|
seq_putc(m, ' ');
|
||||||
@ -1025,7 +1031,12 @@ static int show_mountinfo(struct seq_file *m, void *v)
|
|||||||
|
|
||||||
seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, mnt->mnt_parent->mnt_id,
|
seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, mnt->mnt_parent->mnt_id,
|
||||||
MAJOR(sb->s_dev), MINOR(sb->s_dev));
|
MAJOR(sb->s_dev), MINOR(sb->s_dev));
|
||||||
seq_dentry(m, mnt->mnt_root, " \t\n\\");
|
if (sb->s_op->show_path)
|
||||||
|
err = sb->s_op->show_path(m, mnt);
|
||||||
|
else
|
||||||
|
seq_dentry(m, mnt->mnt_root, " \t\n\\");
|
||||||
|
if (err)
|
||||||
|
goto out;
|
||||||
seq_putc(m, ' ');
|
seq_putc(m, ' ');
|
||||||
seq_path_root(m, &mnt_path, &root, " \t\n\\");
|
seq_path_root(m, &mnt_path, &root, " \t\n\\");
|
||||||
if (root.mnt != p->root.mnt || root.dentry != p->root.dentry) {
|
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)
|
|||||||
seq_puts(m, " - ");
|
seq_puts(m, " - ");
|
||||||
show_type(m, sb);
|
show_type(m, sb);
|
||||||
seq_putc(m, ' ');
|
seq_putc(m, ' ');
|
||||||
mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
|
if (sb->s_op->show_devname)
|
||||||
|
err = sb->s_op->show_devname(m, mnt);
|
||||||
|
else
|
||||||
|
mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
|
||||||
|
if (err)
|
||||||
|
goto out;
|
||||||
seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
|
seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
|
||||||
err = show_sb_opts(m, sb);
|
err = show_sb_opts(m, sb);
|
||||||
if (err)
|
if (err)
|
||||||
@ -1086,11 +1102,15 @@ static int show_vfsstat(struct seq_file *m, void *v)
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
/* device */
|
/* device */
|
||||||
if (mnt->mnt_devname) {
|
if (mnt->mnt_sb->s_op->show_devname) {
|
||||||
seq_puts(m, "device ");
|
err = mnt->mnt_sb->s_op->show_devname(m, mnt);
|
||||||
mangle(m, mnt->mnt_devname);
|
} else {
|
||||||
} else
|
if (mnt->mnt_devname) {
|
||||||
seq_puts(m, "no device");
|
seq_puts(m, "device ");
|
||||||
|
mangle(m, mnt->mnt_devname);
|
||||||
|
} else
|
||||||
|
seq_puts(m, "no device");
|
||||||
|
}
|
||||||
|
|
||||||
/* mount point */
|
/* mount point */
|
||||||
seq_puts(m, " mounted on ");
|
seq_puts(m, " mounted on ");
|
||||||
@ -1104,7 +1124,8 @@ static int show_vfsstat(struct seq_file *m, void *v)
|
|||||||
/* optional statistics */
|
/* optional statistics */
|
||||||
if (mnt->mnt_sb->s_op->show_stats) {
|
if (mnt->mnt_sb->s_op->show_stats) {
|
||||||
seq_putc(m, ' ');
|
seq_putc(m, ' ');
|
||||||
err = mnt->mnt_sb->s_op->show_stats(m, mnt);
|
if (!err)
|
||||||
|
err = mnt->mnt_sb->s_op->show_stats(m, mnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
seq_putc(m, '\n');
|
seq_putc(m, '\n');
|
||||||
|
@ -263,6 +263,8 @@ static match_table_t nfs_local_lock_tokens = {
|
|||||||
static void nfs_umount_begin(struct super_block *);
|
static void nfs_umount_begin(struct super_block *);
|
||||||
static int nfs_statfs(struct dentry *, struct kstatfs *);
|
static int nfs_statfs(struct dentry *, struct kstatfs *);
|
||||||
static int nfs_show_options(struct seq_file *, struct vfsmount *);
|
static int nfs_show_options(struct seq_file *, struct vfsmount *);
|
||||||
|
static int nfs_show_devname(struct seq_file *, struct vfsmount *);
|
||||||
|
static int nfs_show_path(struct seq_file *, struct vfsmount *);
|
||||||
static int nfs_show_stats(struct seq_file *, struct vfsmount *);
|
static int nfs_show_stats(struct seq_file *, struct vfsmount *);
|
||||||
static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *);
|
static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *);
|
||||||
static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type,
|
static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type,
|
||||||
@ -296,6 +298,8 @@ static const struct super_operations nfs_sops = {
|
|||||||
.evict_inode = nfs_evict_inode,
|
.evict_inode = nfs_evict_inode,
|
||||||
.umount_begin = nfs_umount_begin,
|
.umount_begin = nfs_umount_begin,
|
||||||
.show_options = nfs_show_options,
|
.show_options = nfs_show_options,
|
||||||
|
.show_devname = nfs_show_devname,
|
||||||
|
.show_path = nfs_show_path,
|
||||||
.show_stats = nfs_show_stats,
|
.show_stats = nfs_show_stats,
|
||||||
.remount_fs = nfs_remount,
|
.remount_fs = nfs_remount,
|
||||||
};
|
};
|
||||||
@ -366,6 +370,8 @@ static const struct super_operations nfs4_sops = {
|
|||||||
.evict_inode = nfs4_evict_inode,
|
.evict_inode = nfs4_evict_inode,
|
||||||
.umount_begin = nfs_umount_begin,
|
.umount_begin = nfs_umount_begin,
|
||||||
.show_options = nfs_show_options,
|
.show_options = nfs_show_options,
|
||||||
|
.show_devname = nfs_show_devname,
|
||||||
|
.show_path = nfs_show_path,
|
||||||
.show_stats = nfs_show_stats,
|
.show_stats = nfs_show_stats,
|
||||||
.remount_fs = nfs_remount,
|
.remount_fs = nfs_remount,
|
||||||
};
|
};
|
||||||
@ -726,6 +732,28 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int nfs_show_devname(struct seq_file *m, struct vfsmount *mnt)
|
||||||
|
{
|
||||||
|
char *page = (char *) __get_free_page(GFP_KERNEL);
|
||||||
|
char *devname, *dummy;
|
||||||
|
int err = 0;
|
||||||
|
if (!page)
|
||||||
|
return -ENOMEM;
|
||||||
|
devname = nfs_path(&dummy, mnt->mnt_root, page, PAGE_SIZE);
|
||||||
|
if (IS_ERR(devname))
|
||||||
|
err = PTR_ERR(devname);
|
||||||
|
else
|
||||||
|
seq_escape(m, devname, " \t\n\\");
|
||||||
|
free_page((unsigned long)page);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int nfs_show_path(struct seq_file *m, struct vfsmount *mnt)
|
||||||
|
{
|
||||||
|
seq_puts(m, "/");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Present statistical information for this VFS mountpoint
|
* Present statistical information for this VFS mountpoint
|
||||||
*/
|
*/
|
||||||
|
@ -1632,6 +1632,8 @@ struct super_operations {
|
|||||||
void (*umount_begin) (struct super_block *);
|
void (*umount_begin) (struct super_block *);
|
||||||
|
|
||||||
int (*show_options)(struct seq_file *, struct vfsmount *);
|
int (*show_options)(struct seq_file *, struct vfsmount *);
|
||||||
|
int (*show_devname)(struct seq_file *, struct vfsmount *);
|
||||||
|
int (*show_path)(struct seq_file *, struct vfsmount *);
|
||||||
int (*show_stats)(struct seq_file *, struct vfsmount *);
|
int (*show_stats)(struct seq_file *, struct vfsmount *);
|
||||||
#ifdef CONFIG_QUOTA
|
#ifdef CONFIG_QUOTA
|
||||||
ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
|
ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user