Open ojeda opened 3 years ago
Some notes after perusing a couple of C drivers:
pr_cont()
seems to be commonly used as a one-word follow-up for a previous pr_*
invocation. L238/239 of nxt6000.c
.pr_cont()
s invariably end with a pr_cont("\n");
at the end.pr_cont()
just seems to be used as a one-off print appending the previous one. It seems like it should be quite trivial to replace pr_cont()
invocations with a single call to any of the pr_*!
macros using format!()
or simple substitutions. L298 of ssb/pci.c
and L1707 of floppy.c
, pr_cont()
is used to show progress of some execution as it occurs during a loop. I'm not sure if this is possible to achieve without pr_cont()
.L1382 of floppy.c
where pr_cont()
is called inside the tell_sector()
function in continuation to a DPRINT()
. Should be possible to have tell_sector()
return the string in question to the invoking expression and store it for a single pr_*
invocation.Apologies if I misunderstood anything. Please let me know if I should sample a couple more drivers.
This isn't actually showing progress; it's only printing an array.
This looks like the only case where pr_cont
usage is inevitable, aka showing progress. But that could probably be replaced with multiple lines.
@nbdd0121
@ojeda
Sample a few C drivers where
pr_cont
is used, and try to see what are their use cases. Then, taking that into account, decide and justify whether we should remove it fromrust/kernel/print.rs
(e.g. if it looks like all the C use cases can be easily done with Rust's formatting, or if it looks most of them should not be usingpr_cont()
, etc.).