mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liu ShuoX <shuox.liu@intel.com>
To: linux-kernel@vger.kernel.org
Cc: yanmin_zhang@linux.intel.com, Liu ShuoX <shuox.liu@intel.com>,
	Zhang Yanmin <yanmin.zhang@intel.com>,
	Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>,
	Kees Cook <keescook@chromium.org>,
	Tony Luck <tony.luck@intel.com>
Subject: [PATCH v5 2/3] pstore: add seq_ops for norm zone
Date: Tue,  6 May 2014 13:03:45 +0800	[thread overview]
Message-ID: <1399352628-13308-3-git-send-email-shuox.liu@intel.com> (raw)
In-Reply-To: <1399352628-13308-1-git-send-email-shuox.liu@intel.com>

Some developers want to output the pstore record trace flexible.
So add seq_ops into ramoops_zone in case users would make private output
format.

Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
Signed-off-by: Liu ShuoX <shuox.liu@intel.com>
---
 fs/pstore/inode.c              | 10 ++++++++--
 include/linux/pstore_ramoops.h |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index d463481..a9c9782 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -207,14 +207,20 @@ static ssize_t pstore_file_read(struct file *file, char __user *userbuf,
 static int pstore_file_open(struct inode *inode, struct file *file)
 {
 	struct pstore_private *ps = inode->i_private;
+	struct ramoops_context *cxt = ps->psi->data;
+	struct ramoops_zone    *zones = cxt ? cxt->zones : NULL;
 	struct seq_file *sf;
 	int err;
 	const struct seq_operations *sops = NULL;
 
 	if (ps->type == PSTORE_TYPE_FTRACE)
 		sops = &pstore_ftrace_seq_ops;
-	if (ps->type == PSTORE_TYPE_NORM)
-		sops = &pstore_seq_ops;
+	if (ps->type == PSTORE_TYPE_NORM && zones) {
+		if (zones[ps->id].seq_ops)
+			sops = zones[ps->id].seq_ops;
+		else
+			sops = &pstore_seq_ops;
+	}
 
 	err = seq_open(file, sops);
 	if (err < 0)
diff --git a/include/linux/pstore_ramoops.h b/include/linux/pstore_ramoops.h
index 28f47a9..b8da964 100644
--- a/include/linux/pstore_ramoops.h
+++ b/include/linux/pstore_ramoops.h
@@ -33,6 +33,7 @@ struct ramoops_zone {
 	int		item_size;
 	void (*print_record)(struct seq_file *s, void *record);
 	void *(*get_new_record)(struct persistent_ram_zone *prz);
+	const struct seq_operations *seq_ops;
 };
 
 /*
-- 
1.8.3.2


  parent reply	other threads:[~2014-05-06  5:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06  5:03 [PATCH v5 0/3] Add a method to expand tracers for pstore easily Liu ShuoX
2014-05-06  5:03 ` [PATCH v5 1/3] pstore: restructure ramoops to support more trace Liu ShuoX
2014-05-06  5:03 ` Liu ShuoX [this message]
2014-05-06  5:03 ` [PATCH v5 3/3] pstore: support current records dump in ramoops Liu ShuoX
2014-05-06  5:03 ` [PATCH] [NOMERGE] reserved ram for pstore on PC (applied on top of new pstore patch) Liu ShuoX
2014-05-06 14:48   ` Paul Gortmaker
2014-05-07  1:30     ` Liu ShuoX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399352628-13308-3-git-send-email-shuox.liu@intel.com \
    --to=shuox.liu@intel.com \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=yanmin.zhang@intel.com \
    --cc=yanmin_zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®