Re:Greg K-H: "Writing new code in Rust is a win for all of us"
by mananaysiempre on Friday February 21, 2025 @06:30PM
(#43134405)
> If you've just spent half an hour walking through driver code for hardware you've never heard of changing stuff [...].
Isn’t the point of Coccinelle that you don’t have to spend time walking through (C) driver code you’ve never heard of?
Re:Greg K-H: "Writing new code in Rust is a win for all of us"
by tialaramex on Saturday February 22, 2025 @05:43AM
(#43137852)
I have never used Coccinelle but yes, sort of. However, you're on the hook for the patch you submit, Coccinelle isn't a person so if you blindly send out a patch Coccinelle generated, without even eyeballing it, you should expect some risk of thrown tomatoes if (unknown to you) this utterly broke some clever code using your previous API in a way you hadn't anticipated in a driver you don't run.
quaff(something, 5, Q_DOOP) ... into ... quaff(something, 5, 0, Q_DEFAULT | (Q_DOOP << 4))
Then it's not beyond the wits of a C programmer to realise that the Rust binding
quaff(var1, n, maybe_doop) ... can be ... quaff(var1, n, 0, Q_DEFAULT | (maybe_doop << 4))
Probably the Rust maintainer will be horrified and emit a patch to do something more idiomatic for binding your new API but there's an excellent chance that meanwhile your minimal patch builds and works since now it has the right number and type of arguments.