syfs question

Sadanand Warrier sadanandwarrier at gmail.com
Wed Feb 26 10:15:43 EST 2020


If I call device_create with a existing class the device lands up in
/sys/devices/virtual.  Using device_add I could populate the parent of the
device and leave the class empty or provide a class and get the device to
be created in the parent directory.

What exactly is the significance of the" /sys/devices/virtual"  directory?
Is this meant to carry devices of a specific type say something that is
divorced from actual hardware?

Secondly a device created under /sys/devices/virtual has a uevent file that
is populated like this.

-bash-4.2$ cat uevent
MAJOR=13
MINOR=63
DEVNAME=input/mice
-bash-4.2$

A device in a specific PCI slot has something like this instead..
-bash-4.2$ cat
/sys/devices/pci0000:00/0000:00:02.2/0000:03:00.3/net/eth1/uevent
INTERFACE=eth1
IFINDEX=3

How is this file populated? Is it done by udev or is this done via a kernel
call?

Thanks

S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200226/d8a613e3/attachment.html>


More information about the Kernelnewbies mailing list