aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2015-06-19 04:30:28 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-06-23 18:01:07 -0400
commit2726d56620ce71f40dd583d51391b86e1ab8cc57 (patch)
tree5fad19a48f9eb60de9e407e0b0baa24bb72e7dbb
parent9bf39ab2adafd7cf8740859cb49e7b7952813a5d (diff)
vfs: add seq_file_path() helper
Turn seq_path(..., &file->f_path, ...); into seq_file_path(..., file, ...); Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/md/bitmap.c2
-rw-r--r--fs/proc/nommu.c2
-rw-r--r--fs/proc/task_mmu.c4
-rw-r--r--fs/proc/task_nommu.c2
-rw-r--r--fs/seq_file.c14
-rw-r--r--include/linux/seq_file.h1
-rw-r--r--mm/swapfile.c2
7 files changed, 21 insertions, 6 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index dda33d648354..3813fdfee4be 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1922,7 +1922,7 @@ void bitmap_status(struct seq_file *seq, struct bitmap *bitmap)
1922 chunk_kb ? "KB" : "B"); 1922 chunk_kb ? "KB" : "B");
1923 if (bitmap->storage.file) { 1923 if (bitmap->storage.file) {
1924 seq_printf(seq, ", file: "); 1924 seq_printf(seq, ", file: ");
1925 seq_path(seq, &bitmap->storage.file->f_path, " \t\n"); 1925 seq_file_path(seq, bitmap->storage.file, " \t\n");
1926 } 1926 }
1927 1927
1928 seq_printf(seq, "\n"); 1928 seq_printf(seq, "\n");
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index d4a35746cab9..f8595e8b5cd0 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -64,7 +64,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
64 64
65 if (file) { 65 if (file) {
66 seq_pad(m, ' '); 66 seq_pad(m, ' ');
67 seq_path(m, &file->f_path, ""); 67 seq_file_path(m, file, "");
68 } 68 }
69 69
70 seq_putc(m, '\n'); 70 seq_putc(m, '\n');
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 6dee68d013ff..ca1e091881d4 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -310,7 +310,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
310 */ 310 */
311 if (file) { 311 if (file) {
312 seq_pad(m, ' '); 312 seq_pad(m, ' ');
313 seq_path(m, &file->f_path, "\n"); 313 seq_file_path(m, file, "\n");
314 goto done; 314 goto done;
315 } 315 }
316 316
@@ -1509,7 +1509,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
1509 1509
1510 if (file) { 1510 if (file) {
1511 seq_puts(m, " file="); 1511 seq_puts(m, " file=");
1512 seq_path(m, &file->f_path, "\n\t= "); 1512 seq_file_path(m, file, "\n\t= ");
1513 } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { 1513 } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) {
1514 seq_puts(m, " heap"); 1514 seq_puts(m, " heap");
1515 } else { 1515 } else {
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 599ec2e20104..e0d64c92e4f6 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -180,7 +180,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
180 180
181 if (file) { 181 if (file) {
182 seq_pad(m, ' '); 182 seq_pad(m, ' ');
183 seq_path(m, &file->f_path, ""); 183 seq_file_path(m, file, "");
184 } else if (mm) { 184 } else if (mm) {
185 pid_t tid = pid_of_stack(priv, vma, is_pid); 185 pid_t tid = pid_of_stack(priv, vma, is_pid);
186 186
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 555f82155be8..d8a0545ad7ea 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -487,6 +487,20 @@ int seq_path(struct seq_file *m, const struct path *path, const char *esc)
487} 487}
488EXPORT_SYMBOL(seq_path); 488EXPORT_SYMBOL(seq_path);
489 489
490/**
491 * seq_file_path - seq_file interface to print a pathname of a file
492 * @m: the seq_file handle
493 * @file: the struct file to print
494 * @esc: set of characters to escape in the output
495 *
496 * return the absolute path to the file.
497 */
498int seq_file_path(struct seq_file *m, struct file *file, const char *esc)
499{
500 return seq_path(m, &file->f_path, esc);
501}
502EXPORT_SYMBOL(seq_file_path);
503
490/* 504/*
491 * Same as seq_path, but relative to supplied root. 505 * Same as seq_path, but relative to supplied root.
492 */ 506 */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index afbb1fd77c77..912a7c482649 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -123,6 +123,7 @@ __printf(2, 3) int seq_printf(struct seq_file *, const char *, ...);
123__printf(2, 0) int seq_vprintf(struct seq_file *, const char *, va_list args); 123__printf(2, 0) int seq_vprintf(struct seq_file *, const char *, va_list args);
124 124
125int seq_path(struct seq_file *, const struct path *, const char *); 125int seq_path(struct seq_file *, const struct path *, const char *);
126int seq_file_path(struct seq_file *, struct file *, const char *);
126int seq_dentry(struct seq_file *, struct dentry *, const char *); 127int seq_dentry(struct seq_file *, struct dentry *, const char *);
127int seq_path_root(struct seq_file *m, const struct path *path, 128int seq_path_root(struct seq_file *m, const struct path *path,
128 const struct path *root, const char *esc); 129 const struct path *root, const char *esc);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index a7e72103f23b..41e4581af7c5 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2032,7 +2032,7 @@ static int swap_show(struct seq_file *swap, void *v)
2032 } 2032 }
2033 2033
2034 file = si->swap_file; 2034 file = si->swap_file;
2035 len = seq_path(swap, &file->f_path, " \t\n\\"); 2035 len = seq_file_path(swap, file, " \t\n\\");
2036 seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", 2036 seq_printf(swap, "%*s%s\t%u\t%u\t%d\n",
2037 len < 40 ? 40 - len : 1, " ", 2037 len < 40 ? 40 - len : 1, " ",
2038 S_ISBLK(file_inode(file)->i_mode) ? 2038 S_ISBLK(file_inode(file)->i_mode) ?