Closed ischeinkman closed 2 months ago
Thanks for your work!
Would you mind moving profile::write_all_cores
to the sysfs::writing
module that you just created? Feels a bit more suited for that.
Also thanks for highlighting the required uses of subshells too, I will need to research ways of getting rid of those, as creating a shell is technically worse than running an independent Command
for commands that do not necessarily require it. The modprobe one shouldn't be hard to do, just multiple synchronous calls to run_command
but the lsusb
and lspci
ones would be harder, either recreating what they do through sysfs or moving the sed code into rust using regex.
Would you mind moving
profile::write_all_cores
to thesysfs::writing
module that you just created? Feels a bit more suited for that.
Yup, done!
Also thanks for highlighting the required uses of subshells too, I will need to research ways of getting rid of those, as creating a shell is technically worse than running an independent
Command
for commands that do not necessarily require it. The modprobe one shouldn't be hard to do, just multiple synchronous calls torun_command
but thelsusb
andlspci
ones would be harder, either recreating what they do through sysfs or moving the sed code into rust using regex.
Funnily enough the lsusb
one will actually be one of the easiest because it seems you've already pulled out the regex parsing code into Rust itself. Really the only difficult one is the lspci
call thanks to its sed
pipe, but we can use the existing lsusb
code as a base to figure that one out.
Thanks.
Replaced a lot of subshell calls with normal, in-process syscalls.
Specifically:
echo {} > {}
have been replaced with newwrite_
helper functions for writing eitherstr
s,u32
s, orbool
values. This mirrors the existing helpers insysfs::reading
.readlink {}
have been replaced with thestd::fs::read_link
function.Implications:
Command
call) are:NetworkSettings::apply_kernel_module_settings
, since we currently remove & add 2 modules in a single command (instead of 4 different subprocesses)PCIInfo::obtain
, where we use ased
block to filter & parse the output oflspci -s
.