rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
log_source_t Struct Reference

A byte source that can be read from the top more than once. More...

#include <log_csv.h>

Data Fields

size_t(*) read (void *ctx, char *buf, size_t max)
bool(*) rewind (void *ctx)
bool(*) error (void *ctx)
 Did the last read fail, as opposed to reaching the end?
void * ctx
bool(*) size (void *ctx, size_t *bytes)
 Optional, both or neither: the length of the input in bytes, and a move to an offset from its start, after which read() continues there.
bool(*) seek (void *ctx, size_t offset)

Detailed Description

A byte source that can be read from the top more than once.

Not a FILE*: the host tests feed strings, the firmware feeds a file on the card, and neither knows about the other.

Field Documentation

◆ error

bool(*) log_source_t::error(void *ctx)

Did the last read fail, as opposed to reaching the end?

Optional: NULL means "reads never fail", which is true of a block of memory and false of an SD card. Without it a bad sector reads as a clean end of file, and a truncated log is presented as a complete short one.

◆ read

size_t(*) log_source_t::read(void *ctx, char *buf, size_t max)

0: end of input

◆ rewind

bool(*) log_source_t::rewind(void *ctx)

rewinds to the top; false when the source cannot

◆ size

bool(*) log_source_t::size(void *ctx, size_t *bytes)

Optional, both or neither: the length of the input in bytes, and a move to an offset from its start, after which read() continues there.

With them the analysis reads the last bytes of a file past the row cap for the cut row, instead of every row up to them. NULL means the source can only be read from the top; it is then read on to its end. Last in the struct, so a source written as { read, rewind, error, ctx } has neither.


The documentation for this struct was generated from the following file: