lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 28 Sep 2007 03:44:24 -0400
From:	Kyle Moffett <mrmacman_g4@....com>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Vegard Nossum <vegard.nossum@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Michael Holzheu <holzheu@...ux.vnet.ibm.com>,
	Joe Perches <joe@...ches.com>, Rob Landley <rob@...dley.net>,
	Dick Streefland <dick.streefland@...ium.nl>,
	Jesse Barnes <jesse.barnes@...el.com>,
	Arnd Bergmann <arnd@...db.de>,
	Jan Engelhardt <jengelh@...putergmbh.de>,
	Emil Medve <Emilian.Medve@...escale.com>,
	Stephen Hemminger <shemminger@...ux-foundation.org>,
	"linux@...izon.com" <linux@...izon.com>
Subject: Re: [RFC] New kernel-message logging API (take 2)

On Sep 28, 2007, at 03:31:11, Geert Uytterhoeven wrote:
> Can't you store the loglevel in the kprint_block and check it in  
> all successive kprint_*() macros? If gcc knows it's constant, it  
> can optimize the non-wanted code away. As other fields in struct  
> kprint_block cannot be constant (they store internal state), you  
> have to split it like:
>
>     struct kprint_block {
> 	    int loglevel;
> 	    struct real_kprint_block real;  /* internal state */
>     }
>
> and pass &block.real() instead of &block to all successive internal  
> functions.  I haven't tried this, so let's hope gcc is actually  
> smart enough...

Well actually, I believe you could just do:

struct kprint_block {
	const int loglevel;
	[...];
};

Then cast away the constness to actually set it initially:
*((int *)&block.loglevel) = LOGLEVEL;

Cheers,
Kyle Moffett

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ