[Toybox] [PATCH] acpi: change when to recurse

Rob Landley rob at landley.net
Sun Oct 5 14:28:21 PDT 2014


On 10/04/14 15:52, Isaac Dunham wrote:
> acpi: never follow symlinks, always recurse in dirs.
> 
> /sys/class contains several directories, each containing symlinks to
> devices of a given type.
> The symlinks are where we want to end recursion.
> This makes for a simpler, cleaner, and more correct check, avoids needless
> recursion, and shrinks the text segment by 25 bytes (at least here).

I _totally_ got bit by this doing mdev back on busybox... repeatedly:

http://lists.busybox.net/pipermail/busybox/2006-February/052297.html
http://lists.busybox.net/pipermail/busybox/2008-July/066210.html

I.E. things that were directories can become symlinks, and vice versa.
I'm reluctant to trust it.

> --
> I noticed that this approach was possible while poking around thinking
> about a possible Busybox port, plotting to add -c and -t, and experimenting
> with using nftw.
> 
> acpi -c seems to be fairly simple:

I have no idea what acpi -c or -t are supposed to _do_, and you don't
say here.

>   recurse through /sys/class/thermal,
>   read type, max_state, and cur_state,
>   if max_state and cur_state were unreadable,
>     printf("Cooling %d: %s no state information available\n", ctr++, type)
>   else printf("Cooling %d: %s %d of %d\n",ctr++,type,cur_state, max_state)
> 
> It would be rather difficult to do this in the same callback as -ab.

Not knowing what -ab do, i think I'll have to re-reply to this message
when I have time to dig through the code and see what the existing one
does...


> The above method does ignore quite a few sensors;
> there's no obvious way to get HDD temps besides these commands:
>  smartctl -A -d ata /dev/sda |grep Temperature
> # or (Hitachi-only, but no spin-up)
>  hdparm -H /dev/sda

strace, the breakfast of champions.

> Then also Thinkpads have multiple sensors, which are apparently named 
> (in sysfs) temp*_input
> The "official" acpi misses both the Thinkpad sensors and HDD sensors.

If you have the testing environment, by all means let's get this right.

Query: what are you trying to _do_?

Rob

 1412544501.0


More information about the Toybox mailing list