On 7 Oct 2013 at 16:00, Byrne, Kevin wrote:
I am trying to write cross-platform Boost code that utilizes sparse files on Windows7 and FreeBSD. I already have Windows code that creates and accesses a sparse file. I am of the understanding that Boost code cannot create a Windows7 sparse file for me so I am trying to create the file using the Windows code and then replace my ReadFileEx() and WriteFileEx() with Boost streams. I have had luck with using iostreams::file to access an existing Windows sparse file but it fails when I have to read a sparse area thinking it is at the end of the file. I tried creating a stream using an existing HANDLE but was not successful in reading or writing file content. Before I proceed further I thought I would ask first if Boost is capable of using Windows7 sparse file technology. If it is capable I would appreciate some guidance on how. I have done a bit of searching on the web with not much helpful information.
Supposedly a file marked with the sparse flag appears like a non-sparse file to normal file i/o functions. In theory, Boost shouldn't notice a difference. In practice, I'd guess this is not a well tested path of code. Even in AFIO which is intended for this sort of thing, I haven't bothered testing spare files. My main rationale: ReFS drops sparse file support in favour of delayed allocation like is common on Linux, so on Windows it's a dead end technology and is officially on track for deprecation. I agree this doesn't help you hugely right now. I suspect that subclassing your own Boost.Iostreams adapter with the right sparse files functions is likely your best course of action. Sorry. Niall -- Currently unemployed and looking for work. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/