From: Richard Weinberger <richard@nod.at>
To: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: "Tony Luck" <tony.luck@gmail.com>, "Madper Xie" <cxie@redhat.com>,
"matt.fleming@intel.com" <matt.fleming@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
"Linux EFI" <linux-efi@vger.kernel.org>, 谢成骏 <bbboson@gmail.com>
Subject: Re: [PATCH] Make efi-pstore return a unique id
Date: Fri, 01 Nov 2013 21:08:26 +0100 [thread overview]
Message-ID: <52740A3A.70202@nod.at> (raw)
In-Reply-To: <A5ED84D3BB3A384992CBB9C77DEDA4D47F9DD941@USINDEM103.corp.hds.com>
Am 01.11.2013 20:22, schrieb Seiji Aguchi:
>>>> +{
>>>> + char id_str[64];
>>>> + u64 id = 0;
>>>> +
>>>> + sprintf(id_str, "%lu%u%d", timestamp, part, count);
>>>> + if (kstrtoull(id_str, 10, &id))
>>>> + pr_warn("efi-pstore: failed to generate id\n");
>>>> + return id;
>>>> +}
>>>
>>> This is just odd. You make a string from three ints and then a parse
>>> it to a int again.
>>
>> Agreed. I liked your ((timestamp * 100 + part) * 100 + count function much
>> more than this.
>
> I was worried that the part and count could be more than 100.
> If it happens, the id may not be unique...
>
> But, currently, size of nvram storage is limited, so it is a corner case.
> I respect your opinion.
What about feeding the bytes of all three integers into a non-cryptographic hash function?
Using this way you get a cheap unique id.
Thanks,
//richard
next prev parent reply other threads:[~2013-11-01 20:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 16:14 [PATCH] Make efi-pstore return a unique id Madper Xie
2013-11-01 16:28 ` Richard Weinberger
2013-11-01 18:58 ` Tony Luck
2013-11-01 19:22 ` Seiji Aguchi
2013-11-01 20:08 ` Richard Weinberger [this message]
2013-11-01 20:57 ` Seiji Aguchi
2013-11-02 0:17 ` Tony Luck
2013-11-02 12:28 ` Seiji Aguchi
2013-11-02 1:15 ` Madper Xie
2013-11-20 9:29 ` Madper Xie
2013-11-20 15:17 ` Seiji Aguchi
2013-11-21 13:53 ` Madper Xie
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=52740A3A.70202@nod.at \
--to=richard@nod.at \
--cc=bbboson@gmail.com \
--cc=cxie@redhat.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.fleming@intel.com \
--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