From: Martin Pitt <martin.pitt@ubuntu.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH 0/2] libudev: Get all sysfs attrs for a device
Date: Thu, 03 Mar 2011 17:00:07 +0000 [thread overview]
Message-ID: <20110303170006.GF4723@piware.de> (raw)
In-Reply-To: <4D6F5CA6.2010905@secunet.com>
Kay Sievers [2011-03-03 15:11 +0100]:
> Keep in mind, that if you are root, you can do really nasty things if
> you open/read binary files. Sysfs is not meant to be used to blindly
> open "random" files. Think of it as device ioctl()s -- nobody would
> expect to just issue all numbers to a device, to check what comes back
> :) Things can go very wrong here.
The current patches don't actually open the attribute files, just read
the dir and stat the files; but I guess that was meant as a general
"never try to iterate over all of them" warning.
> The same code is used by udevd. For performance reasons, we can not
> afford to call readdir() for every device we look at. We don't want to
> cache anything which we don't need.
Indeed, and I actually see no reason why
udev_device_get_sysattr_value() would cause the building of the cache;
shouldn't that be done in the new udev_device_get_sysattr_list_entry()
instead, where it actually belongs?
(Note that you have the wrong function name in the doc comment of
udev_device_get_sysattr_list_entry()).
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
next prev parent reply other threads:[~2011-03-03 17:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 9:17 [PATCH 0/2] libudev: Get all sysfs attrs for a device Thomas Egerer
2011-03-03 14:11 ` Kay Sievers
2011-03-03 17:00 ` Martin Pitt [this message]
2011-03-03 17:15 ` Kay Sievers
2011-03-03 17:38 ` Thomas Egerer
2011-03-03 17:47 ` Kay Sievers
2011-03-04 16:06 ` Thomas Egerer
2011-03-04 22:14 ` Kay Sievers
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=20110303170006.GF4723@piware.de \
--to=martin.pitt@ubuntu.com \
--cc=linux-hotplug@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.