msoulier/tftpy — pull request #30 by fknittel (2012-04-27 17:04:44+00:00)
Title: Introduce virtual file system abstraction

(Unfortunately, this is again based on the previous two pull requests / branches. I'll happily rebase if you're not interested in pulling them.)

This basically re-implements my older patch from the old fabians-patches branch. The basic idea is to abstract away all file system access, allowing various neat tricks.

Since my last implementation you've added a dyn_file_func call-back, but unfortunately this doesn't cleanly cover the intended use-cases:
* even when using dyn_file_func, the file-system is checked anyway (although I see that there's a different pull request that would change this)
* if the dynamic function uses the file-system in some way, it has to re-implement the file-system access stuff again - it can't re-use tftpy's code.
* tftpy can't easily provide multi-root support

The patches attempt to stay as compatible to the old interface as possible. If you find the approach generally acceptable, I'll continue along those lines to properly support tsize. (Right now tsize appears to be broken.)

The patches have the side-effect of accepting files starting with "/". BOOTP implementations appear to use this by default, so I see this as a feature, not a bug. :)

Please feel free to request smaller patches / reworked patches. I'm also willing to discuss a different approach.