in real-time I want to print out hot-plugging events on Harddisks only. My code does print out all events for the correct "devtype"("disk") and "subsystem"("block"). However this includes devices I don`t care about such as loop devices, cdrom devices etc I only care about raw disks (e.g /dev/sda and not partitions like /dev/sda1). Is there a ways to filter from within libudev on something like that? in udev rule speak this is called "KERNEL". In essence I want to show all new devices that would match a udev rule like this:
KERNEL=="sd*", ENV{DEVTYPE}=="disk"
this would only match raw disks. like /dev/sda.
Now my program can match against devtype and and subsystem by using the
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", "disk");
libudev call.
now this however still prints out changes to devices such as /dev/loop* or /dev/sr* which I don`t want.
is there a way to filter on KERNEL?
edit: