[gdal-dev] vsipreload: enabling VSI Virtual File API for regular I/O

Even Rouault even.rouault at mines-paris.org
Sun May 26 07:46:31 PDT 2013


Hi,

I've just commited in trunk a new file port/vsipreload.cpp.

This file is the source code for a standalone shared library that can be 
LD_PRELOAD'ed as an overload of libc to enable VSI Virtual FILE API to be used 
with binaries using regular libc I/O API.

WARNING: Linux glibc ONLY. Might work with some adaptations (mainly around 
64bit symbols) on other Unix systems

Compile:
g++ -Wall -fPIC port/vsipreload.cpp -shared -o vsipreload.so -Iport \
	-L. -L.libs -lgdal

Examples :

LD_PRELOAD=vsipreload.so gdalinfo \
	/vsicurl/http://download.osgeo.org/gdal/data/ecw/spif83.ecw

LD_PRELOAD=vsipreload.so gdalinfo \
 'HDF4_EOS:EOS_GRID:"/vsicurl/http://download.osgeo.org/gdal/data/hdf4/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf":MODIS_NACP_EVI:MODIS_EVI'

LD_PRELOAD=vsipreload.so ogrinfo \
	 /vsicurl/http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/testavc -ro

LD_PRELOAD=vsipreload.so ogrinfo -ro \
	
/vsizip//vsicurl/http://download.osgeo.org/gdal/1.10.0/gdalautotest-1.10.0.zip/gdalautotest-1.10.0/ogr/data/testavc

It can work even with non GDAL binaries :

LD_PRELOAD=vsipreload.so h5dump -d /x \
	/vsicurl/http://download.osgeo.org/gdal/data/netcdf/utm-big-chunks.nc

LD_PRELOAD=vsipreload.so sqlite3 \
	 /vsicurl/http://download.osgeo.org/gdal/data/sqlite3/polygon.db \
	"select * from polygon limit 10"

This can work with all VSI Large File API filesystems : /vsizip/ , /vsitar/, 
/vsisubfile/ , etc...

This is still a bit experimental in the sense that only the most common glibc 
I/O API have been overloaded. If exotic ones are used with /vsi files, crashes 
are likely.

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list