On Fri, 1 Jun 2012 22:39:58 +0200 Niklas Söderlund niso@kth.se wrote:
Add return values to sp_synchronize so we can signal a failure to the only upstream caller, which is prepared to propagate a failure.
The addition of a return code to signal a failure from the read syscall in sp_sync_read_timeout is a bit of a stretch and might look strange. But the only caller is in the loop in sp_synchronize and any sequential call to read will result in the same error and end result. But please take a extra look on this to make sure we don't miss any corner case.
The alternative would be to differentiate between a read failure over fast detection of a EAGAIN. The end result would in my opinion only make the code harder to read. The cost is that upon read failure the user might be spammed up to 10 times with the same error message before flashrom dies.
Hello Niklas,
i am making progress in reviewing your exit-removal patches (thx!), but this one bugs me a bit. First of all i have to admit, that i dont fully understand your commit log. You are talking about an additional return code in sp_sync_read_timeout that "might look strange" although there is non. i dont get the start of the last paragraph either, but at least the last sentence is pretty clear. the removal of exits should not change the output in general, and in this case i think so too. spamming the user just because the code would be a bit ugly is not an option.
could you please rephrase your thoughts on how to solve this. we can then discuss if it is viable. i played with the code myself a bit, and couldnt come up with something non-ugly and working either. :/