All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [Patch] libsensors: Ignore directories and symlinks in
@ 2009-02-05  9:03 Andre Prendel
  2009-02-05  9:53 ` [lm-sensors] [Patch] libsensors: Ignore directories and Jean Delvare
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Andre Prendel @ 2009-02-05  9:03 UTC (permalink / raw)
  To: lm-sensors

Sysfs directory of the hwmon devices contains directories and symlinks.

Here is the output on my Thinkpad:

  andre@ubuntu:/sys/class/hwmon/hwmon0/device$ ls -l
  insgesamt 0
  lrwxrwxrwx 1 root root    0 2009-02-04 19:44 bus -> ../../../bus/platform
  lrwxrwxrwx 1 root root    0 2009-02-04 19:42 driver ->
  ../../../bus/platform/drivers/thinkpad_hwmon 
  -r--r--r-- 1 root root 4096 2009-02-04 19:44 fan1_input
  lrwxrwxrwx 1 root root    0 2009-02-04 19:44 hwmon:hwmon0 ->
  ../../../class/hwmon/hwmon0 
  -r--r--r-- 1 root root 4096 2009-02-04 19:44 modalias
  -r--r--r-- 1 root root 4096 2009-02-04 19:44 name
  drwxr-xr-x 2 root root    0 2009-02-04 19:44 power
  -rw-r--r-- 1 root root 4096 2009-02-04 19:44 pwm1
  -rw-r--r-- 1 root root 4096 2009-02-04 19:44 pwm1_enable
  lrwxrwxrwx 1 root root    0 2009-02-04 19:42 subsystem ->
  ../../../bus/platform 
  -r--r--r-- 1 root root 4096 2009-02-04 19:44 temp10_input
  -r--r--r-- 1 root root 4096 2009-02-04 19:44 temp11_input
  -r--r--r-- 1 root root 4096 2009-02-04 19:44 temp12_input
  [...]

IMO we can ignore them looking for subfeatures (in
sensors_read_dynamic_chip()), can't we?

I assume there are no hidden files in the directory, right? That's the
reason why I have removed this from condition.

Any comments or improvements?

---
--- lm-sensors-dev/lib/sysfs.c	2009-01-26 17:43:43.000000000 +0100
+++ my-sensors-dev/lib/sysfs.c	2009-02-04 21:59:44.000000000 +0100
@@ -360,7 +360,8 @@ static int sensors_read_dynamic_chip(sen
 		char *name = ent->d_name;
 		int nr;
 
-		if (ent->d_name[0] = '.')
+		/* Skip directories and symlinks.  */
+		if (ent->d_type = DT_DIR || ent->d_type = DT_LNK)
 			continue;
 
 		sftype = sensors_subfeature_get_type(name, &nr);

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-02-06 12:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-05  9:03 [lm-sensors] [Patch] libsensors: Ignore directories and symlinks in Andre Prendel
2009-02-05  9:53 ` [lm-sensors] [Patch] libsensors: Ignore directories and Jean Delvare
2009-02-05 10:45 ` Andre Prendel
2009-02-05 13:31 ` Jean Delvare
2009-02-05 14:20 ` Andre Prendel
2009-02-05 14:32 ` Jean Delvare
2009-02-06  8:43 ` Andre Prendel
2009-02-06 12:59 ` Jean Delvare

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.