lkml.org 
[lkml]   [2013]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] Make efi-pstore return a unique id
From
>> +static u64 efi_generate_id(unsigned long timestamp, unsigned int part, int count)

I don't think the "efi_" prefix is needed here. For one thing the
function is static, so
no name space pollution worries. For another - it makes it look like
this is some thing
defined in EFI standard. If "generate_id()" is too generic for your
tastes ... then a
"pstore_" prefix might be more appropriate.

>> +{
>> + 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.

-Tony


\
 
 \ /
  Last update: 2013-11-01 20:21    [W:0.035 / U:11.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site