Commit c32c2f63 authored by Jan Blunck's avatar Jan Blunck Committed by Linus Torvalds

d_path: Make seq_path() use a struct path argument

seq_path() is always called with a dentry and a vfsmount from a struct path.
Make seq_path() take it directly as an argument.
Signed-off-by: default avatarJan Blunck <jblunck@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e83aece3
...@@ -5197,8 +5197,7 @@ static int md_seq_show(struct seq_file *seq, void *v) ...@@ -5197,8 +5197,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
chunk_kb ? "KB" : "B"); chunk_kb ? "KB" : "B");
if (bitmap->file) { if (bitmap->file) {
seq_printf(seq, ", file: "); seq_printf(seq, ", file: ");
seq_path(seq, bitmap->file->f_path.mnt, seq_path(seq, &bitmap->file->f_path, " \t\n");
bitmap->file->f_path.dentry," \t\n");
} }
seq_printf(seq, "\n"); seq_printf(seq, "\n");
......
...@@ -408,10 +408,11 @@ static int show_vfsmnt(struct seq_file *m, void *v) ...@@ -408,10 +408,11 @@ static int show_vfsmnt(struct seq_file *m, void *v)
{ 0, NULL } { 0, NULL }
}; };
struct proc_fs_info *fs_infop; struct proc_fs_info *fs_infop;
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
seq_putc(m, ' '); seq_putc(m, ' ');
seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); seq_path(m, &mnt_path, " \t\n\\");
seq_putc(m, ' '); seq_putc(m, ' ');
mangle(m, mnt->mnt_sb->s_type->name); mangle(m, mnt->mnt_sb->s_type->name);
if (mnt->mnt_sb->s_subtype && mnt->mnt_sb->s_subtype[0]) { if (mnt->mnt_sb->s_subtype && mnt->mnt_sb->s_subtype[0]) {
...@@ -443,6 +444,7 @@ struct seq_operations mounts_op = { ...@@ -443,6 +444,7 @@ struct seq_operations mounts_op = {
static int show_vfsstat(struct seq_file *m, void *v) static int show_vfsstat(struct seq_file *m, void *v)
{ {
struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list); struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
int err = 0; int err = 0;
/* device */ /* device */
...@@ -454,7 +456,7 @@ static int show_vfsstat(struct seq_file *m, void *v) ...@@ -454,7 +456,7 @@ static int show_vfsstat(struct seq_file *m, void *v)
/* mount point */ /* mount point */
seq_puts(m, " mounted on "); seq_puts(m, " mounted on ");
seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); seq_path(m, &mnt_path, " \t\n\\");
seq_putc(m, ' '); seq_putc(m, ' ');
/* file system type */ /* file system type */
......
...@@ -203,7 +203,7 @@ static int expkey_show(struct seq_file *m, ...@@ -203,7 +203,7 @@ static int expkey_show(struct seq_file *m,
if (test_bit(CACHE_VALID, &h->flags) && if (test_bit(CACHE_VALID, &h->flags) &&
!test_bit(CACHE_NEGATIVE, &h->flags)) { !test_bit(CACHE_NEGATIVE, &h->flags)) {
seq_printf(m, " "); seq_printf(m, " ");
seq_path(m, ek->ek_path.mnt, ek->ek_path.dentry, "\\ \t\n"); seq_path(m, &ek->ek_path, "\\ \t\n");
} }
seq_printf(m, "\n"); seq_printf(m, "\n");
return 0; return 0;
...@@ -649,7 +649,7 @@ static int svc_export_show(struct seq_file *m, ...@@ -649,7 +649,7 @@ static int svc_export_show(struct seq_file *m,
return 0; return 0;
} }
exp = container_of(h, struct svc_export, h); exp = container_of(h, struct svc_export, h);
seq_path(m, exp->ex_path.mnt, exp->ex_path.dentry, " \t\n\\"); seq_path(m, &exp->ex_path, " \t\n\\");
seq_putc(m, '\t'); seq_putc(m, '\t');
seq_escape(m, exp->ex_client->name, " \t\n\\"); seq_escape(m, exp->ex_client->name, " \t\n\\");
seq_putc(m, '('); seq_putc(m, '(');
......
...@@ -67,7 +67,7 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma) ...@@ -67,7 +67,7 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
if (len < 1) if (len < 1)
len = 1; len = 1;
seq_printf(m, "%*c", len, ' '); seq_printf(m, "%*c", len, ' ');
seq_path(m, file->f_path.mnt, file->f_path.dentry, ""); seq_path(m, &file->f_path, "");
} }
seq_putc(m, '\n'); seq_putc(m, '\n');
......
...@@ -271,7 +271,7 @@ static int show_map(struct seq_file *m, void *v) ...@@ -271,7 +271,7 @@ static int show_map(struct seq_file *m, void *v)
*/ */
if (file) { if (file) {
pad_len_spaces(m, len); pad_len_spaces(m, len);
seq_path(m, file->f_path.mnt, file->f_path.dentry, "\n"); seq_path(m, &file->f_path, "\n");
} else { } else {
const char *name = arch_vma_name(vma); const char *name = arch_vma_name(vma);
if (!name) { if (!name) {
......
...@@ -342,13 +342,12 @@ int seq_printf(struct seq_file *m, const char *f, ...) ...@@ -342,13 +342,12 @@ int seq_printf(struct seq_file *m, const char *f, ...)
} }
EXPORT_SYMBOL(seq_printf); EXPORT_SYMBOL(seq_printf);
int seq_path(struct seq_file *m, int seq_path(struct seq_file *m, struct path *path, char *esc)
struct vfsmount *mnt, struct dentry *dentry,
char *esc)
{ {
if (m->count < m->size) { if (m->count < m->size) {
char *s = m->buf + m->count; char *s = m->buf + m->count;
char *p = d_path(dentry, mnt, s, m->size - m->count); char *p = d_path(path->dentry, path->mnt, s,
m->size - m->count);
if (!IS_ERR(p)) { if (!IS_ERR(p)) {
while (s <= p) { while (s <= p) {
char c = *p++; char c = *p++;
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
struct seq_operations; struct seq_operations;
struct file; struct file;
struct vfsmount; struct path;
struct dentry;
struct inode; struct inode;
struct seq_file { struct seq_file {
...@@ -42,7 +41,7 @@ int seq_puts(struct seq_file *m, const char *s); ...@@ -42,7 +41,7 @@ int seq_puts(struct seq_file *m, const char *s);
int seq_printf(struct seq_file *, const char *, ...) int seq_printf(struct seq_file *, const char *, ...)
__attribute__ ((format (printf,2,3))); __attribute__ ((format (printf,2,3)));
int seq_path(struct seq_file *, struct vfsmount *, struct dentry *, char *); int seq_path(struct seq_file *, struct path *, char *);
int single_open(struct file *, int (*)(struct seq_file *, void *), void *); int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
int single_release(struct inode *, struct file *); int single_release(struct inode *, struct file *);
......
...@@ -1996,7 +1996,7 @@ int show_numa_map(struct seq_file *m, void *v) ...@@ -1996,7 +1996,7 @@ int show_numa_map(struct seq_file *m, void *v)
if (file) { if (file) {
seq_printf(m, " file="); seq_printf(m, " file=");
seq_path(m, file->f_path.mnt, file->f_path.dentry, "\n\t= "); seq_path(m, &file->f_path, "\n\t= ");
} else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) {
seq_printf(m, " heap"); seq_printf(m, " heap");
} else if (vma->vm_start <= mm->start_stack && } else if (vma->vm_start <= mm->start_stack &&
......
...@@ -1394,7 +1394,7 @@ static int swap_show(struct seq_file *swap, void *v) ...@@ -1394,7 +1394,7 @@ static int swap_show(struct seq_file *swap, void *v)
} }
file = ptr->swap_file; file = ptr->swap_file;
len = seq_path(swap, file->f_path.mnt, file->f_path.dentry, " \t\n\\"); len = seq_path(swap, &file->f_path, " \t\n\\");
seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", seq_printf(swap, "%*s%s\t%u\t%u\t%d\n",
len < 40 ? 40 - len : 1, " ", len < 40 ? 40 - len : 1, " ",
S_ISBLK(file->f_path.dentry->d_inode->i_mode) ? S_ISBLK(file->f_path.dentry->d_inode->i_mode) ?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment