interview question how does application connects to device

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Wed Jul 6 01:12:27 EDT 2011


> How would using sysfs be useful if we were to talk about interacting with, let's say, a file system? ioctl's are quite versatile and rather easy to use when one wants to interact with a given FS.
>
> For instance, one can manage a Btrfs file system by using an user-level tool, which heavily uses ioctl's. Requiring it to interact with sysfs instead seems like complicating something simple with no apparent purpose.

Franlky, I've never used the sysfs interface and mostly know it from
'theoretical' view-point. It was created mostly for providing a
uniform way for user-space applications (udev/HAL, driver tools, etc)
to interact with a device driver. It exposes the underlying device
topology as a directory tree.

I'm not sure how sysfs applies to 'filesystem' as it depicts a
particular 'device hierarchy tree' within a kernel. As Greg mentioned
here, lot filesystem drivers still prefer to use the ioctl interface.
However, one use for it which I can see, is for controlling the
underlying block device (hard-disk, USB mass storage etc).

HTH,
-mandeep



More information about the Kernelnewbies mailing list