From: Andre Prendel <andre_prendel@gmx.de>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [Patch] libsensors: Ignore directories and
Date: Thu, 05 Feb 2009 14:20:17 +0000 [thread overview]
Message-ID: <20090205142017.GD5150@ubuntu> (raw)
In-Reply-To: <20090205090331.GA5150@ubuntu>
On Thu, Feb 05, 2009 at 02:31:40PM +0100, Jean Delvare wrote:
> Hi Andre,
>
> On Thu, 5 Feb 2009 11:45:36 +0100, Andre Prendel wrote:
> > On Thu, Feb 05, 2009 at 10:53:34AM +0100, Jean Delvare wrote:
> > > On Thu, 5 Feb 2009 10:03:31 +0100, Andre Prendel wrote:
> > > > I assume there are no hidden files in the directory, right? That's the
> > > > reason why I have removed this from condition.
> > >
> > > I've never seen hidden files in sysfs except for sections
> > > in /sys/module. But the purpose of the original code was merely to skip
> > > "." and ".." anyway, not hidden files.
> >
> > At another place (sysfs_foreach_classdev()) there is a comment
> > explaining the condition.
> >
> > [...]
> > if (ent->d_name[0] = '.') /* skip hidden entries */
> > continue;
> > [...]
>
> Indeed, but as I recall, the hidden entries we were worried about
> back then were just "." and "..". I don't expect it to make any
> difference anyway, as I doubt we'll ever have other hidden files or
> directories in class directories, nor do I expect non-directory (or
> link to directory) entries there.
>
> > > (...)
> > > If you really care about performance (and I guess that's the sole
> > > purpose of your patch) then it's faster to check for ent->d_type !> > > DT_REG.
> >
> > Indeed. That's even better.
> >
> > > You can also move "name = ent->d_name" after this test to make
> > > the fast path even faster.
> >
> > This should just avoid needless work and maybe potential errors in
> > parsing unexpected directory names.
>
> I get the idea, and second it.
>
> > > Out of curiosity, did you actually measure any performance improvement
> > > with your patch?
> >
> > I didn't do a measurement. That wasn't the goal.
>
> You might want to ask valgrind about it (I certainly will, being
> curious.)
So I will take a closer look at valgrind. I have used only the
memcheck tool so far. After that you will get an updated patch.
>
> > P.S. To become familiar with the whole code and getting a better
> > understanding how things work, I walk through the code. And if I found
> > something that I would do in a different way, I send a patch to you :)
>
> Sounds like a good plan, don't stop :)
I won't stop. :)
> Care to send an updated patch? I'll be happy to apply it.
Thanks
Andre
> --
> Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2009-02-05 14:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2009-02-05 14:32 ` Jean Delvare
2009-02-06 8:43 ` Andre Prendel
2009-02-06 12:59 ` Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090205142017.GD5150@ubuntu \
--to=andre_prendel@gmx.de \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.