Use udevadm to detect the required kernel modules to load a given
device. udevadm will follow the device chain, help detect all required
parent device drivers as well.
Signed-off-by: Kairui Song <kasong@redhat.com>
block_is_netdevice() {
block_is_nbd "$1" || block_is_iscsi "$1" || block_is_fcoe "$1"
}
+
+# get the corresponding kernel modules of a /sys/class/*/* or/dev/* device
+get_dev_module() {
+ udevadm info -a "$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p'
+}