Commit 2726d566 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Al Viro

vfs: add seq_file_path() helper

Turn
	seq_path(..., &file->f_path, ...);
into
	seq_file_path(..., file, ...);
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 9bf39ab2
...@@ -1922,7 +1922,7 @@ void bitmap_status(struct seq_file *seq, struct bitmap *bitmap) ...@@ -1922,7 +1922,7 @@ void bitmap_status(struct seq_file *seq, struct bitmap *bitmap)
chunk_kb ? "KB" : "B"); chunk_kb ? "KB" : "B");
if (bitmap->storage.file) { if (bitmap->storage.file) {
seq_printf(seq, ", file: "); seq_printf(seq, ", file: ");
seq_path(seq, &bitmap->storage.file->f_path, " \t\n"); seq_file_path(seq, bitmap->storage.file, " \t\n");
} }
seq_printf(seq, "\n"); seq_printf(seq, "\n");
......
...@@ -64,7 +64,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region) ...@@ -64,7 +64,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
if (file) { if (file) {
seq_pad(m, ' '); seq_pad(m, ' ');
seq_path(m, &file->f_path, ""); seq_file_path(m, file, "");
} }
seq_putc(m, '\n'); seq_putc(m, '\n');
......
...@@ -310,7 +310,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) ...@@ -310,7 +310,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
*/ */
if (file) { if (file) {
seq_pad(m, ' '); seq_pad(m, ' ');
seq_path(m, &file->f_path, "\n"); seq_file_path(m, file, "\n");
goto done; goto done;
} }
...@@ -1509,7 +1509,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid) ...@@ -1509,7 +1509,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
if (file) { if (file) {
seq_puts(m, " file="); seq_puts(m, " file=");
seq_path(m, &file->f_path, "\n\t= "); seq_file_path(m, file, "\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_puts(m, " heap"); seq_puts(m, " heap");
} else { } else {
......
...@@ -180,7 +180,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, ...@@ -180,7 +180,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
if (file) { if (file) {
seq_pad(m, ' '); seq_pad(m, ' ');
seq_path(m, &file->f_path, ""); seq_file_path(m, file, "");
} else if (mm) { } else if (mm) {
pid_t tid = pid_of_stack(priv, vma, is_pid); pid_t tid = pid_of_stack(priv, vma, is_pid);
......
...@@ -487,6 +487,20 @@ int seq_path(struct seq_file *m, const struct path *path, const char *esc) ...@@ -487,6 +487,20 @@ int seq_path(struct seq_file *m, const struct path *path, const char *esc)
} }
EXPORT_SYMBOL(seq_path); EXPORT_SYMBOL(seq_path);
/**
* seq_file_path - seq_file interface to print a pathname of a file
* @m: the seq_file handle
* @file: the struct file to print
* @esc: set of characters to escape in the output
*
* return the absolute path to the file.
*/
int seq_file_path(struct seq_file *m, struct file *file, const char *esc)
{
return seq_path(m, &file->f_path, esc);
}
EXPORT_SYMBOL(seq_file_path);
/* /*
* Same as seq_path, but relative to supplied root. * Same as seq_path, but relative to supplied root.
*/ */
......
...@@ -123,6 +123,7 @@ __printf(2, 3) int seq_printf(struct seq_file *, const char *, ...); ...@@ -123,6 +123,7 @@ __printf(2, 3) int seq_printf(struct seq_file *, const char *, ...);
__printf(2, 0) int seq_vprintf(struct seq_file *, const char *, va_list args); __printf(2, 0) int seq_vprintf(struct seq_file *, const char *, va_list args);
int seq_path(struct seq_file *, const struct path *, const char *); int seq_path(struct seq_file *, const struct path *, const char *);
int seq_file_path(struct seq_file *, struct file *, const char *);
int seq_dentry(struct seq_file *, struct dentry *, const char *); int seq_dentry(struct seq_file *, struct dentry *, const char *);
int seq_path_root(struct seq_file *m, const struct path *path, int seq_path_root(struct seq_file *m, const struct path *path,
const struct path *root, const char *esc); const struct path *root, const char *esc);
......
...@@ -2032,7 +2032,7 @@ static int swap_show(struct seq_file *swap, void *v) ...@@ -2032,7 +2032,7 @@ static int swap_show(struct seq_file *swap, void *v)
} }
file = si->swap_file; file = si->swap_file;
len = seq_path(swap, &file->f_path, " \t\n\\"); len = seq_file_path(swap, file, " \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_inode(file)->i_mode) ? S_ISBLK(file_inode(file)->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