[parted-devel] probing devices.. some questions/comments

Bart Hakvoort bart at hakvoort.be
Sat Sep 9 07:39:41 UTC 2006


Hi Folks,

lately i've been looking a bit into 'static void linux_probe_all()'
(arch/linux.c around line 1614) and i have some questions/comments.

this function will first probe some standard devices (/dev/hda,/dev/hdc,
etc...). Then parse the contents of /sys/block or in case the latter
fails, parse the contents of /proc/partitions.

Although very secure, this method creates some problems every now and then
with bad dvd/cd(drive)'s. Large timeouts or even iolocked machines. Of
course issues like this should eventually be solved by the user, but i'm
not certain if we need to probe for these devices.

The reason for probing these standard devices is in the source:
/* we should probe the standard devs too, even with /proc/partitions,
 * because /proc/partitions might return devfs stuff, and we might not
 * have devfs available
 */

Is this still valid? how many people still use devfs? However, i might be
mistaken about the number of users who still rely on this :)

the reason for parsing the contents of /sys/block/ is:
/* /sys/block is more reliable and consistent; fall back to using
 * /proc/partitions if the former is unavailable, however.
 */

In what aspect is /sys/block more reliable and consistent? /proc/partition
seems pretty complete to me :)

one last thingy about 'static int _probe_proc_partitions()' (arch/linux.c
around line 1500).
it says:
/* Heuristic for telling partitions and devices apart
 * Probably needs to be improved
 */
Why not simply take the line with the lowest minor number? afaik this will
always be the device.

btw, i realize all these things are quite trivial, but this has been
popping in and out of my conciousness for over a year now :^) .
Also, i'm happy to provide patches if necessary.

grtz and thnx,

Bart

-- 
--- plors




More information about the parted-devel mailing list