2003-01-18 22:10:24

by Pavel Machek

[permalink] [raw]
Subject: Code obfuscation in acpi


#define acpi_driver_data(d) ((d)->driver_data)

... very nice for obfuscating code ...
Pavel
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?


2003-01-18 22:23:14

by Jeff Garzik

[permalink] [raw]
Subject: Re: Code obfuscation in acpi

On Sat, Jan 18, 2003 at 10:31:34PM +0100, Pavel Machek wrote:
>
> #define acpi_driver_data(d) ((d)->driver_data)
>
> ... very nice for obfuscating code ...

sysfs-based buses use <foo>_{get,set}_drvdata, which looks exactly the
same as this here.

Jeff


2003-01-18 22:31:00

by Pavel Machek

[permalink] [raw]
Subject: Re: Code obfuscation in acpi

Hi!

> > #define acpi_driver_data(d) ((d)->driver_data)
> >
> > ... very nice for obfuscating code ...
>
> sysfs-based buses use <foo>_{get,set}_drvdata, which looks exactly the
> same as this here.

I think such wrappers are really bad idea, see for example this: I
thought "what kind of cleverness is going on here,", and it was very
simple in fact.

else {
entry->proc_fops = &acpi_thermal_state_fops;
entry->data = acpi_driver_data(device);
}


--
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.

2003-01-20 01:35:15

by Rik van Riel

[permalink] [raw]
Subject: Re: Code obfuscation in acpi

On Sat, 18 Jan 2003, Pavel Machek wrote:

> #define acpi_driver_data(d) ((d)->driver_data)
>
> ... very nice for obfuscating code ...

This is usually called "abstraction" and allows you to change
the data structures (when needed) without breaking all the code.

You can learn from this. If swsusp used abstractions it wouldn't
need to have to stick its nose into the code and data structures
from other subsystems and it might even stop breaking every other
release.

cheers,

Rik
--
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/ http://guru.conectiva.com/
Current spamtrap: <a href=mailto:"[email protected]">[email protected]</a>