From patchwork Fri Jun 19 08:30:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 6643491 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 048859F1C1 for ; Fri, 19 Jun 2015 08:30:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B1D92094C for ; Fri, 19 Jun 2015 08:30:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 177942094B for ; Fri, 19 Jun 2015 08:30:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932226AbbFSIa2 (ORCPT ); Fri, 19 Jun 2015 04:30:28 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:34436 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932218AbbFSIaY (ORCPT ); Fri, 19 Jun 2015 04:30:24 -0400 Received: by wicnd19 with SMTP id nd19so11899919wic.1 for ; Fri, 19 Jun 2015 01:30:23 -0700 (PDT) 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=e3chA8pl5GER5fvAWdK4vKXjtLQQ50ZtdpckYMdos5Sh4b6PVjuXrc18iSdTLRc2EI 0bFtVXMT5Pj5cMNg8iQcal1iC1DeCBJfLGLskB7JGmZOzRh/oMk8AhwZGptZi5/fBN/k Djfk76XHt+Qtq41h2ug6YR58YQYX56RVfDnmjtCJtFDkuhPZ88ybW9+M4A3RJebaStpj 19ppIZDdV5dUvarlBZLaaAkzEq7DpeJVDrA7r73cNMmaByeijAYUEj7gYjPh0g/zqE6/ kvmyOaZQCPI/SHuIgI7YaLpaYhlG8YqcdyKhQrjQyR8Vq/8lL6sz1jWhF7cVVTZvkX0o c7zQ== X-Gm-Message-State: ALoCoQnz2Jbb9fXMYq76FxvSKWTWlQLwoyxZFCiXnaXb1JjIqGpmCxEMQ8PQeoU4YjoOuFqDstrO X-Received: by 10.194.71.105 with SMTP id t9mr22930242wju.128.1434702623331; Fri, 19 Jun 2015 01:30:23 -0700 (PDT) Received: from tucsk (pool-dsl-26-0066.externet.hu. [217.173.38.102]) by mx.google.com with ESMTPSA id n3sm7689991wix.1.2015.06.19.01.30.22 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Jun 2015 01:30:22 -0700 (PDT) Date: Fri, 19 Jun 2015 10:30:28 +0200 From: Miklos Szeredi To: Al Viro Cc: David Howells , Linux-Fsdevel , "linux-unionfs@vger.kernel.org" , Kernel Mailing List Subject: [PATCH 2/2] vfs: add seq_file_path() helper Message-ID: <20150619083028.GC24181@tucsk> References: <20150619082913.GB24181@tucsk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150619082913.GB24181@tucsk> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Miklos Szeredi Turn seq_path(..., &file->f_path, ...); into seq_file_path(..., file, ...); Signed-off-by: Miklos Szeredi Acked-by: David Howells --- 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(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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) ?