public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Madper Xie <cxie@redhat.com>
To: Tony Luck <tony.luck@gmail.com>,
	Seiji Aguchi <seiji.aguchi@hds.com>,
	Anton Vorontsov <cbou@mail.ru>, Colin Cross <ccross@google.com>,
	Kees Cook <kees@outflux.net>
Cc: "linux-efi\@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] Differentiating names by adding a timestamp.
Date: Mon, 28 Oct 2013 21:22:25 +0800	[thread overview]
Message-ID: <87li1dv8by.fsf@redhat.com> (raw)


pstore denominate dumped file as type-psname-id. it makes many file have
the same name if there are many entries in backend have the same id.
So adding a timestamp to file name.

Signed-off-by: Madper Xie <cxie@redhat.com>
---
 fs/pstore/inode.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 1282384..bf6ed3a 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -315,32 +315,38 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
 
 	switch (type) {
 	case PSTORE_TYPE_DMESG:
-		sprintf(name, "dmesg-%s-%lld%s", psname, id,
-						compressed ? ".enc.z" : "");
+		sprintf(name, "dmesg-%s-%lld-%lld%s", psname, id,
+			timespec_to_ns(&time), compressed ? ".enc.z" : "");
 		break;
 	case PSTORE_TYPE_CONSOLE:
-		sprintf(name, "console-%s", psname);
+		sprintf(name, "console-%s-%lld", psname, timespec_to_ns(&time));
 		break;
 	case PSTORE_TYPE_FTRACE:
-		sprintf(name, "ftrace-%s", psname);
+		sprintf(name, "ftrace-%s-%lld", psname, timespec_to_ns(&time));
 		break;
 	case PSTORE_TYPE_MCE:
-		sprintf(name, "mce-%s-%lld", psname, id);
+		sprintf(name, "mce-%s-%lld-%lld", psname, id,
+			timespec_to_ns(&time));
 		break;
 	case PSTORE_TYPE_PPC_RTAS:
-		sprintf(name, "rtas-%s-%lld", psname, id);
+		sprintf(name, "rtas-%s-%lld-%lld", psname, id,
+			timespec_to_ns(&time));
 		break;
 	case PSTORE_TYPE_PPC_OF:
-		sprintf(name, "powerpc-ofw-%s-%lld", psname, id);
+		sprintf(name, "powerpc-ofw-%s-%lld-%lld", psname, id,
+			timespec_to_ns(&time));
 		break;
 	case PSTORE_TYPE_PPC_COMMON:
-		sprintf(name, "powerpc-common-%s-%lld", psname, id);
+		sprintf(name, "powerpc-common-%s-%lld-%lld", psname, id,
+			timespec_to_ns(&time));
 		break;
 	case PSTORE_TYPE_UNKNOWN:
-		sprintf(name, "unknown-%s-%lld", psname, id);
+		sprintf(name, "unknown-%s-%lld-%lld", psname, id,
+			timespec_to_ns(&time));
 		break;
 	default:
-		sprintf(name, "type%d-%s-%lld", type, psname, id);
+		sprintf(name, "type%d-%s-%lld-%lld", type, psname, id,
+			timespec_to_ns(&time));
 		break;
 	}
 
-- 
1.8.4.1

             reply	other threads:[~2013-10-28 13:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 13:22 Madper Xie [this message]
2013-10-28 15:46 ` [PATCH] Differentiating names by adding a timestamp Seiji Aguchi

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=87li1dv8by.fsf@redhat.com \
    --to=cxie@redhat.com \
    --cc=cbou@mail.ru \
    --cc=ccross@google.com \
    --cc=kees@outflux.net \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seiji.aguchi@hds.com \
    --cc=tony.luck@gmail.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