Closed lindig closed 8 years ago
Yes, this is much better. Thank you!
My patch contains a bug: c_ret = lseek(c_fd, c_ofs, SEEK_END)
must use 0
rather than c_ofs
. I'm preparing a new one after having verified this.
I'm closing this in favour of a corrected pull request: https://github.com/djs55/ocaml-vhd/pull/35
This PR tries to improve https://github.com/djs55/ocaml-vhd/pull/33. Improvement are:
#ifdef
to make sure to only useSEEK_DATA
,SEEK_HOLE
when it is defined on a platform.lseek(2)
fails only when it is because the file system doesn't supportSEEK_DATA
orSEEK_HOLE
. The previous patch retried irrespective of the reason for failure.I'd like to mention remarks from an internal discussion on the design in general:
lseek
like this should communicate problems rather than trying a fallback. This would mean that more details need to be exposed by the wrapper.SEEK_DATA
and the like, it would be better not to try it repeatedly but to associate this information with the file descriptor. This, again, would mean a different interface that exposes these details at the OCaml level.Signed-off-by: Christian Lindig christian.lindig@citrix.com