ukazkove zdrojaky

Jan Kasprzak kas na fi.muni.cz
Pondělí Březen 6 14:14:29 CET 2006


Dalibor Straka wrote:
: On Fri, Mar 03, 2006 at 10:06:46PM +0100, Jan Kasprzak wrote:
: Nic proti kernelu, ale neutopil
: 
: {
: 	if (!out && !mydev_priv = kmalloc(...))
: 		out = out1;
: 	...	
: 	if (!out && !register_interrupt(...))
: 		out = out2;
: 	...	
: 	if (!out && !register_chrdev(...))
: 		out = out3;
: 	...
: 	return SUCCESS;
: 
: 	switch(out){
: 		case out3: unregister_interrupt(...); /* no break! */
: 		case out2: kfree(...);
: 		case out1: return -ENODEV;
: 	}
: }	
: 
: Docela bych se vsadil, ze vysledny kod bude identicky,

	Krome jinych problemu na ktere uz tady bylo poukazano, bych rekl,
ze se kompilatoru mozna nepodari tu promennou vyoptimalizovat (nehlede
na to ze tento kod je mene citelny, protoze je delsi).

-Yenya

-- 
| Jan "Yenya" Kasprzak  <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839      Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/    Journal: http://www.fi.muni.cz/~kas/blog/ |
> Specs are a basis for _talking_about_ things. But they are _not_ a basis <
> for implementing software.                              --Linus Torvalds <


Další informace o konferenci Linux