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 - subversion
Lint Skipped
Unit Tests Skipped
Build Status
Buildable 24024

Event Timeline

marius requested changes to this revision.Mar 31 2019, 10:35 PM
marius added inline comments.

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

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.

Update based on feedback from marius/imp.

bz marked 2 inline comments as done.Apr 30 2019, 8:36 PM

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

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.