All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@linux.intel.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Tony Luck <tony.luck@intel.com>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	protasnb@gmail.com, tytso@thunk.org
Subject: Re: Top kernel oopses/warnings this week
Date: Mon, 17 Dec 2007 16:39:25 -0800	[thread overview]
Message-ID: <476716BD.7060807@linux.intel.com> (raw)
In-Reply-To: <alpine.LFD.0.9999.0712171607370.21557@woody.linux-foundation.org>

Linus Torvalds wrote:
> 
> On Mon, 17 Dec 2007, Arjan van de Ven wrote:
>> +char *get_boot_uuid(void)
>> +{
>> +	static char target[38];
>> +	unsigned char *uuid;
>> +
>> +	if (sysctl_bootid[8] == 0)
>> +		generate_random_uuid(sysctl_bootid);
>> +	/* sysctl_bootid is signed, to print we need unsigned .. */
>> +	uuid = sysctl_bootid;
>> +
>> +	if (target[0] == 0) {
>> +		sprintf(target, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-"
>> +			"%02x%02x%02x%02x%02x%02x",
> 
> Why isn't *everything* inside that "if (target[0] == 0" check?

the sysctl_bootid is shared with the /proc exposed bootid, so I need to generate it the same way

> I'd _also_ suggest that you'd actually try to avoid that horrid sequence 
> of "%02x..", and instead just make sure that sysctl_bootid[] is 4-byte 
> aligned, and then you can do
> 
> 	sprintf("%08x-%04x-%04x-%04x-%04x%08x",
> 		ntohl(0[(u32 *)uuid]),
> 		ntohs(2[(u16 *)uuid]),
> 		ntohs(3[(u16 *)uuid]),
> 		ntohs(4[(u16 *)uuid]),
> 		ntohs(5[(u16 *)uuid]),
> 		ntohl(3[(u32 *)uuid]));
> 
> which also gets bonus points for being totally unreadable, and thus 100% 
> in the spirit of uuid's.

again.. this is for compatibility with /proc/sys/kernel/random/boot_id .. the code 10 lines below my patch is identical and does
the %02x stuff... I didn't make that up, I just copied that to get the same output.
I can deviate for cleanup... but I can see some value of being the same format and same data.



  reply	other threads:[~2007-12-18  0:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-14 18:46 Top kernel oopses/warnings this week Arjan van de Ven
2007-12-14 18:58 ` Dave Jones
2007-12-14 21:57 ` Andrew Morton
2007-12-14 22:25   ` Natalie Protasevich
2007-12-15  0:38   ` Arjan van de Ven
2007-12-14 22:12 ` Jon Masters
2007-12-15 15:49 ` Stefan Richter
2007-12-15 18:21   ` Arjan van de Ven
2007-12-15 19:44     ` Stefan Richter
2007-12-17 18:25     ` Zach Brown
2007-12-17 18:41       ` Arjan van de Ven
2007-12-17  2:51   ` Dave Jones
2007-12-17 12:33     ` Jon Masters
2007-12-17 13:13       ` Stefan Richter
2007-12-17 16:40         ` Arjan van de Ven
2007-12-17 17:23 ` Ingo Molnar
2007-12-17 21:36   ` Arjan van de Ven
2007-12-17 21:58     ` Theodore Tso
2007-12-17 22:58     ` Tony Luck
2007-12-17 23:17       ` Arjan van de Ven
2007-12-17 23:26         ` Tony Luck
2007-12-17 23:47           ` Arjan van de Ven
2007-12-18  0:21             ` Linus Torvalds
2007-12-18  0:39               ` Arjan van de Ven [this message]
2007-12-18  2:31               ` Theodore Tso
2007-12-18  6:58                 ` Arjan van de Ven
2007-12-18 17:53                   ` Matt Mackall
2007-12-18 18:28                   ` Theodore Tso
2007-12-18 18:45                     ` Linus Torvalds
2007-12-18 10:11                 ` Jon Masters
2007-12-18 18:06               ` Arjan van de Ven
2007-12-18 18:13                 ` Matt Mackall
2007-12-18 18:19                   ` Arjan van de Ven
2007-12-18 17:48     ` Matt Mackall
2007-12-18 23:37       ` Arjan van de Ven

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=476716BD.7060807@linux.intel.com \
    --to=arjan@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=protasnb@gmail.com \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@thunk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.