Douglas Anderson has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/50206 )
Change subject: linux_mtd: Switch fopen() to open() for MTD devices ......................................................................
Patch Set 2:
(1 comment)
File linux_mtd.c:
https://review.coreboot.org/c/flashrom/+/50206/comment/55079206_83e35ecd PS2, Line 206: if (read(dev_fileno, buf + i, step) != step) {
It's probably not hard to get around. (Sorry for not replying earlier, I didn't expect this to get abandoned this fast.)
I'm happy to restore it if you want. ;-) I moved to "Abandoned" state because it seemed like there was general consensus that we didn't want to do it. Just yell if you want it restored.
This should directly map to a read of the flash right? Then we could just re-try the current block (a few times?) if `>= 0 && != step`.
Sure, we could. My bias, which you seemed to share in your other comment, is to leave well enough alone. Thus it doesn't really take much to convince me to abandon this change. My original motivation for posting this was that I don't like ignoring review feedback and Hung-Te requested it. If you and he both agree that there's some benefit for the change then I'm happy to keep spinning but I'm not going to fight for it. In my opinion if we find a case where the current stdio-based implementation is broken then we can switch to the direct ops, but until then it's just churn and you've shown that at least one tricky corner case might not be right. Why mess with it?
I couldn't find any documentation specific to the MTD device nodes, do you know any? I'm also not much experienced with Linux device nodes in general. I guess there could be exceptions to the read() behavior, and it's fair to assume Linux behaviour in this driver anyway.
Yeah, I'm not an expert either. I mostly ended up down this rat hole because flashrom was failing on me and I wanted to fix it. ;-) I took a quick look and don't see any obvious documentation that would cover this type of thing, so probably it's tribal knowledge / read the source code.