Page MenuHomeFreeBSD

Improve sdhci slot_printf() debug printing.

Authored by bz on Mar 29 2019, 9:51 AM.



Improve sdhci slot_printf() debug printing.

Currently slot_printf() uses two printf() calls to print the
device-slot name, and actual message. When other printf()s are
ongoing in parallel this can lead to mixed message on the console,
which is especially unhelpful for debugging or error messages.

Take a hit on the stack and vsnprintf() the message so the buffer.
This way it can be printed along with the device-slot name in one go
avoiding console gibberish.

Sponsored by: The FreeBSD Foundation
MFC After: 2 weeks

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bz created this revision.Mar 29 2019, 9:51 AM
marius requested changes to this revision.Mar 31 2019, 10:35 PM
marius added inline comments.
188 ↗(On Diff #55588)

Apart from the fact that MAX_INPUT doesn't seem like a good match (maximum _output_ would be the interesting part), just hardcoding a size of 128 (and, thus, also saving some stack) should be more than sufficient given that implementing messages that don't fit within 80 columns would be inconvenient.

This revision now requires changes to proceed.Mar 31 2019, 10:35 PM
kibab accepted this revision.Apr 1 2019, 6:10 PM
imp added inline comments.Apr 1 2019, 10:20 PM
188 ↗(On Diff #55588)

Or plan B: use sbuf.
But I don't know what can / can't be malloced from the contexts this has been called from. If it's at all complicated, marius' suggestion is sufficient and likely just fine.

bz updated this revision to Diff 56889.Apr 30 2019, 8:36 PM

Update based on feedback from marius/imp.

bz marked 2 inline comments as done.Apr 30 2019, 8:36 PM
bz added a comment.Jun 1 2019, 5:46 PM

I'd like to commit this the next days. Can someone please review? If not it'll go in by Sat 8 June.

marius accepted this revision.Jun 7 2019, 9:55 PM

Thanks, looks good to me now

This revision is now accepted and ready to land.Jun 7 2019, 9:55 PM
This revision was automatically updated to reflect the committed changes.