Open vissermc opened 2 years ago
Yes, this gave me a lot of problems.
I was using write_from_buffer, but the source buffer on the FPGA was a ring buffer, so offsets cycled back to 0, but used the previous address! This led me to weeks of frustrating debug.
I removed the if (offset)
and always performed the lseek
.
In fairness to the original author the kernel module, this issue only exists in the example test code, but of course we all copy that into our working code, don't we?
This function only does an lseek when the offset is non-zero, but in practice, offset can be zero, and in that case it will continue from writing from previous call. Same applies to read_to_buffer if (offset) { rc = lseek(fd, offset, SEEK_SET);