Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1168613

[PATCH 2/2] vfs: add seq_file_path() helper

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Miklos Szeredi <miklos@szeredi.hu>
Newsgroups linux.kernel
Subject [PATCH 2/2] vfs: add seq_file_path() helper
Date Fri, 19 Jun 2015 10:40:01 +0200
Message-ID <pD009-25F-7@gated-at.bofh.it> (permalink)
References <pCZQu-1Uu-13@gated-at.bofh.it>
X-Original-To Al Viro <viro@ZenIV.linux.org.uk>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=oqAcetQ9Hws9EExl48gJhhJEQrQWz1isPz4Q9cexbNs=; b=iCNy8zPgv1fEVshIRq6eSjYwkmuy2xq1+4BksIDsF1exJx0ueY8FYFNEn+lRIYrxpH 18hmxi3EdDaAosCXh40VKHjfiiq7/uZ3tQIAenEwk9NteKP/3FqYrZmoilInbhO+u/cg P70gtoXpcQEEUXmbIKgBETVNejILCITWrqt90=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=oqAcetQ9Hws9EExl48gJhhJEQrQWz1isPz4Q9cexbNs=; b=Vow60tnKsSEBPgJKCcCk+m7R95lltfEzTcT7C6x1ct/thzXNz7JMa4I/5f6OspKnIT zB1jcfGQP/JKxcceJHGPvB7GpDq7/ZkNvCBrhy/2JUHzcAuyEsEp8/bN8n7q2xKqJCZ0 E6jR4edQ8uwyWmnLQ76vqlOAteKzi30aboO4bqetaWIV/6qeB3xVxwrv+Kc/Evci5UCz taNj8F/v9Ilp4O9PgaLgG7V/RaOi+WxtT7vMY65v3il1U9af10skmj9QJ2Q1D0DO5LMt kxzi9bmH+zM/iaM3vxSfdRrO1oggi1Hcadw1fvPEkQnEPlQnTym8yU5U+I9rwCbjUodz HCSQ==
X-Gm-Message-State ALoCoQnKhRy9WCFtXoSGz0lW7fMKi7V3gPwU5Or2MK8G8FMr8k0Z91E9K0O+ZVKPzl4LXsNNe5Sw
X-Received by 10.194.71.105 with SMTP id t9mr22930242wju.128.1434702623331; Fri, 19 Jun 2015 01:30:23 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 120
Organization linux.* mail to news gateway
X-Original-Cc David Howells <dhowells@redhat.com>, Linux-Fsdevel <linux-fsdevel@vger.kernel.org>, "linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>, Kernel Mailing List <linux-kernel@vger.kernel.org>
X-Original-Date Fri, 19 Jun 2015 10:30:28 +0200
X-Original-Message-ID <20150619083028.GC24181@tucsk>
X-Original-References <20150619082913.GB24181@tucsk>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1168613

Show key headers only | View raw


From: Miklos Szeredi <mszeredi@suse.cz>

Turn
	seq_path(..., &file->f_path, ...);
into
	seq_file_path(..., file, ...);

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
 drivers/md/bitmap.c      |    2 +-
 fs/proc/nommu.c          |    2 +-
 fs/proc/task_mmu.c       |    4 ++--
 fs/proc/task_nommu.c     |    2 +-
 fs/seq_file.c            |   14 ++++++++++++++
 include/linux/seq_file.h |    1 +
 mm/swapfile.c            |    2 +-
 7 files changed, 21 insertions(+), 6 deletions(-)

--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1927,7 +1927,7 @@ void bitmap_status(struct seq_file *seq,
 		   chunk_kb ? "KB" : "B");
 	if (bitmap->storage.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");
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -64,7 +64,7 @@ static int nommu_region_show(struct seq_
 
 	if (file) {
 		seq_pad(m, ' ');
-		seq_path(m, &file->f_path, "");
+		seq_file_path(m, file, "");
 	}
 
 	seq_putc(m, '\n');
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -310,7 +310,7 @@ show_map_vma(struct seq_file *m, struct
 	 */
 	if (file) {
 		seq_pad(m, ' ');
-		seq_path(m, &file->f_path, "\n");
+		seq_file_path(m, file, "\n");
 		goto done;
 	}
 
@@ -1509,7 +1509,7 @@ static int show_numa_map(struct seq_file
 
 	if (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) {
 		seq_puts(m, " heap");
 	} else {
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -180,7 +180,7 @@ static int nommu_vma_show(struct seq_fil
 
 	if (file) {
 		seq_pad(m, ' ');
-		seq_path(m, &file->f_path, "");
+		seq_file_path(m, file, "");
 	} else if (mm) {
 		pid_t tid = pid_of_stack(priv, vma, is_pid);
 
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -487,6 +487,20 @@ int seq_path(struct seq_file *m, const s
 }
 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.
  */
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -123,6 +123,7 @@ __printf(2, 3) int seq_printf(struct seq
 __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_file_path(struct seq_file *, struct file *, const char *);
 int seq_dentry(struct seq_file *, struct dentry *, const char *);
 int seq_path_root(struct seq_file *m, const struct path *path,
 		  const struct path *root, const char *esc);
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2032,7 +2032,7 @@ static int swap_show(struct seq_file *sw
 	}
 
 	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",
 			len < 40 ? 40 - len : 1, " ",
 			S_ISBLK(file_inode(file)->i_mode) ?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] vfs: add file_path() helper Miklos Szeredi <miklos@szeredi.hu> - 2015-06-19 10:30 +0200
  [PATCH 2/2] vfs: add seq_file_path() helper Miklos Szeredi <miklos@szeredi.hu> - 2015-06-19 10:40 +0200
    Re: [PATCH 2/2] vfs: add seq_file_path() helper David Howells <dhowells@redhat.com> - 2015-06-19 10:40 +0200
    Re: [PATCH 2/2] vfs: add seq_file_path() helper Al Viro <viro@ZenIV.linux.org.uk> - 2015-06-19 10:40 +0200
  Re: [PATCH 1/2] vfs: add file_path() helper David Howells <dhowells@redhat.com> - 2015-06-19 10:40 +0200
  Re: [PATCH 1/2] vfs: add file_path() helper Al Viro <viro@ZenIV.linux.org.uk> - 2015-06-19 10:40 +0200
  Re: [PATCH 1/2] vfs: add file_path() helper David Howells <dhowells@redhat.com> - 2015-06-19 10:50 +0200

csiph-web