On Mon, Aug 01, 2022 at 09:30:38AM -0400, Laine Stump wrote:
On 8/1/22 7:58 AM, Erik Skultety wrote:
>
> Instead of calling an external program and then grepping its output which
> technically could change in the future, wouldn't it be better if we read
> /lib/modules/`uname -r`/modules.alias and filtered whatever line had the
> vfio-pci' substring and compared the module name with the user-provided device
> driver?
Again, although I was hesistant about calling an external command, and asked
if there was something simpler, Alex still suggested modinfo, so I'll let
him answer that. Alex?
(Also, although the format of the output of "uname -r" is pretty much
written in stone, you're still running an external command :-))
You wouldn't actually call 'uname -r', you'd invoke uname(2) function
and use the 'release' field in 'struct utsname'.
I'd favour reading modules.alias directly over invoking modinfo for
sure, though I'd be even more in favour of the kernel just exposing
the sysfs attribute and in the meanwhile just hardcoding the only 2
driver names that exist so far.
With regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|